diff options
author | Michael W <baddaemon87@gmail.com> | 2019-09-11 17:17:22 +0200 |
---|---|---|
committer | Michael W <baddaemon87@gmail.com> | 2021-03-14 14:58:34 +0100 |
commit | 27d71a4a6d59302d81b86b3f8ca87adb4f66d9a0 (patch) | |
tree | 5da6ce27194fe43da83d224ab6021d1a65deeb11 /java | |
parent | 4fe95bf5a63550d131bcf9ed2d29a734e4e078be (diff) |
Dialer: Don't prompt to send a message to sensitive numbers
* When calling a number but hanging up, you get a prompt "Send a message"
* For a sensitive number that doesn't make sense for two reasons
a) The message possible wouldn't get received there (most likely)
b) The message would then show up in the messaging app - which is not
really desired either
Change-Id: Ic6450d5a44ba97a4da085adb1da0275477bb14fc
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/postcall/PostCall.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index 376cb456b..69ee37629 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +17,8 @@ package com.android.dialer.postcall; +import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; + import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -40,6 +43,8 @@ import com.android.dialer.storage.StorageComponent; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; +import org.lineageos.lib.phone.SensitivePhoneNumbers; + /** Helper class to handle all post call actions. */ public class PostCall { @@ -217,6 +222,10 @@ public class PostCall { long callDurationMillis = disconnectTimeMillis - connectTimeMillis; boolean callDisconnectedByUser = manager.getBoolean(KEY_POST_CALL_DISCONNECT_PRESSED, false); + String number = manager.getString(KEY_POST_CALL_CALL_NUMBER, null); + + boolean isSensitiveNumber = SensitivePhoneNumbers.getInstance().isSensitiveNumber(context, + number, INVALID_SUBSCRIPTION_ID); ConfigProvider binding = ConfigProviderComponent.get(context).getConfigProvider(); return disconnectTimeMillis != -1 @@ -226,7 +235,8 @@ public class PostCall { && (connectTimeMillis == 0 || binding.getLong("postcall_call_duration_threshold", 35_000) > callDurationMillis) && getPhoneNumber(context) != null - && callDisconnectedByUser; + && callDisconnectedByUser + && !isSensitiveNumber; } private static boolean shouldPromptUserToViewSentMessage(Context context) { |