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

Commit 0a46c2f7 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: If360077718549a66179175e197817f7315d8c8ca
parent 7866342c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -73,7 +73,8 @@ public abstract class AbstractConnectivityPreferenceController
        }

        mContext.registerReceiver(mConnectivityReceiver, connectivityIntentFilter,
                android.Manifest.permission.CHANGE_NETWORK_STATE, null);
                android.Manifest.permission.CHANGE_NETWORK_STATE, null,
                Context.RECEIVER_EXPORTED_UNAUDITED);
    }

    protected abstract String[] getConnectivityIntents();
+2 −1
Original line number Diff line number Diff line
@@ -94,7 +94,8 @@ public class CountdownConditionProvider extends SystemConditionProviderService {
    @Override
    public void onConnected() {
        if (DEBUG) Slog.d(TAG, "onConnected");
        mContext.registerReceiver(mReceiver, new IntentFilter(ACTION));
        mContext.registerReceiver(mReceiver, new IntentFilter(ACTION),
                Context.RECEIVER_EXPORTED_UNAUDITED);
        mConnected = true;
    }

+2 −1
Original line number Diff line number Diff line
@@ -306,7 +306,8 @@ public class EventConditionProvider extends SystemConditionProviderService {
            filter.addAction(Intent.ACTION_TIME_CHANGED);
            filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
            filter.addAction(ACTION_EVALUATE);
            registerReceiver(mReceiver, filter);
            registerReceiver(mReceiver, filter,
                    Context.RECEIVER_EXPORTED_UNAUDITED);
        } else {
            unregisterReceiver(mReceiver);
        }
+2 −1
Original line number Diff line number Diff line
@@ -100,7 +100,8 @@ public class NotificationHistoryDatabase {

        IntentFilter deletionFilter = new IntentFilter(ACTION_HISTORY_DELETION);
        deletionFilter.addDataScheme(SCHEME_DELETION);
        mContext.registerReceiver(mFileCleanupReceiver, deletionFilter);
        mContext.registerReceiver(mFileCleanupReceiver, deletionFilter,
                Context.RECEIVER_EXPORTED_UNAUDITED);
    }

    public void init() {
+2 −1
Original line number Diff line number Diff line
@@ -2328,7 +2328,8 @@ public class NotificationManagerService extends SystemService {

        IntentFilter timeoutFilter = new IntentFilter(ACTION_NOTIFICATION_TIMEOUT);
        timeoutFilter.addDataScheme(SCHEME_TIMEOUT);
        getContext().registerReceiver(mNotificationTimeoutReceiver, timeoutFilter);
        getContext().registerReceiver(mNotificationTimeoutReceiver, timeoutFilter,
                Context.RECEIVER_EXPORTED_UNAUDITED);

        IntentFilter settingsRestoredFilter = new IntentFilter(Intent.ACTION_SETTING_RESTORED);
        getContext().registerReceiver(mRestoreReceiver, settingsRestoredFilter);
Loading