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

Commit 63dc027b authored by Irfan Sheriff's avatar Irfan Sheriff Committed by Android (Google) Code Review
Browse files

Merge "Fix permission issue on channel" into jb-mr1-dev

parents 62e2709c 35bbe27d
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -959,10 +959,8 @@ public class WifiService extends IWifiManager.Stub {
     * an AsyncChannel communication with WifiService
     */
    public Messenger getWifiServiceMessenger() {
         /* STOPSHIP: Fix this to have old sync API not need these new permissions
          * enforceAccessPermission();
          * enforceChangePermission();
          */
        enforceAccessPermission();
        enforceChangePermission();
        return new Messenger(mAsyncServiceHandler);
    }

+8 −2
Original line number Diff line number Diff line
@@ -1358,7 +1358,11 @@ public class WifiManager {

    private void init() {
        mWifiServiceMessenger = getWifiServiceMessenger();
        if (mWifiServiceMessenger == null) throw new RuntimeException("Failed to initialize");
        if (mWifiServiceMessenger == null) {
            mAsyncChannel = null;
            return;
        }

        HandlerThread t = new HandlerThread("WifiManager");
        t.start();
        mHandler = new ServiceHandler(t.getLooper());
@@ -1372,7 +1376,7 @@ public class WifiManager {

    private void validateChannel() {
        if (mAsyncChannel == null) throw new IllegalStateException(
                "Bad WifiManager instance state, re-initialize");
                "No permission to access and change wifi or a bad initialization");
    }

    /**
@@ -1517,6 +1521,8 @@ public class WifiManager {
            return mService.getWifiServiceMessenger();
        } catch (RemoteException e) {
            return null;
        } catch (SecurityException e) {
            return null;
        }
    }