Merge "Fix no cross-profile thumbnail animation" into tm-qpr-dev am: 95264856d1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19574870 Change-Id: Iec3cf22fa0af018960c27fc1a257854fafa3b2f8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -119,6 +119,12 @@ public final class TransitionInfo implements Parcelable {
|
||||
/** The container is going to show IME on its task after the transition. */
|
||||
public static final int FLAG_WILL_IME_SHOWN = 1 << 11;
|
||||
|
||||
/** The container attaches owner profile thumbnail for cross profile animation. */
|
||||
public static final int FLAG_CROSS_PROFILE_OWNER_THUMBNAIL = 1 << 12;
|
||||
|
||||
/** The container attaches work profile thumbnail for cross profile animation. */
|
||||
public static final int FLAG_CROSS_PROFILE_WORK_THUMBNAIL = 1 << 13;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "FLAG_" }, value = {
|
||||
FLAG_NONE,
|
||||
@@ -508,6 +514,11 @@ public final class TransitionInfo implements Parcelable {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
/** Whether the given change flags has included in this change. */
|
||||
public boolean hasFlags(@ChangeFlags int flags) {
|
||||
return (mFlags & flags) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bounds of the container before the change. It may be empty if the container
|
||||
* is coming into existence.
|
||||
|
||||
@@ -44,6 +44,8 @@ import static android.view.WindowManager.TRANSIT_RELAUNCH;
|
||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
import static android.view.WindowManager.transitTypeToString;
|
||||
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL;
|
||||
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL;
|
||||
import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS;
|
||||
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
|
||||
import static android.window.TransitionInfo.FLAG_IS_VOICE_INTERACTION;
|
||||
@@ -903,11 +905,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
private void attachThumbnail(@NonNull ArrayList<Animator> animations,
|
||||
@NonNull Runnable finishCallback, TransitionInfo.Change change,
|
||||
TransitionInfo.AnimationOptions options, float cornerRadius) {
|
||||
final boolean isTask = change.getTaskInfo() != null;
|
||||
final boolean isOpen = Transitions.isOpeningType(change.getMode());
|
||||
final boolean isClose = Transitions.isClosingType(change.getMode());
|
||||
if (isOpen) {
|
||||
if (options.getType() == ANIM_OPEN_CROSS_PROFILE_APPS && isTask) {
|
||||
if (options.getType() == ANIM_OPEN_CROSS_PROFILE_APPS) {
|
||||
attachCrossProfileThumbnailAnimation(animations, finishCallback, change,
|
||||
cornerRadius);
|
||||
} else if (options.getType() == ANIM_THUMBNAIL_SCALE_UP) {
|
||||
@@ -922,8 +923,13 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
||||
@NonNull Runnable finishCallback, TransitionInfo.Change change, float cornerRadius) {
|
||||
final Rect bounds = change.getEndAbsBounds();
|
||||
// Show the right drawable depending on the user we're transitioning to.
|
||||
final Drawable thumbnailDrawable = change.getTaskInfo().userId == mCurrentUserId
|
||||
? mContext.getDrawable(R.drawable.ic_account_circle) : mEnterpriseThumbnailDrawable;
|
||||
final Drawable thumbnailDrawable = change.hasFlags(FLAG_CROSS_PROFILE_OWNER_THUMBNAIL)
|
||||
? mContext.getDrawable(R.drawable.ic_account_circle)
|
||||
: change.hasFlags(FLAG_CROSS_PROFILE_WORK_THUMBNAIL)
|
||||
? mEnterpriseThumbnailDrawable : null;
|
||||
if (thumbnailDrawable == null) {
|
||||
return;
|
||||
}
|
||||
final HardwareBuffer thumbnail = mTransitionAnimation.createCrossProfileAppsThumbnail(
|
||||
thumbnailDrawable, bounds);
|
||||
if (thumbnail == null) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityOptions.ANIM_OPEN_CROSS_PROFILE_APPS;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
@@ -887,6 +888,19 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
||||
transaction);
|
||||
if (mOverrideOptions != null) {
|
||||
info.setAnimationOptions(mOverrideOptions);
|
||||
if (mOverrideOptions.getType() == ANIM_OPEN_CROSS_PROFILE_APPS) {
|
||||
for (int i = 0; i < mTargets.size(); ++i) {
|
||||
final TransitionInfo.Change c = info.getChanges().get(i);
|
||||
final ActivityRecord ar = mTargets.get(i).asActivityRecord();
|
||||
if (ar == null || c.getMode() != TRANSIT_OPEN) continue;
|
||||
int flags = c.getFlags();
|
||||
flags |= ar.mUserId == ar.mWmService.mCurrentUserId
|
||||
? TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL
|
||||
: TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL;
|
||||
c.setFlags(flags);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/188669821): Move to animation impl in shell.
|
||||
|
||||
Reference in New Issue
Block a user