PiP: Start PiP settings as current user.

Previously since PipMenuActivity was started as current user, starting
the new settings activity as the same user works. However now that
Settings activity starts from SysUI directly (which would be SysUI's
primary user), that no longer works - we need to now be explicit about
using current user again.

Bug: 166468109
Test: Enter PIP, press settings gear icon - Settings open
Change-Id: Iaf257405a38d026ff576e747a6a443ab9e4dd8b5
This commit is contained in:
Ben Lin
2020-09-09 13:02:44 -07:00
parent 932d71679f
commit ec084c6e91

View File

@@ -475,12 +475,10 @@ public class PipMenuView extends FrameLayout {
final Pair<ComponentName, Integer> topPipActivityInfo =
PipUtils.getTopPipActivity(mContext, ActivityManager.getService());
if (topPipActivityInfo.first != null) {
final UserHandle user = UserHandle.of(topPipActivityInfo.second);
final Intent settingsIntent = new Intent(ACTION_PICTURE_IN_PICTURE_SETTINGS,
Uri.fromParts("package", topPipActivityInfo.first.getPackageName(), null));
settingsIntent.putExtra(Intent.EXTRA_USER_HANDLE, user);
settingsIntent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
mContext.startActivity(settingsIntent);
mContext.startActivityAsUser(settingsIntent, UserHandle.CURRENT);
}
}