Skip to content

Commit

Permalink
DerpLauncher: Don't create work space for parallel users
Browse files Browse the repository at this point in the history
Parallel users also have badge so don't consider it as work profile.

Change-Id: I8b08f800b0178d3b4b09f2ab72d9de8b35cf1d64
  • Loading branch information
Dhina17 authored and NurKeinNeid committed Oct 17, 2024
1 parent 68acd88 commit 291e929
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/com/android/launcher3/util/ApiWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,20 @@ public Map<UserHandle, UserIconInfo> queryAllUsers() {
UserManager um = mContext.getSystemService(UserManager.class);
Map<UserHandle, UserIconInfo> users = new ArrayMap<>();
List<UserHandle> usersActual = um.getUserProfiles();
usersActual.addAll(ParallelSpaceManager.getInstance().getParallelUserHandles());
List<UserHandle> parallelUsers =
ParallelSpaceManager.getInstance().getParallelUserHandles();
usersActual.addAll(parallelUsers);
if (usersActual != null) {
for (UserHandle user : usersActual) {
long serial = um.getSerialNumberForUser(user);

// Simple check to check if the provided user is work profile
// TODO: Migrate to a better platform API
NoopDrawable d = new NoopDrawable();
boolean isWork = (d != mContext.getPackageManager().getUserBadgedIcon(d, user));
// Parallel users also have badge so don't consider it as work profile
boolean isParallelUser = parallelUsers.contains(user);
boolean isWork = !isParallelUser &&
(d != mContext.getPackageManager().getUserBadgedIcon(d, user));
UserIconInfo info = new UserIconInfo(
user,
isWork ? UserIconInfo.TYPE_WORK : UserIconInfo.TYPE_MAIN,
Expand Down

0 comments on commit 291e929

Please sign in to comment.