[BUG] Fixes various Work Profile Related Issues #6167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lawnchair Improvements: Work Profile Fixes & Tab Customization
Overview
This PR includes multiple improvements to Lawnchair:
Part 1: Fix Work Profile Pause/Unpause Authentication
When using Lawnchair with work profiles (especially Motorola Secure Folder or similar private spaces), attempting to unpause work apps would trigger an authentication prompt requiring the device PIN/password. While the PIN can be skipped, this prompt is annoying and disrupts the user experience.
Additionally, the pause/unpause buttons were not visible due to overly strict permission checks that prevented the WorkModeSwitch from being attached.
Solution
1. Skip Authentication for Work Profile Unpause
requestQuietModeEnabled()with anullIntent (available on Android P+)2. Filter Private Spaces (Secure Folders)
TYPE_WORK)TYPE_PRIVATE) that require authentication by design3. Remove Overly Strict Permission Checks
FLAG_HAS_SHORTCUT_PERMISSIONandFLAG_QUIET_MODE_CHANGE_PERMISSIONrequestQuietModeEnabled()Changes
Modified
WorkProfileManager.setWorkProfileEnabled()to:mWorkProfileMatcherto only process work profilesrequestQuietModeEnabled(!enabled, userProfile, null)to skip authenticationrequestQuietModeEnabled(!enabled, userProfile)if neededModified
WorkProfileManager.attachWorkModeSwitch()to:Part 2: Fix Work Profile State Detection Bug
Problem
Sometimes when work profile was paused, the launcher would still show work app icons (grayed out) instead of showing the unpause card with hidden icons.

Root Cause
LoaderTask.loadAllApps()was using cached quiet mode state frommUserManagerState.isUserQuiet(user), but this cache was initialized earlier inqueryPinnedShortcutsForUnlockedUsers()and could become stale if the work profile state changed between initialization and app loading.The
updateUserQuietMode()method existed inUserManagerStatebut was never being called anywhere in the codebase.Solution
LoaderTask.loadAllApps()to queryUserManager.isQuietModeEnabled(user)directly for real-time statemUserManagerState.updateUserQuietMode()to keep the cached state synchronizedFLAG_WORK_PROFILE_QUIET_MODE_ENABLEDflag is set correctly based on current stateChanges
LoaderTask.loadAllApps():Part 3: Work/Personal Tab Customization Features
New Features
1. Tabs Background Color
2. Tab Container Background Toggle
Changes
workProfileTabBackgroundColorpreference inPreferenceManager2.ktworkProfileTabContainerBackgroundboolean preference inPreferenceManager2.ktDrawableTokens.AllAppsTabsBackgroundto use custom color from preferencesActivityAllAppsContainerView.updateHeaderScroll()to respect the toggle preferenceAppDrawerPreferences.ktTesting
Tested on Motorola device (Android 16) with: