diff options
author | Irfan Sheriff <isheriff@google.com> | 2010-04-05 11:57:56 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-04-06 10:35:27 -0700 |
commit | b2e6c01f449f3fd4effee7029518684deb4e98f6 (patch) | |
tree | 0bede9e5bb642756e7bf6fe54a183c5357be6ef0 /services | |
parent | 7d2511b722808dfc9cadd3f0f49375fcb738df56 (diff) | |
download | frameworks_base-b2e6c01f449f3fd4effee7029518684deb4e98f6.zip frameworks_base-b2e6c01f449f3fd4effee7029518684deb4e98f6.tar.gz frameworks_base-b2e6c01f449f3fd4effee7029518684deb4e98f6.tar.bz2 |
Disable tethering when airplane mode is enabled
Tethering should be disabled when
airplane mode is enabled. Additionally,
we should restore Wifi (if it was on
before tethering was enabled) when
airplane mode is disabled.
Bug: 2567099
Change-Id: Iba2031f5ecb207954fd155c47134b39ed0167fa0
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/WifiService.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 3bfb4c6..c0a4491 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -190,6 +190,12 @@ public class WifiService extends IWifiManager.Stub { */ private int mLastEnableUid = Process.myUid(); + /* + * Last UID that asked to enable WIFI AP. + */ + private int mLastApEnableUid = Process.myUid(); + + /** * Number of allowed radio frequency channels in various regulatory domains. * This list is sufficient for 802.11b/g networks (2.4GHz range). @@ -240,6 +246,10 @@ public class WifiService extends IWifiManager.Stub { public void onReceive(Context context, Intent intent) { // clear our flag indicating the user has overwridden airplane mode mAirplaneModeOverwridden = false; + // on airplane disable, restore Wifi if the saved state indicates so + if (!isAirplaneModeOn() && testAndClearWifiSavedState()) { + persistWifiEnabled(true); + } updateWifiState(); } }, @@ -613,8 +623,7 @@ public class WifiService extends IWifiManager.Stub { sWakeLock.acquire(); Binder.restoreCallingIdentity(ident); - mLastEnableUid = Binder.getCallingUid(); - + mLastApEnableUid = Binder.getCallingUid(); sendAccessPointMessage(enabled, wifiConfig, Binder.getCallingUid()); } @@ -1802,6 +1811,14 @@ public class WifiService extends IWifiManager.Stub { if ((mWifiStateTracker.getWifiState() == WIFI_STATE_ENABLING) && !airplaneMode) { return; } + + /* Disable tethering when airplane mode is enabled */ + if (airplaneMode && + (mWifiApState == WIFI_AP_STATE_ENABLING || mWifiApState == WIFI_AP_STATE_ENABLED)) { + sWakeLock.acquire(); + sendAccessPointMessage(false, null, mLastApEnableUid); + } + if (wifiShouldBeEnabled) { if (wifiShouldBeStarted) { sWakeLock.acquire(); |