From 4eae49c1558a3e889ddccd7800f3a7b7d10f6b9e Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Fri, 16 Dec 2022 16:18:24 +0100 Subject: [PATCH] Add allowedSharedIsolatedProcess attribute. Isolated services can use this attribute to indicate that they are ok being bound into a shared isolated process. The default is false. Bug: 243554393 Test: atest android.externalservice.cts.SharedIsolatedServiceTest Change-Id: Ia4e4e60e801ad4d914ab159892411127e1163d91 --- core/api/current.txt | 2 ++ core/java/android/content/pm/ServiceInfo.java | 14 ++++++++++++++ core/res/res/values/attrs_manifest.xml | 12 ++++++++++++ core/res/res/values/public-staging.xml | 1 + .../java/com/android/server/am/ActiveServices.java | 5 +++++ .../pm/pkg/component/ParsedServiceUtils.java | 2 ++ 6 files changed, 36 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index a75dbcf00d145..38d7063382b22 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -363,6 +363,7 @@ package android { field public static final int allowGameFpsOverride = 16844378; // 0x101065a field public static final int allowNativeHeapPointerTagging = 16844306; // 0x1010612 field public static final int allowParallelSyncs = 16843570; // 0x1010332 + field public static final int allowSharedIsolatedProcess; field public static final int allowSingleTap = 16843353; // 0x1010259 field public static final int allowTaskReparenting = 16843268; // 0x1010204 field public static final int allowUndo = 16843999; // 0x10104df @@ -12521,6 +12522,7 @@ package android.content.pm { method public void dump(android.util.Printer, String); method public int getForegroundServiceType(); field @NonNull public static final android.os.Parcelable.Creator CREATOR; + field public static final int FLAG_ALLOW_SHARED_ISOLATED_PROCESS = 16; // 0x10 field public static final int FLAG_EXTERNAL_SERVICE = 4; // 0x4 field public static final int FLAG_ISOLATED_PROCESS = 2; // 0x2 field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000 diff --git a/core/java/android/content/pm/ServiceInfo.java b/core/java/android/content/pm/ServiceInfo.java index 6453ab0b89649..4ade8a8b87b65 100644 --- a/core/java/android/content/pm/ServiceInfo.java +++ b/core/java/android/content/pm/ServiceInfo.java @@ -78,6 +78,20 @@ public class ServiceInfo extends ComponentInfo */ public static final int FLAG_USE_APP_ZYGOTE = 0x0008; + /** + * Bit in {@link #flags}: If set, and this is an {@link android.R.attr#isolatedProcess} + * service, the service is allowed to be bound in a shared isolated process with other + * isolated services. Note that these other isolated services can also belong to other + * apps from different vendors. + * + * Shared isolated processes are created when using the + * {@link android.content.Context#BIND_SHARED_ISOLATED_PROCESS) during service binding. + * + * Note that when this flag is used, the {@link android.R.attr#process} attribute is + * ignored when the process is bound into a shared isolated process by a client. + */ + public static final int FLAG_ALLOW_SHARED_ISOLATED_PROCESS = 0x0010; + /** * Bit in {@link #flags} indicating if the service is visible to ephemeral applications. * @hide diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index d4644c59fa529..44f85dad95210 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -2963,6 +2963,18 @@ Context.createAttributionContext() using the first attribution tag contained here. --> + +