Merge "Fixing tabOwnerUserHandle population." into udc-dev am: 491db0add7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21465730

Change-Id: Ia433bd1dff81c498c2251c3d728806c22f0e0831
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Himanshu Gupta
2023-02-20 10:33:56 +00:00
committed by Automerger Merge Worker

View File

@@ -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() {