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

Commit 6f786115 authored by Michael Groover's avatar Michael Groover
Browse files

Add required flag to registerReceiver calls for platform services

Android T adds support to allow a runtime receiver to be registered as
not exported, but to ensure apps can take advantage of this, calls to
receiver should be exported for apps targeting T+ that are registering
for unprotected broadcasts. This commit updates all of the calls under
services/ that are registering receivers for unprotected broadcasts.

Bug: 161145287
Test: Manually verified code did not trigger logcat message for not
  specifying the necessary flag when calling #registerReceiver
Change-Id: Icaef9d9cf9ed888d124f33c40dbeb1b15df87938
parent 54d0193e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ public class PolicyWarningUIController {
        filter.addAction(ACTION_A11Y_SETTINGS);
        filter.addAction(ACTION_DISMISS_NOTIFICATION);
        mContext.registerReceiver(mNotificationController, filter,
                Manifest.permission.MANAGE_ACCESSIBILITY, mMainHandler);
                Manifest.permission.MANAGE_ACCESSIBILITY, mMainHandler, Context.RECEIVER_EXPORTED);

    }

+2 −1
Original line number Diff line number Diff line
@@ -209,7 +209,8 @@ public final class AutofillManagerService

        final IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        context.registerReceiver(mBroadcastReceiver, filter, null, FgThread.getHandler());
        context.registerReceiver(mBroadcastReceiver, filter, null, FgThread.getHandler(),
                Context.RECEIVER_NOT_EXPORTED);

        mAugmentedAutofillResolver = new FrameworkResourcesServiceNameResolver(getContext(),
                com.android.internal.R.string.config_defaultAugmentedAutofillService);
+1 −1
Original line number Diff line number Diff line
@@ -347,7 +347,7 @@ public final class SensorPrivacyService extends SystemService {
                            intent.getIntExtra(EXTRA_SENSOR, UNKNOWN), false);
                }
            }, new IntentFilter(ACTION_DISABLE_INDIVIDUAL_SENSOR_PRIVACY),
                    MANAGE_SENSOR_PRIVACY, null);
                    MANAGE_SENSOR_PRIVACY, null, Context.RECEIVER_EXPORTED);
            mUserManagerInternal.addUserRestrictionsListener(this);
        }

+1 −1
Original line number Diff line number Diff line
@@ -681,7 +681,7 @@ public class VpnManagerService extends IVpnManager.Stub {
        intentFilter = new IntentFilter();
        intentFilter.addAction(LockdownVpnTracker.ACTION_LOCKDOWN_RESET);
        mUserAllContext.registerReceiver(
                mIntentReceiver, intentFilter, NETWORK_STACK, mHandler);
                mIntentReceiver, intentFilter, NETWORK_STACK, mHandler, Context.RECEIVER_EXPORTED);
    }

    private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
+2 −1
Original line number Diff line number Diff line
@@ -1117,7 +1117,8 @@ public class AudioService extends IAudioService.Stub
        intentFilter.addAction(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION);
        intentFilter.addAction(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION);

        mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, intentFilter, null, null);
        mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, intentFilter, null, null,
                Context.RECEIVER_EXPORTED);

    }

Loading