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

Commit 2f8fdbd6 authored by Luca Stefani's avatar Luca Stefani
Browse files

Merge remote-tracking branch 'aosp/pie-gsi' into HEAD

* aosp/pie-gsi:
  DO NOT MERGE Set ContainerLayer for buffer-less surface
  DO NOT MERGE: WM: Restrict SC Builder to set a single surface type
  Implement construction of container layers
  SystemConfig: allow reading sku specific props
  Nullify the default wallpaper component if it does not exist

Change-Id: I9f7bb9a2a4f9035cd680ed27dfb82b624ccabb19
parents 788f1c37 7f82dee3
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -1874,23 +1874,33 @@ public class WallpaperManager {
     * @hide
     */
    public static ComponentName getDefaultWallpaperComponent(Context context) {
        ComponentName cn = null;

        String flat = SystemProperties.get(PROP_WALLPAPER_COMPONENT);
        if (!TextUtils.isEmpty(flat)) {
            final ComponentName cn = ComponentName.unflattenFromString(flat);
            if (cn != null) {
                return cn;
            }
            cn = ComponentName.unflattenFromString(flat);
        }

        if (cn == null) {
            flat = context.getString(com.android.internal.R.string.default_wallpaper_component);
            if (!TextUtils.isEmpty(flat)) {
            final ComponentName cn = ComponentName.unflattenFromString(flat);
                cn = ComponentName.unflattenFromString(flat);
            }
        }

        // Check if the package exists
        if (cn != null) {
                return cn;
            try {
                final PackageManager packageManager = context.getPackageManager();
                packageManager.getPackageInfo(cn.getPackageName(),
                        PackageManager.MATCH_DIRECT_BOOT_AWARE
                                | PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
            } catch (PackageManager.NameNotFoundException e) {
                cn = null;
            }
        }

        return null;
        return cn;
    }

    /**
+39 −2
Original line number Diff line number Diff line
@@ -265,6 +265,13 @@ public class SurfaceControl implements Parcelable {
     */
    public static final int FX_SURFACE_DIM = 0x00020000;

    /**
     * Surface creation flag: Creates a container surface.
     * This surface will have no buffers and will only be used
     * as a container for other surfaces, or for its InputInfo.
     */
    public static final int FX_SURFACE_CONTAINER = 0x00080000;

    /**
     * Mask used for FX values above.
     *
@@ -521,13 +528,38 @@ public class SurfaceControl implements Parcelable {
         */
        public Builder setColorLayer(boolean isColorLayer) {
            if (isColorLayer) {
                mFlags |= FX_SURFACE_DIM;
                setFlags(FX_SURFACE_DIM, FX_SURFACE_MASK);
            } else {
                setBufferLayer();
            }
            return this;
        }

        /**
         * Indicates whether a 'ContainerLayer' is to be constructed.
         *
         * Container layers will not be rendered in any fashion and instead are used
         * as a parent of renderable layers.
         *
         * @param isContainerLayer Whether to create a container layer.
         */
        public Builder setContainerLayer(boolean isContainerLayer) {
            if (isContainerLayer) {
                setFlags(FX_SURFACE_CONTAINER, FX_SURFACE_MASK);
            } else {
                mFlags &= ~FX_SURFACE_DIM;
                setBufferLayer();
            }
            return this;
        }

        /**
         * Indicates whether a buffer layer is to be constructed.
         *
         */
        public Builder setBufferLayer() {
            return setFlags(FX_SURFACE_NORMAL, FX_SURFACE_MASK);
        }

        /**
         * Set 'Surface creation flags' such as {@link HIDDEN}, {@link SECURE}.
         *
@@ -538,6 +570,11 @@ public class SurfaceControl implements Parcelable {
            mFlags = flags;
            return this;
        }

        private Builder setFlags(int flags, int mask) {
            mFlags = (mFlags & ~mask) | flags;
            return this;
        }
    }

    /**
+19 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.os.Process;
import android.os.SystemProperties;
import android.os.storage.StorageManager;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -67,6 +68,9 @@ public class SystemConfig {
    private static final int ALLOW_HIDDENAPI_WHITELISTING = 0x40;
    private static final int ALLOW_ALL = ~0;

    // property for runtime configuration differentiation
    private static final String SKU_PROPERTY = "ro.boot.product.hardware.sku";

    // Group-ids that are given to all packages as read from etc/permissions/*.xml.
    int[] mGlobalGids;

@@ -312,6 +316,17 @@ public class SystemConfig {
        readPermissions(Environment.buildPath(
                Environment.getOdmDirectory(), "etc", "permissions"), odmPermissionFlag);

        String skuProperty = SystemProperties.get(SKU_PROPERTY, "");
        if (!skuProperty.isEmpty()) {
            String skuDir = "sku_" + skuProperty;

            readPermissions(Environment.buildPath(
                    Environment.getOdmDirectory(), "etc", "sysconfig", skuDir), odmPermissionFlag);
            readPermissions(Environment.buildPath(
                    Environment.getOdmDirectory(), "etc", "permissions", skuDir),
                    odmPermissionFlag);
        }

        // Allow OEM to customize features and OEM permissions
        int oemPermissionFlag = ALLOW_FEATURES | ALLOW_OEM_PERMISSIONS;
        readPermissions(Environment.buildPath(
@@ -342,6 +357,10 @@ public class SystemConfig {
        // Iterate over the files in the directory and scan .xml files
        File platformFile = null;
        for (File f : libraryDir.listFiles()) {
            if (!f.isFile()) {
                continue;
            }

            // We'll read platform.xml last
            if (f.getPath().endsWith("etc/permissions/platform.xml")) {
                platformFile = f;
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ class AppWindowThumbnail implements Animatable {
                .setFormat(PixelFormat.TRANSLUCENT)
                .setMetadata(appToken.windowType,
                        window != null ? window.mOwnerUid : Binder.getCallingUid())
                .setBufferLayer()
                .build();

        if (SHOW_TRANSACTIONS) {
+3 −2
Original line number Diff line number Diff line
@@ -773,7 +773,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo

        final SurfaceControl.Builder b = mService.makeSurfaceBuilder(mSession)
                .setSize(mSurfaceSize, mSurfaceSize)
                .setOpaque(true);
                .setOpaque(true)
                .setContainerLayer(true);
        mWindowingLayer = b.setName("Display Root").build();
        mOverlayLayer = b.setName("Display Overlays").build();

@@ -3890,7 +3891,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        SurfaceSession s = child != null ? child.getSession() : getSession();
        final SurfaceControl.Builder b = mService.makeSurfaceBuilder(s);
        b.setSize(mSurfaceSize, mSurfaceSize);

        b.setContainerLayer(true);
        if (child == null) {
            return b;
        }
Loading