Merge "[Multiple Users] Start activity as system user." into tm-dev
This commit is contained in:
@@ -1707,7 +1707,7 @@ public class CentralSurfaces extends CoreStartable implements
|
|||||||
@Nullable ActivityLaunchAnimator.Controller animationController,
|
@Nullable ActivityLaunchAnimator.Controller animationController,
|
||||||
boolean showOverLockscreenWhenLocked) {
|
boolean showOverLockscreenWhenLocked) {
|
||||||
startActivity(intent, dismissShade, animationController, showOverLockscreenWhenLocked,
|
startActivity(intent, dismissShade, animationController, showOverLockscreenWhenLocked,
|
||||||
UserHandle.CURRENT);
|
getActivityUserHandle(intent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1794,7 +1794,7 @@ public class CentralSurfaces extends CoreStartable implements
|
|||||||
public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
|
public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
|
||||||
startActivityDismissingKeyguard(intent, false, dismissShade,
|
startActivityDismissingKeyguard(intent, false, dismissShade,
|
||||||
false /* disallowEnterPictureInPictureWhileLaunching */, callback, 0,
|
false /* disallowEnterPictureInPictureWhileLaunching */, callback, 0,
|
||||||
null /* animationController */, UserHandle.CURRENT);
|
null /* animationController */, getActivityUserHandle(intent));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQsExpanded(boolean expanded) {
|
public void setQsExpanded(boolean expanded) {
|
||||||
@@ -2424,7 +2424,7 @@ public class CentralSurfaces extends CoreStartable implements
|
|||||||
boolean dismissShade, int flags) {
|
boolean dismissShade, int flags) {
|
||||||
startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
|
startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
|
||||||
false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
|
false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
|
||||||
flags, null /* animationController */, UserHandle.CURRENT);
|
flags, null /* animationController */, getActivityUserHandle(intent));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
|
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
|
||||||
@@ -2867,7 +2867,7 @@ public class CentralSurfaces extends CoreStartable implements
|
|||||||
null /* callback */,
|
null /* callback */,
|
||||||
0 /* flags */,
|
0 /* flags */,
|
||||||
animationController,
|
animationController,
|
||||||
UserHandle.CURRENT),
|
getActivityUserHandle(intent)),
|
||||||
delay);
|
delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3601,7 +3601,8 @@ public class CentralSurfaces extends CoreStartable implements
|
|||||||
mLaunchEmergencyActionWhenFinishedWaking = false;
|
mLaunchEmergencyActionWhenFinishedWaking = false;
|
||||||
Intent emergencyIntent = getEmergencyActionIntent();
|
Intent emergencyIntent = getEmergencyActionIntent();
|
||||||
if (emergencyIntent != null) {
|
if (emergencyIntent != null) {
|
||||||
mContext.startActivityAsUser(emergencyIntent, UserHandle.CURRENT);
|
mContext.startActivityAsUser(emergencyIntent,
|
||||||
|
getActivityUserHandle(emergencyIntent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateScrimController();
|
updateScrimController();
|
||||||
@@ -4499,4 +4500,20 @@ public class CentralSurfaces extends CoreStartable implements
|
|||||||
@Override
|
@Override
|
||||||
public void dispatchDemoCommand(String command, Bundle args) { }
|
public void dispatchDemoCommand(String command, Bundle args) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines what UserHandle to use when launching an activity.
|
||||||
|
*
|
||||||
|
* We want to ensure that activities that are launched within the systemui process should be
|
||||||
|
* launched as user of the current process.
|
||||||
|
* @param intent
|
||||||
|
* @return UserHandle
|
||||||
|
*/
|
||||||
|
private UserHandle getActivityUserHandle(Intent intent) {
|
||||||
|
if (intent.getComponent() != null
|
||||||
|
&& mContext.getPackageName().equals(intent.getComponent().getPackageName())) {
|
||||||
|
return new UserHandle(UserHandle.myUserId());
|
||||||
|
}
|
||||||
|
return UserHandle.CURRENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user