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

Commit b5ce517b authored by Oleg Blinnikov's avatar Oleg Blinnikov Committed by Android (Google) Code Review
Browse files

Merge "Save&restore display topology" into main

parents 4fde7681 3b3d48e7
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ public final class DisplayTopology implements Parcelable {

    public DisplayTopology() {}

    @VisibleForTesting
    public DisplayTopology(TreeNode root, int primaryDisplayId) {
        mRoot = root;
        if (mRoot != null) {
@@ -540,6 +539,19 @@ public final class DisplayTopology implements Parcelable {
        }
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof DisplayTopology)) {
            return false;
        }
        return obj.toString().equals(toString());
    }

    @Override
    public int hashCode() {
        return toString().hashCode();
    }

    @Override
    public String toString() {
        StringWriter out = new StringWriter();
@@ -610,7 +622,7 @@ public final class DisplayTopology implements Parcelable {
    }

    @Nullable
    private static TreeNode findDisplay(int displayId, @Nullable TreeNode startingNode) {
    public static TreeNode findDisplay(int displayId, @Nullable TreeNode startingNode) {
        if (startingNode == null) {
            return null;
        }
@@ -775,16 +787,22 @@ public final class DisplayTopology implements Parcelable {
         */
        private float mOffset;

        private final List<TreeNode> mChildren = new ArrayList<>();
        private final List<TreeNode> mChildren;

        @VisibleForTesting
        public TreeNode(int displayId, float width, float height, @Position int position,
                float offset) {
            this(displayId, width, height, position, offset, List.of());
        }

        public TreeNode(int displayId, float width, float height, int position,
                        float offset, List<TreeNode> children) {
            mDisplayId = displayId;
            mWidth = width;
            mHeight = height;
            mPosition = position;
            mOffset = offset;
            mChildren = new ArrayList<>(children);
        }

        public TreeNode(Parcel source) {
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ java_library_static {
        ":platform-compat-overrides",
        ":display-device-config",
        ":display-layout-config",
        ":display-topology",
        ":device-state-config",
        "java/com/android/server/EventLogTags.logtags",
        "java/com/android/server/am/EventLogTags.logtags",
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright 2025 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 com.android.server.display;

import android.annotation.Nullable;
import android.hardware.display.DisplayTopology;

/**
 * Allows to save and restore {@link DisplayTopology}.
 * See implementation: {@link DisplayTopologyXmlStore}
 */
interface DisplayTopologyStore {
    boolean saveTopology(DisplayTopology topology);

    @Nullable
    DisplayTopology restoreTopology(DisplayTopology topology);

    void reloadTopologies(int userId);
}
+582 −0

File added.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
@@ -29,6 +29,14 @@ xsd_config {
    gen_writer: true,
}

xsd_config {
    name: "display-topology",
    srcs: ["display-topology/display-topology.xsd"],
    api_dir: "display-topology/schema",
    package_name: "com.android.server.display.topology",
    gen_writer: true,
}

xsd_config {
    name: "display-device-config",
    srcs: ["display-device-config/display-device-config.xsd"],
Loading