[automerger skipped] Use supported locale replace the result from sim info. am: e9360cd21d -s ours
am skip reason: Merged-In Id29bd66c14d7a5415b3d5b2905a2301846780c70 with SHA-1 0b59d2987c is already in history
Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/2475766
Change-Id: I50954b964712b3cac09409e3e4be980b9a8bf618
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 41ff216..a427bac 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -193,6 +193,7 @@
android:label="@string/emergencyDialerIconLabel"
android:theme="@style/EmergencyDialerTheme"
android:screenOrientation="portrait"
+ android:showWhenLocked="true"
android:exported="true"
android:resizeableActivity="false">
<intent-filter>
@@ -509,7 +510,6 @@
<activity android:name="com.android.phone.settings.VoicemailSettingsActivity"
android:label="@string/voicemail"
android:configChanges="orientation|screenSize|keyboardHidden|screenLayout"
- android:screenOrientation="portrait"
android:exported="true"
android:theme="@style/CallSettingsWithoutDividerTheme">
<intent-filter >
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 9b7a43e..5fe8708 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -259,8 +259,6 @@
mEntryType = getIntent().getIntExtra(EXTRA_ENTRY_TYPE, ENTRY_TYPE_UNKNOWN);
Log.d(LOG_TAG, "Launched from " + entryTypeToString(mEntryType));
- // Allow this activity to be displayed in front of the keyguard / lockscreen.
- setShowWhenLocked(true);
// Allow turning screen on
setTurnScreenOn(true);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 09e99ea..0dd316f 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1415,6 +1415,7 @@
request = (MainThreadRequest) ar.userObj;
ResultReceiver result = (ResultReceiver) request.argument;
int error = 0;
+ ModemActivityInfo ret = null;
if (mLastModemActivityInfo == null) {
mLastModemActivitySpecificInfo = new ActivityStatsTechSpecificInfo[1];
mLastModemActivitySpecificInfo[0] =
@@ -1433,12 +1434,14 @@
if (isModemActivityInfoValid(info)) {
mergeModemActivityInfo(info);
}
- mLastModemActivityInfo =
- new ModemActivityInfo(
- mLastModemActivityInfo.getTimestampMillis(),
- mLastModemActivityInfo.getSleepTimeMillis(),
- mLastModemActivityInfo.getIdleTimeMillis(),
- mLastModemActivitySpecificInfo);
+ // This is needed to decouple ret from mLastModemActivityInfo
+ // We don't want to return mLastModemActivityInfo which is updated
+ // inside mergeModemActivityInfo()
+ ret = new ModemActivityInfo(
+ mLastModemActivityInfo.getTimestampMillis(),
+ mLastModemActivityInfo.getSleepTimeMillis(),
+ mLastModemActivityInfo.getIdleTimeMillis(),
+ deepCopyModemActivitySpecificInfo(mLastModemActivitySpecificInfo));
} else {
if (ar.result == null) {
@@ -1456,10 +1459,10 @@
}
}
Bundle bundle = new Bundle();
- if (mLastModemActivityInfo != null) {
+ if (ret != null) {
bundle.putParcelable(
TelephonyManager.MODEM_ACTIVITY_RESULT_KEY,
- mLastModemActivityInfo);
+ ret);
} else {
bundle.putInt(TelephonyManager.EXCEPTION_RESULT_KEY, error);
}
@@ -6321,8 +6324,14 @@
private SecurityException checkNetworkRequestForSanitizedLocationAccess(
NetworkScanRequest request, int subId, String callingPackage) {
- boolean hasCarrierPriv = checkCarrierPrivilegesForPackage(subId, callingPackage)
- == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
+ boolean hasCarrierPriv;
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ hasCarrierPriv = checkCarrierPrivilegesForPackage(subId, callingPackage)
+ == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
boolean hasNetworkScanPermission =
mApp.checkCallingOrSelfPermission(android.Manifest.permission.NETWORK_SCAN)
== PERMISSION_GRANTED;
@@ -7815,7 +7824,7 @@
*/
private void mergeModemActivityInfo(ModemActivityInfo info) {
List<ActivityStatsTechSpecificInfo> merged = new ArrayList<>();
- ActivityStatsTechSpecificInfo mDeltaSpecificInfo;
+ ActivityStatsTechSpecificInfo deltaSpecificInfo;
boolean matched;
for (int i = 0; i < info.getSpecificInfoLength(); i++) {
matched = false;
@@ -7840,13 +7849,13 @@
}
if (!matched) {
- mDeltaSpecificInfo =
+ deltaSpecificInfo =
new ActivityStatsTechSpecificInfo(
rat,
freq,
info.getTransmitTimeMillis(rat, freq),
(int) info.getReceiveTimeMillis(rat, freq));
- merged.addAll(Arrays.asList(mDeltaSpecificInfo));
+ merged.addAll(Arrays.asList(deltaSpecificInfo));
}
}
merged.addAll(Arrays.asList(mLastModemActivitySpecificInfo));
@@ -7861,6 +7870,26 @@
mLastModemActivityInfo.setIdleTimeMillis(
info.getIdleTimeMillis()
+ mLastModemActivityInfo.getIdleTimeMillis());
+
+ mLastModemActivityInfo =
+ new ModemActivityInfo(
+ mLastModemActivityInfo.getTimestampMillis(),
+ mLastModemActivityInfo.getSleepTimeMillis(),
+ mLastModemActivityInfo.getIdleTimeMillis(),
+ mLastModemActivitySpecificInfo);
+ }
+
+ private ActivityStatsTechSpecificInfo[] deepCopyModemActivitySpecificInfo(
+ ActivityStatsTechSpecificInfo[] info) {
+ int infoSize = info.length;
+ ActivityStatsTechSpecificInfo[] ret = new ActivityStatsTechSpecificInfo[infoSize];
+ for (int i = 0; i < infoSize; i++) {
+ ret[i] = new ActivityStatsTechSpecificInfo(
+ info[i].getRat(), info[i].getFrequencyRange(),
+ info[i].getTransmitTimeMillis(),
+ (int) info[i].getReceiveTimeMillis());
+ }
+ return ret;
}
/**
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 8832e73..d0aad4a 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -98,7 +98,6 @@
private static final int THEME = com.android.internal.R.style.Theme_DeviceDefault_Dialog_Alert;
/** USSD information used to aggregate all USSD messages */
- private static AlertDialog sUssdDialog = null;
private static StringBuilder sUssdMsg = new StringBuilder();
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
@@ -588,39 +587,36 @@
// displaying system alert dialog on the screen instead of
// using another activity to display the message. This
// places the message at the forefront of the UI.
+ AlertDialog ussdDialog = new AlertDialog.Builder(context, THEME)
+ .setPositiveButton(R.string.ok, null)
+ .setCancelable(true)
+ .setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ sUssdMsg.setLength(0);
+ }
+ })
+ .create();
- if (sUssdDialog == null) {
- sUssdDialog = new AlertDialog.Builder(context, THEME)
- .setPositiveButton(R.string.ok, null)
- .setCancelable(true)
- .setOnDismissListener(new DialogInterface.OnDismissListener() {
- @Override
- public void onDismiss(DialogInterface dialog) {
- sUssdMsg.setLength(0);
- }
- })
- .create();
+ ussdDialog.getWindow().setType(windowType);
+ ussdDialog.getWindow().addFlags(
+ WindowManager.LayoutParams.FLAG_DIM_BEHIND);
- sUssdDialog.getWindow().setType(windowType);
- sUssdDialog.getWindow().addFlags(
- WindowManager.LayoutParams.FLAG_DIM_BEHIND);
- }
if (sUssdMsg.length() != 0) {
- sUssdMsg
- .insert(0, "\n")
+ sUssdMsg.insert(0, "\n")
.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,
+ ussdDialog.setTitle(app.getResources().getString(R.string.carrier_mmi_msg_title,
phone.getCarrierName()));
} else {
- sUssdDialog
+ ussdDialog
.setTitle(app.getResources().getString(R.string.default_carrier_mmi_msg_title));
}
sUssdMsg.insert(0, text);
- sUssdDialog.setMessage(sUssdMsg.toString());
- sUssdDialog.show();
+ ussdDialog.setMessage(sUssdMsg.toString());
+ ussdDialog.show();
}
/**