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

Commit 97c97911 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Return the existing DisplayAreas when registering an organizer"

parents 01c2bd14 a9e67cd9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2354,6 +2354,15 @@ package android.widget.inline {

package android.window {

  public final class DisplayAreaAppearedInfo implements android.os.Parcelable {
    ctor public DisplayAreaAppearedInfo(@NonNull android.window.DisplayAreaInfo, @NonNull android.view.SurfaceControl);
    method public int describeContents();
    method @NonNull public android.window.DisplayAreaInfo getDisplayAreaInfo();
    method @NonNull public android.view.SurfaceControl getLeash();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.window.DisplayAreaAppearedInfo> CREATOR;
  }

  public final class DisplayAreaInfo implements android.os.Parcelable {
    ctor public DisplayAreaInfo(@NonNull android.window.WindowContainerToken, int, int);
    method public int describeContents();
@@ -2369,7 +2378,7 @@ package android.window {
    ctor public DisplayAreaOrganizer();
    method public void onDisplayAreaAppeared(@NonNull android.window.DisplayAreaInfo, @NonNull android.view.SurfaceControl);
    method public void onDisplayAreaVanished(@NonNull android.window.DisplayAreaInfo);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void registerOrganizer(int);
    method @CallSuper @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.window.DisplayAreaAppearedInfo> registerOrganizer(int);
    field public static final int FEATURE_DEFAULT_TASK_CONTAINER = 1; // 0x1
    field public static final int FEATURE_ONE_HANDED = 3; // 0x3
    field public static final int FEATURE_ROOT = 0; // 0x0
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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 DisplayArea info provided when a DisplayArea is presented to an organizer.
 *
 * @hide
 */
parcelable DisplayAreaAppearedInfo;
+88 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.SurfaceControl;

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

    @NonNull
    private final DisplayAreaInfo mDisplayAreaInfo;

    @NonNull
    private final SurfaceControl mLeash;

    @NonNull
    public static final Creator<DisplayAreaAppearedInfo> CREATOR =
            new Creator<DisplayAreaAppearedInfo>() {
        @Override
        public DisplayAreaAppearedInfo createFromParcel(Parcel source) {
            final DisplayAreaInfo displayAreaInfo = source.readTypedObject(DisplayAreaInfo.CREATOR);
            final SurfaceControl leash = source.readTypedObject(SurfaceControl.CREATOR);
            return new DisplayAreaAppearedInfo(displayAreaInfo, leash);
        }

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

    };

    public DisplayAreaAppearedInfo(@NonNull DisplayAreaInfo displayAreaInfo,
            @NonNull SurfaceControl leash) {
        mDisplayAreaInfo = displayAreaInfo;
        mLeash = leash;
    }

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

    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * @return the DisplayArea info.
     */
    @NonNull
    public DisplayAreaInfo getDisplayAreaInfo() {
        return mDisplayAreaInfo;
    }

    /**
     * @return the leash for the DisplayArea.
     */
    @NonNull
    public SurfaceControl getLeash() {
        return mLeash;
    }
}
+18 −2
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@

package android.window;

import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.os.RemoteException;
import android.view.SurfaceControl;

import java.util.List;

/**
 * Interface for WindowManager to delegate control of display areas.
 * @hide
@@ -84,10 +87,17 @@ public class DisplayAreaOrganizer extends WindowOrganizer {
     */
    public static final int FEATURE_VENDOR_FIRST = FEATURE_SYSTEM_LAST + 1;

    /**
     * Registers a DisplayAreaOrganizer to manage display areas for a given feature.
     *
     * @return a list of display areas that should be managed by the organizer.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    public void registerOrganizer(int displayAreaFeature) {
    @CallSuper
    @NonNull
    public List<DisplayAreaAppearedInfo> registerOrganizer(int displayAreaFeature) {
        try {
            getController().registerOrganizer(mInterface, displayAreaFeature);
            return getController().registerOrganizer(mInterface, displayAreaFeature).getList();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -97,6 +107,7 @@ public class DisplayAreaOrganizer extends WindowOrganizer {
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    @CallSuper
    public void unregisterOrganizer() {
        try {
            getController().unregisterOrganizer(mInterface);
@@ -105,6 +116,11 @@ public class DisplayAreaOrganizer extends WindowOrganizer {
        }
    }

    /**
     * Called when a DisplayArea of the registered window type can be controlled by this organizer.
     * It will not be called for the DisplayAreas that exist when {@link #registerOrganizer(int)} is
     * called.
     */
    public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo,
            @NonNull SurfaceControl leash) {}

+9 −2
Original line number Diff line number Diff line
@@ -16,13 +16,20 @@

package android.window;

import android.content.pm.ParceledListSlice;
import android.window.DisplayAreaAppearedInfo;
import android.window.IDisplayAreaOrganizer;

/** @hide */
interface IDisplayAreaOrganizerController {

    /** Register a DisplayAreaOrganizer to manage display areas for a given feature. */
    void registerOrganizer(in IDisplayAreaOrganizer organizer, int displayAreaFeature);
    /**
     * Registers a DisplayAreaOrganizer to manage display areas for a given feature.
     *
     * @return a list of display areas that should be managed by the organizer.
     */
    ParceledListSlice<DisplayAreaAppearedInfo> registerOrganizer(in IDisplayAreaOrganizer organizer,
        int displayAreaFeature);

    /**
     * Unregisters a previously registered display area organizer.
Loading