diff options
author | Yuhao Zheng <yuhaozheng@google.com> | 2013-09-09 17:00:04 -0700 |
---|---|---|
committer | Yuhao Zheng <yuhaozheng@google.com> | 2013-09-10 09:57:12 -0700 |
commit | 5cd1a0e8d77972ad6cee2625a7e21082932042c2 (patch) | |
tree | c94e16010e757ee06a97c97e0315b5a9357d427c /services | |
parent | 1d2daa7809b58c226410c0060d7837de0a29888a (diff) | |
download | frameworks_base-5cd1a0e8d77972ad6cee2625a7e21082932042c2.zip frameworks_base-5cd1a0e8d77972ad6cee2625a7e21082932042c2.tar.gz frameworks_base-5cd1a0e8d77972ad6cee2625a7e21082932042c2.tar.bz2 |
Add a hidden API to toggle airplane mode.
Added a hidden API under ConnectivityManager to toggle airplane mode.
This may be a temp solution for b/10653570.
bug:10653570
Change-Id: I0b2b42230073289eb8dc6891317d62b84e26c133
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 02a78de..4e3faca 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -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); |