mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
preparations for acceppting calls
This commit is contained in:
parent
c56194c0e5
commit
a971eca6fd
@ -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:
|
||||
|
@ -8,7 +8,6 @@ public enum GBCommand {
|
||||
CALL_END,
|
||||
CALL_INCOMING,
|
||||
CALL_OUTGOING,
|
||||
CALL_PICKUP,
|
||||
CALL_REJECT,
|
||||
CALL_START,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user