mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Fix gray work apps when WorkPausedCard shoul've shown
The reason is because WorkManager doesn't reset when user searches (which is why the apps gray out when you go to toast, turn off work profile then back gesture to all apps) Added test for ActivityAllAppsContainerView that test onAppsUpdated() and check for if there are work apps. From the test environment, onAppsUpdated() needs to be public because the method is outside the package. However, I've wrapped onAppsUpdated package private so I can test it with a boolean parameter. bug: 298492729 test: video: before: https://drive.google.com/file/d/1D0VlGeJEI5lGbYgP5Tnu5UO_Dv61X8Dv/view?usp=sharing after: https://drive.google.com/file/d/1D0qsq7sX_kAp2t92xser7YI4ADBhQfHY/view?usp=sharing Change-Id: I4eb7cf21e273e29171fcd62a4762e8bb1778e720
This commit is contained in:
@@ -131,7 +131,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
protected final List<AdapterHolder> mAH;
|
||||
protected final Predicate<ItemInfo> mPersonalMatcher = ItemInfoMatcher.ofUser(
|
||||
Process.myUserHandle());
|
||||
protected final WorkProfileManager mWorkManager;
|
||||
protected WorkProfileManager mWorkManager;
|
||||
protected final Point mFastScrollerOffset = new Point();
|
||||
protected final int mScrimColor;
|
||||
protected final float mHeaderThreshold;
|
||||
@@ -966,13 +966,14 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
mBottomSheetAlpha = mActivityContext.getDeviceProfile().isTablet ? 1f : alpha;
|
||||
}
|
||||
|
||||
private void onAppsUpdated() {
|
||||
mHasWorkApps = Stream.of(mAllAppsStore.getApps()).anyMatch(mWorkManager.getMatcher());
|
||||
@VisibleForTesting
|
||||
public void onAppsUpdated() {
|
||||
mHasWorkApps = mWorkManager.hasWorkApps();
|
||||
if (!isSearching()) {
|
||||
rebindAdapters();
|
||||
if (mHasWorkApps) {
|
||||
mWorkManager.reset();
|
||||
}
|
||||
}
|
||||
if (mHasWorkApps) {
|
||||
mWorkManager.reset();
|
||||
}
|
||||
|
||||
mActivityContext.getStatsLogManager().logger()
|
||||
@@ -1216,6 +1217,11 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setWorkManager(WorkProfileManager workManager) {
|
||||
mWorkManager = workManager;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public boolean isPersonalTabVisible() {
|
||||
return isDescendantViewVisible(R.id.tab_personal);
|
||||
|
||||
Reference in New Issue
Block a user