Loading quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java +23 −9 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; Loading Loading @@ -118,9 +122,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { if (FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { addAllAppsFromOverviewCatergory(); } if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { addCustomLpnhCatergory(); } addCustomLpnhCategory(); if (getActivity() != null) { getActivity().setTitle("Developer Options"); Loading Loading @@ -423,14 +425,26 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { 105, 500, 100, ALL_APPS_OVERVIEW_THRESHOLD)); } private void addCustomLpnhCatergory() { private void addCustomLpnhCategory() { PreferenceCategory category = newCategory("Long Press Nav Handle Config"); if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " + "which is generally already 50% higher than touch slop)", 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); category.addPreference(createSeekBarPreference("Trigger milliseconds", 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); } if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) { category.addPreference(createSeekBarPreference("Haptic hint start scale", 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT)); category.addPreference(createSeekBarPreference("Haptic hint end scale", 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT)); category.addPreference(createSeekBarPreference("Haptic hint scale exponent", 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); } } /** * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. Loading quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressHandler.java +15 −0 Original line number Diff line number Diff line Loading @@ -46,4 +46,19 @@ public class NavHandleLongPressHandler implements ResourceBasedOverride { public @Nullable Runnable getLongPressRunnable() { return null; } /** * Called when nav handle gesture starts. Returns true if long press nav handle is enabled and * supported. */ public boolean canStartTouch() { return false; } /** * Called when nav handle gesture is finished by the user lifting their finger or the system * cancelling the touch for some other reason. */ public void onTouchFinished() { } } quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +3 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,8 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { mCurrentDownEvent.recycle(); } mCurrentDownEvent = MotionEvent.obtain(ev); if (isInNavBarHorizontalArea(ev.getRawX())) { if (isInNavBarHorizontalArea(ev.getRawX()) && mNavHandleLongPressHandler.canStartTouch()) { MAIN_EXECUTOR.getHandler().postDelayed(mTriggerLongPress, mLongPressTimeout); } Loading Loading @@ -133,6 +134,7 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { private void cancelLongPress() { MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress); mNavHandleLongPressHandler.onTouchFinished(); } private boolean isInNavBarHorizontalArea(float x) { Loading src/com/android/launcher3/LauncherAppState.java +0 −6 Original line number Diff line number Diff line Loading @@ -64,12 +64,6 @@ import com.android.launcher3.widget.custom.CustomWidgetManager; public class LauncherAppState implements SafeCloseable { public static final String ACTION_FORCE_ROLOAD = "force-reload-launcher"; public static final String KEY_ICON_STATE = "pref_icon_shape_path"; public static final String KEY_ALL_APPS_OVERVIEW_THRESHOLD = "pref_all_apps_overview_threshold"; public static final String KEY_LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE = "pref_long_press_nav_handle_slop_multiplier"; public static final String KEY_LONG_PRESS_NAV_HANDLE_TIMEOUT_MS = "pref_long_press_nav_handle_timeout_ms"; // We do not need any synchronization for this variable as its only written on UI thread. public static final MainThreadInitializedObject<LauncherAppState> INSTANCE = Loading src/com/android/launcher3/LauncherPrefs.kt +40 −12 Original line number Diff line number Diff line Loading @@ -297,32 +297,60 @@ class LauncherPrefs(private val encryptedContext: Context) { @JvmField val ICON_STATE = nonRestorableItem( LauncherAppState.KEY_ICON_STATE, "pref_icon_shape_path", "", EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val ALL_APPS_OVERVIEW_THRESHOLD = nonRestorableItem( LauncherAppState.KEY_ALL_APPS_OVERVIEW_THRESHOLD, "pref_all_apps_overview_threshold", 180, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE = nonRestorableItem( LauncherAppState.KEY_LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE, "pref_long_press_nav_handle_slop_multiplier", 100, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val LONG_PRESS_NAV_HANDLE_TIMEOUT_MS = nonRestorableItem( LauncherAppState.KEY_LONG_PRESS_NAV_HANDLE_TIMEOUT_MS, "pref_long_press_nav_handle_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", 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", 50, 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", 2, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS = nonRestorableItem( "pref_long_press_nav_handle_haptic_hint_iterations", 40, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val THEMED_ICONS = backedUpItem(Themes.KEY_THEMED_ICONS, false, EncryptionType.MOVE_TO_DEVICE_PROTECTED) @JvmField val PROMISE_ICON_IDS = backedUpItem(InstallSessionHelper.PROMISE_ICON_IDS, "") Loading Loading
quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java +23 −9 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; Loading Loading @@ -118,9 +122,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { if (FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { addAllAppsFromOverviewCatergory(); } if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { addCustomLpnhCatergory(); } addCustomLpnhCategory(); if (getActivity() != null) { getActivity().setTitle("Developer Options"); Loading Loading @@ -423,14 +425,26 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { 105, 500, 100, ALL_APPS_OVERVIEW_THRESHOLD)); } private void addCustomLpnhCatergory() { private void addCustomLpnhCategory() { PreferenceCategory category = newCategory("Long Press Nav Handle Config"); if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " + "which is generally already 50% higher than touch slop)", 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); category.addPreference(createSeekBarPreference("Trigger milliseconds", 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); } if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) { category.addPreference(createSeekBarPreference("Haptic hint start scale", 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT)); category.addPreference(createSeekBarPreference("Haptic hint end scale", 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT)); category.addPreference(createSeekBarPreference("Haptic hint scale exponent", 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); } } /** * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. Loading
quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressHandler.java +15 −0 Original line number Diff line number Diff line Loading @@ -46,4 +46,19 @@ public class NavHandleLongPressHandler implements ResourceBasedOverride { public @Nullable Runnable getLongPressRunnable() { return null; } /** * Called when nav handle gesture starts. Returns true if long press nav handle is enabled and * supported. */ public boolean canStartTouch() { return false; } /** * Called when nav handle gesture is finished by the user lifting their finger or the system * cancelling the touch for some other reason. */ public void onTouchFinished() { } }
quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +3 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,8 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { mCurrentDownEvent.recycle(); } mCurrentDownEvent = MotionEvent.obtain(ev); if (isInNavBarHorizontalArea(ev.getRawX())) { if (isInNavBarHorizontalArea(ev.getRawX()) && mNavHandleLongPressHandler.canStartTouch()) { MAIN_EXECUTOR.getHandler().postDelayed(mTriggerLongPress, mLongPressTimeout); } Loading Loading @@ -133,6 +134,7 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { private void cancelLongPress() { MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress); mNavHandleLongPressHandler.onTouchFinished(); } private boolean isInNavBarHorizontalArea(float x) { Loading
src/com/android/launcher3/LauncherAppState.java +0 −6 Original line number Diff line number Diff line Loading @@ -64,12 +64,6 @@ import com.android.launcher3.widget.custom.CustomWidgetManager; public class LauncherAppState implements SafeCloseable { public static final String ACTION_FORCE_ROLOAD = "force-reload-launcher"; public static final String KEY_ICON_STATE = "pref_icon_shape_path"; public static final String KEY_ALL_APPS_OVERVIEW_THRESHOLD = "pref_all_apps_overview_threshold"; public static final String KEY_LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE = "pref_long_press_nav_handle_slop_multiplier"; public static final String KEY_LONG_PRESS_NAV_HANDLE_TIMEOUT_MS = "pref_long_press_nav_handle_timeout_ms"; // We do not need any synchronization for this variable as its only written on UI thread. public static final MainThreadInitializedObject<LauncherAppState> INSTANCE = Loading
src/com/android/launcher3/LauncherPrefs.kt +40 −12 Original line number Diff line number Diff line Loading @@ -297,32 +297,60 @@ class LauncherPrefs(private val encryptedContext: Context) { @JvmField val ICON_STATE = nonRestorableItem( LauncherAppState.KEY_ICON_STATE, "pref_icon_shape_path", "", EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val ALL_APPS_OVERVIEW_THRESHOLD = nonRestorableItem( LauncherAppState.KEY_ALL_APPS_OVERVIEW_THRESHOLD, "pref_all_apps_overview_threshold", 180, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE = nonRestorableItem( LauncherAppState.KEY_LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE, "pref_long_press_nav_handle_slop_multiplier", 100, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val LONG_PRESS_NAV_HANDLE_TIMEOUT_MS = nonRestorableItem( LauncherAppState.KEY_LONG_PRESS_NAV_HANDLE_TIMEOUT_MS, "pref_long_press_nav_handle_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", 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", 50, 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", 2, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS = nonRestorableItem( "pref_long_press_nav_handle_haptic_hint_iterations", 40, EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField val THEMED_ICONS = backedUpItem(Themes.KEY_THEMED_ICONS, false, EncryptionType.MOVE_TO_DEVICE_PROTECTED) @JvmField val PROMISE_ICON_IDS = backedUpItem(InstallSessionHelper.PROMISE_ICON_IDS, "") Loading