Merge "Prompting the user to set Pixel/Quickstep as default Home app." into main

This commit is contained in:
Himanshu Gupta authored and Android (Google) Code Review committed 2024-06-12 21:13:19 +00:00
commit cf3a0ef2f0
7 files changed
+113 -7

No files matched your search

@@ -281,10 +281,28 @@ public class PrivateProfileManager extends UserProfileManager {
@Override
public void setQuietMode(boolean enable) {
super.setQuietMode(enable);
UI_HELPER_EXECUTOR.post(() ->
mUserCache.getUserProfiles()
.stream()
.filter(getUserMatcher())
.findFirst()
.ifPresent(userHandle -> setQuietModeSafely(enable, userHandle)));
mReadyToAnimate = true;
}
/**
* Sets Quiet Mode for Private Profile.
* If {@link SecurityException} is thrown, prompts the user to set this launcher as HOME app.
*/
private void setQuietModeSafely(boolean enable, UserHandle userHandle) {
try {
mUserManager.requestQuietModeEnabled(enable, userHandle);
} catch (SecurityException ex) {
ApiWrapper.INSTANCE.get(mAllApps.mActivityContext)
.assignDefaultHomeRole(mAllApps.mActivityContext);
}
}
/**
* Expand the private space after the app list has been added and updated from
* {@link AlphabeticalAppsList#onAppsUpdated()}
@@ -55,12 +55,11 @@ public abstract class UserProfileManager {
public @interface UserProfileState { }
protected final StatsLogManager mStatsLogManager;
protected final UserManager mUserManager;
protected final UserCache mUserCache;
@UserProfileState
private int mCurrentState;
private final UserManager mUserManager;
private final UserCache mUserCache;
protected UserProfileManager(UserManager userManager,
StatsLogManager statsLogManager,
UserCache userCache) {