Merge changes from topic "presubmit-am-3dd8456477cc4638bd44cc60d1a43b48" into sc-qpr1-dev am: d7b9ea1b73
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telephony/+/16102861
Change-Id: Idd97c748cd04c070d6f006064ed2605792bf60e7
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index d3792f1..8df411b 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -65,6 +65,7 @@
import com.android.internal.telephony.TelephonyPermissions;
import com.android.internal.telephony.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
+import com.android.telephony.Rlog;
import java.io.File;
import java.io.FileDescriptor;
@@ -1053,6 +1054,7 @@
}
String fileName;
+ String iccid = null;
if (isNoSimConfig) {
fileName = getFilenameForNoSimConfig(packageName);
} else {
@@ -1062,7 +1064,7 @@
return null;
}
- final String iccid = getIccIdForPhoneId(phoneId);
+ iccid = getIccIdForPhoneId(phoneId);
final int cid = getSpecificCarrierIdForPhoneId(phoneId);
if (iccid == null) {
loge("Cannot restore config with null iccid.");
@@ -1091,7 +1093,15 @@
} catch (FileNotFoundException e) {
// Missing file is normal occurrence that might occur with a new sim or when restoring
// an override file during boot and should not be treated as an error.
- if (file != null) logd("File not found: " + file.getPath());
+ if (file != null) {
+ if (isNoSimConfig) {
+ logd("File not found: " + file.getPath());
+ } else {
+ String filePath = file.getPath();
+ filePath = getFilePathForLogging(filePath, iccid);
+ logd("File not found : " + filePath);
+ }
+ }
} catch (IOException e) {
loge(e.toString());
}
@@ -1099,6 +1109,22 @@
return restoredBundle;
}
+ /**
+ * This method will mask most part of iccid in the filepath for logging on userbuild
+ */
+ private String getFilePathForLogging(String filePath, String iccid) {
+ // If loggable then return with actual file path
+ if (Rlog.isLoggable(LOG_TAG, Log.VERBOSE)) {
+ return filePath;
+ }
+ String path = filePath;
+ int length = (iccid != null) ? iccid.length() : 0;
+ if (length > 5 && filePath != null) {
+ path = filePath.replace(iccid.substring(5), "***************");
+ }
+ return path;
+ }
+
private PersistableBundle restoreConfigFromXml(String packageName, @NonNull String extraString,
int phoneId) {
return restoreConfigFromXml(packageName, extraString, phoneId, false);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 03b0be9..fcb1764 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2055,7 +2055,8 @@
case CMD_PREPARE_UNATTENDED_REBOOT:
request = (MainThreadRequest) msg.obj;
request.result =
- UiccController.getInstance().getPinStorage().prepareUnattendedReboot();
+ UiccController.getInstance().getPinStorage()
+ .prepareUnattendedReboot(request.workSource);
notifyRequester(request);
break;
@@ -6921,7 +6922,9 @@
for (int p = packages.size() - 1; p >= 0; p--) {
PackageInfo pkgInfo = packages.get(p);
if (pkgInfo != null && pkgInfo.packageName != null
- && card.getCarrierPrivilegeStatus(pkgInfo)
+ && getCarrierPrivilegeStatusFromCarrierConfigRules(
+ card.getCarrierPrivilegeStatus(pkgInfo),
+ getPhone(phoneId), pkgInfo.packageName)
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
privilegedPackages.add(pkgInfo.packageName);
}
@@ -10894,11 +10897,12 @@
@Override
@TelephonyManager.PrepareUnattendedRebootResult
public int prepareForUnattendedReboot() {
+ WorkSource workSource = getWorkSource(Binder.getCallingUid());
enforceRebootPermission();
final long identity = Binder.clearCallingIdentity();
try {
- return (int) sendRequest(CMD_PREPARE_UNATTENDED_REBOOT, null);
+ return (int) sendRequest(CMD_PREPARE_UNATTENDED_REBOOT, null, workSource);
} finally {
Binder.restoreCallingIdentity(identity);
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 766a75e..02ccac9 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -498,7 +498,8 @@
IntentFilter intentFilter = new IntentFilter(
TelecomManager.ACTION_TTY_PREFERRED_MODE_CHANGED);
- registerReceiver(mTtyBroadcastReceiver, intentFilter);
+ registerReceiver(mTtyBroadcastReceiver, intentFilter,
+ android.Manifest.permission.MODIFY_PHONE_STATE, null);
}
@Override