am 9b120ead: Merge "Make the notification settings view less janky." into honeycomb
* commit '9b120ead0b5a3783031f35b93890226fc45f8f30': Make the notification settings view less janky.
This commit is contained in:
@@ -21,6 +21,7 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.provider.Settings;
|
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
|
// TODO: Fix this racy API by adding something better to TelephonyManager or
|
||||||
// ConnectivityService.
|
// ConnectivityService.
|
||||||
private void unsafe(boolean enabled) {
|
private void unsafe(final boolean enabled) {
|
||||||
Settings.System.putInt(
|
AsyncTask.execute(new Runnable() {
|
||||||
mContext.getContentResolver(),
|
public void run() {
|
||||||
Settings.System.AIRPLANE_MODE_ON,
|
Settings.System.putInt(
|
||||||
enabled ? 1 : 0);
|
mContext.getContentResolver(),
|
||||||
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
Settings.System.AIRPLANE_MODE_ON,
|
||||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
enabled ? 1 : 0);
|
||||||
intent.putExtra("state", enabled);
|
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||||
mContext.sendBroadcast(intent);
|
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
||||||
|
intent.putExtra("state", enabled);
|
||||||
|
mContext.sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy;
|
|||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
@@ -45,7 +46,6 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCheckedChanged(CompoundButton view, boolean checked) {
|
public void onCheckedChanged(CompoundButton view, boolean checked) {
|
||||||
Slog.d(TAG, "onCheckedChanged checked=" + checked + " mLockRotation=" + mLockRotation);
|
|
||||||
if (checked != mLockRotation) {
|
if (checked != mLockRotation) {
|
||||||
setLockRotation(checked);
|
setLockRotation(checked);
|
||||||
}
|
}
|
||||||
@@ -56,18 +56,22 @@ public class AutoRotateController implements CompoundButton.OnCheckedChangeListe
|
|||||||
return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0);
|
return 0 == Settings.System.getInt(cr, Settings.System.ACCELEROMETER_ROTATION, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLockRotation(boolean locked) {
|
private void setLockRotation(final boolean locked) {
|
||||||
mLockRotation = locked;
|
mLockRotation = locked;
|
||||||
try {
|
AsyncTask.execute(new Runnable() {
|
||||||
IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService(
|
public void run() {
|
||||||
Context.WINDOW_SERVICE));
|
try {
|
||||||
ContentResolver cr = mContext.getContentResolver();
|
IWindowManager wm = IWindowManager.Stub.asInterface(
|
||||||
if (locked) {
|
ServiceManager.getService(Context.WINDOW_SERVICE));
|
||||||
wm.freezeRotation();
|
ContentResolver cr = mContext.getContentResolver();
|
||||||
} else {
|
if (locked) {
|
||||||
wm.thawRotation();
|
wm.freezeRotation();
|
||||||
}
|
} else {
|
||||||
} catch (RemoteException exc) {
|
wm.thawRotation();
|
||||||
}
|
}
|
||||||
|
} catch (RemoteException exc) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy;
|
|||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.IPowerManager;
|
import android.os.IPowerManager;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -79,11 +80,15 @@ public class BrightnessController implements ToggleSlider.Listener {
|
|||||||
setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
|
setMode(automatic ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
|
||||||
: Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
|
: Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
|
||||||
if (!automatic) {
|
if (!automatic) {
|
||||||
value = value + value + MINIMUM_BACKLIGHT;
|
final int val = value + value + MINIMUM_BACKLIGHT;
|
||||||
setBrightness(value);
|
setBrightness(val);
|
||||||
if (!tracking) {
|
if (!tracking) {
|
||||||
Settings.System.putInt(mContext.getContentResolver(),
|
AsyncTask.execute(new Runnable() {
|
||||||
Settings.System.SCREEN_BRIGHTNESS, value);
|
public void run() {
|
||||||
|
Settings.System.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SCREEN_BRIGHTNESS, val);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user