diff options
| author | 2011-01-16 13:10:11 -0800 | |
|---|---|---|
| committer | 2011-01-16 13:10:11 -0800 | |
| commit | c07d7c139bafab41024d6abc2e39ded880c23e6d (patch) | |
| tree | 0bed5ddc5dd4e3087735549e7b3136023156ffdf | |
| parent | 81de61bfddceba0eb77b3aacea317594b0f1de49 (diff) | |
Make the notification settings view less janky.
Bug: 3124822
Change-Id: I8fb9d169ae047d9b6738bb66e60a193a7a749efb
3 files changed, 40 insertions, 26 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java index da60f0d681c7..1b2fcadcbeb9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AirplaneModeController.java @@ -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; @@ -78,15 +79,19 @@ public class AirplaneModeController extends BroadcastReceiver // TODO: Fix this racy API by adding something better to TelephonyManager or // ConnectivityService. - private void unsafe(boolean enabled) { - Settings.System.putInt( - mContext.getContentResolver(), - Settings.System.AIRPLANE_MODE_ON, - enabled ? 1 : 0); - Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); - intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); - intent.putExtra("state", enabled); - mContext.sendBroadcast(intent); + private void unsafe(final boolean enabled) { + AsyncTask.execute(new Runnable() { + public void run() { + Settings.System.putInt( + mContext.getContentResolver(), + Settings.System.AIRPLANE_MODE_ON, + enabled ? 1 : 0); + Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); + intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); + intent.putExtra("state", enabled); + mContext.sendBroadcast(intent); + } + }); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java index 866e5fcad7b4..b0a6d7aeca78 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AutoRotateController.java @@ -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; @@ -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); } @@ -56,18 +56,22 @@ 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; - try { - IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService( - Context.WINDOW_SERVICE)); - ContentResolver cr = mContext.getContentResolver(); - if (locked) { - wm.freezeRotation(); - } else { - wm.thawRotation(); - } - } catch (RemoteException exc) { - } + AsyncTask.execute(new Runnable() { + public void run() { + try { + IWindowManager wm = IWindowManager.Stub.asInterface( + ServiceManager.getService(Context.WINDOW_SERVICE)); + ContentResolver cr = mContext.getContentResolver(); + if (locked) { + wm.freezeRotation(); + } else { + wm.thawRotation(); + } + } catch (RemoteException exc) { + } + } + }); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java index ca1d98fc8984..521467a5d76a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java @@ -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; @@ -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) { - Settings.System.putInt(mContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS, value); + AsyncTask.execute(new Runnable() { + public void run() { + Settings.System.putInt(mContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS, val); + } + }); } } } |