2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Fix showing callers number on Pie

This commit is contained in:
Nicolas Fella
2019-03-21 23:13:27 +00:00
parent a8bc4f24c7
commit 17e9892c80

View File

@@ -108,15 +108,15 @@ public class TelephonyPlugin extends Plugin {
else if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) else if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))
intState = TelephonyManager.CALL_STATE_OFFHOOK; intState = TelephonyManager.CALL_STATE_OFFHOOK;
String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); // We will get a second broadcast with the phone number https://developer.android.com/reference/android/telephony/TelephonyManager#ACTION_PHONE_STATE_CHANGED
if (number == null) if (!intent.hasExtra(TelephonyManager.EXTRA_INCOMING_NUMBER))
number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); return;
String number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
final int finalIntState = intState; final int finalIntState = intState;
final String finalNumber = number;
if (finalIntState != lastState) { if (finalIntState != lastState) {
callBroadcastReceived(finalIntState, finalNumber); callBroadcastReceived(finalIntState, number);
} }
} }
} }