Merge "telephony/common/* should use android.util.Log"
This commit is contained in:
committed by
Android (Google) Code Review
commit
f800e435de
@@ -16,8 +16,6 @@
|
||||
|
||||
package android.telephony;
|
||||
|
||||
import com.android.telephony.Rlog;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
|
||||
@@ -27,7 +27,7 @@ import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.permission.IPermissionManager;
|
||||
import android.provider.Settings;
|
||||
import com.android.telephony.Rlog;
|
||||
import android.util.Log;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
@@ -80,7 +80,7 @@ public final class CarrierAppUtils {
|
||||
IPackageManager packageManager, IPermissionManager permissionManager,
|
||||
TelephonyManager telephonyManager, int userId, Context context) {
|
||||
if (DEBUG) {
|
||||
Rlog.d(TAG, "disableCarrierAppsUntilPrivileged");
|
||||
Log.d(TAG, "disableCarrierAppsUntilPrivileged");
|
||||
}
|
||||
SystemConfig config = SystemConfig.getInstance();
|
||||
ArraySet<String> systemCarrierAppsDisabledUntilUsed =
|
||||
@@ -108,7 +108,7 @@ public final class CarrierAppUtils {
|
||||
IPackageManager packageManager, IPermissionManager permissionManager, int userId,
|
||||
Context context) {
|
||||
if (DEBUG) {
|
||||
Rlog.d(TAG, "disableCarrierAppsUntilPrivileged");
|
||||
Log.d(TAG, "disableCarrierAppsUntilPrivileged");
|
||||
}
|
||||
SystemConfig config = SystemConfig.getInstance();
|
||||
ArraySet<String> systemCarrierAppsDisabledUntilUsed =
|
||||
@@ -187,7 +187,7 @@ public final class CarrierAppUtils {
|
||||
|| ai.enabledSetting
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
|
||||
|| (ai.flags & ApplicationInfo.FLAG_INSTALLED) == 0)) {
|
||||
Rlog.i(TAG, "Update state(" + packageName + "): ENABLED for user "
|
||||
Log.i(TAG, "Update state(" + packageName + "): ENABLED for user "
|
||||
+ userId);
|
||||
packageManager.setSystemAppInstallState(
|
||||
packageName,
|
||||
@@ -210,7 +210,7 @@ public final class CarrierAppUtils {
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
|
||||
|| (associatedApp.flags
|
||||
& ApplicationInfo.FLAG_INSTALLED) == 0) {
|
||||
Rlog.i(TAG, "Update associated state(" + associatedApp.packageName
|
||||
Log.i(TAG, "Update associated state(" + associatedApp.packageName
|
||||
+ "): ENABLED for user " + userId);
|
||||
packageManager.setSystemAppInstallState(
|
||||
associatedApp.packageName,
|
||||
@@ -235,7 +235,7 @@ public final class CarrierAppUtils {
|
||||
&& ai.enabledSetting
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|
||||
&& (ai.flags & ApplicationInfo.FLAG_INSTALLED) != 0) {
|
||||
Rlog.i(TAG, "Update state(" + packageName
|
||||
Log.i(TAG, "Update state(" + packageName
|
||||
+ "): DISABLED_UNTIL_USED for user " + userId);
|
||||
packageManager.setSystemAppInstallState(
|
||||
packageName,
|
||||
@@ -253,7 +253,7 @@ public final class CarrierAppUtils {
|
||||
== PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|
||||
&& (associatedApp.flags
|
||||
& ApplicationInfo.FLAG_INSTALLED) != 0) {
|
||||
Rlog.i(TAG,
|
||||
Log.i(TAG,
|
||||
"Update associated state(" + associatedApp.packageName
|
||||
+ "): DISABLED_UNTIL_USED for user " + userId);
|
||||
packageManager.setSystemAppInstallState(
|
||||
@@ -280,7 +280,7 @@ public final class CarrierAppUtils {
|
||||
permissionManager.grantDefaultPermissionsToEnabledCarrierApps(packageNames, userId);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Rlog.w(TAG, "Could not reach PackageManager", e);
|
||||
Log.w(TAG, "Could not reach PackageManager", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ public final class CarrierAppUtils {
|
||||
return ai;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Rlog.w(TAG, "Could not reach PackageManager", e);
|
||||
Log.w(TAG, "Could not reach PackageManager", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.internal.telephony;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import com.android.telephony.Rlog;
|
||||
import android.util.Log;
|
||||
import android.text.TextUtils;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
@@ -498,11 +498,11 @@ public class GsmAlphabet {
|
||||
StringBuilder ret = new StringBuilder(lengthSeptets);
|
||||
|
||||
if (languageTable < 0 || languageTable > sLanguageTables.length) {
|
||||
Rlog.w(TAG, "unknown language table " + languageTable + ", using default");
|
||||
Log.w(TAG, "unknown language table " + languageTable + ", using default");
|
||||
languageTable = 0;
|
||||
}
|
||||
if (shiftTable < 0 || shiftTable > sLanguageShiftTables.length) {
|
||||
Rlog.w(TAG, "unknown single shift table " + shiftTable + ", using default");
|
||||
Log.w(TAG, "unknown single shift table " + shiftTable + ", using default");
|
||||
shiftTable = 0;
|
||||
}
|
||||
|
||||
@@ -512,11 +512,11 @@ public class GsmAlphabet {
|
||||
String shiftTableToChar = sLanguageShiftTables[shiftTable];
|
||||
|
||||
if (languageTableToChar.isEmpty()) {
|
||||
Rlog.w(TAG, "no language table for code " + languageTable + ", using default");
|
||||
Log.w(TAG, "no language table for code " + languageTable + ", using default");
|
||||
languageTableToChar = sLanguageTables[0];
|
||||
}
|
||||
if (shiftTableToChar.isEmpty()) {
|
||||
Rlog.w(TAG, "no single shift table for code " + shiftTable + ", using default");
|
||||
Log.w(TAG, "no single shift table for code " + shiftTable + ", using default");
|
||||
shiftTableToChar = sLanguageShiftTables[0];
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ public class GsmAlphabet {
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException ex) {
|
||||
Rlog.e(TAG, "Error GSM 7 bit packed: ", ex);
|
||||
Log.e(TAG, "Error GSM 7 bit packed: ", ex);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -813,7 +813,7 @@ public class GsmAlphabet {
|
||||
for (int i = 0; i < sz; i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == GSM_EXTENDED_ESCAPE) {
|
||||
Rlog.w(TAG, "countGsmSeptets() string contains Escape character, skipping.");
|
||||
Log.w(TAG, "countGsmSeptets() string contains Escape character, skipping.");
|
||||
continue;
|
||||
}
|
||||
if (charToLanguageTable.get(c, -1) != -1) {
|
||||
@@ -892,7 +892,7 @@ public class GsmAlphabet {
|
||||
for (int i = 0; i < sz && !lpcList.isEmpty(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == GSM_EXTENDED_ESCAPE) {
|
||||
Rlog.w(TAG, "countGsmSeptets() string contains Escape character, ignoring!");
|
||||
Log.w(TAG, "countGsmSeptets() string contains Escape character, ignoring!");
|
||||
continue;
|
||||
}
|
||||
// iterate through enabled locking shift tables
|
||||
@@ -1496,7 +1496,7 @@ public class GsmAlphabet {
|
||||
int numTables = sLanguageTables.length;
|
||||
int numShiftTables = sLanguageShiftTables.length;
|
||||
if (numTables != numShiftTables) {
|
||||
Rlog.e(TAG, "Error: language tables array length " + numTables +
|
||||
Log.e(TAG, "Error: language tables array length " + numTables +
|
||||
" != shift tables array length " + numShiftTables);
|
||||
}
|
||||
|
||||
@@ -1506,7 +1506,7 @@ public class GsmAlphabet {
|
||||
|
||||
int tableLen = table.length();
|
||||
if (tableLen != 0 && tableLen != 128) {
|
||||
Rlog.e(TAG, "Error: language tables index " + i +
|
||||
Log.e(TAG, "Error: language tables index " + i +
|
||||
" length " + tableLen + " (expected 128 or 0)");
|
||||
}
|
||||
|
||||
@@ -1524,7 +1524,7 @@ public class GsmAlphabet {
|
||||
|
||||
int shiftTableLen = shiftTable.length();
|
||||
if (shiftTableLen != 0 && shiftTableLen != 128) {
|
||||
Rlog.e(TAG, "Error: language shift tables index " + i +
|
||||
Log.e(TAG, "Error: language shift tables index " + i +
|
||||
" length " + shiftTableLen + " (expected 128 or 0)");
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.internal.telephony;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import com.android.telephony.Rlog;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.HbpcdLookup.ArbitraryMccSidMatch;
|
||||
import com.android.internal.telephony.HbpcdLookup.MccIdd;
|
||||
@@ -54,16 +54,16 @@ public final class HbpcdUtils {
|
||||
if (c2 != null) {
|
||||
int c2Counter = c2.getCount();
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "Query unresolved arbitrary table, entries are " + c2Counter);
|
||||
Log.d(LOG_TAG, "Query unresolved arbitrary table, entries are " + c2Counter);
|
||||
}
|
||||
if (c2Counter == 1) {
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "Query Unresolved arbitrary returned the cursor " + c2);
|
||||
Log.d(LOG_TAG, "Query Unresolved arbitrary returned the cursor " + c2);
|
||||
}
|
||||
c2.moveToFirst();
|
||||
tmpMcc = c2.getInt(0);
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "MCC found in arbitrary_mcc_sid_match: " + tmpMcc);
|
||||
Log.d(LOG_TAG, "MCC found in arbitrary_mcc_sid_match: " + tmpMcc);
|
||||
}
|
||||
c2.close();
|
||||
return tmpMcc;
|
||||
@@ -85,18 +85,18 @@ public final class HbpcdUtils {
|
||||
int c3Counter = c3.getCount();
|
||||
if (c3Counter > 0) {
|
||||
if (c3Counter > 1) {
|
||||
Rlog.w(LOG_TAG, "something wrong, get more results for 1 conflict SID: " + c3);
|
||||
Log.w(LOG_TAG, "something wrong, get more results for 1 conflict SID: " + c3);
|
||||
}
|
||||
if (DBG) Rlog.d(LOG_TAG, "Query conflict sid returned the cursor " + c3);
|
||||
if (DBG) Log.d(LOG_TAG, "Query conflict sid returned the cursor " + c3);
|
||||
c3.moveToFirst();
|
||||
tmpMcc = c3.getInt(0);
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "MCC found in mcc_lookup_table. Return tmpMcc = " + tmpMcc);
|
||||
Log.d(LOG_TAG, "MCC found in mcc_lookup_table. Return tmpMcc = " + tmpMcc);
|
||||
}
|
||||
if (!isNitzTimeZone) {
|
||||
// time zone is not accurate, it may get wrong mcc, ignore it.
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "time zone is not accurate, mcc may be " + tmpMcc);
|
||||
Log.d(LOG_TAG, "time zone is not accurate, mcc may be " + tmpMcc);
|
||||
}
|
||||
tmpMcc = 0;
|
||||
}
|
||||
@@ -115,18 +115,18 @@ public final class HbpcdUtils {
|
||||
null, null);
|
||||
if (c5 != null) {
|
||||
if (c5.getCount() > 0) {
|
||||
if (DBG) Rlog.d(LOG_TAG, "Query Range returned the cursor " + c5);
|
||||
if (DBG) Log.d(LOG_TAG, "Query Range returned the cursor " + c5);
|
||||
c5.moveToFirst();
|
||||
tmpMcc = c5.getInt(0);
|
||||
if (DBG) Rlog.d(LOG_TAG, "SID found in mcc_sid_range. Return tmpMcc = " + tmpMcc);
|
||||
if (DBG) Log.d(LOG_TAG, "SID found in mcc_sid_range. Return tmpMcc = " + tmpMcc);
|
||||
c5.close();
|
||||
return tmpMcc;
|
||||
}
|
||||
c5.close();
|
||||
}
|
||||
if (DBG) Rlog.d(LOG_TAG, "SID NOT found in mcc_sid_range.");
|
||||
if (DBG) Log.d(LOG_TAG, "SID NOT found in mcc_sid_range.");
|
||||
|
||||
if (DBG) Rlog.d(LOG_TAG, "Exit getMccByOtherFactors. Return tmpMcc = " + tmpMcc);
|
||||
if (DBG) Log.d(LOG_TAG, "Exit getMccByOtherFactors. Return tmpMcc = " + tmpMcc);
|
||||
// If unknown MCC still could not be resolved,
|
||||
return tmpMcc;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public final class HbpcdUtils {
|
||||
* Gets country information with given MCC.
|
||||
*/
|
||||
public String getIddByMcc(int mcc) {
|
||||
if (DBG) Rlog.d(LOG_TAG, "Enter getHbpcdInfoByMCC.");
|
||||
if (DBG) Log.d(LOG_TAG, "Enter getHbpcdInfoByMCC.");
|
||||
String idd = "";
|
||||
|
||||
Cursor c = null;
|
||||
@@ -145,19 +145,19 @@ public final class HbpcdUtils {
|
||||
MccIdd.MCC + "=" + mcc, null, null);
|
||||
if (cur != null) {
|
||||
if (cur.getCount() > 0) {
|
||||
if (DBG) Rlog.d(LOG_TAG, "Query Idd returned the cursor " + cur);
|
||||
if (DBG) Log.d(LOG_TAG, "Query Idd returned the cursor " + cur);
|
||||
// TODO: for those country having more than 1 IDDs, need more information
|
||||
// to decide which IDD would be used. currently just use the first 1.
|
||||
cur.moveToFirst();
|
||||
idd = cur.getString(0);
|
||||
if (DBG) Rlog.d(LOG_TAG, "IDD = " + idd);
|
||||
if (DBG) Log.d(LOG_TAG, "IDD = " + idd);
|
||||
|
||||
}
|
||||
cur.close();
|
||||
}
|
||||
if (c != null) c.close();
|
||||
|
||||
if (DBG) Rlog.d(LOG_TAG, "Exit getHbpcdInfoByMCC.");
|
||||
if (DBG) Log.d(LOG_TAG, "Exit getHbpcdInfoByMCC.");
|
||||
return idd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import android.os.UserHandle;
|
||||
import android.provider.Telephony;
|
||||
import android.provider.Telephony.Sms.Intents;
|
||||
import android.telephony.PackageChangeReceiver;
|
||||
import com.android.telephony.Rlog;
|
||||
import android.util.Log;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -565,7 +565,7 @@ public final class SmsApplication {
|
||||
int mode = appOps.unsafeCheckOp(opStr, applicationData.mUid,
|
||||
applicationData.mPackageName);
|
||||
if (mode != AppOpsManager.MODE_ALLOWED) {
|
||||
Rlog.e(LOG_TAG, applicationData.mPackageName + " lost "
|
||||
Log.e(LOG_TAG, applicationData.mPackageName + " lost "
|
||||
+ opStr + ": "
|
||||
+ (updateIfNeeded ? " (fixing)" : " (no permission to fix)"));
|
||||
if (updateIfNeeded) {
|
||||
@@ -643,7 +643,7 @@ public final class SmsApplication {
|
||||
int uid = packageManager.getPackageInfo(oldPackageName, 0).applicationInfo.uid;
|
||||
setExclusiveAppops(oldPackageName, appOps, uid, AppOpsManager.MODE_DEFAULT);
|
||||
} catch (NameNotFoundException e) {
|
||||
Rlog.w(LOG_TAG, "Old SMS package not found: " + oldPackageName);
|
||||
Log.w(LOG_TAG, "Old SMS package not found: " + oldPackageName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ public final class SmsApplication {
|
||||
// the package signature matches system signature.
|
||||
final int result = packageManager.checkSignatures(context.getPackageName(), packageName);
|
||||
if (result != PackageManager.SIGNATURE_MATCH) {
|
||||
Rlog.e(LOG_TAG, packageName + " does not have system signature");
|
||||
Log.e(LOG_TAG, packageName + " does not have system signature");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -758,13 +758,13 @@ public final class SmsApplication {
|
||||
int mode = appOps.unsafeCheckOp(AppOpsManager.OPSTR_WRITE_SMS, info.applicationInfo.uid,
|
||||
packageName);
|
||||
if (mode != AppOpsManager.MODE_ALLOWED) {
|
||||
Rlog.w(LOG_TAG, packageName + " does not have OP_WRITE_SMS: (fixing)");
|
||||
Log.w(LOG_TAG, packageName + " does not have OP_WRITE_SMS: (fixing)");
|
||||
setExclusiveAppops(packageName, appOps, info.applicationInfo.uid,
|
||||
AppOpsManager.MODE_ALLOWED);
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
// No whitelisted system app on this device
|
||||
Rlog.e(LOG_TAG, "Package not found: " + packageName);
|
||||
Log.e(LOG_TAG, "Package not found: " + packageName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,13 +24,16 @@ import android.os.PersistableBundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import com.android.telephony.Rlog;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.HbpcdLookup.MccIdd;
|
||||
import com.android.internal.telephony.HbpcdLookup.MccLookup;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -143,7 +146,7 @@ public class SmsNumberUtils {
|
||||
|
||||
// First check whether the number is a NANP number.
|
||||
int nanpState = checkNANP(numberEntry, allIDDs);
|
||||
if (DBG) Rlog.d(TAG, "NANP type: " + getNumberPlanType(nanpState));
|
||||
if (DBG) Log.d(TAG, "NANP type: " + getNumberPlanType(nanpState));
|
||||
|
||||
if ((nanpState == NP_NANP_LOCAL)
|
||||
|| (nanpState == NP_NANP_AREA_LOCAL)
|
||||
@@ -173,7 +176,7 @@ public class SmsNumberUtils {
|
||||
|
||||
int internationalState = checkInternationalNumberPlan(context, numberEntry, allIDDs,
|
||||
NANP_IDD);
|
||||
if (DBG) Rlog.d(TAG, "International type: " + getNumberPlanType(internationalState));
|
||||
if (DBG) Log.d(TAG, "International type: " + getNumberPlanType(internationalState));
|
||||
String returnNumber = null;
|
||||
|
||||
switch (internationalState) {
|
||||
@@ -272,7 +275,7 @@ public class SmsNumberUtils {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Rlog.e(TAG, "Can't access HbpcdLookup database", e);
|
||||
Log.e(TAG, "Can't access HbpcdLookup database", e);
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
@@ -281,7 +284,7 @@ public class SmsNumberUtils {
|
||||
|
||||
IDDS_MAPS.put(mcc, allIDDs);
|
||||
|
||||
if (DBG) Rlog.d(TAG, "MCC = " + mcc + ", all IDDs = " + allIDDs);
|
||||
if (DBG) Log.d(TAG, "MCC = " + mcc + ", all IDDs = " + allIDDs);
|
||||
return allIDDs;
|
||||
}
|
||||
|
||||
@@ -472,7 +475,7 @@ public class SmsNumberUtils {
|
||||
int tempCC = allCCs[i];
|
||||
for (int j = 0; j < MAX_COUNTRY_CODES_LENGTH; j ++) {
|
||||
if (tempCC == ccArray[j]) {
|
||||
if (DBG) Rlog.d(TAG, "Country code = " + tempCC);
|
||||
if (DBG) Log.d(TAG, "Country code = " + tempCC);
|
||||
return tempCC;
|
||||
}
|
||||
}
|
||||
@@ -509,7 +512,7 @@ public class SmsNumberUtils {
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Rlog.e(TAG, "Can't access HbpcdLookup database", e);
|
||||
Log.e(TAG, "Can't access HbpcdLookup database", e);
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
@@ -561,10 +564,10 @@ public class SmsNumberUtils {
|
||||
* Filter the destination number if using VZW sim card.
|
||||
*/
|
||||
public static String filterDestAddr(Context context, int subId, String destAddr) {
|
||||
if (DBG) Rlog.d(TAG, "enter filterDestAddr. destAddr=\"" + Rlog.pii(TAG, destAddr) + "\"" );
|
||||
if (DBG) Log.d(TAG, "enter filterDestAddr. destAddr=\"" + pii(TAG, destAddr) + "\"" );
|
||||
|
||||
if (destAddr == null || !PhoneNumberUtils.isGlobalPhoneNumber(destAddr)) {
|
||||
Rlog.w(TAG, "destAddr" + Rlog.pii(TAG, destAddr) +
|
||||
Log.w(TAG, "destAddr" + pii(TAG, destAddr) +
|
||||
" is not a global phone number! Nothing changed.");
|
||||
return destAddr;
|
||||
}
|
||||
@@ -585,9 +588,9 @@ public class SmsNumberUtils {
|
||||
}
|
||||
|
||||
if (DBG) {
|
||||
Rlog.d(TAG, "destAddr is " + ((result != null)?"formatted.":"not formatted."));
|
||||
Rlog.d(TAG, "leave filterDestAddr, new destAddr=\"" + (result != null ? Rlog.pii(TAG,
|
||||
result) : Rlog.pii(TAG, destAddr)) + "\"");
|
||||
Log.d(TAG, "destAddr is " + ((result != null)?"formatted.":"not formatted."));
|
||||
Log.d(TAG, "leave filterDestAddr, new destAddr=\"" + (result != null ? pii(TAG,
|
||||
result) : pii(TAG, destAddr)) + "\"");
|
||||
}
|
||||
return result != null ? result : destAddr;
|
||||
}
|
||||
@@ -608,7 +611,7 @@ public class SmsNumberUtils {
|
||||
networkType = CDMA_HOME_NETWORK;
|
||||
}
|
||||
} else {
|
||||
if (DBG) Rlog.w(TAG, "warning! unknown mPhoneType value=" + phoneType);
|
||||
if (DBG) Log.w(TAG, "warning! unknown mPhoneType value=" + phoneType);
|
||||
}
|
||||
|
||||
return networkType;
|
||||
@@ -650,4 +653,44 @@ public class SmsNumberUtils {
|
||||
// by default this value is false
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redact personally identifiable information for production users.
|
||||
* @param tag used to identify the source of a log message
|
||||
* @param pii the personally identifiable information we want to apply secure hash on.
|
||||
* @return If tag is loggable in verbose mode or pii is null, return the original input.
|
||||
* otherwise return a secure Hash of input pii
|
||||
*/
|
||||
private static String pii(String tag, Object pii) {
|
||||
String val = String.valueOf(pii);
|
||||
if (pii == null || TextUtils.isEmpty(val) || Log.isLoggable(tag, Log.VERBOSE)) {
|
||||
return val;
|
||||
}
|
||||
return "[" + secureHash(val.getBytes()) + "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a secure hash (using the SHA1 algorithm) of the provided input.
|
||||
*
|
||||
* @return "****" if the build type is user, otherwise the hash
|
||||
* @param input the bytes for which the secure hash should be computed.
|
||||
*/
|
||||
private static String secureHash(byte[] input) {
|
||||
// Refrain from logging user personal information in user build.
|
||||
if (android.os.Build.IS_USER) {
|
||||
return "****";
|
||||
}
|
||||
|
||||
MessageDigest messageDigest;
|
||||
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("SHA-1");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
return "####";
|
||||
}
|
||||
|
||||
byte[] result = messageDigest.digest(input);
|
||||
return Base64.encodeToString(
|
||||
result, Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import com.android.telephony.Rlog;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
@@ -521,7 +520,7 @@ public final class TelephonyPermissions {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DBG) Rlog.d(LOG_TAG, "No modify permission, check carrier privilege next.");
|
||||
if (DBG) Log.d(LOG_TAG, "No modify permission, check carrier privilege next.");
|
||||
enforceCallingOrSelfCarrierPrivilege(context, subId, message);
|
||||
}
|
||||
|
||||
@@ -539,7 +538,7 @@ public final class TelephonyPermissions {
|
||||
}
|
||||
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "No READ_PHONE_STATE permission, check carrier privilege next.");
|
||||
Log.d(LOG_TAG, "No READ_PHONE_STATE permission, check carrier privilege next.");
|
||||
}
|
||||
|
||||
enforceCallingOrSelfCarrierPrivilege(context, subId, message);
|
||||
@@ -559,7 +558,7 @@ public final class TelephonyPermissions {
|
||||
}
|
||||
|
||||
if (DBG) {
|
||||
Rlog.d(LOG_TAG, "No READ_PRIVILEDED_PHONE_STATE permission, "
|
||||
Log.d(LOG_TAG, "No READ_PRIVILEDED_PHONE_STATE permission, "
|
||||
+ "check carrier privilege next.");
|
||||
}
|
||||
|
||||
@@ -584,7 +583,7 @@ public final class TelephonyPermissions {
|
||||
Context context, int subId, int uid, String message) {
|
||||
if (getCarrierPrivilegeStatus(context, subId, uid)
|
||||
!= TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
|
||||
if (DBG) Rlog.e(LOG_TAG, "No Carrier Privilege.");
|
||||
if (DBG) Log.e(LOG_TAG, "No Carrier Privilege.");
|
||||
throw new SecurityException(message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user