Fix the Int value to reflect shared preferences value in TouchInteractionService.
This cl fixes following things
- When featureFlag is present, always read the value from FeatureFlag.get() instead of preferences.
- Add new function getIntFlagBackedUpByLauncherPrefs to read from sharedPreferences
- Make FlagTogglerPrefUi.java updateMenu() public
- When intFlag is modified in Developer Options, Apply button will show up. So launcher can restart and values get applied.
- Omnient Int flags will read from Featureflag.get() instead of shared preferences directly.
Bug: 320696242
Test: Manual
Flag: NA. Developer Options related
Change-Id: Id916b25d0397505d240ea8444d896c8ace826e57
diff --git a/src/com/android/launcher3/LauncherPrefs.kt b/src/com/android/launcher3/LauncherPrefs.kt
index 067d150..3b62ae1 100644
--- a/src/com/android/launcher3/LauncherPrefs.kt
+++ b/src/com/android/launcher3/LauncherPrefs.kt
@@ -20,17 +20,11 @@
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_HAPTIC_HINT_DELAY
-import com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_END_SCALE_PERCENT
-import com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_ITERATIONS
-import com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_SCALE_EXPONENT
-import com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_START_SCALE_PERCENT
-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
@@ -313,53 +307,45 @@
)
@JvmField
val LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE =
- nonRestorableItem(
- "pref_long_press_nav_handle_slop_percentage",
- LPNH_SLOP_PERCENTAGE.get(),
- EncryptionType.MOVE_TO_DEVICE_PROTECTED
- )
+ nonRestorableItem("LPNH_SLOP_PERCENTAGE", 100, EncryptionType.MOVE_TO_DEVICE_PROTECTED)
@JvmField
val LONG_PRESS_NAV_HANDLE_TIMEOUT_MS =
nonRestorableItem(
- "pref_long_press_nav_handle_timeout_ms",
- LPNH_TIMEOUT_MS.get(),
+ "LPNH_TIMEOUT_MS",
+ ViewConfiguration.getLongPressTimeout(),
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT =
nonRestorableItem(
- "pref_long_press_nav_handle_haptic_hint_start_scale_percent",
- LPNH_HAPTIC_HINT_START_SCALE_PERCENT.get(),
+ "LPNH_HAPTIC_HINT_START_SCALE_PERCENT",
+ 0,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT =
nonRestorableItem(
- "pref_long_press_nav_handle_haptic_hint_end_scale_percent",
- LPNH_HAPTIC_HINT_END_SCALE_PERCENT.get(),
+ "LPNH_HAPTIC_HINT_END_SCALE_PERCENT",
+ 100,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT =
nonRestorableItem(
- "pref_long_press_nav_handle_haptic_hint_scale_exponent",
- LPNH_HAPTIC_HINT_SCALE_EXPONENT.get(),
+ "LPNH_HAPTIC_HINT_SCALE_EXPONENT",
+ 1,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS =
nonRestorableItem(
- "pref_long_press_nav_handle_haptic_hint_iterations",
- LPNH_HAPTIC_HINT_ITERATIONS.get(),
+ "LPNH_HAPTIC_HINT_ITERATIONS",
+ 50,
EncryptionType.MOVE_TO_DEVICE_PROTECTED
)
@JvmField
val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_DELAY =
- nonRestorableItem(
- "pref_long_press_nav_handle_haptic_hint_delay",
- LPNH_HAPTIC_HINT_DELAY.get(),
- EncryptionType.MOVE_TO_DEVICE_PROTECTED
- )
+ nonRestorableItem("LPNH_HAPTIC_HINT_DELAY", 0, EncryptionType.MOVE_TO_DEVICE_PROTECTED)
@JvmField
val PRIVATE_SPACE_APPS =
nonRestorableItem("pref_private_space_apps", 0, EncryptionType.MOVE_TO_DEVICE_PROTECTED)