wifidisplay: restrict broadcast by the proper permission

WIFI_DISPLAY_STATUS_CHANGED event contains the MAC address of peers.
As the MAC address is PII data, this should be restricted by proper
permission.

Bug: 176541017
Test: install PoC in b/176541017 and check PII data is not leaked.
Change-Id: I36b85f44678fe232486702fa009f5f06d1a7af75
This commit is contained in:
Jimmy Chen
2021-03-04 13:19:52 +08:00
parent ed260d837f
commit fd8b6dabf9
2 changed files with 9 additions and 1 deletions

View File

@@ -61,6 +61,9 @@ public final class DisplayManager {
* {@link #EXTRA_WIFI_DISPLAY_STATUS} extra.
* </p><p>
* 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>
* @hide
*/

View File

@@ -91,6 +91,10 @@ final class WifiDisplayAdapter extends DisplayAdapter {
private boolean mPendingStatusChangeBroadcast;
private static final String[] RECEIVER_PERMISSIONS_FOR_BROADCAST = {
android.Manifest.permission.ACCESS_FINE_LOCATION,
};
// Called with SyncRoot lock held.
public WifiDisplayAdapter(DisplayManagerService.SyncRoot syncRoot,
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.
getContext().sendBroadcastAsUser(intent, UserHandle.ALL);
getContext().createContextAsUser(UserHandle.ALL, 0)
.sendBroadcastWithMultiplePermissions(intent, RECEIVER_PERMISSIONS_FOR_BROADCAST);
}
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {