Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62924a3c authored by Michael W's avatar Michael W
Browse files

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
parent 27d71a4a
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -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