mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Merge pull request #1253 from skweee/android9callerid
Fix caller ID for incoming calls on Android 9
This commit is contained in:
commit
449184c591
@ -8,6 +8,7 @@
|
||||
-->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
|
@ -297,6 +297,8 @@ public class ControlCenterv2 extends AppCompatActivity
|
||||
wantedPermissions.add(Manifest.permission.READ_CONTACTS);
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_DENIED)
|
||||
wantedPermissions.add(Manifest.permission.CALL_PHONE);
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CALL_LOG) == PackageManager.PERMISSION_DENIED)
|
||||
wantedPermissions.add(Manifest.permission.READ_CALL_LOG);
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_DENIED)
|
||||
wantedPermissions.add(Manifest.permission.READ_PHONE_STATE);
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.PROCESS_OUTGOING_CALLS) == PackageManager.PERMISSION_DENIED)
|
||||
|
@ -41,11 +41,13 @@ public class PhoneCallReceiver extends BroadcastReceiver {
|
||||
if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) {
|
||||
mSavedNumber = intent.getExtras().getString("android.intent.extra.PHONE_NUMBER");
|
||||
} else {
|
||||
if (intent.hasExtra(TelephonyManager.EXTRA_INCOMING_NUMBER)) {
|
||||
String number = intent.getExtras().getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
|
||||
int state = tm.getCallState();
|
||||
onCallStateChanged(context, state, number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onCallStateChanged(Context context, int state, String number) {
|
||||
if (mLastState == state) {
|
||||
|
Loading…
Reference in New Issue
Block a user