diff options
| author | 2023-02-20 10:18:51 +0000 | |
|---|---|---|
| committer | 2023-02-20 10:18:51 +0000 | |
| commit | 491db0add79b526fcb506c74268593e20147e93c (patch) | |
| tree | 24da6e930e73cdf0358cc133e6f190f68975d9b5 | |
| parent | fedd356d5c0a138d64d229e8f7bfe4cc7a729851 (diff) | |
| parent | 14dd80579a7b6cbe3f3425b259afe6dee4ad2f76 (diff) | |
Merge "Fixing tabOwnerUserHandle population." into udc-dev
| -rw-r--r-- | core/java/com/android/internal/app/ResolverActivity.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index d6a515ae2da2..73c5207e6238 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -739,6 +739,11 @@ public class ResolverActivity extends Activity implements } protected UserHandle fetchPersonalProfileUserHandle() { + // ActivityManager.getCurrentUser() refers to the current Foreground user. When clone/work + // profile is active, we always make the personal tab from the foreground user. + // Outside profiles, current foreground user is potentially the same as the sharesheet + // process's user (UserHandle.myUserId()), so we continue to create personal tab with the + // current foreground user. mPersonalProfileUserHandle = UserHandle.of(ActivityManager.getCurrentUser()); return mPersonalProfileUserHandle; } @@ -768,10 +773,11 @@ public class ResolverActivity extends Activity implements } private UserHandle fetchTabOwnerUserHandleForLaunch() { - if (isLaunchedAsCloneProfile()) { - return getPersonalProfileUserHandle(); - } - return mLaunchedFromUserHandle; + // If we are in work profile's process, return WorkProfile user as owner, otherwise we + // always return PersonalProfile user as owner + return UserHandle.of(UserHandle.myUserId()).equals(getWorkProfileUserHandle()) + ? getWorkProfileUserHandle() + : getPersonalProfileUserHandle(); } private boolean hasWorkProfile() { |