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

Commit cf717a20 authored by Chris Li's avatar Chris Li
Browse files

Add TaskFragmentOrganizer API

Mainly the API surface.

Bug: 190433129
Test: N/A
Change-Id: I426b7fdbe62d58213c5e49a4773dd5fda0eb4dfe
parent 80897e90
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.window;

import android.content.res.Configuration;
import android.os.IBinder;
import android.window.TaskFragmentAppearedInfo;
import android.window.TaskFragmentInfo;

/** @hide */
oneway interface ITaskFragmentOrganizer {
    void onTaskFragmentAppeared(in TaskFragmentAppearedInfo taskFragmentAppearedInfo);
    void onTaskFragmentInfoChanged(in TaskFragmentInfo taskFragmentInfo);
    void onTaskFragmentVanished(in TaskFragmentInfo taskFragmentInfo);

    /**
     * Called when the parent leaf Task of organized TaskFragments is changed.
     * When the leaf Task is changed, the organizer may want to update the TaskFragments in one
     * transaction.
     *
     * For case like screen size change, it will trigger onTaskFragmentParentInfoChanged with new
     * Task bounds, but may not trigger onTaskFragmentInfoChanged because there can be an override
     * bounds.
     */
    void onTaskFragmentParentInfoChanged(in IBinder fragmentToken, in Configuration parentConfig);
}
+33 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.window;

import android.window.ITaskFragmentOrganizer;

/** @hide */
interface ITaskFragmentOrganizerController {

    /**
     * Registers a TaskFragmentOrganizer to manage TaskFragments.
     */
    void registerOrganizer(in ITaskFragmentOrganizer organizer);

    /**
     * Unregisters a previously registered TaskFragmentOrganizer.
     */
    void unregisterOrganizer(in ITaskFragmentOrganizer organizer);
}
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.view.SurfaceControl;

import android.os.IBinder;
import android.window.IDisplayAreaOrganizerController;
import android.window.ITaskFragmentOrganizerController;
import android.window.ITaskOrganizerController;
import android.window.ITransitionPlayer;
import android.window.IWindowContainerTransactionCallback;
@@ -77,6 +78,9 @@ interface IWindowOrganizerController {
    /** @return An interface enabling the management of display area organizers. */
    IDisplayAreaOrganizerController getDisplayAreaOrganizerController();

    /** @return An interface enabling the management of task fragment organizers. */
    ITaskFragmentOrganizerController getTaskFragmentOrganizerController();

    /**
     * Registers a transition player with Core. There is only one of these at a time and calling
     * this will replace the existing one if set.
+15 −2
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ import android.os.Parcelable;
 * @hide
 */
public final class TaskFragmentCreationParams implements Parcelable {

    /** The organizer that will organize this TaskFragment. */
    @NonNull
    private final ITaskFragmentOrganizer mOrganizer;

    /**
     * Unique token assigned from the client organizer to identify the {@link TaskFragmentInfo} when
     * a new TaskFragment is created with this option.
@@ -46,13 +51,18 @@ public final class TaskFragmentCreationParams implements Parcelable {
    private final Rect mInitialBounds = new Rect();

    private TaskFragmentCreationParams(
            @NonNull IBinder fragmentToken, @NonNull IBinder ownerToken,
            @NonNull Rect initialBounds) {
            @NonNull ITaskFragmentOrganizer organizer, @NonNull IBinder fragmentToken,
            @NonNull IBinder ownerToken, @NonNull Rect initialBounds) {
        mOrganizer = organizer;
        mFragmentToken = fragmentToken;
        mOwnerToken = ownerToken;
        mInitialBounds.set(initialBounds);
    }

    public ITaskFragmentOrganizer getOrganizer() {
        return mOrganizer;
    }

    public IBinder getFragmentToken() {
        return mFragmentToken;
    }
@@ -66,6 +76,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
    }

    private TaskFragmentCreationParams(Parcel in) {
        mOrganizer = ITaskFragmentOrganizer.Stub.asInterface(in.readStrongBinder());
        mFragmentToken = in.readStrongBinder();
        mOwnerToken = in.readStrongBinder();
        mInitialBounds.readFromParcel(in);
@@ -73,6 +84,7 @@ public final class TaskFragmentCreationParams implements Parcelable {

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeStrongInterface(mOrganizer);
        dest.writeStrongBinder(mFragmentToken);
        dest.writeStrongBinder(mOwnerToken);
        mInitialBounds.writeToParcel(dest, flags);
@@ -95,6 +107,7 @@ public final class TaskFragmentCreationParams implements Parcelable {
    @Override
    public String toString() {
        return "TaskFragmentCreationParams{"
                + " organizer=" + mOrganizer
                + " fragmentToken=" + mFragmentToken
                + " ownerToken=" + mOwnerToken
                + " initialBounds=" + mInitialBounds
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ public final class TaskFragmentInfo implements Parcelable {
            @NonNull IBinder fragmentToken, @NonNull ComponentName initialComponentName,
            @NonNull WindowContainerToken token, @NonNull Configuration configuration,
            boolean isEmpty, boolean isVisible) {
        if (fragmentToken == null || initialComponentName == null) {
            throw new IllegalArgumentException("Invalid TaskFragmentInfo.");
        }
        mFragmentToken = fragmentToken;
        mInitialComponentName = initialComponentName;
        mToken = token;
Loading