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

Commit f1df5845 authored by Michael Groover's avatar Michael Groover
Browse files

Add required flag to registerReceiver call in RemoteBugreportManager

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
registerReceiver must specify a flag indicating whether the receiver
should be exported for apps targeting T+ that are registering for
unprotected broadcasts. This commit adds the RECEIVER_EXPORTED flag
to the call to registerReceiver in RemoteBugreportManager when
registering for the REMOTE_BUGREPORT_DISPATCH action as this is
broadcast from shell.

Bug: 161145287
Test: Manually verified logcat warning was not reported
Change-Id: I51ef7b5c275c70edd4eaa98132b98315c1e04256
parent d63ec172
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -219,7 +219,8 @@ public class RemoteBugreportManager {
        try {
            final IntentFilter filterFinished =
                    new IntentFilter(ACTION_REMOTE_BUGREPORT_DISPATCH, BUGREPORT_MIMETYPE);
            mContext.registerReceiver(mRemoteBugreportFinishedReceiver, filterFinished);
            mContext.registerReceiver(mRemoteBugreportFinishedReceiver, filterFinished,
                    Context.RECEIVER_EXPORTED);
        } catch (IntentFilter.MalformedMimeTypeException e) {
            // should never happen, as setting a constant
            Slogf.w(LOG_TAG, e, "Failed to set type %s", BUGREPORT_MIMETYPE);
+6 −0
Original line number Diff line number Diff line
@@ -438,6 +438,12 @@ public class DpmMockContext extends MockContext {
        return spiedContext.registerReceiver(receiver, filter);
    }

    @Override
    public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter, int flags) {
        mMockSystemServices.registerReceiver(receiver, filter, null);
        return spiedContext.registerReceiver(receiver, filter, flags);
    }

    @Override
    public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter,
            String broadcastPermission, Handler scheduler) {