mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-17 12:56:48 +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;
|
int keyCode;
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case CALL_END:
|
case CALL_END:
|
||||||
|
case CALL_START:
|
||||||
try {
|
try {
|
||||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
Class clazz = Class.forName(telephonyManager.getClass().getName());
|
Class clazz = Class.forName(telephonyManager.getClass().getName());
|
||||||
Method method = clazz.getDeclaredMethod("getITelephony");
|
Method method = clazz.getDeclaredMethod("getITelephony");
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
ITelephony telephonyService = (ITelephony) method.invoke(telephonyManager);
|
ITelephony telephonyService = (ITelephony) method.invoke(telephonyManager);
|
||||||
telephonyService.endCall();
|
if (command == GBCommand.CALL_END) {
|
||||||
|
telephonyService.endCall();
|
||||||
|
} else {
|
||||||
|
telephonyService.answerRingingCall();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(TAG, "could not hangup call");
|
Log.w(TAG, "could not start or hangup call");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -8,7 +8,6 @@ public enum GBCommand {
|
|||||||
CALL_END,
|
CALL_END,
|
||||||
CALL_INCOMING,
|
CALL_INCOMING,
|
||||||
CALL_OUTGOING,
|
CALL_OUTGOING,
|
||||||
CALL_PICKUP,
|
|
||||||
CALL_REJECT,
|
CALL_REJECT,
|
||||||
CALL_START,
|
CALL_START,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user