File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
services/java/com/android/server
wifi/java/android/net/wifi Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -959,10 +959,8 @@ public void clearBlacklist() {
959959 * an AsyncChannel communication with WifiService
960960 */
961961 public Messenger getWifiServiceMessenger () {
962- /* STOPSHIP: Fix this to have old sync API not need these new permissions
963- * enforceAccessPermission();
964- * enforceChangePermission();
965- */
962+ enforceAccessPermission ();
963+ enforceChangePermission ();
966964 return new Messenger (mAsyncServiceHandler );
967965 }
968966
Original file line number Diff line number Diff line change @@ -1358,7 +1358,11 @@ private Object removeListener(int key) {
13581358
13591359 private void init () {
13601360 mWifiServiceMessenger = getWifiServiceMessenger ();
1361- if (mWifiServiceMessenger == null ) throw new RuntimeException ("Failed to initialize" );
1361+ if (mWifiServiceMessenger == null ) {
1362+ mAsyncChannel = null ;
1363+ return ;
1364+ }
1365+
13621366 HandlerThread t = new HandlerThread ("WifiManager" );
13631367 t .start ();
13641368 mHandler = new ServiceHandler (t .getLooper ());
@@ -1372,7 +1376,7 @@ private void init() {
13721376
13731377 private void validateChannel () {
13741378 if (mAsyncChannel == null ) throw new IllegalStateException (
1375- "Bad WifiManager instance state, re-initialize " );
1379+ "No permission to access and change wifi or a bad initialization " );
13761380 }
13771381
13781382 /**
@@ -1517,6 +1521,8 @@ public Messenger getWifiServiceMessenger() {
15171521 return mService .getWifiServiceMessenger ();
15181522 } catch (RemoteException e ) {
15191523 return null ;
1524+ } catch (SecurityException e ) {
1525+ return null ;
15201526 }
15211527 }
15221528
You can’t perform that action at this time.
0 commit comments