Expose ActivityOptions#isShareIdentityEnabled API

Android U introduced new APIs to allow a launching app to share its
identity with a launched activity. This commit exposes a new API
in ActivityOptions to return whether a launching app has opted-in to
sharing its identity from an instance of ActivityOptions.

Bug: 262712655
Test: atest ShareIdentityTest
Change-Id: I6f77ed7151baa3ca572ef58a1867a91c98403a97
This commit is contained in:
Michael Groover
2022-12-19 18:03:06 -06:00
parent 9e5f119429
commit a1fba70f4f
3 changed files with 5 additions and 4 deletions

View File

@@ -4611,6 +4611,7 @@ package android.app {
method public boolean getLockTaskMode();
method public int getSplashScreenStyle();
method public boolean isPendingIntentBackgroundActivityLaunchAllowed();
method public boolean isShareIdentityEnabled();
method public static android.app.ActivityOptions makeBasic();
method public static android.app.ActivityOptions makeClipRevealAnimation(android.view.View, int, int, int, int);
method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);

View File

@@ -1499,13 +1499,13 @@ public class ActivityOptions extends ComponentOptions {
* Returns whether the launching app has opted-in to sharing its identity with the launched
* activity.
*
* @return {@code true} if the launching app has opted-in to sharing its identity
*
* @see #setShareIdentityEnabled(boolean)
* @see Activity#getLaunchedFromUid()
* @see Activity#getLaunchedFromPackage()
*
* @hide
*/
public boolean getShareIdentity() {
public boolean isShareIdentityEnabled() {
return mShareIdentity;
}

View File

@@ -2003,7 +2003,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
mOverrideTaskTransition = options.getOverrideTaskTransition();
mDismissKeyguard = options.getDismissKeyguard();
mShareIdentity = options.getShareIdentity();
mShareIdentity = options.isShareIdentityEnabled();
}
ColorDisplayService.ColorDisplayServiceInternal cds = LocalServices.getService(