Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 94cb9615 authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-security-9.0.0_r71' into staging/lineage-16.0_merge_android-security-9.0.0_r71

Android Security 9.0.0 Release 71 (7449186)

* tag 'android-security-9.0.0_r71':
  DO NOT MERGE

Change-Id: Ie5939f532cda342f0e396341803e86b85d8acb41
parents 5119b83a caf0bfe8
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.telephony.UiccAccessRule;
import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;
import android.text.format.Time;
import android.util.EventLog;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
@@ -238,6 +239,11 @@ public class SubscriptionController extends ISub.Stub {
                android.Manifest.permission.MODIFY_PHONE_STATE, message);
    }

    private void enforceReadPrivilegedPhoneState(String message) {
        mContext.enforceCallingOrSelfPermission(
                Manifest.permission.READ_PRIVILEGED_PHONE_STATE, message);
    }

    /**
     * Broadcast when SubscriptionInfo has changed
     * FIXME: Hopefully removed if the API council accepts SubscriptionInfoListener
@@ -737,12 +743,18 @@ public class SubscriptionController extends ISub.Stub {

    @Override
    public List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage) {
        // This API isn't public, so no need to provide a valid subscription ID - we're not worried
        // about carrier-privileged callers not having access.
        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
                mContext, SubscriptionManager.INVALID_SUBSCRIPTION_ID, callingPackage,
                "getAvailableSubscriptionInfoList")) {
            throw new SecurityException("Need READ_PHONE_STATE to call "
        try {
            enforceReadPrivilegedPhoneState("getAvailableSubscriptionInfoList");
        } catch (SecurityException e) {
            try {
                mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE, null);
                // If caller doesn't have READ_PRIVILEGED_PHONE_STATE permission but only
                // has READ_PHONE_STATE permission, log this event.
                EventLog.writeEvent(0x534e4554, "185235454", Binder.getCallingUid());
            } catch (SecurityException ex) {
                // Ignore
            }
            throw new SecurityException("Need READ_PRIVILEGED_PHONE_STATE to call "
                    + " getAvailableSubscriptionInfoList");
        }