From 17e9892c80300e89ccd3dc2cd9f5a7450869a67b Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 21 Mar 2019 23:13:27 +0000 Subject: [PATCH] Fix showing callers number on Pie --- .../Plugins/TelephonyPlugin/TelephonyPlugin.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java b/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java index 9ed5ab59..acf8ad3d 100644 --- a/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java @@ -108,15 +108,15 @@ public class TelephonyPlugin extends Plugin { else if (state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) intState = TelephonyManager.CALL_STATE_OFFHOOK; - String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); - if (number == null) - number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); + // We will get a second broadcast with the phone number https://developer.android.com/reference/android/telephony/TelephonyManager#ACTION_PHONE_STATE_CHANGED + if (!intent.hasExtra(TelephonyManager.EXTRA_INCOMING_NUMBER)) + return; + String number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); final int finalIntState = intState; - final String finalNumber = number; if (finalIntState != lastState) { - callBroadcastReceived(finalIntState, finalNumber); + callBroadcastReceived(finalIntState, number); } } }