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

Commit 05ab4390 authored by Malcolm Chen's avatar 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 2eb9f746
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -8291,7 +8291,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;->stringToGsm7BitPacked(Ljava/lang/String;IZII)[B
Lcom/android/internal/telephony/GsmAlphabet;->stringToGsm7BitPackedWithHeader(Ljava/lang/String;[BII)[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/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/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$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IPhoneStateListener;
Lcom/android/internal/telephony/IPhoneStateListener;->onCallForwardingIndicatorChanged(Z)V
Lcom/android/internal/telephony/IPhoneStateListener;->onCallForwardingIndicatorChanged(Z)V
+1 −1
Original line number Original line Diff line number Diff line
@@ -518,7 +518,7 @@ final class SystemServiceRegistry {
                new CachedServiceFetcher<CarrierConfigManager>() {
                new CachedServiceFetcher<CarrierConfigManager>() {
            @Override
            @Override
            public CarrierConfigManager createService(ContextImpl ctx) {
            public CarrierConfigManager createService(ContextImpl ctx) {
                return new CarrierConfigManager();
                return new CarrierConfigManager(ctx.getOuterContext());
            }});
            }});


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


    private final Context mContext;

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


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


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


    void notifyConfigChangedForSubId(int subId);
    void notifyConfigChangedForSubId(int subId);


Loading