1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

preparations for acceppting calls

This commit is contained in:
Andreas Shimokawa 2015-03-17 21:42:31 +01:00
parent c56194c0e5
commit a971eca6fd
2 changed files with 7 additions and 3 deletions

View File

@ -21,15 +21,20 @@ public class GBCallControlReceiver extends BroadcastReceiver {
int keyCode;
switch (command) {
case CALL_END:
case CALL_START:
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class clazz = Class.forName(telephonyManager.getClass().getName());
Method method = clazz.getDeclaredMethod("getITelephony");
method.setAccessible(true);
ITelephony telephonyService = (ITelephony) method.invoke(telephonyManager);
telephonyService.endCall();
if (command == GBCommand.CALL_END) {
telephonyService.endCall();
} else {
telephonyService.answerRingingCall();
}
} catch (Exception e) {
Log.w(TAG, "could not hangup call");
Log.w(TAG, "could not start or hangup call");
}
break;
default:

View File

@ -8,7 +8,6 @@ public enum GBCommand {
CALL_END,
CALL_INCOMING,
CALL_OUTGOING,
CALL_PICKUP,
CALL_REJECT,
CALL_START,