Disable a phone number log for user build
A phone number is privacy data. Therefore, it should be prevented
from logging in user build.
Test: manual - checked log
Bug: 34582911
Change-Id: Id040653dbfd236250e7eb07c9c2e9587ded3d63f
diff --git a/telecomm/java/android/telecom/Log.java b/telecomm/java/android/telecom/Log.java
index ced6627..6107895 100644
--- a/telecomm/java/android/telecom/Log.java
+++ b/telecomm/java/android/telecom/Log.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
+import android.os.Build;
import android.telecom.Logging.EventManager;
import android.telecom.Logging.Session;
import android.telecom.Logging.SessionManager;
@@ -55,6 +56,7 @@
public static boolean ERROR = isLoggable(android.util.Log.ERROR);
private static final boolean FORCE_LOGGING = false; /* STOP SHIP if true */
+ private static final boolean USER_BUILD = Build.TYPE.equals("user");
// Used to synchronize singleton logging lazy initialization
private static final Object sSingletonSync = new Object();
@@ -404,7 +406,8 @@
/**
* Redact personally identifiable information for production users.
- * If we are running in verbose mode, return the original string, otherwise
+ * If we are running in verbose mode, return the original string,
+ * and return "****" if we are running on the user build, otherwise
* return a SHA-1 hash of the input string.
*/
public static String pii(Object pii) {
@@ -415,6 +418,11 @@
}
private static String secureHash(byte[] input) {
+ // Refrain from logging user personal information in user build.
+ if (USER_BUILD) {
+ return "****";
+ }
+
if (sMessageDigest != null) {
sMessageDigest.reset();
sMessageDigest.update(input);