From 85e745929f4f47843df04e7067ccb0a491c96aaf Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 6 Mar 2019 11:49:22 -0800 Subject: [PATCH 1/4] Remove the swipe up setting from system Bug: 127366543 Test: adb shell dumpsys setting Change-Id: I3a1a716a73d91048886b67444b574abdfc61323e --- core/java/android/provider/Settings.java | 14 -------- .../settings/SettingsProtoDumpUtil.java | 6 ---- .../providers/settings/SettingsProvider.java | 2 +- .../shared/system/SettingsCompat.java | 25 ------------- .../recents/OverviewProxyService.java | 35 ++++++------------- 5 files changed, 11 insertions(+), 71 deletions(-) delete mode 100644 packages/SystemUI/shared/src/com/android/systemui/shared/system/SettingsCompat.java diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 53c7edace9c20..702dc74f77480 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -8044,17 +8044,6 @@ public final class Settings { private static final Validator CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** - * Whether the swipe up gesture to switch apps should be enabled. - * - * @hide - */ - public static final String SWIPE_UP_TO_SWITCH_APPS_ENABLED = - "swipe_up_to_switch_apps_enabled"; - - private static final Validator SWIPE_UP_TO_SWITCH_APPS_ENABLED_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Whether or not the smart camera lift trigger that launches the camera when the user moves * the phone into a position for taking photos should be enabled. @@ -8739,7 +8728,6 @@ public final class Settings { DISPLAY_WHITE_BALANCE_ENABLED, SYNC_PARENT_SOUNDS, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, - SWIPE_UP_TO_SWITCH_APPS_ENABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, SYSTEM_NAVIGATION_KEYS_ENABLED, QS_TILES, @@ -8902,8 +8890,6 @@ public final class Settings { VALIDATORS.put(SYNC_PARENT_SOUNDS, SYNC_PARENT_SOUNDS_VALIDATOR); VALIDATORS.put(CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED_VALIDATOR); - VALIDATORS.put(SWIPE_UP_TO_SWITCH_APPS_ENABLED, - SWIPE_UP_TO_SWITCH_APPS_ENABLED_VALIDATOR); VALIDATORS.put(CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED_VALIDATOR); VALIDATORS.put(SYSTEM_NAVIGATION_KEYS_ENABLED, diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index de7202cc63f94..e374db310737f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -2410,12 +2410,6 @@ class SettingsProtoDumpUtil { Settings.Secure.WAKE_GESTURE_ENABLED, SecureSettingsProto.WAKE_GESTURE_ENABLED); - final long launcherToken = p.start(SecureSettingsProto.LAUNCHER); - dumpSetting(s, p, - Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, - SecureSettingsProto.Launcher.SWIPE_UP_TO_SWITCH_APPS_ENABLED); - p.end(launcherToken); - final long zenToken = p.start(SecureSettingsProto.ZEN); dumpSetting(s, p, Settings.Secure.ZEN_DURATION, diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 7337cdb81ebf4..7d147194114fe 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -4330,7 +4330,7 @@ public class SettingsProvider extends ContentProvider { // Migrate the swipe up setting only if it is set final SettingsState secureSettings = getSecureSettingsLocked(userId); final Setting swipeUpSetting = secureSettings.getSettingLocked( - Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED); + "swipe_up_to_switch_apps_enabled"); if (swipeUpSetting != null && !swipeUpSetting.isNull()) { navBarMode = swipeUpSetting.getValue().equals("1") ? NAV_BAR_MODE_2BUTTON diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SettingsCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SettingsCompat.java deleted file mode 100644 index c16cf92a5e8f8..0000000000000 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SettingsCompat.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.systemui.shared.system; - -import android.provider.Settings; - -public class SettingsCompat { - - public static final String SWIPE_UP_SETTING_NAME - = Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED; -} diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 92195942ca06a..52eced987a6e7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -20,6 +20,7 @@ import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON; @@ -36,6 +37,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; +import android.content.res.Resources; import android.graphics.Rect; import android.graphics.Region; import android.os.Binder; @@ -46,7 +48,6 @@ import android.os.Looper; import android.os.PatternMatcher; import android.os.RemoteException; import android.os.UserHandle; -import android.provider.Settings; import android.util.Log; import android.view.InputChannel; import android.view.MotionEvent; @@ -589,11 +590,11 @@ public class OverviewProxyService implements CallbackControllercom.android.managedprovisioning - - false - false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 012f736d5ee39..eb98bb86d74dc 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3514,7 +3514,6 @@ - From e108b6777b87cabd275aa8999ecbd67dd24b099b Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 6 Mar 2019 16:11:28 -0800 Subject: [PATCH 3/4] Check the overlay state for updating sysui Bug: 127366543 Test: Change the system navigation gesture setting, ensure SystemUI updates Change-Id: I448ea554b0bea2e3742291fc9ce12ab87c9fdbd5 --- .../shared/system/NavigationBarCompat.java | 6 +- .../shared/system/QuickStepContract.java | 63 +++++++++++++++++++ .../recents/OverviewProxyService.java | 13 ++-- .../statusbar/phone/NavBarTintController.java | 8 +-- .../statusbar/phone/NavigationBackAction.java | 4 +- .../phone/NavigationBarFragment.java | 2 +- .../phone/NavigationBarInflaterView.java | 11 ++-- .../statusbar/phone/NavigationBarView.java | 51 +++++++++++---- .../phone/NavigationPrototypeController.java | 3 +- .../statusbar/phone/QuickStepController.java | 29 +++++++-- 10 files changed, 147 insertions(+), 43 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java index b363b4a242e1d..8d6f830c6d8ed 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java @@ -21,12 +21,8 @@ import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -/** - * TODO: Remove this class - */ public class NavigationBarCompat extends QuickStepContract { - @Retention(RetentionPolicy.SOURCE) @IntDef({HIT_TARGET_NONE, HIT_TARGET_BACK, HIT_TARGET_HOME, HIT_TARGET_OVERVIEW}) public @interface HitTarget{} @@ -59,4 +55,6 @@ public class NavigationBarCompat extends QuickStepContract { * Interaction type: show/hide the overview button while this service is connected to launcher */ public static final int FLAG_SHOW_OVERVIEW_BUTTON = 0x4; + + } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java index 6d7abd0898619..46f4c8689196e 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java @@ -16,7 +16,13 @@ package com.android.systemui.shared.system; +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON; +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; + +import android.content.Context; import android.content.res.Resources; +import android.view.WindowManagerPolicyConstants; /** * Various shared constants between Launcher and SysUI as part of quickstep @@ -28,6 +34,13 @@ public class QuickStepContract { public static final String KEY_EXTRA_WINDOW_CORNER_RADIUS = "extra_window_corner_radius"; public static final String KEY_EXTRA_SUPPORTS_WINDOW_CORNERS = "extra_supports_window_corners"; + public static final String NAV_BAR_MODE_2BUTTON_OVERLAY = + WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY; + public static final String NAV_BAR_MODE_3BUTTON_OVERLAY = + WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY; + public static final String NAV_BAR_MODE_GESTURAL_OVERLAY = + WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY; + /** * Touch slopes and thresholds for quick step operations. Drag slop is the point where the * home button press/long press over are ignored and will start to drag when exceeded and the @@ -49,4 +62,54 @@ public class QuickStepContract { private static int convertDpToPixel(float dp) { return (int) (dp * Resources.getSystem().getDisplayMetrics().density); } + + /** + * @return whether this nav bar mode is edge to edge + */ + public static boolean isGesturalMode(int mode) { + return mode == NAV_BAR_MODE_GESTURAL; + } + + /** + * @return whether the current nav bar mode is gestural + */ + public static boolean isGesturalMode(Context context) { + return isGesturalMode(getCurrentInteractionMode(context)); + } + + /** + * @return whether this nav bar mode is swipe up + */ + public static boolean isSwipeUpMode(int mode) { + return mode == NAV_BAR_MODE_2BUTTON; + } + + /** + * @return whether the current nav bar mode is swipe up + */ + public static boolean isSwipeUpMode(Context context) { + return isSwipeUpMode(getCurrentInteractionMode(context)); + } + + /** + * @return whether this nav bar mode is 3 button + */ + public static boolean isLegacyMode(int mode) { + return mode == NAV_BAR_MODE_3BUTTON; + } + + /** + * @return whether this nav bar mode is 3 button + */ + public static boolean isLegacyMode(Context context) { + return isLegacyMode(getCurrentInteractionMode(context)); + } + + /** + * @return the current nav bar interaction mode + */ + public static int getCurrentInteractionMode(Context context) { + return context.getResources().getInteger( + com.android.internal.R.integer.config_navBarInteractionMode); + } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 52eced987a6e7..494e6cde5a1c3 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -20,7 +20,6 @@ import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; -import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP; import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON; @@ -37,7 +36,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; -import android.content.res.Resources; import android.graphics.Rect; import android.graphics.Region; import android.os.Binder; @@ -61,6 +59,7 @@ import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.InputChannelCompat.InputEventDispatcher; +import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.stackdivider.Divider; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.CallbackController; @@ -590,9 +589,7 @@ public class OverviewProxyService implements CallbackController Date: Wed, 20 Mar 2019 12:01:44 -0700 Subject: [PATCH 4/4] Overlaying the nav bar frame dimens - Also remove the experimental overlay packages Bug: 127366543 Test: Switch to gestural nav, ensure the nav bar shrinks Change-Id: Id13b95b2b0fe0db26bfa026602b7fe27a27ac15f --- packages/overlays/Android.mk | 8 ------ .../res/values/dimens.xml | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml diff --git a/packages/overlays/Android.mk b/packages/overlays/Android.mk index b5223445d127a..c57d4e9f1395c 100644 --- a/packages/overlays/Android.mk +++ b/packages/overlays/Android.mk @@ -48,14 +48,6 @@ include $(BUILD_PHONY_PACKAGE) include $(CLEAR_VARS) LOCAL_MODULE := frameworks-base-overlays-debug -LOCAL_REQUIRED_MODULES := \ - ExperimentNavigationBarFloatingOverlay \ - ExperimentNavigationBarVisualInsetOverlay \ - ExperimentNavigationBarDefaultOverlay \ - ExperimentNavigationBarSlimOverlay32 \ - ExperimentNavigationBarSlimOverlay40 \ - ExperimentNavigationBarLargeOverlay56 \ - ExperimentNavigationBarLargeOverlay64 include $(BUILD_PHONY_PACKAGE) include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml new file mode 100644 index 0000000000000..721d11be8cb56 --- /dev/null +++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/dimens.xml @@ -0,0 +1,28 @@ + + + + + 16dp + + 16dp + + 48dp + + 48dp + \ No newline at end of file