Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java +14 −9 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncTask; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading Loading @@ -78,7 +79,9 @@ public class AirplaneModeController extends BroadcastReceiver // TODO: Fix this racy API by adding something better to TelephonyManager or // ConnectivityService. private void unsafe(boolean enabled) { private void unsafe(final boolean enabled) { AsyncTask.execute(new Runnable() { public void run() { Settings.System.putInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, Loading @@ -88,5 +91,7 @@ public class AirplaneModeController extends BroadcastReceiver intent.putExtra("state", enabled); mContext.sendBroadcast(intent); } }); } } packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java +17 −13 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy; import android.content.ContentResolver; import android.content.Context; import android.os.AsyncTask; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading Loading @@ -45,7 +46,6 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe } public void onCheckedChanged(CompoundButton view, boolean checked) { Slog.d(TAG, "onCheckedChanged checked=" + checked + " mLockRotation=" + mLockRotation); if (checked != mLockRotation) { setLockRotation(checked); } Loading @@ -56,11 +56,13 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); } private void setLockRotation(boolean locked) { private void setLockRotation(final boolean locked) { mLockRotation = locked; AsyncTask.execute(new Runnable() { public void run() { try { IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService( Context.WINDOW_SERVICE)); IWindowManager wm = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); ContentResolver cr = mContext.getContentResolver(); if (locked) { wm.freezeRotation(); Loading @@ -70,4 +72,6 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe } catch (RemoteException exc) { } } }); } } packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java +9 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy; import android.content.ContentResolver; import android.content.Context; import android.os.AsyncTask; import android.os.IPowerManager; import android.os.RemoteException; import android.os.ServiceManager; Loading Loading @@ -79,11 +80,15 @@ public class BrightnessController implements ToggleSlider.Listener { setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); if (!automatic) { value = value + value + MINIMUM_BACKLIGHT; setBrightness(value); final int val = value + value + MINIMUM_BACKLIGHT; setBrightness(val); if (!tracking) { AsyncTask.execute(new Runnable() { public void run() { Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, value); Settings.System.SCREEN_BRIGHTNESS, val); } }); } } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java +14 −9 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncTask; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading Loading @@ -78,7 +79,9 @@ public class AirplaneModeController extends BroadcastReceiver // TODO: Fix this racy API by adding something better to TelephonyManager or // ConnectivityService. private void unsafe(boolean enabled) { private void unsafe(final boolean enabled) { AsyncTask.execute(new Runnable() { public void run() { Settings.System.putInt( mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, Loading @@ -88,5 +91,7 @@ public class AirplaneModeController extends BroadcastReceiver intent.putExtra("state", enabled); mContext.sendBroadcast(intent); } }); } }
packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java +17 −13 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy; import android.content.ContentResolver; import android.content.Context; import android.os.AsyncTask; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; Loading Loading @@ -45,7 +46,6 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe } public void onCheckedChanged(CompoundButton view, boolean checked) { Slog.d(TAG, "onCheckedChanged checked=" + checked + " mLockRotation=" + mLockRotation); if (checked != mLockRotation) { setLockRotation(checked); } Loading @@ -56,11 +56,13 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0); } private void setLockRotation(boolean locked) { private void setLockRotation(final boolean locked) { mLockRotation = locked; AsyncTask.execute(new Runnable() { public void run() { try { IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService( Context.WINDOW_SERVICE)); IWindowManager wm = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); ContentResolver cr = mContext.getContentResolver(); if (locked) { wm.freezeRotation(); Loading @@ -70,4 +72,6 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe } catch (RemoteException exc) { } } }); } }
packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java +9 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy; import android.content.ContentResolver; import android.content.Context; import android.os.AsyncTask; import android.os.IPowerManager; import android.os.RemoteException; import android.os.ServiceManager; Loading Loading @@ -79,11 +80,15 @@ public class BrightnessController implements ToggleSlider.Listener { setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC : Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); if (!automatic) { value = value + value + MINIMUM_BACKLIGHT; setBrightness(value); final int val = value + value + MINIMUM_BACKLIGHT; setBrightness(val); if (!tracking) { AsyncTask.execute(new Runnable() { public void run() { Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, value); Settings.System.SCREEN_BRIGHTNESS, val); } }); } } } Loading