diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 35215e1ad7..cfe602eb28 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -263,6 +263,7 @@ 35dp 24dp 220dp + 108dp 316dp 4dp 25dp diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 3e13a446b1..c089d1bcd4 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -43,7 +43,6 @@ import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION; import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.statehandlers.DepthController.DEPTH; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION; import static com.android.launcher3.views.FloatingIconView.getFloatingIconView; @@ -77,7 +76,6 @@ import android.os.Looper; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; -import android.util.Log; import android.util.Pair; import android.util.Size; import android.view.SurfaceControl; @@ -137,7 +135,6 @@ import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.wm.shell.startingsurface.IStartingWindowListener; import java.util.ArrayList; -import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -447,7 +444,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener 4 - rotationChange); } } - if (mDeviceProfile.isTaskbarPresentInApps) { + if (mDeviceProfile.isTaskbarPresentInApps && !target.willShowImeOnTarget) { // Animate to above the taskbar. bounds.bottom -= target.contentInsets.bottom; } @@ -623,28 +620,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener RecentsView overview = mLauncher.getOverviewPanel(); ObjectAnimator alpha = ObjectAnimator.ofFloat(overview, RecentsView.CONTENT_ALPHA, alphas); - Log.d(BAD_STATE, "QTM composeViewContentAnimator alphas=" + Arrays.toString(alphas)); - alpha.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - Log.d(BAD_STATE, "QTM composeViewContentAnimator onStart"); - } - - @Override - public void onAnimationCancel(Animator animation) { - float alpha = overview == null ? -1 : RecentsView.CONTENT_ALPHA.get(overview); - Log.d(BAD_STATE, "QTM composeViewContentAnimator onCancel, alpha=" + alpha); - } - - @Override - public void onAnimationEnd(Animator animation) { - Log.d(BAD_STATE, "QTM composeViewContentAnimator onEnd"); - } - }); alpha.setDuration(CONTENT_ALPHA_DURATION); alpha.setInterpolator(LINEAR); anim.play(alpha); - Log.d(BAD_STATE, "QTM composeViewContentAnimator setFreezeVisibility=true"); overview.setFreezeViewVisibility(true); ObjectAnimator scaleAnim = ObjectAnimator.ofFloat(overview, SCALE_PROPERTY, scales); @@ -653,7 +631,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener anim.play(scaleAnim); return () -> { - Log.d(BAD_STATE, "QTM composeViewContentAnimator onEnd setFreezeVisibility=false"); overview.setFreezeViewVisibility(false); SCALE_PROPERTY.set(overview, 1f); mLauncher.getStateManager().reapplyState(); diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index 800e1629f4..06524636c6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.taskbar; +import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; @@ -25,6 +27,7 @@ import android.graphics.Rect; import android.view.View; import android.view.ViewOutlineProvider; +import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.RevealOutlineAnimation; @@ -55,9 +58,9 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT private final TaskbarActivityContext mActivity; private final SharedPreferences mPrefs; private final StashedHandleView mStashedHandleView; - private final int mStashedHandleWidth; + private int mStashedHandleWidth; private final int mStashedHandleHeight; - private final RegionSamplingHelper mRegionSamplingHelper; + private RegionSamplingHelper mRegionSamplingHelper; private final MultiValueAlpha mTaskbarStashedHandleAlpha; private final AnimatedFloat mTaskbarStashedHandleHintScale = new AnimatedFloat( this::updateStashedHandleHintScale); @@ -85,30 +88,27 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT mPrefs.getBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, false), false /* animate */); final Resources resources = mActivity.getResources(); - mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width); mStashedHandleHeight = resources.getDimensionPixelSize( R.dimen.taskbar_stashed_handle_height); - mRegionSamplingHelper = new RegionSamplingHelper(mStashedHandleView, - new RegionSamplingHelper.SamplingCallback() { - @Override - public void onRegionDarknessChanged(boolean isRegionDark) { - mStashedHandleView.updateHandleColor(isRegionDark, true /* animate */); - mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, - isRegionDark).apply(); - } - - @Override - public Rect getSampledRegion(View sampledView) { - return mStashedHandleView.getSampledRegion(); - } - }, Executors.UI_HELPER_EXECUTOR); } public void init(TaskbarControllers controllers) { mControllers = controllers; - mStashedHandleView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarSize; + DeviceProfile deviceProfile = mActivity.getDeviceProfile(); + Resources resources = mActivity.getResources(); + if (isPhoneMode(mActivity.getDeviceProfile())) { + mStashedHandleView.getLayoutParams().height = + resources.getDimensionPixelSize(R.dimen.taskbar_size); + mStashedHandleWidth = + resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen); + } else { + mStashedHandleView.getLayoutParams().height = deviceProfile.taskbarSize; + mStashedHandleWidth = + resources.getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width); + } - mTaskbarStashedHandleAlpha.getProperty(ALPHA_INDEX_STASHED).setValue(0); + mTaskbarStashedHandleAlpha.getProperty(ALPHA_INDEX_STASHED).setValue( + isPhoneMode(deviceProfile) ? 1 : 0); mTaskbarStashedHandleHintScale.updateValue(1f); final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); @@ -135,10 +135,33 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT view.setPivotX(stashedCenterX); view.setPivotY(stashedCenterY); }); + initRegionSampler(); + if (isPhoneMode(deviceProfile)) { + onIsStashedChanged(true); + } } + private void initRegionSampler() { + mRegionSamplingHelper = new RegionSamplingHelper(mStashedHandleView, + new RegionSamplingHelper.SamplingCallback() { + @Override + public void onRegionDarknessChanged(boolean isRegionDark) { + mStashedHandleView.updateHandleColor(isRegionDark, true /* animate */); + mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_HANDLE_REGION_DARK_KEY, + isRegionDark).apply(); + } + + @Override + public Rect getSampledRegion(View sampledView) { + return mStashedHandleView.getSampledRegion(); + } + }, Executors.UI_HELPER_EXECUTOR); + } + + public void onDestroy() { mRegionSamplingHelper.stopAndDestroy(); + mRegionSamplingHelper = null; } public MultiValueAlpha getStashedHandleAlpha() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 2280b959d5..f5fe77a22b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -24,6 +24,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; +import static com.android.launcher3.taskbar.TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW; import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; @@ -130,6 +131,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // The flag to know if the window is excluded from magnification region computation. private boolean mIsExcludeFromMagnificationRegion = false; private boolean mBindingItems = false; + private boolean mAddedWindow = false; + private final TaskbarShortcutMenuAccessibilityDelegate mAccessibilityDelegate; @@ -218,7 +221,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mControllers.init(sharedState); updateSysuiStateFlags(sharedState.sysuiStateFlags, true /* fromInit */); - mWindowManager.addView(mDragLayer, mWindowLayoutParams); + if (!mAddedWindow) { + mWindowManager.addView(mDragLayer, mWindowLayoutParams); + mAddedWindow = true; + } else { + mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + } } @Override @@ -461,7 +469,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mIsDestroyed = true; setUIController(TaskbarUIController.DEFAULT); mControllers.onDestroy(); - mWindowManager.removeViewImmediate(mDragLayer); + if (!FLAG_HIDE_NAVBAR_WINDOW) { + mWindowManager.removeViewImmediate(mDragLayer); + mAddedWindow = false; + } } public void updateSysuiStateFlags(int systemUiStateFlags, boolean fromInit) { @@ -596,6 +607,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * Returns the default height of the window, including the static corner radii above taskbar. */ public int getDefaultTaskbarWindowHeight() { + if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) { + return getResources().getDimensionPixelSize(R.dimen.taskbar_stashed_size); + } return mDeviceProfile.taskbarSize + Math.max(getLeftCornerRadius(), getRightCornerRadius()); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java index 1c8148b81e..ee17ad0e1f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java @@ -86,8 +86,14 @@ public class TaskbarDragLayer extends BaseDragLayer { } } + protected void onDestroy(boolean forceDestroy) { + if (forceDestroy) { + ViewTreeObserverWrapper.removeOnComputeInsetsListener(mTaskbarInsetsComputer); + } + } + protected void onDestroy() { - ViewTreeObserverWrapper.removeOnComputeInsetsListener(mTaskbarInsetsComputer); + onDestroy(!TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW); } @Override @@ -101,7 +107,7 @@ public class TaskbarDragLayer extends BaseDragLayer { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - onDestroy(); + onDestroy(true); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 06262c0a25..353bf89998 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -30,6 +30,7 @@ import android.content.res.Configuration; import android.hardware.display.DisplayManager; import android.net.Uri; import android.os.Handler; +import android.os.SystemProperties; import android.provider.Settings; import android.view.Display; @@ -58,6 +59,9 @@ import java.io.PrintWriter; */ public class TaskbarManager { + public static final boolean FLAG_HIDE_NAVBAR_WINDOW = + SystemProperties.getBoolean("persist.wm.debug.hide_navbar_window", false); + private static final Uri USER_SETUP_COMPLETE_URI = Settings.Secure.getUriFor( Settings.Secure.USER_SETUP_COMPLETE); @@ -147,7 +151,7 @@ public class TaskbarManager { } else { // Config change might be handled without re-creating the taskbar if (mTaskbarActivityContext != null) { - if (dp != null && dp.isTaskbarPresent) { + if (dp != null && isTaskbarPresent(dp)) { mTaskbarActivityContext.updateDeviceProfile(dp); } mTaskbarActivityContext.onConfigurationChanged(configDiff); @@ -159,7 +163,8 @@ public class TaskbarManager { @Override public void onLowMemory() { } }; - mShutdownReceiver = new SimpleBroadcastReceiver(i -> destroyExistingTaskbar()); + mShutdownReceiver = new SimpleBroadcastReceiver(i -> + destroyExistingTaskbar()); mDispInfoChangeListener = (context, info, flags) -> { if ((flags & CHANGE_FLAGS) != 0) { recreateTaskbar(); @@ -179,7 +184,9 @@ public class TaskbarManager { private void destroyExistingTaskbar() { if (mTaskbarActivityContext != null) { mTaskbarActivityContext.onDestroy(); - mTaskbarActivityContext = null; + if (!FLAG_HIDE_NAVBAR_WINDOW) { + mTaskbarActivityContext = null; + } } } @@ -260,24 +267,32 @@ public class TaskbarManager { } } + /** + * This method is called multiple times (ex. initial init, then when user unlocks) in which case + * we fully want to destroy an existing taskbar and create a new one. + * In other case (folding/unfolding) we don't need to remove and add window. + */ private void recreateTaskbar() { + DeviceProfile dp = mUserUnlocked ? + LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null; + destroyExistingTaskbar(); - DeviceProfile dp = - mUserUnlocked ? LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null; - - boolean isTaskBarEnabled = dp != null && dp.isTaskbarPresent; - + boolean isTaskBarEnabled = dp != null && isTaskbarPresent(dp); if (!isTaskBarEnabled) { SystemUiProxy.INSTANCE.get(mContext) .notifyTaskbarStatus(/* visible */ false, /* stashed */ false); return; } - mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController, - mUnfoldProgressProvider); - + if (mTaskbarActivityContext == null) { + mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController, + mUnfoldProgressProvider); + } else { + mTaskbarActivityContext.updateDeviceProfile(dp); + } mTaskbarActivityContext.init(mSharedState); + if (mActivity != null) { mTaskbarActivityContext.setUIController( createTaskbarUIControllerForActivity(mActivity)); @@ -301,6 +316,18 @@ public class TaskbarManager { } } + /** + * @return {@code true} if provided device profile isn't a large screen profile + * and we are using a single window for taskbar and navbar. + */ + public static boolean isPhoneMode(DeviceProfile deviceProfile) { + return TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW && deviceProfile.isPhone; + } + + private boolean isTaskbarPresent(DeviceProfile deviceProfile) { + return FLAG_HIDE_NAVBAR_WINDOW || deviceProfile.isTaskbarPresent; + } + public void onRotationProposal(int rotation, boolean isValid) { if (mTaskbarActivityContext != null) { mTaskbarActivityContext.onRotationProposal(rotation, isValid); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 85331459ad..114ab4e976 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -20,6 +20,7 @@ import static android.view.HapticFeedbackConstants.LONG_PRESS; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW; +import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.launcher3.taskbar.Utilities.appendFlag; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING; @@ -30,6 +31,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.annotation.Nullable; import android.content.SharedPreferences; +import android.content.res.Resources; import android.util.Log; import android.view.View; import android.view.ViewConfiguration; @@ -38,6 +40,7 @@ import androidx.annotation.NonNull; import com.android.internal.jank.InteractionJankMonitor; import com.android.launcher3.DeviceProfile; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.testing.shared.TestProtocol; @@ -69,6 +72,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 6; public static final int FLAG_STASHED_IN_APP_ALL_APPS = 1 << 7; // All apps is visible. public static final int FLAG_IN_SETUP = 1 << 8; // In the Setup Wizard + public static final int FLAG_STASHED_SMALL_SCREEN = 1 << 9; // phone screen gesture nav, stashed // If any of these flags are enabled, isInApp should return true. private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP; @@ -76,7 +80,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // If we're in an app and any of these flags are enabled, taskbar should be stashed. private 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_SETUP - | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_APP_ALL_APPS; + | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_APP_ALL_APPS | + FLAG_STASHED_SMALL_SCREEN; private static final int FLAGS_STASHED_IN_APP_IGNORING_IME = FLAGS_STASHED_IN_APP & ~FLAG_STASHED_IN_APP_IME; @@ -166,15 +171,25 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba boolean inApp = hasAnyFlag(flags, FLAGS_IN_APP); boolean stashedInApp = hasAnyFlag(flags, FLAGS_STASHED_IN_APP); boolean stashedLauncherState = hasAnyFlag(flags, FLAG_IN_STASHED_LAUNCHER_STATE); - return (inApp && stashedInApp) || (!inApp && stashedLauncherState); + boolean stashedForSmallScreen = hasAnyFlag(flags, FLAG_STASHED_SMALL_SCREEN); + return (inApp && stashedInApp) || (!inApp && stashedLauncherState) + || stashedForSmallScreen; }); public TaskbarStashController(TaskbarActivityContext activity) { mActivity = activity; mPrefs = Utilities.getPrefs(mActivity); mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity); - mUnstashedHeight = mActivity.getDeviceProfile().taskbarSize; - mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarSize; + if (isPhoneMode(mActivity.getDeviceProfile())) { + // DeviceProfile's taskbar vars aren't initialized w/ the flag off + Resources resources = mActivity.getResources(); + mUnstashedHeight = resources.getDimensionPixelSize(R.dimen.taskbar_size); + mStashedHeight = resources.getDimensionPixelOffset(R.dimen.taskbar_stashed_size); + } else { + mUnstashedHeight = mActivity.getDeviceProfile().taskbarSize; + mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarSize; + } + } public void init(TaskbarControllers controllers, boolean setupUIVisible) { @@ -202,6 +217,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp); updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup); updateStateForFlag(FLAG_IN_SETUP, isInSetup); + updateStateForFlag(FLAG_STASHED_SMALL_SCREEN, isPhoneMode(mActivity.getDeviceProfile())); applyState(); notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp()); @@ -212,7 +228,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * state. */ public boolean supportsVisualStashing() { - return mControllers.uiController.supportsVisualStashing(); + return mControllers.uiController.supportsVisualStashing() || + isPhoneMode(mActivity.getDeviceProfile()); } /** @@ -266,7 +283,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Returns whether the taskbar should be stashed in the current LauncherState. */ public boolean isInStashedLauncherState() { - return hasAnyFlag(FLAG_IN_STASHED_LAUNCHER_STATE) && supportsVisualStashing(); + return (hasAnyFlag(FLAG_IN_STASHED_LAUNCHER_STATE) && supportsVisualStashing()); } private boolean hasAnyFlag(int flagMask) { @@ -295,6 +312,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * @see WindowInsets.Type#systemBars() */ public int getContentHeightToReportToApps() { + if (isPhoneMode(mActivity.getDeviceProfile())) { + return getStashedHeight(); + } + if (supportsVisualStashing() && hasAnyFlag(FLAGS_REPORT_STASHED_INSETS_TO_APP)) { DeviceProfile dp = mActivity.getDeviceProfile(); if (hasAnyFlag(FLAG_STASHED_IN_APP_SETUP) && dp.isTaskbarPresent && !dp.isLandscape) { @@ -410,11 +431,18 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } mAnimator = new AnimatorSet(); addJankMonitorListener(mAnimator, /* appearing= */ !mIsStashed); + final float stashTranslation = isPhoneMode(mActivity.getDeviceProfile()) ? 0 : + (mUnstashedHeight - mStashedHeight) / 2f; if (!supportsVisualStashing()) { // Just hide/show the icons and background instead of stashing into a handle. mAnimator.play(mIconAlphaForStash.animateToValue(isStashed ? 0 : 1) .setDuration(duration)); + mAnimator.playTogether(mTaskbarBackgroundOffset.animateToValue(isStashed ? 1 : 0) + .setDuration(duration)); + mAnimator.playTogether(mIconTranslationYForStash.animateToValue(isStashed ? + stashTranslation : 0) + .setDuration(duration)); mAnimator.play(mTaskbarImeBgAlpha.animateToValue( hasAnyFlag(FLAG_STASHED_IN_APP_IME) ? 0 : 1).setDuration(duration)); mAnimator.setStartDelay(startDelay); @@ -438,7 +466,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba if (isStashed) { firstHalfDurationScale = 0.75f; secondHalfDurationScale = 0.5f; - final float stashTranslation = (mUnstashedHeight - mStashedHeight) / 2f; fullLengthAnimatorSet.play(mIconTranslationYForStash.animateToValue(stashTranslation)); if (animateBg) { @@ -450,7 +477,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba firstHalfAnimatorSet.playTogether( mIconAlphaForStash.animateToValue(0), - mIconScaleForStash.animateToValue(STASHED_TASKBAR_SCALE) + mIconScaleForStash.animateToValue(isPhoneMode(mActivity.getDeviceProfile()) ? + 0 : STASHED_TASKBAR_SCALE) ); secondHalfAnimatorSet.playTogether( mTaskbarStashedHandleAlpha.animateToValue(1) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 077172da18..0f6de73c7d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -20,6 +20,7 @@ import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP; +import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.quickstep.AnimatedFloat.VALUE; import android.annotation.NonNull; @@ -35,6 +36,7 @@ import androidx.core.view.OneShotPreDrawListener; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAppState; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AlphaUpdateListener; import com.android.launcher3.anim.AnimatorPlaybackController; @@ -108,7 +110,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar public void init(TaskbarControllers controllers) { mControllers = controllers; mTaskbarView.init(new TaskbarViewCallbacks()); - mTaskbarView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarSize; + mTaskbarView.getLayoutParams().height = isPhoneMode(mActivity.getDeviceProfile()) + ? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_size) + : mActivity.getDeviceProfile().taskbarSize; mThemeIconsColor = ThemedIconDrawable.getColors(mTaskbarView.getContext())[0]; mTaskbarIconScaleForStash.updateValue(1f); diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index f2205097a4..ea0972f293 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -28,7 +28,6 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SP import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.FIRST_FLOATING_TASK_TRANSLATE_OFFSCREEN; import static com.android.quickstep.views.RecentsView.OVERVIEW_PROGRESS; @@ -40,7 +39,6 @@ import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION import android.graphics.Rect; import android.graphics.RectF; import android.util.FloatProperty; -import android.util.Log; import androidx.annotation.NonNull; @@ -77,10 +75,7 @@ public abstract class BaseRecentsViewStateController ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, scaleAndOffset[1]); TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f); - float recentsAlpha = state.overviewUi ? 1f : 0; - Log.d(BAD_STATE, "BaseRecentsViewStateController setState state=" + state - + ", alpha=" + recentsAlpha); - getContentAlphaProperty().set(mRecentsView, recentsAlpha); + getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness()); RECENTS_GRID_PROGRESS.set(mRecentsView, state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f); @@ -90,8 +85,6 @@ public abstract class BaseRecentsViewStateController @Override public void setStateWithAnimation(LauncherState toState, StateAnimationConfig config, PendingAnimation builder) { - Log.d(BAD_STATE, "BaseRecentsViewStateController setStateWithAnimation state=" + toState - + ", config.skipOverview=" + config.hasAnimationFlag(SKIP_OVERVIEW)); if (config.hasAnimationFlag(SKIP_OVERVIEW)) { return; } @@ -158,10 +151,7 @@ public abstract class BaseRecentsViewStateController } } - float recentsAlpha = toState.overviewUi ? 1 : 0; - Log.d(BAD_STATE, "BaseRecentsViewStateController setStateWithAnimationInternal toState=" - + toState + ", alpha=" + recentsAlpha); - setter.setFloat(mRecentsView, getContentAlphaProperty(), recentsAlpha, + setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); setter.setFloat( diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 4092a73304..bc76487cf8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -39,7 +39,6 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_S import static com.android.launcher3.states.StateAnimationConfig.SKIP_ALL_ANIMATIONS; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT; import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; @@ -56,7 +55,6 @@ import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.graphics.PointF; -import android.util.Log; import android.view.MotionEvent; import android.view.animation.Interpolator; @@ -227,7 +225,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // Set RecentView's initial properties. RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]); ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, 1f); - Log.d(BAD_STATE, "NBQSTC setupOverviewAnimators setContentAlpha=1"); mRecentsView.setContentAlpha(1); mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress()); mLauncher.getActionsView().getVisibilityAlpha().setValue( @@ -247,24 +244,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, QUICK_SWITCH.getWorkspaceScrimColor(mLauncher), LINEAR); if (mRecentsView.getTaskViewCount() == 0) { xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR); - Log.d(BAD_STATE, "NBQSTC setupOverviewAnimators from: 0 to: 1"); - xAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - Log.d(BAD_STATE, "NBQSTC setupOverviewAnimators onStart"); - } - - @Override - public void onAnimationCancel(Animator animation) { - float alpha = mRecentsView == null ? -1 : CONTENT_ALPHA.get(mRecentsView); - Log.d(BAD_STATE, "NBQSTC setupOverviewAnimators onCancel, alpha=" + alpha); - } - - @Override - public void onAnimationEnd(Animator animation) { - Log.d(BAD_STATE, "NBQSTC setupOverviewAnimators onEnd"); - } - }); } mXOverviewAnim = xAnim.createPlaybackController(); mXOverviewAnim.dispatchOnStart(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index f607aa3429..e5cd53abf5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -29,7 +29,6 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; @@ -37,7 +36,6 @@ import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHO import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; -import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.Launcher; @@ -114,7 +112,6 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll RECENTS_SCALE_PROPERTY.set(mOverviewPanel, QUICK_SWITCH.getOverviewScaleAndOffset(mLauncher)[0] * 0.85f); ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mOverviewPanel, 1f); - Log.d(BAD_STATE, "QuickSwitchTouchController initCurrentAnimation setContentAlpha=1"); mOverviewPanel.setContentAlpha(1); mCurrentAnimation = mLauncher.getStateManager() diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 98824ebd2f..4435eda184 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -23,7 +23,6 @@ import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSI import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_PRE_DELAY; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.graphics.SysUiScrim.SYSUI_PROGRESS; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; import static com.android.quickstep.OverviewComponentObserver.startHomeIntentSafely; import static com.android.quickstep.TaskUtils.taskIsATargetWithMode; @@ -39,7 +38,6 @@ import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.util.Log; import android.view.Display; import android.view.SurfaceControl.Transaction; import android.view.View; @@ -314,7 +312,6 @@ public final class RecentsActivity extends StatefulActivity { protected void onStart() { // Set the alpha to 1 before calling super, as it may get set back to 0 due to // onActivityStart callback. - Log.d(BAD_STATE, "RecentsActivity onStart mFallbackRecentsView.setContentAlpha(1)"); mFallbackRecentsView.setContentAlpha(1); super.onStart(); mFallbackRecentsView.updateLocusId(); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index c28fc9d120..fa30b8f739 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -37,7 +37,6 @@ import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLAT import static com.android.launcher3.anim.Interpolators.clampToProgress; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.statehandlers.DepthController.DEPTH; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING; @@ -55,7 +54,6 @@ import android.graphics.Matrix.ScaleToFit; import android.graphics.Rect; import android.graphics.RectF; import android.os.Build; -import android.util.Log; import android.view.SurfaceControl; import android.view.View; import android.window.TransitionInfo; @@ -571,29 +569,6 @@ public final class TaskViewUtils { launcherAnim = dp.isTablet ? ObjectAnimator.ofFloat(recentsView, RecentsView.CONTENT_ALPHA, 0) : recentsView.createAdjacentPageAnimForTaskLaunch(taskView); - if (dp.isTablet) { - Log.d(BAD_STATE, "TVU composeRecentsLaunchAnimator alpha=" + 0); - launcherAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - Log.d(BAD_STATE, "TVU composeRecentsLaunchAnimator onStart"); - } - - @Override - public void onAnimationCancel(Animator animation) { - float alpha = recentsView == null - ? -1 - : RecentsView.CONTENT_ALPHA.get(recentsView); - Log.d(BAD_STATE, "TVU composeRecentsLaunchAnimator onCancel, alpha=" - + alpha); - } - - @Override - public void onAnimationEnd(Animator animation) { - Log.d(BAD_STATE, "TVU composeRecentsLaunchAnimator onEnd"); - } - }); - } launcherAnim.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR); launcherAnim.setDuration(RECENTS_LAUNCH_DURATION); diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 3734f116b5..eb739a6972 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -15,7 +15,6 @@ */ package com.android.quickstep.fallback; -import static com.android.launcher3.testing.shared.TestProtocol.BAD_STATE; import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.fallback.RecentsState.DEFAULT; import static com.android.quickstep.fallback.RecentsState.HOME; @@ -27,7 +26,6 @@ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import androidx.annotation.Nullable; @@ -225,7 +223,6 @@ public class FallbackRecentsView extends RecentsView extends PagedView // different effects based on device performance. On at least one relatively high-end // device I've tried, translating the launcher causes things to get quite laggy. mLauncher.getDragLayer().setTranslationX(transX); - Log.d(BAD_STATE, "Workspace onOverlayScrollChanged DragLayer ALPHA_INDEX_OVERLAY=" + alpha); mLauncher.getDragLayer().getAlphaProperty(ALPHA_INDEX_OVERLAY).setValue(alpha); } diff --git a/src/com/android/launcher3/model/AllAppsList.java b/src/com/android/launcher3/model/AllAppsList.java index 4875d83942..95150dc526 100644 --- a/src/com/android/launcher3/model/AllAppsList.java +++ b/src/com/android/launcher3/model/AllAppsList.java @@ -18,6 +18,7 @@ package com.android.launcher3.model; import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR; import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY; +import static com.android.launcher3.testing.shared.TestProtocol.INCORRECT_INFO_UPDATED; import android.content.ComponentName; import android.content.Context; @@ -38,6 +39,7 @@ import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.pm.PackageInstallInfo; +import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.FlagOp; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.SafeCloseable; @@ -270,8 +272,14 @@ public class AllAppsList { } public void updateIconsAndLabels(HashSet packages, UserHandle user) { + if (TestProtocol.sDebugTracing) { + Log.i(INCORRECT_INFO_UPDATED, "updateIconsAndLabels: packages=" + packages); + } for (AppInfo info : data) { if (info.user.equals(user) && packages.contains(info.componentName.getPackageName())) { + if (TestProtocol.sDebugTracing) { + Log.i(INCORRECT_INFO_UPDATED, "updateIconsAndLabels: updating info=" + info); + } mIconCache.updateTitleAndIcon(info); info.sectionName = mIndex.computeSectionName(info.title); mDataChanged = true; diff --git a/src/com/android/launcher3/testing/shared/TestProtocol.java b/src/com/android/launcher3/testing/shared/TestProtocol.java index d872476974..67efb58848 100644 --- a/src/com/android/launcher3/testing/shared/TestProtocol.java +++ b/src/com/android/launcher3/testing/shared/TestProtocol.java @@ -136,8 +136,8 @@ public final class TestProtocol { public static final String NO_DROP_TARGET = "b/195031154"; public static final String NULL_INT_SET = "b/200572078"; public static final String MISSING_PROMISE_ICON = "b/202985412"; - public static final String BAD_STATE = "b/223498680"; public static final String TASKBAR_IN_APP_STATE = "b/227657604"; + public static final String INCORRECT_INFO_UPDATED = "b/239465630"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display"; diff --git a/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java index dba0a4063f..960d27d27f 100644 --- a/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java +++ b/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java @@ -1,5 +1,7 @@ package com.android.launcher3.model; +import static com.android.launcher3.testing.shared.TestProtocol.INCORRECT_INFO_UPDATED; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotSame; @@ -14,6 +16,7 @@ import android.graphics.Color; import android.os.Process; import android.os.UserHandle; import android.os.UserManager; +import android.util.Log; import androidx.annotation.NonNull; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -26,6 +29,7 @@ import com.android.launcher3.icons.cache.CachingLogic; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; +import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.LauncherModelHelper; import org.junit.After; @@ -43,12 +47,15 @@ import java.util.HashSet; @RunWith(AndroidJUnit4.class) public class CacheDataUpdatedTaskTest { + private static final String TAG = "CacheDataUpdatedTaskTest"; + private static final String NEW_LABEL_PREFIX = "new-label-"; private LauncherModelHelper mModelHelper; @Before public void setup() throws Exception { + TestProtocol.sDebugTracing = true; mModelHelper = new LauncherModelHelper(); mModelHelper.initializeData("cache_data_updated_task_data"); @@ -88,6 +95,7 @@ public class CacheDataUpdatedTaskTest { @After public void tearDown() { mModelHelper.destroy(); + TestProtocol.sDebugTracing = false; } private CacheDataUpdatedTask newTask(int op, String... pkg) { @@ -111,6 +119,7 @@ public class CacheDataUpdatedTaskTest { // Verify that only app1 var updated in allAppsList assertFalse(mModelHelper.getAllAppsList().data.isEmpty()); for (AppInfo info : mModelHelper.getAllAppsList().data) { + Log.i(INCORRECT_INFO_UPDATED, "testCacheUpdate_update_apps: checking info=" + info); if (info.componentName.getPackageName().equals("app1")) { assertFalse(info.bitmap.isNullOrLowRes()); } else {