Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efc718a4 authored by Shivangi Dubey's avatar Shivangi Dubey Committed by Automerger Merge Worker
Browse files

Merge "Add 'Stay unlocked on fold' toogle to settings" into udc-qpr-dev am:...

Merge "Add 'Stay unlocked on fold' toogle to settings" into udc-qpr-dev am: c44cfb9c am: 8f56db82

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23831665



Change-Id: Ife5a01d198c58802352013ec2976f19750ac1a37
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 97622ba2 8f56db82
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -4846,6 +4846,15 @@ public final class Settings {
        @Readable
        @Readable
        public static final String PEAK_REFRESH_RATE = "peak_refresh_rate";
        public static final String PEAK_REFRESH_RATE = "peak_refresh_rate";
        /**
         * Control whether to stay awake on fold
         *
         * If this isn't set, the system falls back to a device specific default.
         * @hide
         */
        @Readable
        public static final String STAY_AWAKE_ON_FOLD = "stay_awake_on_fold";
        /**
        /**
         * The amount of time in milliseconds before the device goes to sleep or begins
         * The amount of time in milliseconds before the device goes to sleep or begins
         * to dream after a period of inactivity.  This value is also known as the
         * to dream after a period of inactivity.  This value is also known as the
+1 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,7 @@ public class SystemSettings {
        Settings.System.TTY_MODE,
        Settings.System.TTY_MODE,
        Settings.System.MASTER_MONO,
        Settings.System.MASTER_MONO,
        Settings.System.MASTER_BALANCE,
        Settings.System.MASTER_BALANCE,
        Settings.System.STAY_AWAKE_ON_FOLD,
        Settings.System.SOUND_EFFECTS_ENABLED,
        Settings.System.SOUND_EFFECTS_ENABLED,
        Settings.System.HAPTIC_FEEDBACK_ENABLED,
        Settings.System.HAPTIC_FEEDBACK_ENABLED,
        Settings.System.POWER_SOUNDS_ENABLED,       // moved to global
        Settings.System.POWER_SOUNDS_ENABLED,       // moved to global
+1 −0
Original line number Original line Diff line number Diff line
@@ -218,6 +218,7 @@ public class SystemSettingsValidators {
        VALIDATORS.put(System.WIFI_STATIC_DNS1, LENIENT_IP_ADDRESS_VALIDATOR);
        VALIDATORS.put(System.WIFI_STATIC_DNS1, LENIENT_IP_ADDRESS_VALIDATOR);
        VALIDATORS.put(System.WIFI_STATIC_DNS2, LENIENT_IP_ADDRESS_VALIDATOR);
        VALIDATORS.put(System.WIFI_STATIC_DNS2, LENIENT_IP_ADDRESS_VALIDATOR);
        VALIDATORS.put(System.SHOW_BATTERY_PERCENT, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.SHOW_BATTERY_PERCENT, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.STAY_AWAKE_ON_FOLD, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.WEAR_ACCESSIBILITY_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.WEAR_ACCESSIBILITY_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.WEAR_ACCESSIBILITY_GESTURE_ENABLED_DURING_OOBE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.WEAR_ACCESSIBILITY_GESTURE_ENABLED_DURING_OOBE, BOOLEAN_VALIDATOR);
+3 −1
Original line number Original line Diff line number Diff line
@@ -155,6 +155,7 @@ import com.android.server.display.layout.Layout;
import com.android.server.display.mode.DisplayModeDirector;
import com.android.server.display.mode.DisplayModeDirector;
import com.android.server.display.utils.SensorUtils;
import com.android.server.display.utils.SensorUtils;
import com.android.server.input.InputManagerInternal;
import com.android.server.input.InputManagerInternal;
import com.android.server.utils.FoldSettingWrapper;
import com.android.server.wm.SurfaceAnimationThread;
import com.android.server.wm.SurfaceAnimationThread;
import com.android.server.wm.WindowManagerInternal;
import com.android.server.wm.WindowManagerInternal;


@@ -540,7 +541,8 @@ public final class DisplayManagerService extends SystemService {
        mUiHandler = UiThread.getHandler();
        mUiHandler = UiThread.getHandler();
        mDisplayDeviceRepo = new DisplayDeviceRepository(mSyncRoot, mPersistentDataStore);
        mDisplayDeviceRepo = new DisplayDeviceRepository(mSyncRoot, mPersistentDataStore);
        mLogicalDisplayMapper = new LogicalDisplayMapper(mContext, mDisplayDeviceRepo,
        mLogicalDisplayMapper = new LogicalDisplayMapper(mContext, mDisplayDeviceRepo,
                new LogicalDisplayListener(), mSyncRoot, mHandler);
                new LogicalDisplayListener(), mSyncRoot, mHandler,
                new FoldSettingWrapper(mContext.getContentResolver()));
        mDisplayModeDirector = new DisplayModeDirector(context, mHandler);
        mDisplayModeDirector = new DisplayModeDirector(context, mHandler);
        mBrightnessSynchronizer = new BrightnessSynchronizer(mContext);
        mBrightnessSynchronizer = new BrightnessSynchronizer(mContext);
        Resources resources = mContext.getResources();
        Resources resources = mContext.getResources();
+12 −7
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ import android.view.DisplayInfo;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.display.layout.DisplayIdProducer;
import com.android.server.display.layout.DisplayIdProducer;
import com.android.server.display.layout.Layout;
import com.android.server.display.layout.Layout;
import com.android.server.utils.FoldSettingWrapper;


import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Arrays;
@@ -142,6 +143,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
    private final Listener mListener;
    private final Listener mListener;
    private final DisplayManagerService.SyncRoot mSyncRoot;
    private final DisplayManagerService.SyncRoot mSyncRoot;
    private final LogicalDisplayMapperHandler mHandler;
    private final LogicalDisplayMapperHandler mHandler;
    private final FoldSettingWrapper mFoldSettingWrapper;
    private final PowerManager mPowerManager;
    private final PowerManager mPowerManager;


    /**
    /**
@@ -189,21 +191,23 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {


    LogicalDisplayMapper(@NonNull Context context, @NonNull DisplayDeviceRepository repo,
    LogicalDisplayMapper(@NonNull Context context, @NonNull DisplayDeviceRepository repo,
            @NonNull Listener listener, @NonNull DisplayManagerService.SyncRoot syncRoot,
            @NonNull Listener listener, @NonNull DisplayManagerService.SyncRoot syncRoot,
            @NonNull Handler handler) {
            @NonNull Handler handler, FoldSettingWrapper foldSettingWrapper) {
        this(context, repo, listener, syncRoot, handler,
        this(context, repo, listener, syncRoot, handler,
                new DeviceStateToLayoutMap((isDefault) -> isDefault ? DEFAULT_DISPLAY
                new DeviceStateToLayoutMap((isDefault) -> isDefault ? DEFAULT_DISPLAY
                        : sNextNonDefaultDisplayId++));
                        : sNextNonDefaultDisplayId++), foldSettingWrapper);
    }
    }


    LogicalDisplayMapper(@NonNull Context context, @NonNull DisplayDeviceRepository repo,
    LogicalDisplayMapper(@NonNull Context context, @NonNull DisplayDeviceRepository repo,
            @NonNull Listener listener, @NonNull DisplayManagerService.SyncRoot syncRoot,
            @NonNull Listener listener, @NonNull DisplayManagerService.SyncRoot syncRoot,
            @NonNull Handler handler, @NonNull DeviceStateToLayoutMap deviceStateToLayoutMap) {
            @NonNull Handler handler, @NonNull DeviceStateToLayoutMap deviceStateToLayoutMap,
            FoldSettingWrapper foldSettingWrapper) {
        mSyncRoot = syncRoot;
        mSyncRoot = syncRoot;
        mPowerManager = context.getSystemService(PowerManager.class);
        mPowerManager = context.getSystemService(PowerManager.class);
        mInteractive = mPowerManager.isInteractive();
        mInteractive = mPowerManager.isInteractive();
        mHandler = new LogicalDisplayMapperHandler(handler.getLooper());
        mHandler = new LogicalDisplayMapperHandler(handler.getLooper());
        mDisplayDeviceRepo = repo;
        mDisplayDeviceRepo = repo;
        mListener = listener;
        mListener = listener;
        mFoldSettingWrapper = foldSettingWrapper;
        mSingleDisplayDemoMode = SystemProperties.getBoolean("persist.demo.singledisplay", false);
        mSingleDisplayDemoMode = SystemProperties.getBoolean("persist.demo.singledisplay", false);
        mSupportsConcurrentInternalDisplays = context.getResources().getBoolean(
        mSupportsConcurrentInternalDisplays = context.getResources().getBoolean(
                com.android.internal.R.bool.config_supportsConcurrentInternalDisplays);
                com.android.internal.R.bool.config_supportsConcurrentInternalDisplays);
@@ -531,9 +535,10 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
     * Returns if the device should be put to sleep or not.
     * Returns if the device should be put to sleep or not.
     *
     *
     * Includes a check to verify that the device state that we are moving to, {@code pendingState},
     * Includes a check to verify that the device state that we are moving to, {@code pendingState},
     * is the same as the physical state of the device, {@code baseState}. Different values for
     * is the same as the physical state of the device, {@code baseState}. Also if the
     * these parameters indicate a device state override is active, and we shouldn't put the device
     * 'Stay Awake On Fold' is not enabled. Different values for these parameters indicate a device
     * to sleep to provide a better user experience.
     * state override is active, and we shouldn't put the device to sleep to provide a better user
     * experience.
     *
     *
     * @param pendingState device state we are moving to
     * @param pendingState device state we are moving to
     * @param currentState device state we are currently in
     * @param currentState device state we are currently in
@@ -551,7 +556,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
                && mDeviceStatesOnWhichToSleep.get(pendingState)
                && mDeviceStatesOnWhichToSleep.get(pendingState)
                && !mDeviceStatesOnWhichToSleep.get(currentState)
                && !mDeviceStatesOnWhichToSleep.get(currentState)
                && !isOverrideActive
                && !isOverrideActive
                && isInteractive && isBootCompleted;
                && isInteractive && isBootCompleted && !mFoldSettingWrapper.shouldStayAwakeOnFold();
    }
    }


    private boolean areAllTransitioningDisplaysOffLocked() {
    private boolean areAllTransitioningDisplaysOffLocked() {
Loading