Loading core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -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); } Loading core/tests/coretests/src/android/app/DownloadManagerBaseTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 " + Loading @@ -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); } Loading @@ -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); } /** Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +3 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.hardware.display.DisplayManager; import android.hardware.display.WifiDisplay; import android.hardware.display.WifiDisplayStatus; import android.net.Uri; import android.os.UserHandle; import android.provider.ContactsContract; import android.provider.Settings; import android.view.LayoutInflater; Loading Loading @@ -147,7 +148,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, // TODO: Sets the view to be "awaiting" if not already awaiting // Change the system setting Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, enabled ? 1 : 0); // TODO: Update the UI to reflect system setting Loading @@ -156,7 +157,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, // Post the intent Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", enabled); mContext.sendBroadcast(intent); mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } // NetworkSignalChanged callback @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java +3 −3 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public class AirplaneModeController extends BroadcastReceiver private boolean getAirplaneMode() { ContentResolver cr = mContext.getContentResolver(); return 0 != Settings.System.getInt(cr, Settings.System.AIRPLANE_MODE_ON, 0); return 0 != Settings.Global.getInt(cr, Settings.Global.AIRPLANE_MODE_ON, 0); } // TODO: Fix this racy API by adding something better to TelephonyManager or Loading @@ -82,9 +82,9 @@ public class AirplaneModeController extends BroadcastReceiver private void unsafe(final boolean enabled) { AsyncTask.execute(new Runnable() { public void run() { Settings.System.putInt( Settings.Global.putInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, Settings.Global.AIRPLANE_MODE_ON, enabled ? 1 : 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); Loading Loading
core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading
core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -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); } Loading
core/tests/coretests/src/android/app/DownloadManagerBaseTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 " + Loading @@ -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); } Loading @@ -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); } /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +3 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.hardware.display.DisplayManager; import android.hardware.display.WifiDisplay; import android.hardware.display.WifiDisplayStatus; import android.net.Uri; import android.os.UserHandle; import android.provider.ContactsContract; import android.provider.Settings; import android.view.LayoutInflater; Loading Loading @@ -147,7 +148,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, // TODO: Sets the view to be "awaiting" if not already awaiting // Change the system setting Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, enabled ? 1 : 0); // TODO: Update the UI to reflect system setting Loading @@ -156,7 +157,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, // Post the intent Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", enabled); mContext.sendBroadcast(intent); mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } // NetworkSignalChanged callback @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java +3 −3 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ public class AirplaneModeController extends BroadcastReceiver private boolean getAirplaneMode() { ContentResolver cr = mContext.getContentResolver(); return 0 != Settings.System.getInt(cr, Settings.System.AIRPLANE_MODE_ON, 0); return 0 != Settings.Global.getInt(cr, Settings.Global.AIRPLANE_MODE_ON, 0); } // TODO: Fix this racy API by adding something better to TelephonyManager or Loading @@ -82,9 +82,9 @@ public class AirplaneModeController extends BroadcastReceiver private void unsafe(final boolean enabled) { AsyncTask.execute(new Runnable() { public void run() { Settings.System.putInt( Settings.Global.putInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, Settings.Global.AIRPLANE_MODE_ON, enabled ? 1 : 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); Loading