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 | |
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')
3 files changed, 12 insertions, 10 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); } diff --git a/core/tests/coretests/src/android/app/DownloadManagerBaseTest.java b/core/tests/coretests/src/android/app/DownloadManagerBaseTest.java index b2075ae..af2a944 100644 --- a/core/tests/coretests/src/android/app/DownloadManagerBaseTest.java +++ b/core/tests/coretests/src/android/app/DownloadManagerBaseTest.java @@ -29,6 +29,7 @@ import android.net.Uri; import android.net.wifi.WifiManager; import android.os.Environment; import android.os.ParcelFileDescriptor; +import android.os.UserHandle; import android.os.ParcelFileDescriptor.AutoCloseInputStream; import android.os.SystemClock; import android.provider.Settings; @@ -553,7 +554,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase { int state = enable ? 1 : 0; // Change the system setting - Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, + Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, state); String timeoutMessage = "Timed out waiting for airplane mode to be " + @@ -561,8 +562,8 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase { // wait for airplane mode to change state int currentWaitTime = 0; - while (Settings.System.getInt(mContext.getContentResolver(), - Settings.System.AIRPLANE_MODE_ON, -1) != state) { + while (Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON, -1) != state) { timeoutWait(currentWaitTime, DEFAULT_WAIT_POLL_TIME, DEFAULT_MAX_WAIT_TIME, timeoutMessage); } @@ -570,7 +571,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase { // Post the intent Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", true); - mContext.sendBroadcast(intent); + mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } /** |