@Implements(value=android.content.pm.CrossProfileApps.class, minSdk=28) public class ShadowCrossProfileApps extends Object
CrossProfileApps
.Modifier and Type | Class | Description |
---|---|---|
static class |
ShadowCrossProfileApps.StartedActivity |
Container object to hold parameters passed to
startMainActivity(ComponentName,
UserHandle) or startActivity(ComponentName, UserHandle) . |
static class |
ShadowCrossProfileApps.StartedMainActivity |
Deprecated.
Use
peekNextStartedActivity() and ShadowCrossProfileApps.StartedActivity instead. |
Constructor | Description |
---|---|
ShadowCrossProfileApps() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
__constructor__(Context context,
ICrossProfileApps service) |
|
void |
addTargetUserProfile(UserHandle userHandle) |
Adds
userHandle to the list of accessible handles. |
void |
clearNextStartedActivities() |
Clears all records of
ShadowCrossProfileApps.StartedActivity s from calls to CrossProfileApps.startActivity(ComponentName, UserHandle) or CrossProfileApps.startMainActivity(ComponentName, UserHandle) . |
void |
clearTargetUserProfiles() |
Clears the list of accessible handles.
|
ShadowCrossProfileApps.StartedActivity |
getNextStartedActivity() |
Consumes the most recent
ComponentName , UserHandle pair started by CrossProfileApps.startMainActivity(ComponentName, UserHandle) or CrossProfileApps.startActivity(ComponentName, UserHandle) , and returns it wrapped in ShadowCrossProfileApps.StartedActivity . |
protected Drawable |
getProfileSwitchingIconDrawable(UserHandle userHandle) |
Returns a
Drawable that can be shown for profile switching, which is guaranteed to
always be the same for a particular user and to be distinct between users. |
protected CharSequence |
getProfileSwitchingLabel(UserHandle userHandle) |
Returns a
CharSequence that can be shown as a label for profile switching, which is
guaranteed to always be the same for a particular user and to be distinct between users. |
protected List<UserHandle> |
getTargetUserProfiles() |
Returns a list of
UserHandle s currently accessible. |
ShadowCrossProfileApps.StartedActivity |
peekNextStartedActivity() |
Returns the most recent
ComponentName , UserHandle pair started by CrossProfileApps.startMainActivity(ComponentName, UserHandle) or CrossProfileApps.startActivity(ComponentName, UserHandle) , wrapped in ShadowCrossProfileApps.StartedActivity . |
ShadowCrossProfileApps.StartedMainActivity |
peekNextStartedMainActivity() |
Deprecated.
Use
peekNextStartedActivity() instead. |
void |
removeTargetUserProfile(UserHandle userHandle) |
Removes
userHandle from the list of accessible handles, if present. |
protected void |
startActivity(ComponentName componentName,
UserHandle targetUser) |
Simulates starting the activity specified in the specified profile, performing the same
security checks done by the real
CrossProfileApps . |
protected void |
startMainActivity(ComponentName componentName,
UserHandle targetUser) |
Simulates starting the main activity specified in the specified profile, performing the same
security checks done by the real
CrossProfileApps . |
protected void |
verifyHasInteractAcrossProfilesPermission() |
Ensure the current package has the permission to interact across profiles.
|
@Implementation protected void __constructor__(Context context, ICrossProfileApps service)
@Implementation protected List<UserHandle> getTargetUserProfiles()
UserHandle
s currently accessible. This list is populated from calls
to addTargetUserProfile(UserHandle)
.@Implementation protected Drawable getProfileSwitchingIconDrawable(UserHandle userHandle)
Drawable
that can be shown for profile switching, which is guaranteed to
always be the same for a particular user and to be distinct between users.@Implementation protected CharSequence getProfileSwitchingLabel(UserHandle userHandle)
CharSequence
that can be shown as a label for profile switching, which is
guaranteed to always be the same for a particular user and to be distinct between users.@Implementation protected void startMainActivity(ComponentName componentName, UserHandle targetUser)
CrossProfileApps
.
The most recent main activity started can be queried by peekNextStartedActivity()
()}.
@Implementation(minSdk=29) protected void startActivity(ComponentName componentName, UserHandle targetUser)
CrossProfileApps
.
The most recent main activity started can be queried by peekNextStartedActivity()
()}.
public void addTargetUserProfile(UserHandle userHandle)
userHandle
to the list of accessible handles.public void removeTargetUserProfile(UserHandle userHandle)
userHandle
from the list of accessible handles, if present.public void clearTargetUserProfiles()
@Nullable @Deprecated public ShadowCrossProfileApps.StartedMainActivity peekNextStartedMainActivity()
peekNextStartedActivity()
instead.ComponentName
, UserHandle
pair started by CrossProfileApps.startMainActivity(ComponentName, UserHandle)
, wrapped in ShadowCrossProfileApps.StartedMainActivity
.@Nullable public ShadowCrossProfileApps.StartedActivity peekNextStartedActivity()
ComponentName
, UserHandle
pair started by CrossProfileApps.startMainActivity(ComponentName, UserHandle)
or CrossProfileApps.startActivity(ComponentName, UserHandle)
, wrapped in ShadowCrossProfileApps.StartedActivity
.@Nullable public ShadowCrossProfileApps.StartedActivity getNextStartedActivity()
ComponentName
, UserHandle
pair started by CrossProfileApps.startMainActivity(ComponentName, UserHandle)
or CrossProfileApps.startActivity(ComponentName, UserHandle)
, and returns it wrapped in ShadowCrossProfileApps.StartedActivity
.public void clearNextStartedActivities()
ShadowCrossProfileApps.StartedActivity
s from calls to CrossProfileApps.startActivity(ComponentName, UserHandle)
or CrossProfileApps.startMainActivity(ComponentName, UserHandle)
.protected void verifyHasInteractAcrossProfilesPermission()