Merge "READ_PRIVILEGED/system allows callers to see all uicc card info"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4ad0d26..04374c4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -42,6 +42,10 @@
<string name="payphone">Payphone</string>
<!-- In-call screen: status label for a call that's on hold -->
<string name="onHold">On hold</string>
+ <!-- Title for carrier MMI message -->
+ <string name="carrier_mmi_msg_title">(<xliff:g id="mmicarrier" example="T-Mobile">%s</xliff:g>) Message</string>
+ <!-- Default title for carrier MMI message -->
+ <string name="default_carrier_mmi_msg_title">Carrier Message</string>
<!-- Possible error messages with outgoing calls --><skip/>
<string name="mmiStarted">MMI code started</string>
<!-- Dialog label when a USSD code starts running -->
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index cf7bafd..1c4b1c3 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -957,21 +957,17 @@
log("Ignore invalid phoneId: " + phoneId + " for subId: " + subId);
return;
}
- String callingPackageName = mContext.getPackageManager().getNameForUid(
- Binder.getCallingUid());
- // TODO: Check that the calling packages is privileged for subId specifically.
- int privilegeStatus = TelephonyManager.from(mContext).checkCarrierPrivilegesForPackage(
- callingPackageName);
- // Requires the calling app to be either a carrier privileged app or
+
+ // Requires the calling app to be either a carrier privileged app for this subId or
// system privileged app with MODIFY_PHONE_STATE permission.
- if (privilegeStatus != TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
- mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MODIFY_PHONE_STATE,
- "Require carrier privileges or MODIFY_PHONE_STATE permission.");
- }
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mContext, subId,
+ "Require carrier privileges or MODIFY_PHONE_STATE permission.");
// This method should block until deleting has completed, so that an error which prevents us
// from clearing the cache is passed back to the carrier app. With the files successfully
// deleted, this can return and we will eventually bind to the carrier app.
+ String callingPackageName = mContext.getPackageManager().getNameForUid(
+ Binder.getCallingUid());
clearCachedConfigForPackage(callingPackageName);
updateConfigForPhoneId(phoneId);
}
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 20c8276..e46cfc0 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -448,7 +448,7 @@
app.setPukEntryProgressDialog(pd);
} else if ((app.getPUKEntryActivity() != null) && (state == MmiCode.State.FAILED)) {
- createUssdDialog(app, context, text,
+ createUssdDialog(app, context, text, phone,
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
// In case of failure to unlock, we'll need to reset the
// PUK unlock activity, so that the user may try again.
@@ -463,7 +463,7 @@
// A USSD in a pending state means that it is still
// interacting with the user.
if (state != MmiCode.State.PENDING) {
- createUssdDialog(app, context, text,
+ createUssdDialog(app, context, text, phone,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
} else {
log("displayMMIComplete: USSD code has requested user input. Constructing input "
@@ -584,10 +584,11 @@
* @param app This is {@link PhoneGlobals}
* @param context Context to get strings.
* @param text This is message's result.
+ * @param phone This is phone to create sssd dialog.
* @param windowType The new window type. {@link WindowManager.LayoutParams}.
*/
public static void createUssdDialog(PhoneGlobals app, Context context, CharSequence text,
- int windowType) {
+ Phone phone, int windowType) {
log("displayMMIComplete: MMI code has finished running.");
log("displayMMIComplete: Extended NW displayMMIInitiate (" + text + ")");
@@ -621,6 +622,13 @@
.insert(0, app.getResources().getString(R.string.ussd_dialog_sep))
.insert(0, "\n");
}
+ if (phone != null && phone.getCarrierName() != null) {
+ sUssdDialog.setTitle(app.getResources().getString(R.string.carrier_mmi_msg_title,
+ phone.getCarrierName()));
+ } else {
+ sUssdDialog
+ .setTitle(app.getResources().getString(R.string.default_carrier_mmi_msg_title));
+ }
sUssdMsg.insert(0, text);
sUssdDialog.setMessage(sUssdMsg.toString());
sUssdDialog.show();
diff --git a/src/com/android/phone/settings/SuppServicesUiUtil.java b/src/com/android/phone/settings/SuppServicesUiUtil.java
index 8cb37a5..1a6bb7f 100644
--- a/src/com/android/phone/settings/SuppServicesUiUtil.java
+++ b/src/com/android/phone/settings/SuppServicesUiUtil.java
@@ -203,7 +203,7 @@
Log.d(LOG_TAG, "handleCallerIdUssdResponse: response ="
+ response.toString());
PhoneUtils.createUssdDialog(app, context, response.toString(),
- WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ phone, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
@Override
@@ -214,7 +214,7 @@
+ failureCode);
PhoneUtils.createUssdDialog(app, context,
context.getText(R.string.response_error),
- WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ phone, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
};