From 5fdf2d08fcc8268a11333b49d5f3bb8c945633c0 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Fri, 24 Sep 2021 10:48:01 -0700 Subject: [PATCH 1/4] Add a scrim to taskbar for bubbles expanded state When bubbles are expanded a scrim is shown on top of everything. Taskbar is layered above bubbles but we still need the scrim to show on top of it. This CL adds the ability to show a scrim on taskbar. The scrim is a view in the taskbar drag layer and is placed between the taskbar and the nav buttons so that it can block touches / scrim the taskbar but still allow the nav buttons to be visible and touchable. Add interpolators for alpha matching what bubbles is using. Test: manual 1 - expand bubbles while taskbar is visible => observe scrim - open manage menu => observe darker scrim 2 - check that taps on scrim collapse manage menu or stack 3 - check there isn't a scrim while taskbar is stashed and bubbles / manage menu are open 4 - check that three button nav works while bubbles are expanded Bug: 197139718 Change-Id: I94c4ecd07f81b2bad55c38525d60f493d3c1f9d8 --- quickstep/res/layout/taskbar.xml | 5 + .../taskbar/TaskbarActivityContext.java | 3 + .../launcher3/taskbar/TaskbarControllers.java | 4 + .../launcher3/taskbar/TaskbarScrimView.java | 129 ++++++++++++++++++ .../taskbar/TaskbarScrimViewController.java | 94 +++++++++++++ .../taskbar/TaskbarStashController.java | 8 ++ 6 files changed, 243 insertions(+) create mode 100644 quickstep/src/com/android/launcher3/taskbar/TaskbarScrimView.java create mode 100644 quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java diff --git a/quickstep/res/layout/taskbar.xml b/quickstep/res/layout/taskbar.xml index 83ad9f33e5..3fdbfb2eac 100644 --- a/quickstep/res/layout/taskbar.xml +++ b/quickstep/res/layout/taskbar.xml @@ -30,6 +30,11 @@ android:layout_gravity="bottom" android:clipChildren="false" /> + + 0f; + mTaskbarScrimPaint.setAlpha((int) (alpha * 255)); + invalidate(); + } + + /** + * Sets the radius of the left and right corners above the taskbar. + * @param leftCornerRadius the radius of the left corner. + * @param rightCornerRadius the radius of the right corner. + */ + protected void setCornerSizes(float leftCornerRadius, float rightCornerRadius) { + mLeftCornerRadius = leftCornerRadius; + mRightCornerRadius = rightCornerRadius; + + Path square = new Path(); + square.addRect(0, 0, mLeftCornerRadius, mLeftCornerRadius, Path.Direction.CW); + Path circle = new Path(); + circle.addCircle(mLeftCornerRadius, 0, mLeftCornerRadius, Path.Direction.CW); + mInvertedLeftCornerPath.op(square, circle, Path.Op.DIFFERENCE); + square.reset(); + square.addRect(0, 0, mRightCornerRadius, mRightCornerRadius, Path.Direction.CW); + circle.reset(); + circle.addCircle(0, 0, mRightCornerRadius, Path.Direction.CW); + mInvertedRightCornerPath.op(square, circle, Path.Op.DIFFERENCE); + + if (mShowScrim) { + invalidate(); + } + } +} diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java new file mode 100644 index 0000000000..e7e55efe63 --- /dev/null +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2021 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.launcher3.taskbar; + +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED; + +import android.animation.ObjectAnimator; +import android.view.animation.Interpolator; +import android.view.animation.PathInterpolator; + +import com.android.quickstep.AnimatedFloat; +import com.android.quickstep.SystemUiProxy; + +/** + * Handles properties/data collection, and passes the results to {@link TaskbarScrimView} to render. + */ +public class TaskbarScrimViewController { + + private static final float SCRIM_ALPHA = 0.6f; + + private static final Interpolator SCRIM_ALPHA_IN = new PathInterpolator(0.4f, 0f, 1f, 1f); + private static final Interpolator SCRIM_ALPHA_OUT = new PathInterpolator(0f, 0f, 0.8f, 1f); + + private final TaskbarActivityContext mActivity; + private final TaskbarScrimView mScrimView; + + // Alpha property for the scrim. + private final AnimatedFloat mScrimAlpha = new AnimatedFloat(this::updateScrimAlpha); + + // Initialized in init. + private TaskbarControllers mControllers; + + public TaskbarScrimViewController(TaskbarActivityContext activity, TaskbarScrimView scrimView) { + mActivity = activity; + mScrimView = scrimView; + mScrimView.setCornerSizes(mActivity.getLeftCornerRadius(), + mActivity.getRightCornerRadius()); + mScrimView.setBackgroundHeight(mActivity.getDeviceProfile().taskbarSize); + } + + /** + * Initializes the controller + */ + public void init(TaskbarControllers controllers) { + mControllers = controllers; + } + + /** + * Updates the scrim state based on the flags. + */ + public void updateStateForSysuiFlags(int stateFlags) { + final boolean bubblesExpanded = (stateFlags & SYSUI_STATE_BUBBLES_EXPANDED) != 0; + final boolean manageMenuExpanded = + (stateFlags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0; + final boolean showScrim = !mControllers.navbarButtonsViewController.isImeVisible() + && bubblesExpanded && mControllers.taskbarStashController.isInAppAndNotStashed(); + final float scrimAlpha = manageMenuExpanded + // When manage menu shows there's the first scrim and second scrim so figure out + // what the total transparency would be. + ? (SCRIM_ALPHA + (SCRIM_ALPHA * (1 - SCRIM_ALPHA))) + : showScrim ? SCRIM_ALPHA : 0; + showScrim(showScrim, scrimAlpha); + } + + private void showScrim(boolean showScrim, float alpha) { + mScrimView.setOnClickListener(showScrim ? (view) -> onClick() : null); + mScrimView.setClickable(showScrim); + ObjectAnimator anim = mScrimAlpha.animateToValue(showScrim ? alpha : 0); + anim.setInterpolator(showScrim ? SCRIM_ALPHA_IN : SCRIM_ALPHA_OUT); + anim.start(); + } + + private void updateScrimAlpha() { + mScrimView.setScrimAlpha(mScrimAlpha.value); + } + + private void onClick() { + SystemUiProxy.INSTANCE.get(mActivity).onBackPressed(); + } +} diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 6d6f0f2e00..d71625ed52 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -198,6 +198,14 @@ public class TaskbarStashController { return (flags & flagMask) != 0; } + + /** + * Returns whether the taskbar is currently visible and in an app. + */ + public boolean isInAppAndNotStashed() { + return !mIsStashed && (mState & FLAG_IN_APP) != 0; + } + public int getContentHeight() { return isStashed() ? mStashedHeight : mUnstashedHeight; } From caecf6393b80f07942370c23db77ac42dbc1281a Mon Sep 17 00:00:00 2001 From: Trevor Radcliffe Date: Tue, 12 Oct 2021 23:00:23 +0000 Subject: [PATCH 2/4] Migrate Aardwolf to Soong Fixes: 202886196 Test: apkanalyzer--apks are identical Test: Treehugger Change-Id: Iff24028632c4b6929c408db2dbae9a3d98604810 --- tests/dummy_app/Android.bp | 28 ++++++++++++++++++++++++++++ tests/dummy_app/Android.mk | 21 --------------------- 2 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 tests/dummy_app/Android.bp delete mode 100644 tests/dummy_app/Android.mk diff --git a/tests/dummy_app/Android.bp b/tests/dummy_app/Android.bp new file mode 100644 index 0000000000..4f83bb706e --- /dev/null +++ b/tests/dummy_app/Android.bp @@ -0,0 +1,28 @@ +// +// Copyright (C) 2021 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 { + default_applicable_licenses: ["packages_apps_Launcher3_license"], +} + +android_app { + name: "Aardwolf", + srcs: ["src/**/*.java"], + sdk_version: "current", + dex_preopt: { + enabled: false, + }, +} diff --git a/tests/dummy_app/Android.mk b/tests/dummy_app/Android.mk deleted file mode 100644 index 3472079d16..0000000000 --- a/tests/dummy_app/Android.mk +++ /dev/null @@ -1,21 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := samples - -# Only compile source java files in this apk. -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := Aardwolf -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE - -LOCAL_SDK_VERSION := current - -LOCAL_DEX_PREOPT := false - -include $(BUILD_PACKAGE) - -# Use the following include to make our test apk. -include $(call all-makefiles-under,$(LOCAL_PATH)) From bb6e278f14e4e98789eac222ed8e393649eb1126 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 28 Sep 2021 15:09:25 -0700 Subject: [PATCH 3/4] Fix taskbar layout issues in setup wizard - Align nav buttons (only back is enabled) to start instead of end - Don't animate from init() - Provide 0 contentInsets.bottom - Auto-stash the taskbar during setup - Hide the stashed handle by adding an alpha channel for home disabled - Report 0 contentInsets when stashed if the handle isn't visible - Tint nav buttons according to theme Test: adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.SetupWizardTestActivity Bug: 194786060 Change-Id: I4a40501e8aad2a38ec00398efe9ea3dbfa7428cd --- .../taskbar/LauncherTaskbarUIController.java | 16 +++++++- .../taskbar/NavbarButtonsViewController.java | 35 +++++++++++++++- .../taskbar/StashedHandleViewController.java | 30 ++++++++++---- .../taskbar/TaskbarActivityContext.java | 2 + .../taskbar/TaskbarStashController.java | 41 ++++++++++++++++--- 5 files changed, 108 insertions(+), 16 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 6bc49ed076..2661940e8a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE; +import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_SETUP; import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME; import android.animation.Animator; @@ -122,7 +123,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mLauncher.setTaskbarUIController(this); mKeyguardController = taskbarControllers.taskbarKeyguardController; - onLauncherResumedOrPaused(mLauncher.hasBeenResumed()); + onLauncherResumedOrPaused(mLauncher.hasBeenResumed(), true /* fromInit */); mIconAlignmentForResumedState.finishAnimation(); onIconAlignmentRatioChanged(); @@ -162,6 +163,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController { * Should be called from onResume() and onPause(), and animates the Taskbar accordingly. */ public void onLauncherResumedOrPaused(boolean isResumed) { + onLauncherResumedOrPaused(isResumed, false /* fromInit */); + } + + private void onLauncherResumedOrPaused(boolean isResumed, boolean fromInit) { if (mKeyguardController.isScreenOff()) { if (!isResumed) { return; @@ -172,6 +177,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } long duration = QuickstepTransitionManager.CONTENT_ALPHA_DURATION; + if (fromInit) { + // Since we are creating the starting state, we don't have a state to animate from, so + // set our state immediately. + duration = 0; + } ObjectAnimator anim = mIconAlignmentForResumedState.animateToValue( getCurrentIconAlignmentRatio(), isResumed ? 1 : 0) .setDuration(duration); @@ -183,6 +193,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController { TaskbarStashController stashController = mControllers.taskbarStashController; stashController.updateStateForFlag(FLAG_IN_APP, !isResumed); + if (isResumed) { + // Launcher is resumed, meaning setup must be finished. + stashController.updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, false); + } stashController.applyState(duration); } diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 4b75db4fbe..a480480573 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -36,12 +36,14 @@ import android.animation.ObjectAnimator; import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.LayoutRes; +import android.content.res.ColorStateList; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region.Op; import android.graphics.drawable.AnimatedVectorDrawable; import android.provider.Settings; import android.util.Property; +import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnHoverListener; @@ -58,6 +60,7 @@ import com.android.launcher3.taskbar.contextual.RotationButton; import com.android.launcher3.taskbar.contextual.RotationButtonController; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.SettingsCache; +import com.android.launcher3.util.Themes; import com.android.quickstep.AnimatedFloat; import java.util.ArrayList; @@ -146,12 +149,33 @@ public class NavbarButtonsViewController { flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0)); // Force nav buttons (specifically back button) to be visible during setup wizard. - boolean areButtonsForcedVisible = !SettingsCache.INSTANCE.get(mContext).getValue( + boolean isInSetup = !SettingsCache.INSTANCE.get(mContext).getValue( Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0); - if (isThreeButtonNav || areButtonsForcedVisible) { + if (isThreeButtonNav || isInSetup) { initButtons(mNavButtonContainer, mEndContextualContainer, mControllers.navButtonController); + if (isInSetup) { + // Since setup wizard only has back button enabled, it looks strange to be + // end-aligned, so start-align instead. + FrameLayout.LayoutParams navButtonsLayoutParams = (FrameLayout.LayoutParams) + mNavButtonContainer.getLayoutParams(); + navButtonsLayoutParams.setMarginStart(navButtonsLayoutParams.getMarginEnd()); + navButtonsLayoutParams.setMarginEnd(0); + navButtonsLayoutParams.gravity = Gravity.START; + mNavButtonContainer.requestLayout(); + + if (!isThreeButtonNav) { + // Tint all the nav buttons since there's no taskbar background in SUW. + for (int i = 0; i < mNavButtonContainer.getChildCount(); i++) { + if (!(mNavButtonContainer.getChildAt(i) instanceof ImageView)) continue; + ImageView button = (ImageView) mNavButtonContainer.getChildAt(i); + button.setImageTintList(ColorStateList.valueOf(Themes.getAttrColor( + button.getContext(), android.R.attr.textColorPrimary))); + } + } + } + // Animate taskbar background when IME shows mPropertyHolders.add(new StatePropertyHolder( mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(), @@ -284,6 +308,13 @@ public class NavbarButtonsViewController { return (mState & FLAG_IME_VISIBLE) != 0; } + /** + * Returns true if the home button is disabled + */ + public boolean isHomeDisabled() { + return (mState & FLAG_DISABLE_HOME) != 0; + } + /** * Returns true if the recents (overview) button is disabled */ diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index 10da8267e0..2c80f06eb1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -30,6 +30,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.RevealOutlineAnimation; import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; import com.android.launcher3.util.Executors; +import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.AnimatedFloat; import com.android.systemui.shared.navigationbar.RegionSamplingHelper; @@ -38,6 +39,10 @@ import com.android.systemui.shared.navigationbar.RegionSamplingHelper; */ public class StashedHandleViewController { + public static final int ALPHA_INDEX_STASHED = 0; + public static final int ALPHA_INDEX_HOME_DISABLED = 1; + private static final int NUM_ALPHA_CHANNELS = 2; + /** * The SharedPreferences key for whether the stashed handle region is dark. */ @@ -50,8 +55,7 @@ public class StashedHandleViewController { private final int mStashedHandleWidth; private final int mStashedHandleHeight; private final RegionSamplingHelper mRegionSamplingHelper; - private final AnimatedFloat mTaskbarStashedHandleAlpha = new AnimatedFloat( - this::updateStashedHandleAlpha); + private final MultiValueAlpha mTaskbarStashedHandleAlpha; private final AnimatedFloat mTaskbarStashedHandleHintScale = new AnimatedFloat( this::updateStashedHandleHintScale); @@ -69,6 +73,8 @@ public class StashedHandleViewController { mActivity = activity; mPrefs = Utilities.getPrefs(mActivity); mStashedHandleView = stashedHandleView; + mTaskbarStashedHandleAlpha = new MultiValueAlpha(mStashedHandleView, NUM_ALPHA_CHANNELS); + mTaskbarStashedHandleAlpha.setUpdateVisibility(true); mStashedHandleView.updateHandleColor( mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false), false /* animate */); @@ -96,7 +102,7 @@ public class StashedHandleViewController { mControllers = controllers; mStashedHandleView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarSize; - updateStashedHandleAlpha(); + mTaskbarStashedHandleAlpha.getProperty(ALPHA_INDEX_STASHED).setValue(0); mTaskbarStashedHandleHintScale.updateValue(1f); final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); @@ -129,7 +135,7 @@ public class StashedHandleViewController { mRegionSamplingHelper.stopAndDestroy(); } - public AnimatedFloat getStashedHandleAlpha() { + public MultiValueAlpha getStashedHandleAlpha() { return mTaskbarStashedHandleAlpha; } @@ -163,12 +169,20 @@ public class StashedHandleViewController { } } - protected void updateStashedHandleAlpha() { - mStashedHandleView.setAlpha(mTaskbarStashedHandleAlpha.value); - } - protected void updateStashedHandleHintScale() { mStashedHandleView.setScaleX(mTaskbarStashedHandleHintScale.value); mStashedHandleView.setScaleY(mTaskbarStashedHandleHintScale.value); } + + /** + * Should be called when the home button is disabled, so we can hide this handle as well. + */ + public void setIsHomeButtonDisabled(boolean homeDisabled) { + mTaskbarStashedHandleAlpha.getProperty(ALPHA_INDEX_HOME_DISABLED).setValue( + homeDisabled ? 0 : 1); + } + + public boolean isStashedHandleVisible() { + return mStashedHandleView.getVisibility() == View.VISIBLE; + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index a8c94ce5c0..cfe0a720d1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -321,6 +321,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ panelExpanded || inSettings); mControllers.taskbarViewController.setRecentsButtonDisabled( mControllers.navbarButtonsViewController.isRecentsDisabled()); + mControllers.stashedHandleViewController.setIsHomeButtonDisabled( + mControllers.navbarButtonsViewController.isHomeDisabled()); mControllers.taskbarKeyguardController.updateStateForSysuiFlags(systemUiStateFlags); mControllers.taskbarStashController.updateStateForSysuiFlags(systemUiStateFlags); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 6d6f0f2e00..8bedf548dd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -25,15 +25,21 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.annotation.Nullable; +import android.app.ActivityManager; +import android.content.ComponentName; import android.content.SharedPreferences; import android.content.res.Resources; +import android.provider.Settings; import android.view.ViewConfiguration; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; +import com.android.launcher3.util.SettingsCache; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.SystemUiProxy; +import com.android.quickstep.interaction.AllSetActivity; +import com.android.systemui.shared.system.ActivityManagerWrapper; import java.util.function.IntPredicate; @@ -47,11 +53,12 @@ public class TaskbarStashController { public static final int FLAG_STASHED_IN_APP_MANUAL = 1 << 1; // long press, persisted public static final int FLAG_STASHED_IN_APP_PINNED = 1 << 2; // app pinning public static final int FLAG_STASHED_IN_APP_EMPTY = 1 << 3; // no hotseat icons - public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 4; + public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 4; // setup wizard and AllSetActivity + public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 5; // If we're in an app and any of these flags are enabled, taskbar should be stashed. public static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL - | FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY; + | FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP; /** * How long to stash/unstash when manually invoked via long press. @@ -103,7 +110,7 @@ public class TaskbarStashController { private AnimatedFloat mIconScaleForStash; private AnimatedFloat mIconTranslationYForStash; // Stashed handle properties. - private AnimatedFloat mTaskbarStashedHandleAlpha; + private AlphaProperty mTaskbarStashedHandleAlpha; private AnimatedFloat mTaskbarStashedHandleHintScale; /** Whether we are currently visually stashed (might change based on launcher state). */ @@ -143,12 +150,14 @@ public class TaskbarStashController { StashedHandleViewController stashedHandleController = controllers.stashedHandleViewController; - mTaskbarStashedHandleAlpha = stashedHandleController.getStashedHandleAlpha(); + mTaskbarStashedHandleAlpha = stashedHandleController.getStashedHandleAlpha().getProperty( + StashedHandleViewController.ALPHA_INDEX_STASHED); mTaskbarStashedHandleHintScale = stashedHandleController.getStashedHandleHintScale(); boolean isManuallyStashedInApp = supportsManualStashing() && mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF); updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp); + updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup()); applyState(); SystemUiProxy.INSTANCE.get(mActivity) @@ -176,6 +185,23 @@ public class TaskbarStashController { return false; } + /** + * Returns whether we are in Setup Wizard or the corresponding AllSetActivity that follows it. + */ + private boolean isInSetup() { + boolean isInSetup = !SettingsCache.INSTANCE.get(mActivity).getValue( + Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0); + if (isInSetup) { + return true; + } + ActivityManager.RunningTaskInfo runningTask = + ActivityManagerWrapper.getInstance().getRunningTask(); + if (runningTask == null || runningTask.baseActivity == null) { + return false; + } + return runningTask.baseActivity.equals(new ComponentName(mActivity, AllSetActivity.class)); + } + /** * Returns whether the taskbar is currently visually stashed. */ @@ -199,7 +225,12 @@ public class TaskbarStashController { } public int getContentHeight() { - return isStashed() ? mStashedHeight : mUnstashedHeight; + if (isStashed()) { + boolean isAnimating = mAnimator != null && mAnimator.isStarted(); + return mControllers.stashedHandleViewController.isStashedHandleVisible() || isAnimating + ? mStashedHeight : 0; + } + return mUnstashedHeight; } public int getStashedHeight() { From 0d794e65aa518a361aacf24c7b862c3217f9ce6e Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Fri, 15 Oct 2021 11:10:50 -0700 Subject: [PATCH 4/4] Enable widget picker aiai search Bug: 183108439 Test: manual Change-Id: I93f00131817622ad441d3374f22f26df8b28114d --- src/com/android/launcher3/config/FeatureFlags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 61f314ca92..b8c5934115 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -157,7 +157,7 @@ public final class FeatureFlags { "ENABLE_OVERVIEW_SELECTIONS", true, "Show Select Mode button in Overview Actions"); public static final BooleanFlag ENABLE_WIDGETS_PICKER_AIAI_SEARCH = new DeviceFlag( - "ENABLE_WIDGETS_PICKER_AIAI_SEARCH", false, "Enable AiAi search in the widgets picker"); + "ENABLE_WIDGETS_PICKER_AIAI_SEARCH", true, "Enable AiAi search in the widgets picker"); public static final BooleanFlag ENABLE_OVERVIEW_SHARING_TO_PEOPLE = getDebugFlag( "ENABLE_OVERVIEW_SHARING_TO_PEOPLE", true,