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

Commit 4eae49c1 authored by Martijn Coenen's avatar Martijn Coenen
Browse files

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
parent 72d234ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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<android.content.pm.ServiceInfo> 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
+14 −0
Original line number Diff line number Diff line
@@ -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
+12 −0
Original line number Diff line number Diff line
@@ -2963,6 +2963,18 @@
             Context.createAttributionContext() using the first attribution tag
             contained here. -->
        <attr name="attributionTags" />
        <!-- If true, 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.
             <p>
             Shared isolated processes are created when using the
             {@link android.content.Context#BIND_SHARED_ISOLATED_PROCESS) during service binding.
             <p>
             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.
        -->
        <attr name="allowSharedIsolatedProcess" format="boolean" />
    </declare-styleable>

    <!-- @hide The <code>apex-system-service</code> tag declares an apex system service
+1 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@
    <public name="visualQueryDetectionService" />
    <public name="physicalKeyboardHintLanguageTag" />
    <public name="physicalKeyboardHintLayoutType" />
    <public name="allowSharedIsolatedProcess" />
  </staging-public-group>

  <staging-public-group type="id" first-id="0x01cd0000">
+5 −0
Original line number Diff line number Diff line
@@ -3935,6 +3935,11 @@ public final class ActiveServices {
                        throw new SecurityException("BIND_SHARED_ISOLATED_PROCESS failed, "
                                + className + " is not an isolatedProcess");
                    }
                    if ((sInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) == 0) {
                        throw new SecurityException("BIND_SHARED_ISOLATED_PROCESS failed, "
                                + className + " has not set the allowSharedIsolatedProcess "
                                + " attribute.");
                    }
                    if (instanceName == null) {
                        throw new IllegalArgumentException("instanceName must be provided for "
                                + "binding a service into a shared isolated process.");
Loading