am 63dc027b: Merge "Fix permission issue on channel" into jb-mr1-dev

* commit '63dc027be28762232335797a30449995c555ae10':
  Fix permission issue on channel
This commit is contained in:
Irfan Sheriff
2012-08-27 12:02:03 -07:00
committed by Android Git Automerger
2 changed files with 10 additions and 6 deletions

View File

@@ -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);
} }

View File

@@ -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;
} }
} }