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

Commit 3bdcf168 authored by Sohani Rao's avatar Sohani Rao
Browse files

Update REQUEST_PEERS message with calling package

The service enforces location permissions on the caller,
verifies the calling package is registered with the uid.

BUG: 30760540
Test: Unit tests, P2p scan to get peer list and
       establishing a Wifi Direct connection
Change-Id: Ia0eb466a370a00c0264944871ce348841a17abc3
parent 37ea9a1f
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -283,6 +283,13 @@ public class WifiP2pManager {
    public static final String EXTRA_HANDOVER_MESSAGE =
    public static final String EXTRA_HANDOVER_MESSAGE =
            "android.net.wifi.p2p.EXTRA_HANDOVER_MESSAGE";
            "android.net.wifi.p2p.EXTRA_HANDOVER_MESSAGE";


    /**
     * The lookup key for a calling package returned by the WifiP2pService.
     * @hide
     */
    public static final String CALLING_PACKAGE =
            "android.net.wifi.p2p.CALLING_PACKAGE";

    IWifiP2pManager mService;
    IWifiP2pManager mService;


    private static final int BASE = Protocol.BASE_WIFI_P2P_MANAGER;
    private static final int BASE = Protocol.BASE_WIFI_P2P_MANAGER;
@@ -1271,7 +1278,10 @@ public class WifiP2pManager {
     */
     */
    public void requestPeers(Channel c, PeerListListener listener) {
    public void requestPeers(Channel c, PeerListListener listener) {
        checkChannel(c);
        checkChannel(c);
        c.mAsyncChannel.sendMessage(REQUEST_PEERS, 0, c.putListener(listener));
        Bundle callingPackage = new Bundle();
        callingPackage.putString(CALLING_PACKAGE, c.mContext.getOpPackageName());
        c.mAsyncChannel.sendMessage(REQUEST_PEERS, 0, c.putListener(listener),
                callingPackage);
    }
    }


    /**
    /**