Use display cutout info in auto-enter-pip transition
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/bpKcGg1eoOo5Jz5U6IwBYK Bug: 191310680 Test: manual, auto-enter-pip from landscape with source rect hint being turned on, see the video Change-Id: Ic191fc73597132a5119522dda477a4319e35d1c8
This commit is contained in:
@@ -115,7 +115,6 @@ import com.android.systemui.shared.system.InputConsumerController;
|
|||||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||||
import com.android.systemui.shared.system.LatencyTrackerCompat;
|
import com.android.systemui.shared.system.LatencyTrackerCompat;
|
||||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||||
import com.android.systemui.shared.system.TaskInfoCompat;
|
|
||||||
import com.android.systemui.shared.system.TaskStackChangeListener;
|
import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||||
|
|
||||||
@@ -1110,7 +1109,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
|
public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
|
||||||
boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
|
boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
|
||||||
if (task.taskId == mGestureState.getRunningTaskId()
|
if (task.taskId == mGestureState.getRunningTaskId()
|
||||||
&& TaskInfoCompat.getActivityType(task) != ACTIVITY_TYPE_HOME) {
|
&& task.configuration.windowConfiguration.getActivityType()
|
||||||
|
!= ACTIVITY_TYPE_HOME) {
|
||||||
// Since this is an edge case, just cancel and relaunch with default activity
|
// Since this is an edge case, just cancel and relaunch with default activity
|
||||||
// options (since we don't know if there's an associated app icon to launch from)
|
// options (since we don't know if there's an associated app icon to launch from)
|
||||||
endRunningWindowAnim(true /* cancel */);
|
endRunningWindowAnim(true /* cancel */);
|
||||||
@@ -1152,8 +1152,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
boolean appCanEnterPip = !mDeviceState.isPipActive()
|
boolean appCanEnterPip = !mDeviceState.isPipActive()
|
||||||
&& runningTaskTarget != null
|
&& runningTaskTarget != null
|
||||||
&& runningTaskTarget.taskInfo.pictureInPictureParams != null
|
&& runningTaskTarget.taskInfo.pictureInPictureParams != null
|
||||||
&& TaskInfoCompat.isAutoEnterPipEnabled(
|
&& runningTaskTarget.taskInfo.pictureInPictureParams.isAutoEnterEnabled();
|
||||||
runningTaskTarget.taskInfo.pictureInPictureParams);
|
|
||||||
HomeAnimationFactory homeAnimFactory =
|
HomeAnimationFactory homeAnimFactory =
|
||||||
createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip,
|
createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip,
|
||||||
runningTaskTarget);
|
runningTaskTarget);
|
||||||
@@ -1254,7 +1253,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
|
|
||||||
final Rect destinationBounds = SystemUiProxy.INSTANCE.get(mContext)
|
final Rect destinationBounds = SystemUiProxy.INSTANCE.get(mContext)
|
||||||
.startSwipePipToHome(taskInfo.topActivity,
|
.startSwipePipToHome(taskInfo.topActivity,
|
||||||
TaskInfoCompat.getTopActivityInfo(taskInfo),
|
taskInfo.topActivityInfo,
|
||||||
runningTaskTarget.taskInfo.pictureInPictureParams,
|
runningTaskTarget.taskInfo.pictureInPictureParams,
|
||||||
homeRotation,
|
homeRotation,
|
||||||
mDp.hotseatBarSizePx);
|
mDp.hotseatBarSizePx);
|
||||||
@@ -1263,9 +1262,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
.setTaskId(runningTaskTarget.taskId)
|
.setTaskId(runningTaskTarget.taskId)
|
||||||
.setComponentName(taskInfo.topActivity)
|
.setComponentName(taskInfo.topActivity)
|
||||||
.setLeash(runningTaskTarget.leash.getSurfaceControl())
|
.setLeash(runningTaskTarget.leash.getSurfaceControl())
|
||||||
.setSourceRectHint(TaskInfoCompat.getPipSourceRectHint(
|
.setSourceRectHint(
|
||||||
runningTaskTarget.taskInfo.pictureInPictureParams))
|
runningTaskTarget.taskInfo.pictureInPictureParams.getSourceRectHint())
|
||||||
.setAppBounds(TaskInfoCompat.getWindowConfigurationBounds(taskInfo))
|
.setAppBounds(taskInfo.configuration.windowConfiguration.getBounds())
|
||||||
.setHomeToWindowPositionMap(homeToWindowPositionMap)
|
.setHomeToWindowPositionMap(homeToWindowPositionMap)
|
||||||
.setStartBounds(startRect)
|
.setStartBounds(startRect)
|
||||||
.setDestinationBounds(destinationBounds)
|
.setDestinationBounds(destinationBounds)
|
||||||
@@ -1275,7 +1274,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
// is not ROTATION_0 (which implies the rotation is turned on in launcher settings).
|
// is not ROTATION_0 (which implies the rotation is turned on in launcher settings).
|
||||||
if (homeRotation == ROTATION_0
|
if (homeRotation == ROTATION_0
|
||||||
&& (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) {
|
&& (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) {
|
||||||
builder.setFromRotation(mTaskViewSimulator, windowRotation);
|
builder.setFromRotation(mTaskViewSimulator, windowRotation,
|
||||||
|
taskInfo.displayCutoutInsets);
|
||||||
}
|
}
|
||||||
final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build();
|
final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build();
|
||||||
AnimatorPlaybackController activityAnimationToHome =
|
AnimatorPlaybackController activityAnimationToHome =
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import android.content.Intent;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||||
import com.android.systemui.shared.system.TaskInfoCompat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for interacting with the Assistant.
|
* Utility class for interacting with the Assistant.
|
||||||
@@ -39,7 +38,7 @@ public final class AssistantUtilities {
|
|||||||
/** Returns true if the given task holds an Assistant activity that is excluded from recents. */
|
/** Returns true if the given task holds an Assistant activity that is excluded from recents. */
|
||||||
public static boolean isExcludedAssistant(TaskInfo info) {
|
public static boolean isExcludedAssistant(TaskInfo info) {
|
||||||
return info != null
|
return info != null
|
||||||
&& TaskInfoCompat.getActivityType(info) == ACTIVITY_TYPE_ASSISTANT
|
&& info.configuration.windowConfiguration.getActivityType() == ACTIVITY_TYPE_ASSISTANT
|
||||||
&& (info.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
|
&& (info.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
|
|||||||
private ComponentName mComponentName;
|
private ComponentName mComponentName;
|
||||||
private SurfaceControl mLeash;
|
private SurfaceControl mLeash;
|
||||||
private Rect mSourceRectHint;
|
private Rect mSourceRectHint;
|
||||||
|
private Rect mDisplayCutoutInsets;
|
||||||
private Rect mAppBounds;
|
private Rect mAppBounds;
|
||||||
private Matrix mHomeToWindowPositionMap;
|
private Matrix mHomeToWindowPositionMap;
|
||||||
private RectF mStartBounds;
|
private RectF mStartBounds;
|
||||||
@@ -366,7 +367,8 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Builder setFromRotation(TaskViewSimulator taskViewSimulator,
|
public Builder setFromRotation(TaskViewSimulator taskViewSimulator,
|
||||||
@RecentsOrientedState.SurfaceRotation int fromRotation) {
|
@RecentsOrientedState.SurfaceRotation int fromRotation,
|
||||||
|
Rect displayCutoutInsets) {
|
||||||
if (fromRotation != Surface.ROTATION_90 && fromRotation != Surface.ROTATION_270) {
|
if (fromRotation != Surface.ROTATION_90 && fromRotation != Surface.ROTATION_270) {
|
||||||
Log.wtf(TAG, "Not a supported rotation, rotation=" + fromRotation);
|
Log.wtf(TAG, "Not a supported rotation, rotation=" + fromRotation);
|
||||||
return this;
|
return this;
|
||||||
@@ -381,6 +383,9 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
|
|||||||
transformed.round(mDestinationBoundsTransformed);
|
transformed.round(mDestinationBoundsTransformed);
|
||||||
|
|
||||||
mFromRotation = fromRotation;
|
mFromRotation = fromRotation;
|
||||||
|
if (displayCutoutInsets != null) {
|
||||||
|
mDisplayCutoutInsets = new Rect(displayCutoutInsets);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +393,14 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
|
|||||||
if (mDestinationBoundsTransformed.isEmpty()) {
|
if (mDestinationBoundsTransformed.isEmpty()) {
|
||||||
mDestinationBoundsTransformed.set(mDestinationBounds);
|
mDestinationBoundsTransformed.set(mDestinationBounds);
|
||||||
}
|
}
|
||||||
|
// adjust the mSourceRectHint / mAppBounds by display cutout if applicable.
|
||||||
|
if (mSourceRectHint != null && mDisplayCutoutInsets != null) {
|
||||||
|
if (mFromRotation == Surface.ROTATION_90) {
|
||||||
|
mSourceRectHint.offset(mDisplayCutoutInsets.left, mDisplayCutoutInsets.top);
|
||||||
|
} else if (mFromRotation == Surface.ROTATION_270) {
|
||||||
|
mAppBounds.inset(mDisplayCutoutInsets);
|
||||||
|
}
|
||||||
|
}
|
||||||
return new SwipePipToHomeAnimator(mContext, mTaskId, mComponentName, mLeash,
|
return new SwipePipToHomeAnimator(mContext, mTaskId, mComponentName, mLeash,
|
||||||
mSourceRectHint, mAppBounds,
|
mSourceRectHint, mAppBounds,
|
||||||
mHomeToWindowPositionMap, mStartBounds, mDestinationBounds,
|
mHomeToWindowPositionMap, mStartBounds, mDestinationBounds,
|
||||||
|
|||||||
Reference in New Issue
Block a user