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

Commit cb571daa authored by Anushree Ganjam's avatar Anushree Ganjam
Browse files

Read LPNH touch slop percentage and timeout ms from DeviceConfig.

Make CUSTOM_LPNH_THRESHOLDS as a ReleaseFlag so this can be enabled from
server for experiments since touch slop percentage and timeout are
applied only when CUSTOM_LPNH_THRESHOLDS is enabled.

Add FeatureFlags for LPNH slop multiplier is "lpnh_slop_percentage" and LPNH timeout is "lpnh_timeout_ms"

Bug: 301680992
Flag: Legacy CUSTOM_LPNH_THRESHOLDS DISABLED
Test: Manual

Change-Id: Ifd066b8cb8521dceb7aa12d9e46f5b7cfce1ec7f
parent 0f7a74a2
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -20,11 +20,12 @@ import android.content.Context.MODE_PRIVATE
import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.util.Log
import android.view.ViewConfiguration
import androidx.annotation.VisibleForTesting
import com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN
import com.android.launcher3.LauncherFiles.DEVICE_PREFERENCES_KEY
import com.android.launcher3.LauncherFiles.SHARED_PREFERENCES_KEY
import com.android.launcher3.config.FeatureFlags.LPNH_SLOP_PERCENTAGE
import com.android.launcher3.config.FeatureFlags.LPNH_TIMEOUT_MS
import com.android.launcher3.model.DeviceGridState
import com.android.launcher3.pm.InstallSessionHelper
import com.android.launcher3.provider.RestoreDbTask
@@ -311,15 +312,15 @@ class LauncherPrefs(private val encryptedContext: Context) {
        @JvmField
        val LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE =
            nonRestorableItem(
                        "pref_long_press_nav_handle_slop_multiplier",
                        100,
                "pref_long_press_nav_handle_slop_percentage",
                        LPNH_SLOP_PERCENTAGE.get(),
                        EncryptionType.MOVE_TO_DEVICE_PROTECTED
            )
        @JvmField
        val LONG_PRESS_NAV_HANDLE_TIMEOUT_MS =
                nonRestorableItem(
                        "pref_long_press_nav_handle_timeout_ms",
                        ViewConfiguration.getLongPressTimeout(),
                        LPNH_TIMEOUT_MS.get(),
                        EncryptionType.MOVE_TO_DEVICE_PROTECTED
                )
        @JvmField
+12 −1
Original line number Diff line number Diff line
@@ -21,8 +21,11 @@ import static com.android.launcher3.config.FeatureFlags.FlagState.DISABLED;
import static com.android.launcher3.config.FeatureFlags.FlagState.ENABLED;
import static com.android.launcher3.config.FeatureFlags.FlagState.TEAMFOOD;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getDebugFlag;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getIntFlag;
import static com.android.launcher3.uioverrides.flags.FlagsFactory.getReleaseFlag;

import android.view.ViewConfiguration;

import androidx.annotation.VisibleForTesting;

import com.android.launcher3.BuildConfig;
@@ -113,9 +116,17 @@ public final class FeatureFlags {
                    "Allow entering All Apps from Overview (e.g. long swipe up from app)");

    public static final BooleanFlag CUSTOM_LPNH_THRESHOLDS =
            getDebugFlag(301680992, "CUSTOM_LPNH_THRESHOLDS", DISABLED,
            getReleaseFlag(301680992, "CUSTOM_LPNH_THRESHOLDS", DISABLED,
                    "Add dev options to customize the LPNH trigger slop and milliseconds");

    public static final IntFlag LPNH_SLOP_PERCENTAGE =
            getIntFlag(301680992, "LPNH_SLOP_PERCENTAGE", 100,
                    "Controls touch slop percentage for lpnh");

    public static final IntFlag LPNH_TIMEOUT_MS =
            getIntFlag(301680992, "LPNH_TIMEOUT_MS", ViewConfiguration.getLongPressTimeout(),
                    "Controls lpnh timeout in milliseconds");

    public static final BooleanFlag ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS = getReleaseFlag(
            270394468, "ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", ENABLED,
            "Enable option to show keyboard when going to all-apps");