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

Commit 488f0a68 authored by Miranda Kephart's avatar Miranda Kephart Committed by Alison Cichowlas
Browse files

Add a flag to change the screenshot keychord delay

Allows overriding the configured keychord delay (the time it takes,
after both the power button and volume down have been pressed, for
a screenshot to be registered/taken). If not set, reads from the
config file (as before). Can be updated with

adb shell device_config put systemui screenshot_keychord_delay <n>

where <n> is the desired timeout, in ms.

Bug: 165267251
Test: manual -- tried setting multiple values, ensured that deleting
the override reverts to the configured value

Change-Id: I2f86abe0332f8072ab4f53baa55f1999aed3865a
Merged-In: I2f86abe0332f8072ab4f53baa55f1999aed3865a
(cherry picked from commit 6e44e9d5)
parent 4db6ccaa
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -409,6 +409,11 @@ public final class SystemUiDeviceConfigFlags {
     */
     */
    public static final String BACK_GESTURE_SLOP_MULTIPLIER = "back_gesture_slop_multiplier";
    public static final String BACK_GESTURE_SLOP_MULTIPLIER = "back_gesture_slop_multiplier";


    /**
     * (long) Screenshot keychord delay (how long the buttons must be pressed), in ms
     */
    public static final String SCREENSHOT_KEYCHORD_DELAY = "screenshot_keychord_delay";

    private SystemUiDeviceConfigFlags() {
    private SystemUiDeviceConfigFlags() {
    }
    }
}
}
+7 −3
Original line number Original line Diff line number Diff line
@@ -69,6 +69,7 @@ import static android.view.WindowManager.TAKE_SCREENSHOT_SELECTED_REGION;
import static android.view.WindowManagerGlobal.ADD_OKAY;
import static android.view.WindowManagerGlobal.ADD_OKAY;
import static android.view.WindowManagerGlobal.ADD_PERMISSION_DENIED;
import static android.view.WindowManagerGlobal.ADD_PERMISSION_DENIED;


import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.SCREENSHOT_KEYCHORD_DELAY;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_UNCOVERED;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_UNCOVERED;
@@ -148,6 +149,7 @@ import android.os.UEventObserver;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.VibrationEffect;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.os.Vibrator;
import android.provider.DeviceConfig;
import android.provider.MediaStore;
import android.provider.MediaStore;
import android.provider.Settings;
import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamManagerInternal;
@@ -1379,12 +1381,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }
    }


    private long getScreenshotChordLongPressDelay() {
    private long getScreenshotChordLongPressDelay() {
        long delayMs = DeviceConfig.getLong(
                DeviceConfig.NAMESPACE_SYSTEMUI, SCREENSHOT_KEYCHORD_DELAY,
                ViewConfiguration.get(mContext).getScreenshotChordKeyTimeout());
        if (mKeyguardDelegate.isShowing()) {
        if (mKeyguardDelegate.isShowing()) {
            // Double the time it takes to take a screenshot from the keyguard
            // Double the time it takes to take a screenshot from the keyguard
            return (long) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER *
            return (long) (KEYGUARD_SCREENSHOT_CHORD_DELAY_MULTIPLIER * delayMs);
                    ViewConfiguration.get(mContext).getScreenshotChordKeyTimeout());
        }
        }
        return ViewConfiguration.get(mContext).getScreenshotChordKeyTimeout();
        return delayMs;
    }
    }


    private long getRingerToggleChordDelay() {
    private long getRingerToggleChordDelay() {