am 63dc027b: Merge "Fix permission issue on channel" into jb-mr1-dev
* commit '63dc027be28762232335797a30449995c555ae10': Fix permission issue on channel
This commit is contained in:
@@ -959,10 +959,8 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
* an AsyncChannel communication with WifiService
|
* an AsyncChannel communication with WifiService
|
||||||
*/
|
*/
|
||||||
public Messenger getWifiServiceMessenger() {
|
public Messenger getWifiServiceMessenger() {
|
||||||
/* STOPSHIP: Fix this to have old sync API not need these new permissions
|
enforceAccessPermission();
|
||||||
* enforceAccessPermission();
|
enforceChangePermission();
|
||||||
* enforceChangePermission();
|
|
||||||
*/
|
|
||||||
return new Messenger(mAsyncServiceHandler);
|
return new Messenger(mAsyncServiceHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1358,7 +1358,11 @@ public class WifiManager {
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
mWifiServiceMessenger = getWifiServiceMessenger();
|
mWifiServiceMessenger = getWifiServiceMessenger();
|
||||||
if (mWifiServiceMessenger == null) throw new RuntimeException("Failed to initialize");
|
if (mWifiServiceMessenger == null) {
|
||||||
|
mAsyncChannel = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HandlerThread t = new HandlerThread("WifiManager");
|
HandlerThread t = new HandlerThread("WifiManager");
|
||||||
t.start();
|
t.start();
|
||||||
mHandler = new ServiceHandler(t.getLooper());
|
mHandler = new ServiceHandler(t.getLooper());
|
||||||
@@ -1372,7 +1376,7 @@ public class WifiManager {
|
|||||||
|
|
||||||
private void validateChannel() {
|
private void validateChannel() {
|
||||||
if (mAsyncChannel == null) throw new IllegalStateException(
|
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();
|
return mService.getWifiServiceMessenger();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return null;
|
return null;
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user