From 62924a3cf27ec62e6bfa2d128f5659559ac8c55f Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 23 Nov 2019 13:31:06 +0100 Subject: 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 --- java/com/android/incallui/CallerInfoUtils.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'java') 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 -- cgit v1.2.3