summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2019-11-23 13:31:06 +0100
committerMichael W <baddaemon87@gmail.com>2021-03-14 14:58:34 +0100
commit62924a3cf27ec62e6bfa2d128f5659559ac8c55f (patch)
treecfacd0797d7c7477f5cd8445e65a6a3bdfef4618 /java
parent27d71a4a6d59302d81b86b3f8ca87adb4f66d9a0 (diff)
Dialer: Hide sensitive numbers from incall screen
* In order to have less places where a sensitive number could be shown during usage, hide them from incall ui as well Change-Id: I686f9a8fc09d62884344a2ddc949f12d0d5e1f7c
Diffstat (limited to 'java')
-rw-r--r--java/com/android/incallui/CallerInfoUtils.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/java/com/android/incallui/CallerInfoUtils.java b/java/com/android/incallui/CallerInfoUtils.java
index 38043eda8..6f73f2f64 100644
--- a/java/com/android/incallui/CallerInfoUtils.java
+++ b/java/com/android/incallui/CallerInfoUtils.java
@@ -16,6 +16,8 @@
package com.android.incallui;
+import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+
import android.content.Context;
import android.content.Loader;
import android.content.Loader.OnLoadCompleteListener;
@@ -33,6 +35,8 @@ import com.android.dialer.util.PermissionsUtil;
import com.android.incallui.call.DialerCall;
import java.util.Arrays;
+import org.lineageos.lib.phone.SensitivePhoneNumbers;
+
/** Utility methods for contact and caller info related functionality */
public class CallerInfoUtils {
@@ -100,6 +104,7 @@ public class CallerInfoUtils {
}
number = modifyForSpecialCnapCases(context, info, number, info.numberPresentation);
}
+ number = modifyPossibleSensitiveNumber(context, info, number);
info.phoneNumber = number;
}
@@ -140,6 +145,19 @@ public class CallerInfoUtils {
return cacheInfo;
}
+ static String modifyPossibleSensitiveNumber(Context context, CallerInfo ci, String number) {
+ if (ci == null || number == null) {
+ return number;
+ }
+ boolean isSensitiveNumber = SensitivePhoneNumbers.getInstance().isSensitiveNumber(context,
+ number, INVALID_SUBSCRIPTION_ID);
+ if (isSensitiveNumber) {
+ number = context.getString(R.string.unknown);
+ ci.numberPresentation = TelecomManager.PRESENTATION_UNKNOWN;
+ }
+ return number;
+ }
+
/**
* Handles certain "corner cases" for CNAP. When we receive weird phone numbers from the network
* to indicate different number presentations, convert them to expected number and presentation