diff options
| author | android-build-team Robot <android-build-team-robot@google.com> | 2018-08-10 20:32:18 +0000 |
|---|---|---|
| committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-08-10 20:32:18 +0000 |
| commit | 86d1f69c9e83aa6637176f8a3934881bea352e81 (patch) | |
| tree | 9a9a36050987bec6d6432907ed11a150de5b5e82 | |
| parent | 68f3d03cd8ac80f215850fd7fd76cac459d7bc3f (diff) | |
| parent | 11a6223ea80f2b6b0f07156009f60a0f7341af36 (diff) | |
| download | platform_packages_services_Telephony-oreo-m7-release.tar.gz platform_packages_services_Telephony-oreo-m7-release.tar.bz2 platform_packages_services_Telephony-oreo-m7-release.zip | |
Merge cherrypicks of [4741663, 4741664, 4741665, 4741666, 4743080, 4743081, 4743082, 4743083, 4741262, 4741263, 4741264, 4741265, 4741266, 4741667, 4743084, 4741242, 4741243, 4741741, 4741742, 4741743, 4741744, 4741822, 4743085, 4741668, 4741338, 4743055, 4743056, 4743070, 4743073, 4743075, 4743076, 4743078, 4743079, 4743161, 4743162, 4743164, 4743165, 4743167, 4743168, 4743169, 4743170, 4741681, 4741682, 4741683, 4741684, 4741685, 4741686, 4741687, 4741688, 4741689, 4741690, 4741691, 4741692, 4741693, 4741694, 4741695, 4741696, 4741697, 4741698, 4741699, 4743240, 4743241, 4743242, 4743243, 4741745, 4741823, 4741824, 4741825, 4741267, 4741268, 4743244, 4743280, 4743281, 4743224, 4743203, 4743204, 4743205, 4741746, 4741747, 4743245, 4741826, 4741827, 4741828, 4741829, 4741748, 4741749, 4741750, 4743233, 4743282, 4741244, 4741245, 4741246, 4741247, 4743206, 4743207, 4743208, 4743209, 4743210, 4743211, 4743212, 4743213, 4743214, 4743215, 4743216, 4743217, 4743218, 4743219, 4743360, 4743361, 4743362, 4743363, 4743364, 4743365, 4743366, 4743367, 4743368, 4743369, 4743370, 4743371, 4743372, 4743373, 4743374, 4743375, 4743376, 4743377, 4743283, 4743284, 4741830, 4742501, 4743246, 4743086, 4743087, 4743378, 4743379, 4741751] into sparse-4749909-L04200000199131547android-8.1.0_r52android-8.1.0_r50android-8.1.0_r47android-8.1.0_r46oreo-m7-releaseoreo-m6-s4-release
Change-Id: I964a7196fe27209849ac22c961febe4cdd3d91a6
| -rw-r--r-- | src/com/android/phone/EmergencyCallbackModeExitDialog.java | 8 | ||||
| -rw-r--r-- | src/com/android/phone/PhoneInterfaceManager.java | 39 |
2 files changed, 37 insertions, 10 deletions
diff --git a/src/com/android/phone/EmergencyCallbackModeExitDialog.java b/src/com/android/phone/EmergencyCallbackModeExitDialog.java index f5509b932..07d518f22 100644 --- a/src/com/android/phone/EmergencyCallbackModeExitDialog.java +++ b/src/com/android/phone/EmergencyCallbackModeExitDialog.java @@ -80,9 +80,11 @@ public class EmergencyCallbackModeExitDialog extends Activity implements OnDismi mPhone = PhoneGlobals.getInstance().getPhoneInEcm(); // Check if phone is in Emergency Callback Mode. If not, exit. - final boolean isInEcm = mPhone.isInEcm(); - Log.i(TAG, "ECMModeExitDialog launched - isInEcm: " + isInEcm + " phone:" + mPhone); - if (mPhone == null || !isInEcm) { + if (mPhone == null || !mPhone.isInEcm()) { + if (mPhone == null) { + android.util.EventLog.writeEvent(0x534e4554, "79995313", -1, ""); + } + Log.i(TAG, "ECMModeExitDialog launched - isInEcm: false" + " phone:" + mPhone); finish(); return; } diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java index 616acda12..f5621e90f 100644 --- a/src/com/android/phone/PhoneInterfaceManager.java +++ b/src/com/android/phone/PhoneInterfaceManager.java @@ -1172,12 +1172,22 @@ public class PhoneInterfaceManager extends ITelephony.Stub { * @return true is a call was ended */ public boolean endCallForSubscriber(int subId) { - if (mApp.checkCallingOrSelfPermission(permission.MODIFY_PHONE_STATE) - != PackageManager.PERMISSION_GRANTED) { - Log.i(LOG_TAG, "endCall: called without modify phone state."); + Phone phone = getPhone(subId); + CallManager callManager = PhoneGlobals.getInstance().getCallManager(); + + // When device is in emergency callback mode or there is an active emergency call, do not + // allow the caller to end the call unless they hold modify phone state permission. + if (phone != null && callManager != null + && (phone.isInEcm() || PhoneUtils.isInEmergencyCall(callManager)) + && mApp.checkCallingOrSelfPermission(permission.MODIFY_PHONE_STATE) + != PackageManager.PERMISSION_GRANTED) { + + Log.i(LOG_TAG, "endCall: called without modify phone state for emergency call."); EventLog.writeEvent(0x534e4554, "67862398", -1, ""); - throw new SecurityException("MODIFY_PHONE_STATE permission required."); + throw new SecurityException( + "MODIFY_PHONE_STATE permission required to end an emergency call."); } + enforceCallPermission(); return (Boolean) sendRequest(CMD_END_CALL, null, new Integer(subId)); } @@ -2468,9 +2478,24 @@ public class PhoneInterfaceManager extends ITelephony.Stub { * Get the forbidden PLMN List from the given app type (ex APPTYPE_USIM) * on a particular subscription */ - public String[] getForbiddenPlmns(int subId, int appType) { - mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE, - "Requires READ_PHONE_STATE"); + public String[] getForbiddenPlmns(int subId, int appType, String callingPackage) { + + if ((mApp.checkCallingOrSelfPermission( + android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + == PackageManager.PERMISSION_GRANTED + || mApp.checkCallingOrSelfPermission( + android.Manifest.permission.READ_PHONE_STATE) + == PackageManager.PERMISSION_GRANTED) + && mAppOps.noteOp( + AppOpsManager.OP_READ_PHONE_STATE, Binder.getCallingUid(), callingPackage) + != AppOpsManager.MODE_ALLOWED) { + EventLog.writeEvent(0x534e4554, "73884967", Binder.getCallingUid(), + "getForbiddenPlmns calllingPackage: " + callingPackage); + } + + if (!canReadPhoneState(callingPackage, "getForbiddenPlmns")) { + return null; + } if (appType != TelephonyManager.APPTYPE_USIM && appType != TelephonyManager.APPTYPE_SIM) { loge("getForbiddenPlmnList(): App Type must be USIM or SIM"); return null; |
