Loading core/java/android/net/ConnectivityManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -1476,4 +1476,20 @@ public class ConnectivityManager { } catch (RemoteException e) { } } /** * Set the value for enabling/disabling airplane mode * * @param enable whether to enable airplane mode or not * * <p>This method requires the call to hold the permission * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}. * @hide */ public void setAirplaneMode(boolean enable) { try { mService.setAirplaneMode(enable); } catch (RemoteException e) { } } } core/java/android/net/IConnectivityManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -156,4 +156,6 @@ interface IConnectivityManager LinkQualityInfo[] getAllLinkQualityInfo(); void setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, in String url); void setAirplaneMode(boolean enable); } services/java/com/android/server/ConnectivityService.java +15 −0 Original line number Diff line number Diff line Loading @@ -4681,6 +4681,21 @@ public class ConnectivityService extends IConnectivityManager.Stub { setProvNotificationVisible(visible, networkType, extraInfo, url); } @Override public void setAirplaneMode(boolean enable) { enforceConnectivityInternalPermission(); final ContentResolver cr = mContext.getContentResolver(); Settings.Global.putInt(cr, Settings.Global.AIRPLANE_MODE_ON, enable ? 1 : 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", enable); final long ident = Binder.clearCallingIdentity(); try { mContext.sendBroadcast(intent); } finally { Binder.restoreCallingIdentity(ident); } } private void onUserStart(int userId) { synchronized(mVpns) { Vpn userVpn = mVpns.get(userId); Loading Loading
core/java/android/net/ConnectivityManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -1476,4 +1476,20 @@ public class ConnectivityManager { } catch (RemoteException e) { } } /** * Set the value for enabling/disabling airplane mode * * @param enable whether to enable airplane mode or not * * <p>This method requires the call to hold the permission * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}. * @hide */ public void setAirplaneMode(boolean enable) { try { mService.setAirplaneMode(enable); } catch (RemoteException e) { } } }
core/java/android/net/IConnectivityManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -156,4 +156,6 @@ interface IConnectivityManager LinkQualityInfo[] getAllLinkQualityInfo(); void setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, in String url); void setAirplaneMode(boolean enable); }
services/java/com/android/server/ConnectivityService.java +15 −0 Original line number Diff line number Diff line Loading @@ -4681,6 +4681,21 @@ public class ConnectivityService extends IConnectivityManager.Stub { setProvNotificationVisible(visible, networkType, extraInfo, url); } @Override public void setAirplaneMode(boolean enable) { enforceConnectivityInternalPermission(); final ContentResolver cr = mContext.getContentResolver(); Settings.Global.putInt(cr, Settings.Global.AIRPLANE_MODE_ON, enable ? 1 : 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", enable); final long ident = Binder.clearCallingIdentity(); try { mContext.sendBroadcast(intent); } finally { Binder.restoreCallingIdentity(ident); } } private void onUserStart(int userId) { synchronized(mVpns) { Vpn userVpn = mVpns.get(userId); Loading