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

Commit d6faddae authored by Charles Chen's avatar Charles Chen Committed by Automerger Merge Worker
Browse files

Merge "Fix SplitContainer not updated when folded." into tm-qpr-dev am: c0ee7bde

parents 66e7b80e c0ee7bde
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -33,19 +33,19 @@ public class TaskFragmentParentInfo implements Parcelable {

    private final int mDisplayId;

    private final boolean mVisibleRequested;
    private final boolean mVisible;

    public TaskFragmentParentInfo(@NonNull Configuration configuration, int displayId,
            boolean visibleRequested) {
            boolean visible) {
        mConfiguration.setTo(configuration);
        mDisplayId = displayId;
        mVisibleRequested = visibleRequested;
        mVisible = visible;
    }

    public TaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) {
        mConfiguration.setTo(info.getConfiguration());
        mDisplayId = info.mDisplayId;
        mVisibleRequested = info.mVisibleRequested;
        mVisible = info.mVisible;
    }

    /** The {@link Configuration} of the parent Task */
@@ -62,9 +62,9 @@ public class TaskFragmentParentInfo implements Parcelable {
        return mDisplayId;
    }

    /** Whether the parent Task is requested to be visible or not */
    public boolean isVisibleRequested() {
        return mVisibleRequested;
    /** Whether the parent Task is visible or not */
    public boolean isVisible() {
        return mVisible;
    }

    /**
@@ -80,7 +80,7 @@ public class TaskFragmentParentInfo implements Parcelable {
            return false;
        }
        return getWindowingMode() == that.getWindowingMode() && mDisplayId == that.mDisplayId
                && mVisibleRequested == that.mVisibleRequested;
                && mVisible == that.mVisible;
    }

    @WindowConfiguration.WindowingMode
@@ -93,7 +93,7 @@ public class TaskFragmentParentInfo implements Parcelable {
        return TaskFragmentParentInfo.class.getSimpleName() + ":{"
                + "config=" + mConfiguration
                + ", displayId=" + mDisplayId
                + ", visibleRequested=" + mVisibleRequested
                + ", visible=" + mVisible
                + "}";
    }

@@ -114,14 +114,14 @@ public class TaskFragmentParentInfo implements Parcelable {
        final TaskFragmentParentInfo that = (TaskFragmentParentInfo) obj;
        return mConfiguration.equals(that.mConfiguration)
                && mDisplayId == that.mDisplayId
                && mVisibleRequested == that.mVisibleRequested;
                && mVisible == that.mVisible;
    }

    @Override
    public int hashCode() {
        int result = mConfiguration.hashCode();
        result = 31 * result + mDisplayId;
        result = 31 * result + (mVisibleRequested ? 1 : 0);
        result = 31 * result + (mVisible ? 1 : 0);
        return result;
    }

@@ -129,13 +129,13 @@ public class TaskFragmentParentInfo implements Parcelable {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        mConfiguration.writeToParcel(dest, flags);
        dest.writeInt(mDisplayId);
        dest.writeBoolean(mVisibleRequested);
        dest.writeBoolean(mVisible);
    }

    private TaskFragmentParentInfo(Parcel in) {
        mConfiguration.readFromParcel(in);
        mDisplayId = in.readInt();
        mVisibleRequested = in.readBoolean();
        mVisible = in.readBoolean();
    }

    public static final Creator<TaskFragmentParentInfo> CREATOR =
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ class TaskContainer {
    void updateTaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) {
        mConfiguration.setTo(info.getConfiguration());
        mDisplayId = info.getDisplayId();
        mIsVisible = info.isVisibleRequested();
        mIsVisible = info.isVisible();
    }

    /**
+6 −2
Original line number Diff line number Diff line
@@ -3547,12 +3547,16 @@ class Task extends TaskFragment {
     * {@link android.window.TaskFragmentOrganizer}
     */
    TaskFragmentParentInfo getTaskFragmentParentInfo() {
        return new TaskFragmentParentInfo(getConfiguration(), getDisplayId(), isVisibleRequested());
        return new TaskFragmentParentInfo(getConfiguration(), getDisplayId(),
                shouldBeVisible(null /* starting */));
    }

    @Override
    void onActivityVisibleRequestedChanged() {
        if (mVisibleRequested != isVisibleRequested()) {
        final boolean prevVisibleRequested = mVisibleRequested;
        // mVisibleRequested is updated in super method.
        super.onActivityVisibleRequestedChanged();
        if (prevVisibleRequested != mVisibleRequested) {
            sendTaskFragmentParentInfoChangedIfNeeded();
        }
    }
+15 −1
Original line number Diff line number Diff line
@@ -2690,12 +2690,26 @@ class TaskFragment extends WindowContainer<WindowContainer> {
            return;
        }
        mVisibleRequested = isVisibleRequested;
        final TaskFragment parentTf = getParent().asTaskFragment();
        final WindowContainer<?> parent = getParent();
        if (parent == null) {
            return;
        }
        final TaskFragment parentTf = parent.asTaskFragment();
        if (parentTf != null) {
            parentTf.onActivityVisibleRequestedChanged();
        }
    }

    @Nullable
    @Override
    TaskFragment getTaskFragment(Predicate<TaskFragment> callback) {
        final TaskFragment taskFragment = super.getTaskFragment(callback);
        if (taskFragment != null) {
            return taskFragment;
        }
        return callback.test(this) ? this : null;
    }

    String toFullString() {
        final StringBuilder sb = new StringBuilder(128);
        sb.append(this);
+1 −0
Original line number Diff line number Diff line
@@ -920,6 +920,7 @@ public class TaskFragmentOrganizerController extends ITaskFragmentOrganizerContr
        for (int i = 0, n = pendingEvents.size(); i < n; i++) {
            final PendingTaskFragmentEvent event = pendingEvents.get(i);
            final Task task = event.mTaskFragment != null ? event.mTaskFragment.getTask() : null;
            // TODO(b/251132298): move visibility check to the client side.
            if (task != null && (task.lastActiveTime <= event.mDeferTime
                    || !(isTaskVisible(task, visibleTasks, invisibleTasks)
                    || shouldSendEventWhenTaskInvisible(event)))) {
Loading