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

Commit 441d61bf authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Add persistentFeature application attribute.

This allows us to only mark processes as persistent
when a feature it actually depends on is present on
the device.

Also adds a "android.hardware.nfc.any" feature, to
indicate the device supports any of the NFC features
that require the NFC process to run persistently.

Bug: 36873979
Bug: 37269025
Test: NFC is still started on devices with NFC
Change-Id: I5792d75d8714f39718fa957177a632efcbbd37d3
parent 055b51af
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -992,6 +992,7 @@ package android {
    field public static final int persistableMode = 16843821; // 0x101042d
    field public static final int persistent = 16842765; // 0x101000d
    field public static final int persistentDrawingCache = 16842990; // 0x10100ee
    field public static final int persistentFeature = 16844134; // 0x1010566
    field public static final deprecated int phoneNumber = 16843111; // 0x1010167
    field public static final int pivotX = 16843189; // 0x10101b5
    field public static final int pivotY = 16843190; // 0x10101b6
+1 −0
Original line number Diff line number Diff line
@@ -1108,6 +1108,7 @@ package android {
    field public static final int persistableMode = 16843821; // 0x101042d
    field public static final int persistent = 16842765; // 0x101000d
    field public static final int persistentDrawingCache = 16842990; // 0x10100ee
    field public static final int persistentFeature = 16844134; // 0x1010566
    field public static final deprecated int phoneNumber = 16843111; // 0x1010167
    field public static final int pivotX = 16843189; // 0x10101b5
    field public static final int pivotY = 16843190; // 0x10101b6
+1 −0
Original line number Diff line number Diff line
@@ -992,6 +992,7 @@ package android {
    field public static final int persistableMode = 16843821; // 0x101042d
    field public static final int persistent = 16842765; // 0x101000d
    field public static final int persistentDrawingCache = 16842990; // 0x10100ee
    field public static final int persistentFeature = 16844134; // 0x1010566
    field public static final deprecated int phoneNumber = 16843111; // 0x1010167
    field public static final int pivotX = 16843189; // 0x10101b5
    field public static final int pivotY = 16843190; // 0x10101b6
+11 −0
Original line number Diff line number Diff line
@@ -1761,6 +1761,17 @@ public abstract class PackageManager {
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports any
     * one of the {@link #FEATURE_NFC}, {@link #FEATURE_NFC_HOST_CARD_EMULATION},
     * or {@link #FEATURE_NFC_HOST_CARD_EMULATION_NFCF} features.
     *
     * @hide
     */
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_NFC_ANY = "android.hardware.nfc.any";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports the OpenGL ES
+6 −1
Original line number Diff line number Diff line
@@ -3363,9 +3363,14 @@ public class PackageParser {
            if (sa.getBoolean(
                    com.android.internal.R.styleable.AndroidManifestApplication_persistent,
                    false)) {
                // Check if persistence is based on a feature being present
                final String requiredFeature = sa.getNonResourceString(
                    com.android.internal.R.styleable.AndroidManifestApplication_persistentFeature);
                if (requiredFeature == null || mCallback.hasFeature(requiredFeature)) {
                    ai.flags |= ApplicationInfo.FLAG_PERSISTENT;
                }
            }
        }

        if (sa.getBoolean(
                com.android.internal.R.styleable.AndroidManifestApplication_requiredForAllUsers,
Loading