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

Commit 80897e90 authored by Chris Li's avatar Chris Li
Browse files

Add WindowContainerTransaction APIs for create/deleteTaskFragment

This change contains mainly the function signatures and data classes.
The actual implemenation will come in a separate cl.

Bug: 190433129
Test: N/A
Change-Id: I4f9695cea270cc06f2f6b1a2c56245cd2a43b9fd
parent a5b25288
Loading
Loading
Loading
Loading
+23 −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;

/**
 * Data object for the TaskFragment info provided when a TaskFragment is presented to an organizer.
 * @hide
 */
parcelable TaskFragmentAppearedInfo;
+86 −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.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.SurfaceControl;

/**
 * Data object for the TaskFragment info provided when a TaskFragment is presented to an organizer.
 * @hide
 */
public final class TaskFragmentAppearedInfo implements Parcelable {

    @NonNull
    private final TaskFragmentInfo mTaskFragmentInfo;

    @NonNull
    private final SurfaceControl mLeash;

    public TaskFragmentAppearedInfo(
            @NonNull TaskFragmentInfo taskFragmentInfo, @NonNull SurfaceControl leash) {
        mTaskFragmentInfo = taskFragmentInfo;
        mLeash = leash;
    }

    public TaskFragmentInfo getTaskFragmentInfo() {
        return mTaskFragmentInfo;
    }

    public SurfaceControl getLeash() {
        return mLeash;
    }

    private TaskFragmentAppearedInfo(Parcel in) {
        mTaskFragmentInfo = in.readTypedObject(TaskFragmentInfo.CREATOR);
        mLeash = in.readTypedObject(SurfaceControl.CREATOR);
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeTypedObject(mTaskFragmentInfo, flags);
        dest.writeTypedObject(mLeash, flags);
    }

    @NonNull
    public static final Creator<TaskFragmentAppearedInfo> CREATOR =
            new Creator<TaskFragmentAppearedInfo>() {
                @Override
                public TaskFragmentAppearedInfo createFromParcel(Parcel in) {
                    return new TaskFragmentAppearedInfo(in);
                }

                @Override
                public TaskFragmentAppearedInfo[] newArray(int size) {
                    return new TaskFragmentAppearedInfo[size];
                }
            };

    @Override
    public String toString() {
        return "TaskFragmentAppearedInfo{"
                + " taskFragmentInfo=" + mTaskFragmentInfo
                + "}";
    }

    @Override
    public int describeContents() {
        return 0;
    }
}
+23 −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;

/**
 * Data object for options to create TaskFragment with.
 * @hide
 */
parcelable TaskFragmentCreationParams;
+108 −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.annotation.NonNull;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Data object for options to create TaskFragment with.
 * @hide
 */
public final class TaskFragmentCreationParams implements Parcelable {
    /**
     * Unique token assigned from the client organizer to identify the {@link TaskFragmentInfo} when
     * a new TaskFragment is created with this option.
     */
    @NonNull
    private final IBinder mFragmentToken;

    /**
     * Activity token used to identify the leaf Task to create the TaskFragment in. It has to belong
     * to the same app as the root Activity of the target Task.
     */
    @NonNull
    private final IBinder mOwnerToken;

    /** The initial bounds of the TaskFragment. Fill parent if empty. */
    @NonNull
    private final Rect mInitialBounds = new Rect();

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

    public IBinder getFragmentToken() {
        return mFragmentToken;
    }

    public IBinder getOwnerToken() {
        return mOwnerToken;
    }

    public Rect getInitialBounds() {
        return mInitialBounds;
    }

    private TaskFragmentCreationParams(Parcel in) {
        mFragmentToken = in.readStrongBinder();
        mOwnerToken = in.readStrongBinder();
        mInitialBounds.readFromParcel(in);
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeStrongBinder(mFragmentToken);
        dest.writeStrongBinder(mOwnerToken);
        mInitialBounds.writeToParcel(dest, flags);
    }

    @NonNull
    public static final Creator<TaskFragmentCreationParams> CREATOR =
            new Creator<TaskFragmentCreationParams>() {
                @Override
                public TaskFragmentCreationParams createFromParcel(Parcel in) {
                    return new TaskFragmentCreationParams(in);
                }

                @Override
                public TaskFragmentCreationParams[] newArray(int size) {
                    return new TaskFragmentCreationParams[size];
                }
            };

    @Override
    public String toString() {
        return "TaskFragmentCreationParams{"
                + " fragmentToken=" + mFragmentToken
                + " ownerToken=" + mOwnerToken
                + " initialBounds=" + mInitialBounds
                + "}";
    }

    @Override
    public int describeContents() {
        return 0;
    }
}
+23 −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;

/**
 * Stores information about a particular TaskFragment.
 * @hide
 */
parcelable TaskFragmentInfo;
Loading