From b5b218eea929f719703ca91df6b9868645909f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Tue, 27 Jun 2023 02:58:26 +0000 Subject: [PATCH 1/4] Remove the keep clear areas XML tag from Hotseat It reports its size through SystemUiProxy and this tag causes it to report the region twice. Additionally upon screen rotation the value is getting updated with a delay, so for a moment two keep clear areas for Launcher are present - one from the previous orientation (on the side), and one from the current orientation (matching the proxy value in unrestrictedKeepClearAreas). Bug: 285242520 Test: before http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/cLtiXGYUyItm2kNCCEkkWA Test: after http://recall/-/ekEuGtt9d9HWqkUtAzpHx8/iPs6fwdSXG3TE0IERmxA8 Change-Id: I40dfe08680c944f2be5db0f6b15515492f409565 --- res/layout/hotseat.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/res/layout/hotseat.xml b/res/layout/hotseat.xml index 95ebd94d0e..82b0b8d74e 100644 --- a/res/layout/hotseat.xml +++ b/res/layout/hotseat.xml @@ -21,5 +21,4 @@ android:layout_height="match_parent" android:theme="@style/HomeScreenElementTheme" android:importantForAccessibility="no" - android:preferKeepClear="true" launcher:containerType="hotseat" /> \ No newline at end of file From 2ba42ef94d5c9b01ed8f2c8b749b08972ebc21c6 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Tue, 27 Jun 2023 22:12:45 +0000 Subject: [PATCH 2/4] Removing ViewCaptureAnalysisRule Bug: 286251603 Test: presubmit Flag: N/A Change-Id: I0123ed3892bbfd6d0e880141ace878b6204dbd81 --- .../quickstep/FallbackRecentsTest.java | 4 +- tests/Android.bp | 1 - .../launcher3/ui/AbstractLauncherUiTest.java | 4 +- .../util/rule/ViewCaptureAnalysisRule.java | 56 ------------------- .../launcher3/util/rule/ViewCaptureRule.kt | 2 +- 5 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 tests/src/com/android/launcher3/util/rule/ViewCaptureAnalysisRule.java diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java index 7492ab8c16..a67d787842 100644 --- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java @@ -62,7 +62,6 @@ import com.android.launcher3.util.rule.FailureWatcher; import com.android.launcher3.util.rule.SamplerRule; import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.TestStabilityRule; -import com.android.launcher3.util.rule.ViewCaptureAnalysisRule; import com.android.launcher3.util.rule.ViewCaptureRule; import com.android.quickstep.views.RecentsView; @@ -123,8 +122,7 @@ public class FallbackRecentsTest { .outerRule(new SamplerRule()) .around(new NavigationModeSwitchRule(mLauncher)) .around(new FailureWatcher(mLauncher, viewCaptureRule::getViewCaptureData)) - .around(viewCaptureRule) - .around(new ViewCaptureAnalysisRule(viewCaptureRule.getViewCapture())); + .around(viewCaptureRule); mOtherLauncherActivity = context.getPackageManager().queryIntentActivities( getHomeIntentInPackage(context), diff --git a/tests/Android.bp b/tests/Android.bp index d518a0ee53..e7f408487d 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -58,7 +58,6 @@ filegroup { "src/com/android/launcher3/util/rule/SimpleActivityRule.java", "src/com/android/launcher3/util/rule/TestStabilityRule.java", "src/com/android/launcher3/util/rule/TISBindRule.java", - "src/com/android/launcher3/util/rule/ViewCaptureAnalysisRule.java", "src/com/android/launcher3/testcomponent/BaseTestingActivity.java", "src/com/android/launcher3/testcomponent/OtherBaseTestingActivity.java", "src/com/android/launcher3/testcomponent/CustomShortcutConfigActivity.java", diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 1262a26338..969b329fd4 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -69,7 +69,6 @@ import com.android.launcher3.util.rule.SamplerRule; import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.TestStabilityRule; -import com.android.launcher3.util.rule.ViewCaptureAnalysisRule; import com.android.launcher3.util.rule.ViewCaptureRule; import org.junit.After; @@ -208,8 +207,7 @@ public abstract class AbstractLauncherUiTest { final RuleChain inner = RuleChain .outerRule(new PortraitLandscapeRunner(this)) .around(new FailureWatcher(mLauncher, viewCaptureRule::getViewCaptureData)) - .around(viewCaptureRule) - .around(new ViewCaptureAnalysisRule(viewCaptureRule.getViewCapture())); + .around(viewCaptureRule); return TestHelpers.isInLauncherProcess() ? RuleChain.outerRule(ShellCommandRule.setDefaultLauncher()).around(inner) diff --git a/tests/src/com/android/launcher3/util/rule/ViewCaptureAnalysisRule.java b/tests/src/com/android/launcher3/util/rule/ViewCaptureAnalysisRule.java deleted file mode 100644 index 702757f0e2..0000000000 --- a/tests/src/com/android/launcher3/util/rule/ViewCaptureAnalysisRule.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2023 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.util.rule; - -import androidx.annotation.NonNull; -import androidx.test.InstrumentationRegistry; - -import com.android.app.viewcapture.ViewCapture; -import com.android.app.viewcapture.data.ExportedData; - -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; - -import java.util.concurrent.ExecutionException; - -/** - * After the test succeeds, the rule looks for anomalies in the data accumulated by ViewCapture - * that's passed as a parameter. If anomalies are detected, throws an exception and fails the test. - */ -public class ViewCaptureAnalysisRule extends TestWatcher { - @NonNull - private final ViewCapture mViewCapture; - - public ViewCaptureAnalysisRule(@NonNull ViewCapture viewCapture) { - mViewCapture = viewCapture; - } - - @Override - protected void succeeded(Description description) { - super.succeeded(description); - try { - analyzeViewCaptureData(mViewCapture.getExportedData( - InstrumentationRegistry.getTargetContext())); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } catch (ExecutionException e) { - throw new RuntimeException(e); - } - } - - private static void analyzeViewCaptureData(ExportedData viewCaptureData) { - } -} diff --git a/tests/src/com/android/launcher3/util/rule/ViewCaptureRule.kt b/tests/src/com/android/launcher3/util/rule/ViewCaptureRule.kt index 6c065026b4..8e2aea8ff0 100644 --- a/tests/src/com/android/launcher3/util/rule/ViewCaptureRule.kt +++ b/tests/src/com/android/launcher3/util/rule/ViewCaptureRule.kt @@ -36,7 +36,7 @@ import org.junit.runners.model.Statement * This rule will not work in OOP tests that don't have access to the activity under test. */ class ViewCaptureRule(var alreadyOpenActivitySupplier: Supplier) : TestRule { - val viewCapture = SimpleViewCapture("test-view-capture") + private val viewCapture = SimpleViewCapture("test-view-capture") var viewCaptureData: ExportedData? = null private set From 0b767c91b592f21ee11a22016f4cc922762e3d4b Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 27 Jun 2023 14:34:59 -0700 Subject: [PATCH 3/4] Use DisplayController.Info to determine if it's a tablet Fixes: 286942201 Test: N/A Change-Id: Iabcceaee45f885f1dd188d3ab9039ffd3a036a0e --- .../quickstep/RecentsAnimationDeviceState.java | 2 +- .../FallbackNavBarTouchController.java | 2 +- .../interaction/NavBarGestureHandler.java | 3 +-- .../android/quickstep/util/NavBarPosition.java | 18 ++++++------------ 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java index 7693e693d6..1448a523b0 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java @@ -239,7 +239,7 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener { public void onDisplayInfoChanged(Context context, Info info, int flags) { if ((flags & (CHANGE_ROTATION | CHANGE_NAVIGATION_MODE)) != 0) { mMode = info.navigationMode; - mNavBarPosition = new NavBarPosition(mContext, mMode, info); + mNavBarPosition = new NavBarPosition(mMode, info); if (mMode == NO_BUTTON) { mExclusionListener.register(); diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java b/quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java index 66f5c00860..8a87f63aaf 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackNavBarTouchController.java @@ -42,7 +42,7 @@ public class FallbackNavBarTouchController implements TouchController, mActivity = activity; NavigationMode sysUINavigationMode = DisplayController.getNavigationMode(mActivity); if (sysUINavigationMode == NavigationMode.NO_BUTTON) { - NavBarPosition navBarPosition = new NavBarPosition(mActivity, sysUINavigationMode, + NavBarPosition navBarPosition = new NavBarPosition(sysUINavigationMode, DisplayController.INSTANCE.get(mActivity).getInfo()); mTriggerSwipeUpTracker = new TriggerSwipeUpTouchTracker(mActivity, true /* disableHorizontalSwipe */, navBarPosition, diff --git a/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java b/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java index 63e41d54fb..c4a2216251 100644 --- a/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java +++ b/quickstep/src/com/android/quickstep/interaction/NavBarGestureHandler.java @@ -60,12 +60,11 @@ public class NavBarGestureHandler implements OnTouchListener, NavBarGestureHandler(Context context) { mContext = context; DisplayController.Info displayInfo = DisplayController.INSTANCE.get(mContext).getInfo(); - final int displayRotation = displayInfo.rotation; Point currentSize = displayInfo.currentSize; mDisplaySize.set(currentSize.x, currentSize.y); mSwipeUpTouchTracker = new TriggerSwipeUpTouchTracker(context, true /*disableHorizontalSwipe*/, - new NavBarPosition(mContext, NavigationMode.NO_BUTTON, displayRotation), + new NavBarPosition(NavigationMode.NO_BUTTON, displayInfo), null /*onInterceptTouch*/, this); mMotionPauseDetector = new MotionPauseDetector(context); diff --git a/quickstep/src/com/android/quickstep/util/NavBarPosition.java b/quickstep/src/com/android/quickstep/util/NavBarPosition.java index a89e7e3e51..94185120b4 100644 --- a/quickstep/src/com/android/quickstep/util/NavBarPosition.java +++ b/quickstep/src/com/android/quickstep/util/NavBarPosition.java @@ -16,9 +16,7 @@ package com.android.quickstep.util; import static com.android.launcher3.util.NavigationMode.NO_BUTTON; -import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen; -import android.content.Context; import android.view.Surface; import com.android.launcher3.util.DisplayController.Info; @@ -29,26 +27,22 @@ import com.android.launcher3.util.NavigationMode; */ public class NavBarPosition { - private final boolean mIsLargeScreen; + private final boolean mIsTablet; private final NavigationMode mMode; private final int mDisplayRotation; - public NavBarPosition(Context context, NavigationMode mode, Info info) { - this(context, mode, info.rotation); - } - - public NavBarPosition(Context context, NavigationMode mode, int displayRotation) { - mIsLargeScreen = isLargeScreen(context); + public NavBarPosition(NavigationMode mode, Info info) { + mIsTablet = info.isTablet(info.realBounds); mMode = mode; - mDisplayRotation = displayRotation; + mDisplayRotation = info.rotation; } public boolean isRightEdge() { - return mMode != NO_BUTTON && mDisplayRotation == Surface.ROTATION_90 && !mIsLargeScreen; + return mMode != NO_BUTTON && mDisplayRotation == Surface.ROTATION_90 && !mIsTablet; } public boolean isLeftEdge() { - return mMode != NO_BUTTON && mDisplayRotation == Surface.ROTATION_270 && !mIsLargeScreen; + return mMode != NO_BUTTON && mDisplayRotation == Surface.ROTATION_270 && !mIsTablet; } public float getRotation() { From 365105118220b218005225b038142273524877cc Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Tue, 27 Jun 2023 17:07:13 +0000 Subject: [PATCH 4/4] Polish home-key from split to pip transition Includes WINDOWING_MODE_MULTI_WINDOW closing target to the condition of playing fallback animation. So the remaining splitting task won't be play with iconview animation when home-key to auto-pip consumed another splitting task in pip transition handler. Bug: 281476331 Test: repro steps of the bug Test: pass existing tests Video: http://recall/-/fLARJNt42LVxc3tt86SneW/eelqATeE1REoOtOEDxeDVR Change-Id: If05d8841a6a940e61f71683422ef1a3d4e3597c7 --- .../launcher3/QuickstepTransitionManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index e5fd605904..a4a5b63833 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -18,6 +18,7 @@ package com.android.launcher3; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; +import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.RemoteAnimationTarget.MODE_OPENING; @@ -1201,14 +1202,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener return false; } - private boolean hasMultipleTargetsWithMode(RemoteAnimationTarget[] targets, int mode) { + private boolean shouldPlayFallbackClosingAnimation(RemoteAnimationTarget[] targets) { int numTargets = 0; for (RemoteAnimationTarget target : targets) { - if (target.mode == mode) { + if (target.mode == MODE_CLOSING) { numTargets++; - } - if (numTargets > 1) { - return true; + if (numTargets > 1 || target.windowConfiguration.getWindowingMode() + == WINDOWING_MODE_MULTI_WINDOW) { + return true; + } } } return false; @@ -1595,7 +1597,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener boolean playFallBackAnimation = (launcherView == null && launcherIsForceInvisibleOrOpening) || mLauncher.getWorkspace().isOverlayShown() - || hasMultipleTargetsWithMode(appTargets, MODE_CLOSING); + || shouldPlayFallbackClosingAnimation(appTargets); boolean playWorkspaceReveal = true; boolean skipAllAppsScale = false;