From d63336846511ae207e7bc3b06762686c800e73ef Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Fri, 18 Oct 2024 13:36:59 -0700 Subject: [PATCH] Call invalidate() during updateView() for updating the header. This issue is triggered due to onAppsUpdated() randomly due to app installing/uninstalling/updating/archiving. Eventually onBind() is called but logs shows evidence that the state is correct (even though it doesn't reflect that), hence invalidating will fix this issue. We can't call notifyItemChange() in updateView() since updateView() can be part of onBind() in which case means this is part of a scrolling gesture. notifyItemChange() via adapter index will also not work in reset() since doing so will mess up upon animation. bug: 373345958 Test: manual/presubmit Flag: NONE invalidating when updateView() is called Change-Id: Ibc99cc70562575cadf035136e50e9e5eec1e70ea --- src/com/android/launcher3/allapps/PrivateProfileManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/PrivateProfileManager.java b/src/com/android/launcher3/allapps/PrivateProfileManager.java index 6a401215f1..fe79f8d874 100644 --- a/src/com/android/launcher3/allapps/PrivateProfileManager.java +++ b/src/com/android/launcher3/allapps/PrivateProfileManager.java @@ -220,7 +220,7 @@ public class PrivateProfileManager extends UserProfileManager { * when animation is not running. */ public void reset() { - // Ensure the state of the header views is what it should be before animating. + // Ensure the state of the header view is what it should be before animating. updateView(); getMainRecyclerView().setChildAttachedConsumer(null); int previousState = getCurrentState(); @@ -435,6 +435,7 @@ public class PrivateProfileManager extends UserProfileManager { lockPill.setVisibility(GONE); } } + mPSHeader.invalidate(); } /** Sets the enablement of the profile when header or button is clicked. */