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

Commit 2e0cba87 authored by Robert Horvath's avatar Robert Horvath
Browse files

Explicitly mark receivers as RECEIVER_NOT_EXPORTED

The intent actions registered for here are only marked as protected
broadcasts if the telephony package is present. In its absence,
receivers *must* specify either RECEIVER_EXPORTED or
RECEIVER_NOT_EXPORTED.

Since these Intents are sent from Telephony, which runs with a system
UID less than the first application UID (10000), the system_server can
receive these broadcasts without exporting the receivers.

Bug: 218831939
Test: build & run on ATV device
Test: atest TelephonySubscriptionTrackerTest
Change-Id: I3fed2a1772fccea611f68e9425755b0c9aa9051e
parent dae8e486
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -73,7 +73,8 @@ public class DataConnectionStats extends BroadcastReceiver {

        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_SIM_STATE_CHANGED);
        mContext.registerReceiver(this, filter, null /* broadcastPermission */, mListenerHandler);
        mContext.registerReceiver(this, filter, null /* broadcastPermission */, mListenerHandler,
                Context.RECEIVER_NOT_EXPORTED);
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public class TelephonySubscriptionTracker extends BroadcastReceiver {
        filter.addAction(ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(ACTION_MULTI_SIM_CONFIG_CHANGED);

        mContext.registerReceiver(this, filter, null, mHandler);
        mContext.registerReceiver(this, filter, null, mHandler, Context.RECEIVER_NOT_EXPORTED);
        mSubscriptionManager.addOnSubscriptionsChangedListener(
                executor, mSubscriptionChangedListener);
        mTelephonyManager.registerTelephonyCallback(executor, mActiveDataSubIdListener);
+3 −2
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class TelephonySubscriptionTrackerTest {

    private IntentFilter getIntentFilter() {
        final ArgumentCaptor<IntentFilter> captor = ArgumentCaptor.forClass(IntentFilter.class);
        verify(mContext).registerReceiver(any(), captor.capture(), any(), any());
        verify(mContext).registerReceiver(any(), captor.capture(), any(), any(), anyInt());

        return captor.getValue();
    }
@@ -258,7 +258,8 @@ public class TelephonySubscriptionTrackerTest {
                        eq(mTelephonySubscriptionTracker),
                        any(IntentFilter.class),
                        any(),
                        eq(mHandler));
                        eq(mHandler),
                        eq(Context.RECEIVER_NOT_EXPORTED));
        final IntentFilter filter = getIntentFilter();
        assertEquals(2, filter.countActions());
        assertTrue(filter.hasAction(ACTION_CARRIER_CONFIG_CHANGED));