diff options
author | Christopher Tate <ctate@google.com> | 2012-09-10 16:50:14 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2012-09-10 16:50:57 -0700 |
commit | c09cdce1b05075da808ae080b9905a14a3e1e627 (patch) | |
tree | 0ed7854c9d6c19e30d16fd4b4fdf652d301deb5e /core/tests/ConnectivityManagerTest | |
parent | 009ea5a04c38dd209b73d28cb867f05e63ec89cc (diff) | |
download | frameworks_base-c09cdce1b05075da808ae080b9905a14a3e1e627.zip frameworks_base-c09cdce1b05075da808ae080b9905a14a3e1e627.tar.gz frameworks_base-c09cdce1b05075da808ae080b9905a14a3e1e627.tar.bz2 |
Update airplane-mode manipulation for the new Settings namespace
Quick Settings and global actions (aka longpress-Power) toggles are
included in this CL. The Settings app manipulations are updated in
a different CL because that's a different git package.
Bug 7132230
Change-Id: I50838f5e8d7b25a750d2bcae90bf384b09816dbb
Diffstat (limited to 'core/tests/ConnectivityManagerTest')
2 files changed, 7 insertions, 6 deletions
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java index 216344d..561e33e 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java @@ -36,6 +36,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import android.view.KeyEvent; @@ -696,12 +697,12 @@ public class ConnectivityManagerTestActivity extends Activity { */ public void setAirplaneMode(Context context, boolean enableAM) { //set the airplane mode - Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, + Settings.Global.putInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, enableAM ? 1 : 0); // Post the intent Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", enableAM); - context.sendBroadcast(intent); + context.sendBroadcastAsUser(intent, UserHandle.ALL); } protected static String convertToQuotedString(String string) { diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java index bf188d3..7928822 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java @@ -59,8 +59,8 @@ public class ConnectivityManagerMobileTest extends wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "CMWakeLock"); wl.acquire(); // Each test case will start with cellular connection - if (Settings.System.getInt(getInstrumentation().getContext().getContentResolver(), - Settings.System.AIRPLANE_MODE_ON) == 1) { + if (Settings.Global.getInt(getInstrumentation().getContext().getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON) == 1) { log("airplane is not disabled, disable it."); cmActivity.setAirplaneMode(getInstrumentation().getContext(), false); } @@ -84,8 +84,8 @@ public class ConnectivityManagerMobileTest extends wl.release(); cmActivity.removeConfiguredNetworksAndDisableWifi(); // if airplane mode is set, disable it. - if (Settings.System.getInt(getInstrumentation().getContext().getContentResolver(), - Settings.System.AIRPLANE_MODE_ON) == 1) { + if (Settings.Global.getInt(getInstrumentation().getContext().getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON) == 1) { log("disable airplane mode if it is enabled"); cmActivity.setAirplaneMode(getInstrumentation().getContext(), false); } |