Fix shared transitions from work profile

We need to start the fade animation (and prevent the initial
ACTION_CLOSE_SYSTEM_DIALOGS broadcast from dismissing the
screenshot UI).

Flag: SCREENSHOT_WORK_PROFILE_POLICY
Bug: 254518387
Test: manual (visual change; observed that UI fades out as expected
when SCREENSHOT_WORK_PROFILE_POLICY flag is on)

Change-Id: I69e7cd94bf621a28ec2ceb3586db0b80a65278e3
This commit is contained in:
Miranda Kephart
2022-10-19 15:13:01 -04:00
parent 693d0a4131
commit 1aef4a20e6

View File

@@ -767,7 +767,9 @@ public class ScreenshotView extends FrameLayout implements
mShareChip.setOnClickListener(v -> {
mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_SHARE_TAPPED, 0, mPackageName);
if (mFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) {
mActionExecutor.launchIntentAsync(ActionIntentCreator.INSTANCE.createShareIntent(
prepareSharedTransition();
mActionExecutor.launchIntentAsync(
ActionIntentCreator.INSTANCE.createShareIntent(
imageData.uri, imageData.subject),
imageData.shareTransition.get().bundle,
imageData.owner.getIdentifier(), false);
@@ -778,6 +780,7 @@ public class ScreenshotView extends FrameLayout implements
mEditChip.setOnClickListener(v -> {
mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_EDIT_TAPPED, 0, mPackageName);
if (mFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) {
prepareSharedTransition();
mActionExecutor.launchIntentAsync(
ActionIntentCreator.INSTANCE.createEditIntent(imageData.uri, mContext),
imageData.editTransition.get().bundle,
@@ -789,6 +792,7 @@ public class ScreenshotView extends FrameLayout implements
mScreenshotPreview.setOnClickListener(v -> {
mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_PREVIEW_TAPPED, 0, mPackageName);
if (mFlags.isEnabled(Flags.SCREENSHOT_WORK_PROFILE_POLICY)) {
prepareSharedTransition();
mActionExecutor.launchIntentAsync(
ActionIntentCreator.INSTANCE.createEditIntent(imageData.uri, mContext),
imageData.editTransition.get().bundle,
@@ -1064,6 +1068,12 @@ public class ScreenshotView extends FrameLayout implements
}
}
private void prepareSharedTransition() {
mPendingSharedTransition = true;
// fade out non-preview UI
createScreenshotFadeDismissAnimation().start();
}
ValueAnimator createScreenshotFadeDismissAnimation() {
ValueAnimator alphaAnim = ValueAnimator.ofFloat(0, 1);
alphaAnim.addUpdateListener(animation -> {