Merge "resolved conflicts for merge of f03ba4f1 to lmp-mr1-dev" into lmp-mr1-dev
This commit is contained in:
@@ -5094,6 +5094,12 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
|
public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether Theater Mode is on.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public static final String THEATER_MODE_ON = "theater_mode_on";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
|
* Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -453,6 +453,26 @@
|
|||||||
<!-- If this is true, key chords can be used to take a screenshot on the device. -->
|
<!-- If this is true, key chords can be used to take a screenshot on the device. -->
|
||||||
<bool name="config_enableScreenshotChord">true</bool>
|
<bool name="config_enableScreenshotChord">true</bool>
|
||||||
|
|
||||||
|
<!-- If this is true, allow wake from theater mode when plugged in or unplugged. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromUnplug">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from gesture. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromGesture">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from camera lens cover is switched. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromCameraLens">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from power key press. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromPowerKey">true</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from regular key press. Setting this value to
|
||||||
|
true implies config_allowTheaterModeWakeFromPowerKey is also true-->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromKey">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from motion. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromMotion">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from lid switch. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromLidSwitch">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode when docked. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromDock">false</bool>
|
||||||
|
<!-- If this is true, allow wake from theater mode from window layout flag. -->
|
||||||
|
<bool name="config_allowTheaterModeWakeFromWindowLayout">false</bool>
|
||||||
|
|
||||||
<!-- Auto-rotation behavior -->
|
<!-- Auto-rotation behavior -->
|
||||||
|
|
||||||
<!-- If true, enables auto-rotation features using the accelerometer.
|
<!-- If true, enables auto-rotation features using the accelerometer.
|
||||||
|
|||||||
@@ -1571,6 +1571,15 @@
|
|||||||
<java-symbol type="bool" name="config_enableNetworkLocationOverlay" />
|
<java-symbol type="bool" name="config_enableNetworkLocationOverlay" />
|
||||||
<java-symbol type="bool" name="config_sf_limitedAlpha" />
|
<java-symbol type="bool" name="config_sf_limitedAlpha" />
|
||||||
<java-symbol type="bool" name="config_unplugTurnsOnScreen" />
|
<java-symbol type="bool" name="config_unplugTurnsOnScreen" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromPowerKey" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromKey" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromMotion" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromLidSwitch" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromDock" />
|
||||||
|
<java-symbol type="bool" name="config_allowTheaterModeWakeFromWindowLayout" />
|
||||||
<java-symbol type="bool" name="config_wifi_background_scan_support" />
|
<java-symbol type="bool" name="config_wifi_background_scan_support" />
|
||||||
<java-symbol type="bool" name="config_wifi_dual_band_support" />
|
<java-symbol type="bool" name="config_wifi_dual_band_support" />
|
||||||
<java-symbol type="bool" name="config_wimaxEnabled" />
|
<java-symbol type="bool" name="config_wimaxEnabled" />
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<integer name="def_screen_off_timeout">60000</integer>
|
<integer name="def_screen_off_timeout">60000</integer>
|
||||||
<integer name="def_sleep_timeout">-1</integer>
|
<integer name="def_sleep_timeout">-1</integer>
|
||||||
<bool name="def_airplane_mode_on">false</bool>
|
<bool name="def_airplane_mode_on">false</bool>
|
||||||
|
<bool name="def_theater_mode_on">false</bool>
|
||||||
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
|
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
|
||||||
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>
|
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>
|
||||||
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>
|
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
|
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
|
||||||
// is properly propagated through your change. Not doing so will result in a loss of user
|
// is properly propagated through your change. Not doing so will result in a loss of user
|
||||||
// settings.
|
// settings.
|
||||||
private static final int DATABASE_VERSION = 114;
|
private static final int DATABASE_VERSION = 116;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private int mUserHandle;
|
private int mUserHandle;
|
||||||
@@ -1828,7 +1828,27 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
upgradeVersion = 113;
|
upgradeVersion = 113;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upgradeVersion < 114) {
|
// We skipped 114 to handle a merge conflict with the introduction of theater mode.
|
||||||
|
|
||||||
|
if (upgradeVersion < 115) {
|
||||||
|
if (mUserHandle == UserHandle.USER_OWNER) {
|
||||||
|
db.beginTransaction();
|
||||||
|
SQLiteStatement stmt = null;
|
||||||
|
try {
|
||||||
|
stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
|
||||||
|
+ " VALUES(?,?);");
|
||||||
|
loadBooleanSetting(stmt, Global.THEATER_MODE_ON,
|
||||||
|
R.bool.def_theater_mode_on);
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
if (stmt != null) stmt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upgradeVersion = 115;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (upgradeVersion < 116) {
|
||||||
if (mUserHandle == UserHandle.USER_OWNER) {
|
if (mUserHandle == UserHandle.USER_OWNER) {
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
SQLiteStatement stmt = null;
|
SQLiteStatement stmt = null;
|
||||||
@@ -1842,8 +1862,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
if (stmt != null) stmt.close();
|
if (stmt != null) stmt.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
upgradeVersion = 114;
|
upgradeVersion = 116;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** Remember to update DATABASE_VERSION above!
|
// *** Remember to update DATABASE_VERSION above!
|
||||||
|
|
||||||
if (upgradeVersion != currentVersion) {
|
if (upgradeVersion != currentVersion) {
|
||||||
@@ -2440,6 +2461,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||||||
loadBooleanSetting(stmt, Settings.Global.AIRPLANE_MODE_ON,
|
loadBooleanSetting(stmt, Settings.Global.AIRPLANE_MODE_ON,
|
||||||
R.bool.def_airplane_mode_on);
|
R.bool.def_airplane_mode_on);
|
||||||
|
|
||||||
|
loadBooleanSetting(stmt, Settings.Global.THEATER_MODE_ON,
|
||||||
|
R.bool.def_theater_mode_on);
|
||||||
|
|
||||||
loadStringSetting(stmt, Settings.Global.AIRPLANE_MODE_RADIOS,
|
loadStringSetting(stmt, Settings.Global.AIRPLANE_MODE_RADIOS,
|
||||||
R.string.def_airplane_mode_radios);
|
R.string.def_airplane_mode_radios);
|
||||||
|
|
||||||
|
|||||||
@@ -503,6 +503,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// What we do when the user double-taps on home
|
// What we do when the user double-taps on home
|
||||||
private int mDoubleTapOnHomeBehavior;
|
private int mDoubleTapOnHomeBehavior;
|
||||||
|
|
||||||
|
// Allowed theater mode wake actions
|
||||||
|
private boolean mAllowTheaterModeWakeFromKey;
|
||||||
|
private boolean mAllowTheaterModeWakeFromPowerKey;
|
||||||
|
private boolean mAllowTheaterModeWakeFromMotion;
|
||||||
|
private boolean mAllowTheaterModeWakeFromCameraLens;
|
||||||
|
private boolean mAllowTheaterModeWakeFromLidSwitch;
|
||||||
|
private boolean mAllowTheaterModeWakeFromWakeGesture;
|
||||||
|
|
||||||
// Screenshot trigger states
|
// Screenshot trigger states
|
||||||
// Time to volume and power must be pressed within this interval of each other.
|
// Time to volume and power must be pressed within this interval of each other.
|
||||||
private static final long SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS = 150;
|
private static final long SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS = 150;
|
||||||
@@ -656,7 +664,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (shouldEnableWakeGestureLp()) {
|
if (shouldEnableWakeGestureLp()) {
|
||||||
performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false);
|
performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false);
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
wakeUp(SystemClock.uptimeMillis(), mAllowTheaterModeWakeFromWakeGesture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1022,6 +1030,21 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
com.android.internal.R.bool.config_lidControlsSleep);
|
com.android.internal.R.bool.config_lidControlsSleep);
|
||||||
mTranslucentDecorEnabled = mContext.getResources().getBoolean(
|
mTranslucentDecorEnabled = mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_enableTranslucentDecor);
|
com.android.internal.R.bool.config_enableTranslucentDecor);
|
||||||
|
|
||||||
|
mAllowTheaterModeWakeFromKey = mContext.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromKey);
|
||||||
|
mAllowTheaterModeWakeFromPowerKey = mAllowTheaterModeWakeFromKey
|
||||||
|
|| mContext.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromPowerKey);
|
||||||
|
mAllowTheaterModeWakeFromMotion = mContext.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromMotion);
|
||||||
|
mAllowTheaterModeWakeFromCameraLens = mContext.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromCameraLens);
|
||||||
|
mAllowTheaterModeWakeFromLidSwitch = mContext.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromLidSwitch);
|
||||||
|
mAllowTheaterModeWakeFromWakeGesture = mContext.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromGesture);
|
||||||
|
|
||||||
readConfigurationDependentBehaviors();
|
readConfigurationDependentBehaviors();
|
||||||
|
|
||||||
mAccessibilityManager = (AccessibilityManager) context.getSystemService(
|
mAccessibilityManager = (AccessibilityManager) context.getSystemService(
|
||||||
@@ -4065,7 +4088,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
updateRotation(true);
|
updateRotation(true);
|
||||||
|
|
||||||
if (lidOpen) {
|
if (lidOpen) {
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
wakeUp(SystemClock.uptimeMillis(), mAllowTheaterModeWakeFromLidSwitch);
|
||||||
} else if (!mLidControlsSleep) {
|
} else if (!mLidControlsSleep) {
|
||||||
mPowerManager.userActivity(SystemClock.uptimeMillis(), false);
|
mPowerManager.userActivity(SystemClock.uptimeMillis(), false);
|
||||||
}
|
}
|
||||||
@@ -4087,7 +4110,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
} else {
|
} else {
|
||||||
intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
||||||
}
|
}
|
||||||
mPowerManager.wakeUp(whenNanos / 1000000);
|
wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromCameraLens);
|
||||||
mContext.startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
|
mContext.startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
|
||||||
}
|
}
|
||||||
mCameraLensCoverState = lensCoverState;
|
mCameraLensCoverState = lensCoverState;
|
||||||
@@ -4265,7 +4288,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// key processing.
|
// key processing.
|
||||||
if (mGlobalKeyManager.shouldHandleGlobalKey(keyCode, event)) {
|
if (mGlobalKeyManager.shouldHandleGlobalKey(keyCode, event)) {
|
||||||
if (isWakeKey) {
|
if (isWakeKey) {
|
||||||
mPowerManager.wakeUp(event.getEventTime());
|
wakeUp(event.getEventTime(), keyCode == KeyEvent.KEYCODE_POWER
|
||||||
|
? mAllowTheaterModeWakeFromPowerKey : mAllowTheaterModeWakeFromKey);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -4514,8 +4538,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isWakeKey) {
|
if (isWakeKey) {
|
||||||
mPowerManager.wakeUp(event.getEventTime());
|
wakeUp(event.getEventTime(), keyCode == KeyEvent.KEYCODE_POWER
|
||||||
|
? mAllowTheaterModeWakeFromPowerKey : mAllowTheaterModeWakeFromKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4558,7 +4584,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
@Override
|
@Override
|
||||||
public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
|
public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
|
||||||
if ((policyFlags & FLAG_WAKE) != 0) {
|
if ((policyFlags & FLAG_WAKE) != 0) {
|
||||||
mPowerManager.wakeUp(whenNanos / 1000000);
|
wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (shouldDispatchInputWhenNonInteractive()) {
|
if (shouldDispatchInputWhenNonInteractive()) {
|
||||||
@@ -4736,6 +4762,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void wakeUp(long wakeTime, boolean wakeInTheaterMode) {
|
||||||
|
if (!wakeInTheaterMode && isTheaterModeEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPowerManager.wakeUp(wakeTime);
|
||||||
|
}
|
||||||
|
|
||||||
// Called on the PowerManager's Notifier thread.
|
// Called on the PowerManager's Notifier thread.
|
||||||
@Override
|
@Override
|
||||||
public void wakingUp() {
|
public void wakingUp() {
|
||||||
@@ -5614,6 +5648,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
ringTone.play();
|
ringTone.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isTheaterModeEnabled() {
|
||||||
|
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Global.THEATER_MODE_ON, 0) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isGlobalAccessibilityGestureEnabled() {
|
private boolean isGlobalAccessibilityGestureEnabled() {
|
||||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 0) == 1;
|
Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 0) == 1;
|
||||||
|
|||||||
@@ -65,11 +65,15 @@ final class DockObserver extends SystemService {
|
|||||||
|
|
||||||
private boolean mUpdatesStopped;
|
private boolean mUpdatesStopped;
|
||||||
|
|
||||||
|
private final boolean mAllowTheaterModeWakeFromDock;
|
||||||
|
|
||||||
public DockObserver(Context context) {
|
public DockObserver(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
|
mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
|
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
|
||||||
|
mAllowTheaterModeWakeFromDock = context.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromDock);
|
||||||
|
|
||||||
init(); // set initial status
|
init(); // set initial status
|
||||||
|
|
||||||
@@ -126,8 +130,12 @@ final class DockObserver extends SystemService {
|
|||||||
if (newState != mReportedDockState) {
|
if (newState != mReportedDockState) {
|
||||||
mReportedDockState = newState;
|
mReportedDockState = newState;
|
||||||
if (mSystemReady) {
|
if (mSystemReady) {
|
||||||
// Wake up immediately when docked or undocked.
|
// Wake up immediately when docked or undocked except in theater mode.
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
if (mAllowTheaterModeWakeFromDock
|
||||||
|
|| Settings.Global.getInt(getContext().getContentResolver(),
|
||||||
|
Settings.Global.THEATER_MODE_ON, 0) == 0) {
|
||||||
|
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
||||||
|
}
|
||||||
updateLocked();
|
updateLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,6 +281,9 @@ public final class PowerManagerService extends SystemService
|
|||||||
// True if the device should wake up when plugged or unplugged.
|
// True if the device should wake up when plugged or unplugged.
|
||||||
private boolean mWakeUpWhenPluggedOrUnpluggedConfig;
|
private boolean mWakeUpWhenPluggedOrUnpluggedConfig;
|
||||||
|
|
||||||
|
// True if the device should wake up when plugged or unplugged in theater mode.
|
||||||
|
private boolean mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig;
|
||||||
|
|
||||||
// True if the device should suspend when the screen is off due to proximity.
|
// True if the device should suspend when the screen is off due to proximity.
|
||||||
private boolean mSuspendWhenScreenOffDueToProximityConfig;
|
private boolean mSuspendWhenScreenOffDueToProximityConfig;
|
||||||
|
|
||||||
@@ -420,6 +423,9 @@ public final class PowerManagerService extends SystemService
|
|||||||
// True if the battery level is currently considered low.
|
// True if the battery level is currently considered low.
|
||||||
private boolean mBatteryLevelLow;
|
private boolean mBatteryLevelLow;
|
||||||
|
|
||||||
|
// True if theater mode is enabled
|
||||||
|
private boolean mTheaterModeEnabled;
|
||||||
|
|
||||||
private final ArrayList<PowerManagerInternal.LowPowerModeListener> mLowPowerModeListeners
|
private final ArrayList<PowerManagerInternal.LowPowerModeListener> mLowPowerModeListeners
|
||||||
= new ArrayList<PowerManagerInternal.LowPowerModeListener>();
|
= new ArrayList<PowerManagerInternal.LowPowerModeListener>();
|
||||||
|
|
||||||
@@ -568,6 +574,9 @@ public final class PowerManagerService extends SystemService
|
|||||||
resolver.registerContentObserver(Settings.Global.getUriFor(
|
resolver.registerContentObserver(Settings.Global.getUriFor(
|
||||||
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
|
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
|
||||||
false, mSettingsObserver, UserHandle.USER_ALL);
|
false, mSettingsObserver, UserHandle.USER_ALL);
|
||||||
|
resolver.registerContentObserver(Settings.Global.getUriFor(
|
||||||
|
Settings.Global.THEATER_MODE_ON),
|
||||||
|
false, mSettingsObserver, UserHandle.USER_ALL);
|
||||||
// Go.
|
// Go.
|
||||||
readConfigurationLocked();
|
readConfigurationLocked();
|
||||||
updateSettingsLocked();
|
updateSettingsLocked();
|
||||||
@@ -585,6 +594,8 @@ public final class PowerManagerService extends SystemService
|
|||||||
com.android.internal.R.bool.config_powerDecoupleInteractiveModeFromDisplay);
|
com.android.internal.R.bool.config_powerDecoupleInteractiveModeFromDisplay);
|
||||||
mWakeUpWhenPluggedOrUnpluggedConfig = resources.getBoolean(
|
mWakeUpWhenPluggedOrUnpluggedConfig = resources.getBoolean(
|
||||||
com.android.internal.R.bool.config_unplugTurnsOnScreen);
|
com.android.internal.R.bool.config_unplugTurnsOnScreen);
|
||||||
|
mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig = resources.getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromUnplug);
|
||||||
mSuspendWhenScreenOffDueToProximityConfig = resources.getBoolean(
|
mSuspendWhenScreenOffDueToProximityConfig = resources.getBoolean(
|
||||||
com.android.internal.R.bool.config_suspendWhenScreenOffDueToProximity);
|
com.android.internal.R.bool.config_suspendWhenScreenOffDueToProximity);
|
||||||
mDreamsSupportedConfig = resources.getBoolean(
|
mDreamsSupportedConfig = resources.getBoolean(
|
||||||
@@ -636,6 +647,8 @@ public final class PowerManagerService extends SystemService
|
|||||||
UserHandle.USER_CURRENT);
|
UserHandle.USER_CURRENT);
|
||||||
mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver,
|
mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver,
|
||||||
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC);
|
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC);
|
||||||
|
mTheaterModeEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Global.THEATER_MODE_ON, 0) == 1;
|
||||||
|
|
||||||
final int oldScreenBrightnessSetting = mScreenBrightnessSetting;
|
final int oldScreenBrightnessSetting = mScreenBrightnessSetting;
|
||||||
mScreenBrightnessSetting = Settings.System.getIntForUser(resolver,
|
mScreenBrightnessSetting = Settings.System.getIntForUser(resolver,
|
||||||
@@ -1334,6 +1347,11 @@ public final class PowerManagerService extends SystemService
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't wake while theater mode is enabled.
|
||||||
|
if (mTheaterModeEnabled && !mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise wake up!
|
// Otherwise wake up!
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2360,6 +2378,10 @@ public final class PowerManagerService extends SystemService
|
|||||||
+ mDecoupleHalInteractiveModeFromDisplayConfig);
|
+ mDecoupleHalInteractiveModeFromDisplayConfig);
|
||||||
pw.println(" mWakeUpWhenPluggedOrUnpluggedConfig="
|
pw.println(" mWakeUpWhenPluggedOrUnpluggedConfig="
|
||||||
+ mWakeUpWhenPluggedOrUnpluggedConfig);
|
+ mWakeUpWhenPluggedOrUnpluggedConfig);
|
||||||
|
pw.println(" mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig="
|
||||||
|
+ mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig);
|
||||||
|
pw.println(" mTheaterModeEnabled="
|
||||||
|
+ mTheaterModeEnabled);
|
||||||
pw.println(" mSuspendWhenScreenOffDueToProximityConfig="
|
pw.println(" mSuspendWhenScreenOffDueToProximityConfig="
|
||||||
+ mSuspendWhenScreenOffDueToProximityConfig);
|
+ mSuspendWhenScreenOffDueToProximityConfig);
|
||||||
pw.println(" mDreamsSupportedConfig=" + mDreamsSupportedConfig);
|
pw.println(" mDreamsSupportedConfig=" + mDreamsSupportedConfig);
|
||||||
|
|||||||
@@ -619,6 +619,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
boolean mTurnOnScreen;
|
boolean mTurnOnScreen;
|
||||||
|
|
||||||
|
// Whether or not a layout can cause a wake up when theater mode is enabled.
|
||||||
|
boolean mAllowTheaterModeWakeFromLayout;
|
||||||
|
|
||||||
DragState mDragState = null;
|
DragState mDragState = null;
|
||||||
|
|
||||||
// For frozen screen animations.
|
// For frozen screen animations.
|
||||||
@@ -881,6 +884,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
mAnimator = new WindowAnimator(this);
|
mAnimator = new WindowAnimator(this);
|
||||||
|
|
||||||
|
mAllowTheaterModeWakeFromLayout = context.getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_allowTheaterModeWakeFromWindowLayout);
|
||||||
|
|
||||||
LocalServices.addService(WindowManagerInternal.class, new LocalService());
|
LocalServices.addService(WindowManagerInternal.class, new LocalService());
|
||||||
initPolicy();
|
initPolicy();
|
||||||
|
|
||||||
@@ -9953,8 +9959,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mTurnOnScreen) {
|
if (mTurnOnScreen) {
|
||||||
if (DEBUG_VISIBILITY) Slog.v(TAG, "Turning screen on after layout!");
|
if (mAllowTheaterModeWakeFromLayout
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
|| Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Global.THEATER_MODE_ON, 0) == 0) {
|
||||||
|
if (DEBUG_VISIBILITY) Slog.v(TAG, "Turning screen on after layout!");
|
||||||
|
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
||||||
|
}
|
||||||
mTurnOnScreen = false;
|
mTurnOnScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user