Merge "Move up activity type method to general container"

This commit is contained in:
Riddle Hsu
2022-02-11 08:03:26 +00:00
committed by Android (Google) Code Review
7 changed files with 15 additions and 14 deletions

View File

@@ -544,6 +544,11 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
return getActivityType() == ACTIVITY_TYPE_RECENTS;
}
final boolean isActivityTypeHomeOrRecents() {
final int activityType = getActivityType();
return activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS;
}
public boolean isActivityTypeAssistant() {
return getActivityType() == ACTIVITY_TYPE_ASSISTANT;
}

View File

@@ -4083,7 +4083,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
final boolean renewImeSurface = mImeScreenshot == null
|| mImeScreenshot.getWidth() != mInputMethodWindow.getFrame().width()
|| mImeScreenshot.getHeight() != mInputMethodWindow.getFrame().height();
if (task != null && !task.isHomeOrRecentsRootTask()) {
if (task != null && !task.isActivityTypeHomeOrRecents()) {
SurfaceControl.ScreenshotHardwareBuffer imeBuffer = renewImeSurface
? mWmService.mTaskSnapshotController.snapshotImeFromAttachedTask(task)
: null;

View File

@@ -529,7 +529,7 @@ class RecentTasks {
*/
void notifyTaskPersisterLocked(Task task, boolean flush) {
final Task rootTask = task != null ? task.getRootTask() : null;
if (rootTask != null && rootTask.isHomeOrRecentsRootTask()) {
if (rootTask != null && rootTask.isActivityTypeHomeOrRecents()) {
// Never persist the home or recents task.
return;
}
@@ -563,7 +563,7 @@ class RecentTasks {
private static boolean shouldPersistTaskLocked(Task task) {
final Task rootTask = task.getRootTask();
return task.isPersistable && (rootTask == null || !rootTask.isHomeOrRecentsRootTask());
return task.isPersistable && (rootTask == null || !rootTask.isActivityTypeHomeOrRecents());
}
void onSystemReadyLocked() {
@@ -994,7 +994,7 @@ class RecentTasks {
}
final Task rootTask = task.getRootTask();
if ((task.isPersistable || task.inRecents)
&& (rootTask == null || !rootTask.isHomeOrRecentsRootTask())) {
&& (rootTask == null || !rootTask.isActivityTypeHomeOrRecents())) {
if (TaskPersister.DEBUG) Slog.d(TAG, "adding to persistentTaskIds task=" + task);
persistentTaskIds.add(task.mTaskId);
} else {

View File

@@ -613,7 +613,7 @@ public class RecentsAnimationController implements DeathRecipient {
final TaskFragment adjacentTask = task.getRootTask().getAdjacentTaskFragment();
final boolean inSplitScreen = task.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW
&& adjacentTask != null;
if (task.isHomeOrRecentsRootTask()
if (task.isActivityTypeHomeOrRecents()
// Skip if the task is in split screen and in landscape.
|| (inSplitScreen && isDisplayLandscape)
// Skip if the task is the top task in split screen.

View File

@@ -2711,7 +2711,7 @@ class Task extends TaskFragment {
// they extend past their root task and sysui uses the root task surface to control
// cropping.
// TODO(b/158242495): get rid of this when drag/drop can use surface bounds.
if (isActivityTypeHome() || isActivityTypeRecents()) {
if (isActivityTypeHomeOrRecents()) {
// Make sure this is the top-most non-organizer root task (if not top-most, it means
// another translucent task could be above this, so this needs to stay cropped.
final Task rootTask = getRootTask();
@@ -3306,7 +3306,7 @@ class Task extends TaskFragment {
if (control != null) {
// We let the transition to be controlled by RecentsAnimation, and callback task's
// RemoteAnimationTarget for remote runner to animate.
if (enter && !isHomeOrRecentsRootTask()) {
if (enter && !isActivityTypeHomeOrRecents()) {
ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
"applyAnimationUnchecked, control: %s, task: %s, transit: %s",
control, asTask(), AppTransition.appTransitionOldToString(transit));
@@ -4591,10 +4591,6 @@ class Task extends TaskFragment {
!PRESERVE_WINDOWS);
}
final boolean isHomeOrRecentsRootTask() {
return isActivityTypeHome() || isActivityTypeRecents();
}
final boolean isOnHomeDisplay() {
return getDisplayId() == DEFAULT_DISPLAY;
}
@@ -5044,7 +5040,7 @@ class Task extends TaskFragment {
// The transition animation and starting window are not needed if {@code allowMoveToFront}
// is false, because the activity won't be visible.
if ((!isHomeOrRecentsRootTask() || hasActivity()) && allowMoveToFront) {
if ((!isActivityTypeHomeOrRecents() || hasActivity()) && allowMoveToFront) {
final DisplayContent dc = mDisplayContent;
if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
"Prepare open transition: starting " + r);

View File

@@ -825,7 +825,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
// the bottom of the screen, so we need to animate it.
for (int i = 0; i < mTargets.size(); ++i) {
final Task task = mTargets.get(i).asTask();
if (task == null || !task.isHomeOrRecentsRootTask()) continue;
if (task == null || !task.isActivityTypeHomeOrRecents()) continue;
animate = task.isVisibleRequested();
break;
}

View File

@@ -2790,7 +2790,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
@TransitionOldType int transit, boolean isVoiceInteraction,
@Nullable ArrayList<WindowContainer> sources) {
final Task task = asTask();
if (task != null && !enter && !task.isHomeOrRecentsRootTask()) {
if (task != null && !enter && !task.isActivityTypeHomeOrRecents()) {
final InsetsControlTarget imeTarget = mDisplayContent.getImeTarget(IME_TARGET_LAYERING);
final boolean isImeLayeringTarget = imeTarget != null && imeTarget.getWindow() != null
&& imeTarget.getWindow().getTask() == task;