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

Commit 98ba0ca7 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of [14947191, 14947212, 14947132, 14947133, 14947450,...

Merge cherrypicks of [14947191, 14947212, 14947132, 14947133, 14947450, 14947331] into security-aosp-oc-mr1-release

Change-Id: I026cfbb8f34ec1926505da3eea635c9380667c32
parents 39268886 1697442c
Loading
Loading
Loading
Loading
+18 −2
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;
@@ -256,6 +257,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
@@ -734,8 +740,18 @@ public class SubscriptionController extends ISub.Stub {

    @Override
    public List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage) {
        if (!canReadPhoneState(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");
        }