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

Commit 6cc64f72 authored by Malcolm Chen's avatar Malcolm Chen Committed by Xiangyu/Malcolm Chen
Browse files

Have proper permission check in getConfigForSubId

In CarrierConfigManager, add pass context in constructor, so that
when calling CarrierConfigLoader#getConfigForSubId, it can pass
callingPackage.

Bug: 73136824
Test: regression
Change-Id: I4bbff4ea30e2d5473c14d24d6833bf3ca3c595ec
Merged-In: I4bbff4ea30e2d5473c14d24d6833bf3ca3c595ec
parent 36ce625c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7809,7 +7809,7 @@ Lcom/android/internal/telephony/GsmAlphabet;->sLanguageTables:[Ljava/lang/String
Lcom/android/internal/telephony/GsmAlphabet;->stringToGsm7BitPacked(Ljava/lang/String;IZII)[B
Lcom/android/internal/telephony/GsmAlphabet;->stringToGsm7BitPackedWithHeader(Ljava/lang/String;[BII)[B
Lcom/android/internal/telephony/GsmAlphabet;->stringToGsm8BitPacked(Ljava/lang/String;)[B
Lcom/android/internal/telephony/ICarrierConfigLoader;->getConfigForSubId(I)Landroid/os/PersistableBundle;
Lcom/android/internal/telephony/ICarrierConfigLoader;->getConfigForSubId(ILjava/lang/String;)Landroid/os/PersistableBundle;
Lcom/android/internal/telephony/IMms$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IMms;
Lcom/android/internal/telephony/IPhoneStateListener$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IPhoneStateListener;
Lcom/android/internal/telephony/IPhoneStateListener;->onCallForwardingIndicatorChanged(Z)V
+1 −1
Original line number Diff line number Diff line
@@ -490,7 +490,7 @@ final class SystemServiceRegistry {
                new CachedServiceFetcher<CarrierConfigManager>() {
            @Override
            public CarrierConfigManager createService(ContextImpl ctx) {
                return new CarrierConfigManager();
                return new CarrierConfigManager(ctx.getOuterContext());
            }});

        registerService(Context.TELECOM_SERVICE, TelecomManager.class,
+5 −2
Original line number Diff line number Diff line
@@ -51,10 +51,13 @@ public class CarrierConfigManager {
    public static final String EXTRA_SUBSCRIPTION_INDEX =
            SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX;

    private final Context mContext;

    /**
     * @hide
     */
    public CarrierConfigManager() {
    public CarrierConfigManager(Context context) {
        mContext = context;
    }

    /**
@@ -2271,7 +2274,7 @@ public class CarrierConfigManager {
                        + " ICarrierConfigLoader is null");
                return null;
            }
            return loader.getConfigForSubId(subId);
            return loader.getConfigForSubId(subId, mContext.getOpPackageName());
        } catch (RemoteException ex) {
            Rlog.e(TAG, "Error getting config for subId " + subId + ": "
                    + ex.toString());
+2 −2
Original line number Diff line number Diff line
@@ -6554,7 +6554,7 @@ public class TelephonyManager {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.canChangeDtmfToneLength();
                return telephony.canChangeDtmfToneLength(mSubId, getOpPackageName());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#canChangeDtmfToneLength", e);
@@ -6573,7 +6573,7 @@ public class TelephonyManager {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.isWorldPhone();
                return telephony.isWorldPhone(mSubId, getOpPackageName());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#isWorldPhone", e);
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.os.PersistableBundle;
 */
interface ICarrierConfigLoader {

    PersistableBundle getConfigForSubId(int subId);
    PersistableBundle getConfigForSubId(int subId, String callingPackage);

    void notifyConfigChangedForSubId(int subId);

Loading