Loading core/java/android/app/TaskInfo.java +31 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.util.Log; import android.window.WindowContainerToken; import java.util.ArrayList; import java.util.Objects; /** * Stores information about a particular Task. Loading Loading @@ -287,6 +288,36 @@ public class TaskInfo { return parentTaskId != INVALID_TASK_ID; } /** * Returns {@code true} if parameters that are important for task organizers have changed * and {@link com.android.server.wm.TaskOrginizerController} needs to notify listeners * about that. * @hide */ public boolean equalsForTaskOrganizer(@Nullable TaskInfo that) { if (that == null) { return false; } return topActivityType == that.topActivityType && isResizeable == that.isResizeable && Objects.equals(positionInParent, that.positionInParent) && equalsLetterboxParams(that) && pictureInPictureParams == that.pictureInPictureParams && getWindowingMode() == that.getWindowingMode() && Objects.equals(taskDescription, that.taskDescription); } private boolean equalsLetterboxParams(TaskInfo that) { return Objects.equals(letterboxActivityBounds, that.letterboxActivityBounds) && Objects.equals( getConfiguration().windowConfiguration.getBounds(), that.getConfiguration().windowConfiguration.getBounds()) && Objects.equals( getConfiguration().windowConfiguration.getMaxBounds(), that.getConfiguration().windowConfiguration.getMaxBounds()) && Objects.equals(parentBounds, that.parentBounds); } /** * Reads the TaskInfo from a parcel. */ Loading services/core/java/com/android/server/wm/TaskOrganizerController.java +1 −26 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import static com.android.server.wm.WindowOrganizerController.CONTROLLABLE_WINDO import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.TaskDescription; import android.app.WindowConfiguration; import android.content.Intent; import android.content.pm.ActivityInfo; Loading @@ -52,7 +51,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.WeakHashMap; import java.util.function.Consumer; Loading Loading @@ -538,16 +536,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { } mTmpTaskInfo.configuration.unset(); task.fillTaskInfo(mTmpTaskInfo); boolean changed = lastInfo == null || mTmpTaskInfo.topActivityType != lastInfo.topActivityType || mTmpTaskInfo.isResizeable != lastInfo.isResizeable || !Objects.equals( mTmpTaskInfo.positionInParent, lastInfo.positionInParent) || isLetterboxInfoChanged(lastInfo, mTmpTaskInfo) || mTmpTaskInfo.pictureInPictureParams != lastInfo.pictureInPictureParams || mTmpTaskInfo.getWindowingMode() != lastInfo.getWindowingMode() || !TaskDescription.equals(mTmpTaskInfo.taskDescription, lastInfo.taskDescription); boolean changed = !mTmpTaskInfo.equalsForTaskOrganizer(lastInfo); if (!changed) { int cfgChanges = mTmpTaskInfo.configuration.diff(lastInfo.configuration); final int winCfgChanges = (cfgChanges & ActivityInfo.CONFIG_WINDOW_CONFIGURATION) != 0 Loading Loading @@ -582,20 +571,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { } } private boolean isLetterboxInfoChanged( final RunningTaskInfo lastInfo, final RunningTaskInfo currentInfo) { return !Objects.equals( currentInfo.letterboxActivityBounds, lastInfo.letterboxActivityBounds) || !Objects.equals( currentInfo.getConfiguration().windowConfiguration.getBounds(), lastInfo.getConfiguration().windowConfiguration.getBounds()) || !Objects.equals( currentInfo.getConfiguration().windowConfiguration.getMaxBounds(), lastInfo.getConfiguration().windowConfiguration.getMaxBounds()) || !Objects.equals(currentInfo.parentBounds, lastInfo.parentBounds); } @Override public WindowContainerToken getImeTarget(int displayId) { enforceTaskPermission("getImeTarget()"); Loading Loading
core/java/android/app/TaskInfo.java +31 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.util.Log; import android.window.WindowContainerToken; import java.util.ArrayList; import java.util.Objects; /** * Stores information about a particular Task. Loading Loading @@ -287,6 +288,36 @@ public class TaskInfo { return parentTaskId != INVALID_TASK_ID; } /** * Returns {@code true} if parameters that are important for task organizers have changed * and {@link com.android.server.wm.TaskOrginizerController} needs to notify listeners * about that. * @hide */ public boolean equalsForTaskOrganizer(@Nullable TaskInfo that) { if (that == null) { return false; } return topActivityType == that.topActivityType && isResizeable == that.isResizeable && Objects.equals(positionInParent, that.positionInParent) && equalsLetterboxParams(that) && pictureInPictureParams == that.pictureInPictureParams && getWindowingMode() == that.getWindowingMode() && Objects.equals(taskDescription, that.taskDescription); } private boolean equalsLetterboxParams(TaskInfo that) { return Objects.equals(letterboxActivityBounds, that.letterboxActivityBounds) && Objects.equals( getConfiguration().windowConfiguration.getBounds(), that.getConfiguration().windowConfiguration.getBounds()) && Objects.equals( getConfiguration().windowConfiguration.getMaxBounds(), that.getConfiguration().windowConfiguration.getMaxBounds()) && Objects.equals(parentBounds, that.parentBounds); } /** * Reads the TaskInfo from a parcel. */ Loading
services/core/java/com/android/server/wm/TaskOrganizerController.java +1 −26 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import static com.android.server.wm.WindowOrganizerController.CONTROLLABLE_WINDO import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.TaskDescription; import android.app.WindowConfiguration; import android.content.Intent; import android.content.pm.ActivityInfo; Loading @@ -52,7 +51,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.WeakHashMap; import java.util.function.Consumer; Loading Loading @@ -538,16 +536,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { } mTmpTaskInfo.configuration.unset(); task.fillTaskInfo(mTmpTaskInfo); boolean changed = lastInfo == null || mTmpTaskInfo.topActivityType != lastInfo.topActivityType || mTmpTaskInfo.isResizeable != lastInfo.isResizeable || !Objects.equals( mTmpTaskInfo.positionInParent, lastInfo.positionInParent) || isLetterboxInfoChanged(lastInfo, mTmpTaskInfo) || mTmpTaskInfo.pictureInPictureParams != lastInfo.pictureInPictureParams || mTmpTaskInfo.getWindowingMode() != lastInfo.getWindowingMode() || !TaskDescription.equals(mTmpTaskInfo.taskDescription, lastInfo.taskDescription); boolean changed = !mTmpTaskInfo.equalsForTaskOrganizer(lastInfo); if (!changed) { int cfgChanges = mTmpTaskInfo.configuration.diff(lastInfo.configuration); final int winCfgChanges = (cfgChanges & ActivityInfo.CONFIG_WINDOW_CONFIGURATION) != 0 Loading Loading @@ -582,20 +571,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { } } private boolean isLetterboxInfoChanged( final RunningTaskInfo lastInfo, final RunningTaskInfo currentInfo) { return !Objects.equals( currentInfo.letterboxActivityBounds, lastInfo.letterboxActivityBounds) || !Objects.equals( currentInfo.getConfiguration().windowConfiguration.getBounds(), lastInfo.getConfiguration().windowConfiguration.getBounds()) || !Objects.equals( currentInfo.getConfiguration().windowConfiguration.getMaxBounds(), lastInfo.getConfiguration().windowConfiguration.getMaxBounds()) || !Objects.equals(currentInfo.parentBounds, lastInfo.parentBounds); } @Override public WindowContainerToken getImeTarget(int displayId) { enforceTaskPermission("getImeTarget()"); Loading