Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97c0e547 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Adding task id to TaskFragmentParentInfo" into main

parents 5929cb08 7b3fa3f2
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ public final class TaskFragmentParentInfo implements Parcelable {

    private final int mDisplayId;

    private final int mTaskId;

    private final boolean mVisible;

    private final boolean mHasDirectActivity;
@@ -49,9 +51,11 @@ public final class TaskFragmentParentInfo implements Parcelable {

    /** @hide */
    public TaskFragmentParentInfo(@NonNull Configuration configuration, int displayId,
            boolean visible, boolean hasDirectActivity, @Nullable SurfaceControl decorSurface) {
            int taskId, boolean visible, boolean hasDirectActivity,
            @Nullable SurfaceControl decorSurface) {
        mConfiguration.setTo(configuration);
        mDisplayId = displayId;
        mTaskId = taskId;
        mVisible = visible;
        mHasDirectActivity = hasDirectActivity;
        mDecorSurface = decorSurface;
@@ -61,6 +65,7 @@ public final class TaskFragmentParentInfo implements Parcelable {
    public TaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) {
        mConfiguration.setTo(info.getConfiguration());
        mDisplayId = info.mDisplayId;
        mTaskId = info.mTaskId;
        mVisible = info.mVisible;
        mHasDirectActivity = info.mHasDirectActivity;
        mDecorSurface = info.mDecorSurface;
@@ -86,6 +91,15 @@ public final class TaskFragmentParentInfo implements Parcelable {
        return mDisplayId;
    }

    /**
     * The id of the parent Task.
     *
     * @hide
     */
    public int getTaskId() {
        return mTaskId;
    }

    /**
     * Whether the parent Task is visible or not
     *
@@ -120,7 +134,8 @@ public final class TaskFragmentParentInfo implements Parcelable {
            return false;
        }
        return getWindowingMode() == that.getWindowingMode() && mDisplayId == that.mDisplayId
                && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity
                && mTaskId == that.mTaskId && mVisible == that.mVisible
                && mHasDirectActivity == that.mHasDirectActivity
                && mDecorSurface == that.mDecorSurface;
    }

@@ -140,6 +155,7 @@ public final class TaskFragmentParentInfo implements Parcelable {
        return TaskFragmentParentInfo.class.getSimpleName() + ":{"
                + "config=" + mConfiguration
                + ", displayId=" + mDisplayId
                + ", taskId=" + mTaskId
                + ", visible=" + mVisible
                + ", hasDirectActivity=" + mHasDirectActivity
                + ", decorSurface=" + mDecorSurface
@@ -163,6 +179,7 @@ public final class TaskFragmentParentInfo implements Parcelable {
        final TaskFragmentParentInfo that = (TaskFragmentParentInfo) obj;
        return mConfiguration.equals(that.mConfiguration)
                && mDisplayId == that.mDisplayId
                && mTaskId == that.mTaskId
                && mVisible == that.mVisible
                && mHasDirectActivity == that.mHasDirectActivity
                && mDecorSurface == that.mDecorSurface;
@@ -172,6 +189,7 @@ public final class TaskFragmentParentInfo implements Parcelable {
    public int hashCode() {
        int result = mConfiguration.hashCode();
        result = 31 * result + mDisplayId;
        result = 31 * result + mTaskId;
        result = 31 * result + (mVisible ? 1 : 0);
        result = 31 * result + (mHasDirectActivity ? 1 : 0);
        result = 31 * result + Objects.hashCode(mDecorSurface);
@@ -183,6 +201,7 @@ public final class TaskFragmentParentInfo implements Parcelable {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        mConfiguration.writeToParcel(dest, flags);
        dest.writeInt(mDisplayId);
        dest.writeInt(mTaskId);
        dest.writeBoolean(mVisible);
        dest.writeBoolean(mHasDirectActivity);
        dest.writeTypedObject(mDecorSurface, flags);
@@ -191,6 +210,7 @@ public final class TaskFragmentParentInfo implements Parcelable {
    private TaskFragmentParentInfo(Parcel in) {
        mConfiguration.readFromParcel(in);
        mDisplayId = in.readInt();
        mTaskId = in.readInt();
        mVisible = in.readBoolean();
        mHasDirectActivity = in.readBoolean();
        mDecorSurface = in.readTypedObject(SurfaceControl.CREATOR);
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class BackupHelper {
    void scheduleBackup() {
        if (!mBackupIdlerScheduled) {
            mBackupIdlerScheduled = true;
            Looper.myQueue().addIdleHandler(mBackupIdler);
            Looper.getMainLooper().getQueue().addIdleHandler(mBackupIdler);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ class TaskContainer {
        mInfo = new TaskFragmentParentInfo(
                taskProperties.getConfiguration(),
                taskProperties.getDisplayId(),
                taskId,
                // Note that it is always called when there's a new Activity is started, which
                // implies the host task is visible and has an activity in the task.
                true /* visible */,
@@ -194,7 +195,8 @@ class TaskContainer {

    void setInvisible() {
        mInfo = new TaskFragmentParentInfo(mInfo.getConfiguration(), mInfo.getDisplayId(),
                false /* visible */, mInfo.hasDirectActivity(), mInfo.getDecorSurface());
                mInfo.getTaskId(), false /* visible */, mInfo.hasDirectActivity(),
                mInfo.getDecorSurface());
    }

    boolean hasDirectActivity() {
+5 −3
Original line number Diff line number Diff line
@@ -549,7 +549,7 @@ public class OverlayPresentationTest {
        assertThat(taskContainer.getTaskFragmentContainers()).containsExactly(overlayContainer);

        taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(Configuration.EMPTY,
                DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */,
                DEFAULT_DISPLAY, TASK_ID, true /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */));

        mSplitController.updateOverlayContainer(mTransaction, overlayContainer);
@@ -618,7 +618,8 @@ public class OverlayPresentationTest {
        final TaskContainer.TaskProperties taskProperties = taskContainer.getTaskProperties();
        final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo(
                new Configuration(taskProperties.getConfiguration()), taskProperties.getDisplayId(),
                true /* visible */, false /* hasDirectActivity */, null /* decorSurface */);
                TASK_ID, true /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */);
        parentInfo.getConfiguration().windowConfiguration.getBounds().offset(10, 10);

        mSplitController.onTaskFragmentParentInfoChanged(mTransaction, TASK_ID, parentInfo);
@@ -642,7 +643,8 @@ public class OverlayPresentationTest {
        final TaskContainer.TaskProperties taskProperties = taskContainer.getTaskProperties();
        final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo(
                new Configuration(taskProperties.getConfiguration()), taskProperties.getDisplayId(),
                true /* visible */, false /* hasDirectActivity */, null /* decorSurface */);
                TASK_ID, true /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */);

        mSplitController.onTaskFragmentParentInfoChanged(mTransaction, TASK_ID, parentInfo);

+4 −4
Original line number Diff line number Diff line
@@ -1164,7 +1164,7 @@ public class SplitControllerTest {
    public void testOnTransactionReady_taskFragmentParentInfoChanged() {
        final TaskFragmentTransaction transaction = new TaskFragmentTransaction();
        final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo(Configuration.EMPTY,
                DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */,
                DEFAULT_DISPLAY, TASK_ID, true /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */);
        transaction.addChange(new TaskFragmentTransaction.Change(
                TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED)
@@ -1625,7 +1625,7 @@ public class SplitControllerTest {
        final TaskContainer taskContainer = mSplitController.getTaskContainer(TASK_ID);
        final Configuration configuration = new Configuration();
        final TaskFragmentParentInfo originalInfo = new TaskFragmentParentInfo(configuration,
                DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */,
                DEFAULT_DISPLAY, TASK_ID, true /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */);
        mSplitController.onTaskFragmentParentInfoChanged(mock(WindowContainerTransaction.class),
                TASK_ID, originalInfo);
@@ -1634,7 +1634,7 @@ public class SplitControllerTest {
        // Making a public configuration change while the Task is invisible.
        configuration.densityDpi += 100;
        final TaskFragmentParentInfo invisibleInfo = new TaskFragmentParentInfo(configuration,
                DEFAULT_DISPLAY, false /* visible */, false /* hasDirectActivity */,
                DEFAULT_DISPLAY, TASK_ID, false /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */);
        mSplitController.onTaskFragmentParentInfoChanged(mock(WindowContainerTransaction.class),
                TASK_ID, invisibleInfo);
@@ -1646,7 +1646,7 @@ public class SplitControllerTest {

        // Updates when Task to become visible
        final TaskFragmentParentInfo visibleInfo = new TaskFragmentParentInfo(configuration,
                DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */,
                DEFAULT_DISPLAY, TASK_ID, true /* visible */, false /* hasDirectActivity */,
                null /* decorSurface */);
        mSplitController.onTaskFragmentParentInfoChanged(mock(WindowContainerTransaction.class),
                TASK_ID, visibleInfo);
Loading