Merge "Add DisplayAreaInfo" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
74aa929f63
@@ -5260,10 +5260,20 @@ package android.widget {
|
|||||||
|
|
||||||
package android.window {
|
package android.window {
|
||||||
|
|
||||||
|
public final class DisplayAreaInfo implements android.os.Parcelable {
|
||||||
|
ctor public DisplayAreaInfo(@NonNull android.window.WindowContainerToken, int);
|
||||||
|
method public int describeContents();
|
||||||
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
|
field @NonNull public static final android.os.Parcelable.Creator<android.window.DisplayAreaInfo> CREATOR;
|
||||||
|
field @NonNull public final android.content.res.Configuration configuration;
|
||||||
|
field public final int displayId;
|
||||||
|
field @NonNull public final android.window.WindowContainerToken token;
|
||||||
|
}
|
||||||
|
|
||||||
public class DisplayAreaOrganizer extends android.window.WindowOrganizer {
|
public class DisplayAreaOrganizer extends android.window.WindowOrganizer {
|
||||||
ctor public DisplayAreaOrganizer();
|
ctor public DisplayAreaOrganizer();
|
||||||
method public void onDisplayAreaAppeared(@NonNull android.window.WindowContainerToken);
|
method public void onDisplayAreaAppeared(@NonNull android.window.DisplayAreaInfo);
|
||||||
method public void onDisplayAreaVanished(@NonNull android.window.WindowContainerToken);
|
method public void onDisplayAreaVanished(@NonNull android.window.DisplayAreaInfo);
|
||||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void registerOrganizer(int);
|
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS) public void registerOrganizer(int);
|
||||||
field public static final int FEATURE_DEFAULT_TASK_CONTAINER = 1; // 0x1
|
field public static final int FEATURE_DEFAULT_TASK_CONTAINER = 1; // 0x1
|
||||||
field public static final int FEATURE_ROOT = 0; // 0x0
|
field public static final int FEATURE_ROOT = 0; // 0x0
|
||||||
|
|||||||
18
core/java/android/window/DisplayAreaInfo.aidl
Normal file
18
core/java/android/window/DisplayAreaInfo.aidl
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
parcelable DisplayAreaInfo;
|
||||||
87
core/java/android/window/DisplayAreaInfo.java
Normal file
87
core/java/android/window/DisplayAreaInfo.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* 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.content.res.Configuration;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores information about a particular {@link com.android.server.wm.DisplayArea}. This object will
|
||||||
|
* be sent to registered {@link DisplayAreaOrganizer} to provide information when the DisplayArea
|
||||||
|
* is added, removed, or changed.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public final class DisplayAreaInfo implements Parcelable {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public final WindowContainerToken token;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public final Configuration configuration = new Configuration();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the display this display area is associated with.
|
||||||
|
*/
|
||||||
|
public final int displayId;
|
||||||
|
|
||||||
|
public DisplayAreaInfo(@NonNull WindowContainerToken token, int displayId) {
|
||||||
|
this.token = token;
|
||||||
|
this.displayId = displayId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DisplayAreaInfo(Parcel in) {
|
||||||
|
token = WindowContainerToken.CREATOR.createFromParcel(in);
|
||||||
|
configuration.readFromParcel(in);
|
||||||
|
displayId = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
|
token.writeToParcel(dest, flags);
|
||||||
|
configuration.writeToParcel(dest, flags);
|
||||||
|
dest.writeInt(displayId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public static final Creator<DisplayAreaInfo> CREATOR = new Creator<DisplayAreaInfo>() {
|
||||||
|
@Override
|
||||||
|
public DisplayAreaInfo createFromParcel(Parcel in) {
|
||||||
|
return new DisplayAreaInfo(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DisplayAreaInfo[] newArray(int size) {
|
||||||
|
return new DisplayAreaInfo[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DisplayAreaInfo{token=" + token
|
||||||
|
+ " config=" + configuration + "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,21 +52,20 @@ public class DisplayAreaOrganizer extends WindowOrganizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisplayAreaAppeared(@NonNull WindowContainerToken displayArea) {}
|
public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo) {}
|
||||||
|
|
||||||
public void onDisplayAreaVanished(@NonNull WindowContainerToken displayArea) {}
|
|
||||||
|
|
||||||
|
public void onDisplayAreaVanished(@NonNull DisplayAreaInfo displayAreaInfo) {}
|
||||||
|
|
||||||
private final IDisplayAreaOrganizer mInterface = new IDisplayAreaOrganizer.Stub() {
|
private final IDisplayAreaOrganizer mInterface = new IDisplayAreaOrganizer.Stub() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisplayAreaAppeared(@NonNull WindowContainerToken displayArea) {
|
public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo) {
|
||||||
DisplayAreaOrganizer.this.onDisplayAreaAppeared(displayArea);
|
DisplayAreaOrganizer.this.onDisplayAreaAppeared(displayAreaInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisplayAreaVanished(@NonNull WindowContainerToken displayArea) {
|
public void onDisplayAreaVanished(@NonNull DisplayAreaInfo displayAreaInfo) {
|
||||||
DisplayAreaOrganizer.this.onDisplayAreaVanished(displayArea);
|
DisplayAreaOrganizer.this.onDisplayAreaVanished(displayAreaInfo);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
package android.window;
|
package android.window;
|
||||||
|
|
||||||
import android.window.WindowContainerToken;
|
import android.window.DisplayAreaInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for WindowManager to delegate control of display areas.
|
* Interface for WindowManager to delegate control of display areas.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
oneway interface IDisplayAreaOrganizer {
|
oneway interface IDisplayAreaOrganizer {
|
||||||
void onDisplayAreaAppeared(in WindowContainerToken displayArea);
|
void onDisplayAreaAppeared(in DisplayAreaInfo displayAreaInfo);
|
||||||
void onDisplayAreaVanished(in WindowContainerToken displayArea);
|
void onDisplayAreaVanished(in DisplayAreaInfo displayAreaInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static com.android.server.wm.WindowContainerChildProto.DISPLAY_AREA;
|
|||||||
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
|
import android.window.DisplayAreaInfo;
|
||||||
import android.window.IDisplayAreaOrganizer;
|
import android.window.IDisplayAreaOrganizer;
|
||||||
|
|
||||||
import com.android.server.policy.WindowManagerPolicy;
|
import com.android.server.policy.WindowManagerPolicy;
|
||||||
@@ -158,6 +159,14 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
|
|||||||
return mOrganizer != null;
|
return mOrganizer != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DisplayAreaInfo getDisplayAreaInfo() {
|
||||||
|
DisplayAreaInfo info = new DisplayAreaInfo(mRemoteToken.toWindowContainerToken(),
|
||||||
|
getDisplayContent().getDisplayId());
|
||||||
|
info.configuration.setTo(getConfiguration());
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DisplayArea that contains WindowTokens, and orders them according to their type.
|
* DisplayArea that contains WindowTokens, and orders them according to their type.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class DisplayAreaOrganizerController extends IDisplayAreaOrganizerControl
|
|||||||
|
|
||||||
void onDisplayAreaAppeared(IDisplayAreaOrganizer organizer, DisplayArea da) {
|
void onDisplayAreaAppeared(IDisplayAreaOrganizer organizer, DisplayArea da) {
|
||||||
try {
|
try {
|
||||||
organizer.onDisplayAreaAppeared(da.mRemoteToken.toWindowContainerToken());
|
organizer.onDisplayAreaAppeared(da.getDisplayAreaInfo());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// Oh well...
|
// Oh well...
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ public class DisplayAreaOrganizerController extends IDisplayAreaOrganizerControl
|
|||||||
|
|
||||||
void onDisplayAreaVanished(IDisplayAreaOrganizer organizer, DisplayArea da) {
|
void onDisplayAreaVanished(IDisplayAreaOrganizer organizer, DisplayArea da) {
|
||||||
try {
|
try {
|
||||||
organizer.onDisplayAreaVanished(da.mRemoteToken.toWindowContainerToken());
|
organizer.onDisplayAreaVanished(da.getDisplayAreaInfo());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// Oh well...
|
// Oh well...
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user