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

Commit cd05cf4a authored by Jimmy Chen's avatar Jimmy Chen Committed by Automerger Merge Worker
Browse files

Merge "wifidisplay: restrict broadcast by the proper permission" into rvc-dev am: 3d6cf521

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13824717

Change-Id: I0e02f1d3d7ab499b605354725792a02c0749aec9
parents 21f28e69 3d6cf521
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,9 @@ public final class DisplayManager {
     * {@link #EXTRA_WIFI_DISPLAY_STATUS} extra.
     * {@link #EXTRA_WIFI_DISPLAY_STATUS} extra.
     * </p><p>
     * </p><p>
     * This broadcast is only sent to registered receivers and can only be sent by the system.
     * This broadcast is only sent to registered receivers and can only be sent by the system.
     * </p><p>
     * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission is required to
     * receive this broadcast.
     * </p>
     * </p>
     * @hide
     * @hide
     */
     */
+6 −1
Original line number Original line Diff line number Diff line
@@ -91,6 +91,10 @@ final class WifiDisplayAdapter extends DisplayAdapter {


    private boolean mPendingStatusChangeBroadcast;
    private boolean mPendingStatusChangeBroadcast;


    private static final String[] RECEIVER_PERMISSIONS_FOR_BROADCAST = {
            android.Manifest.permission.ACCESS_FINE_LOCATION,
    };

    // Called with SyncRoot lock held.
    // Called with SyncRoot lock held.
    public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
    public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
            Context context, Handler handler, Listener listener,
            Context context, Handler handler, Listener listener,
@@ -432,7 +436,8 @@ final class WifiDisplayAdapter extends DisplayAdapter {
        }
        }


        // Send protected broadcast about wifi display status to registered receivers.
        // Send protected broadcast about wifi display status to registered receivers.
        getContext().sendBroadcastAsUser(intent, UserHandle.ALL);
        getContext().createContextAsUser(UserHandle.ALL, 0)
                .sendBroadcastWithMultiplePermissions(intent, RECEIVER_PERMISSIONS_FOR_BROADCAST);
    }
    }


    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {