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

Commit de14599c 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 T 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 T release.

Bug: 161145287
Test: Build
Change-Id: I5faa64ae0d2b22b62390bf13cb2b87fd6926e0c7
parent 2e6243d9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ public class PluginManagerImpl extends BroadcastReceiver implements PluginManage
        filter.addAction(PLUGIN_CHANGED);
        filter.addAction(DISABLE_PLUGIN);
        filter.addDataScheme("package");
        mContext.registerReceiver(this, filter, PluginActionManager.PLUGIN_PERMISSION, null);
        mContext.registerReceiver(this, filter, PluginActionManager.PLUGIN_PERMISSION, null,
                Context.RECEIVER_EXPORTED_UNAUDITED);
        filter = new IntentFilter(Intent.ACTION_USER_UNLOCKED);
        mContext.registerReceiver(this, filter);
    }
+2 −1
Original line number Diff line number Diff line
@@ -91,7 +91,8 @@ class KeyguardEsimArea extends Button implements View.OnClickListener {
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mContext.registerReceiver(mReceiver, new IntentFilter(ACTION_DISABLE_ESIM),
                PERMISSION_SELF, null /* scheduler */);
                PERMISSION_SELF, null /* scheduler */,
                Context.RECEIVER_EXPORTED_UNAUDITED);
    }

    public static boolean isEsimLocked(Context context, int subId) {
+2 −1
Original line number Diff line number Diff line
@@ -112,7 +112,8 @@ public class SliceBroadcastRelayHandler extends CoreStartable {

        public void register(Context context, ComponentName receiver, IntentFilter filter) {
            mReceivers.add(receiver);
            context.registerReceiver(this, filter);
            context.registerReceiver(this, filter,
                    Context.RECEIVER_EXPORTED_UNAUDITED);
        }

        public void unregister(Context context) {
+1 −1
Original line number Diff line number Diff line
@@ -518,7 +518,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);

        context.registerReceiver(mBroadcastReceiver, filter);
        context.registerReceiver(mBroadcastReceiver, filter, Context.RECEIVER_EXPORTED_UNAUDITED);
        mSensorPrivacyManager = context.getSystemService(SensorPrivacyManager.class);
    }

+2 −1
Original line number Diff line number Diff line
@@ -539,7 +539,8 @@ public class UdfpsController implements DozeReceiver {

        final IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        context.registerReceiver(mBroadcastReceiver, filter);
        context.registerReceiver(mBroadcastReceiver, filter,
                Context.RECEIVER_EXPORTED_UNAUDITED);

        udfpsHapticsSimulator.setUdfpsController(this);
    }
Loading