Merge "Provide a way to keep dreaming when undocking." into tm-qpr-dev

This commit is contained in:
William Leshner
2022-08-26 21:07:36 +00:00
committed by Android (Google) Code Review
4 changed files with 19 additions and 5 deletions

View File

@@ -550,6 +550,9 @@
<!-- If this is true, long press on power button will be available from the non-interactive state -->
<bool name="config_supportLongPressPowerWhenNonInteractive">false</bool>
<!-- If this is true, then keep dreaming when undocking. -->
<bool name="config_keepDreamingWhenUndocking">false</bool>
<!-- Auto-rotation behavior -->
<!-- If true, enables auto-rotation features using the accelerometer.

View File

@@ -1978,6 +1978,7 @@
<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_keepDreamingWhenUndocking" />
<java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" />
<java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" />
<java-symbol type="bool" name="config_wimaxEnabled" />

View File

@@ -69,6 +69,7 @@ final class DockObserver extends SystemService {
private boolean mUpdatesStopped;
private final boolean mKeepDreamingWhenUndocking;
private final boolean mAllowTheaterModeWakeFromDock;
private final List<ExtconStateConfig> mExtconStateConfigs;
@@ -164,6 +165,8 @@ final class DockObserver extends SystemService {
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
mAllowTheaterModeWakeFromDock = context.getResources().getBoolean(
com.android.internal.R.bool.config_allowTheaterModeWakeFromDock);
mKeepDreamingWhenUndocking = context.getResources().getBoolean(
com.android.internal.R.bool.config_keepDreamingWhenUndocking);
mExtconStateConfigs = loadExtconStateConfigs(context);
@@ -216,10 +219,8 @@ final class DockObserver extends SystemService {
if (newState != mReportedDockState) {
mReportedDockState = newState;
if (mSystemReady) {
// Wake up immediately when docked or undocked except in theater mode.
if (mAllowTheaterModeWakeFromDock
|| Settings.Global.getInt(getContext().getContentResolver(),
Settings.Global.THEATER_MODE_ON, 0) == 0) {
// Wake up immediately when docked or undocked unless prohibited from doing so.
if (allowWakeFromDock()) {
mPowerManager.wakeUp(SystemClock.uptimeMillis(),
"android.server:DOCK");
}
@@ -228,6 +229,15 @@ final class DockObserver extends SystemService {
}
}
private boolean allowWakeFromDock() {
if (mKeepDreamingWhenUndocking) {
return false;
}
return (mAllowTheaterModeWakeFromDock
|| Settings.Global.getInt(getContext().getContentResolver(),
Settings.Global.THEATER_MODE_ON, 0) == 0);
}
private void updateLocked() {
mWakeLock.acquire();
mHandler.sendEmptyMessage(MSG_DOCK_STATE_CHANGED);

View File

@@ -1487,7 +1487,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
a.colorMode = ActivityInfo.COLOR_MODE_DEFAULT;
a.flags |= ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
a.resizeMode = RESIZE_MODE_UNRESIZEABLE;
a.configChanges = ActivityInfo.CONFIG_ORIENTATION;
a.configChanges = 0xffffffff;
final ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchActivityType(ACTIVITY_TYPE_DREAM);