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

Commit 8d1c1270 authored by Michael Groover's avatar Michael Groover
Browse files

Add unaudited exported flag to exposed runtime receivers

Android T allows apps to declare a runtime receiver as not exported
by invoking registerReceiver with a new RECEIVER_NOT_EXPORTED flag;
receivers registered with this flag will only receive broadcasts from
the platform and the app itself. However to ensure developers can
properly protect their receivers, all apps targeting U or later
registering a receiver for non-system broadcasts must specify either
the exported or not exported flag when invoking #registerReceiver;
if one of these flags is not provided, the platform will throw a
SecurityException. This commit updates all the exposed receivers
with a new RECEIVER_EXPORTED_UNAUDITED flag to maintain the existing
behavior of exporting the receiver while also flagging the receiver
for audit before the U release.

Bug: 234659204
Test: Build
Change-Id: I9806eafcaa0b25f7a2a34c80cbf20eb60c53cda0
parent 47267ced
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -145,7 +145,8 @@ public class CallWaitingController extends Handler {

    private void initialize() {
        mContext.registerReceiver(mReceiver, new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED),
                Context.RECEIVER_EXPORTED_UNAUDITED);

        int phoneId = mPhone.getPhoneId();
        int subId = mPhone.getSubId();
+2 −1
Original line number Diff line number Diff line
@@ -377,7 +377,8 @@ public class CarrierPrivilegesTracker extends Handler {
        certFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        certFilter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED);
        certFilter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED);
        mContext.registerReceiver(mIntentReceiver, certFilter);
        mContext.registerReceiver(mIntentReceiver, certFilter,
                Context.RECEIVER_EXPORTED_UNAUDITED);

        IntentFilter packageFilter = new IntentFilter();
        packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
+2 −1
Original line number Diff line number Diff line
@@ -246,7 +246,8 @@ public class MultiSimSettingController extends Handler {
        mIsAskEverytimeSupportedForSms = mContext.getResources()
                .getBoolean(com.android.internal.R.bool.config_sms_ask_every_time_support);
        context.registerReceiver(mIntentReceiver, new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED),
                Context.RECEIVER_EXPORTED_UNAUDITED);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -699,7 +699,7 @@ public class ServiceStateTracker extends Handler {
        filter.addAction(Intent.ACTION_LOCALE_CHANGED);
        filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED);
        context.registerReceiver(mIntentReceiver, filter);
        context.registerReceiver(mIntentReceiver, filter, Context.RECEIVER_EXPORTED_UNAUDITED);

        mPhone.notifyOtaspChanged(TelephonyManager.OTASP_UNINITIALIZED);

+2 −1
Original line number Diff line number Diff line
@@ -651,7 +651,8 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        appChangedFilter.addDataScheme("package");
        mReceiverContext.registerReceiver(mAppChangedReceiver, appChangedFilter);
        mReceiverContext.registerReceiver(mConfigChangedReceiver, new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED),
                Context.RECEIVER_EXPORTED_UNAUDITED);

        UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        if (userManager.isUserUnlocked()) {
Loading