From 017bbc098a18ff0e52e078f3b0c86ecaf3f9d44e Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 23 Sep 2022 14:14:52 -0700 Subject: [PATCH 1/2] Don't moveToRestState from onTaskAppeared There's a possible race here where we call moveToRestState before Launcher is actually stopped, so it starts to animate the state change, causing a visual jump before it gets stopped. We already call moveToRestState in StatefulActivity#onStop, so this one shouldn't be necessary anyway. Test: Enable Winscope tracing, quick switch from app A to app B; before this change, 9/10 times it would repro the jump in the bug, 0/10 times after this fix. (Also verified through debug logging.) Fixes: 244583136 Change-Id: I656b028f26a64f872960cb3fe87c39b097431511 --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 1 - .../src/com/android/quickstep/BaseActivityInterface.java | 8 -------- 2 files changed, 9 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 24bb393f0f..7ae2ae8a18 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -2070,7 +2070,6 @@ public abstract class AbsSwipeUpHandler, if (handleTaskAppeared(appearedTaskTargets)) { mRecentsAnimationController.finish(false /* toRecents */, null /* onFinishComplete */); - mActivityInterface.onLaunchTaskSuccess(); ActiveGestureLog.INSTANCE.addLog( /* event= */ "finishRecentsAnimation", /* extras= */ false, diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 315a91e0a1..226b173ecd 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -183,14 +183,6 @@ public abstract class BaseActivityInterface Date: Fri, 16 Sep 2022 17:30:44 -0700 Subject: [PATCH 2/2] Reduces search clipping when work profile is not present. Basically, adds the spacing that is otherwise included by the tab protection (which is about 4dp less than the spacing that was previously being added). Adds a compile-time flag to render the header at all times to help visualize issues like this in the future. Check the screenshots below to see some examples of this. Screenshots: https://drive.google.com/drive/folders/1n4wwtjMwOR-eDIE1xAoG3oLXO7txpoT_?resourcekey=0-WP0RNbp7vFh2Yw1wUBZTaA&usp=sharing Bug: 240672593 Bug: 243728487 Test: Manually checked search transition, scrolling behavior, and highlight of the search results with and without a work profile. Change-Id: I166d136e568c5621c81378fa09021666d95f0ffc --- .../allapps/BaseAllAppsContainerView.java | 28 +++++++++++++------ .../launcher3/allapps/FloatingHeaderView.java | 11 ++++++-- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index 3983f40de0..f08254204e 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -88,6 +88,9 @@ public abstract class BaseAllAppsContainerView 0 && tabsHeight != 0) { - mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha)); + if (DEBUG_HEADER_PROTECTION) { + mHeaderPaint.setColor(Color.BLUE); + mHeaderPaint.setAlpha(255); + } else { + mHeaderPaint.setAlpha((int) (getAlpha() * mTabsProtectionAlpha)); + } canvas.drawRect(0, bottom, canvas.getWidth(), bottom + tabsHeight, mHeaderPaint); } } diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 1ef54984ef..1cbb0f9481 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -277,7 +277,7 @@ public class FloatingHeaderView extends LinearLayout implements } } - public int getMaxTranslation() { + int getMaxTranslation() { if (mMaxTranslation == 0 && (mTabsHidden || mFloatingRowsCollapsed)) { return getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_bottom_padding); } else if (mMaxTranslation > 0 && mTabsHidden) { @@ -334,7 +334,8 @@ public class FloatingHeaderView extends LinearLayout implements int clipTop = getPaddingTop() - mTabsAdditionalPaddingTop; if (mTabsHidden) { - clipTop += getPaddingBottom() - mTabsAdditionalPaddingBottom; + // Add back spacing that is otherwise covered by the tabs. + clipTop += mTabsAdditionalPaddingTop; } mRVClip.top = mTabsHidden || mFloatingRowsCollapsed ? clipTop : 0; mHeaderClip.top = clipTop; @@ -405,6 +406,10 @@ public class FloatingHeaderView extends LinearLayout implements return mFloatingRowsHeight; } + int getTabsAdditionalPaddingTop() { + return mTabsAdditionalPaddingTop; + } + int getTabsAdditionalPaddingBottom() { return mTabsAdditionalPaddingBottom; } @@ -473,7 +478,7 @@ public class FloatingHeaderView extends LinearLayout implements /** * Returns visible height of FloatingHeaderView contents requiring header protection */ - public int getPeripheralProtectionHeight() { + int getPeripheralProtectionHeight() { if (!mHeaderProtectionSupported) { return 0; }