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

Commit 6516885e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a new feature to store IncFs version." into sc-dev

parents 08c619d6 50bc17cd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2523,7 +2523,8 @@ package android.content.pm {
    field public static final String FEATURE_BROADCAST_RADIO = "android.hardware.broadcastradio";
    field public static final String FEATURE_CONTEXT_HUB = "android.hardware.context_hub";
    field public static final String FEATURE_CROSS_LAYER_BLUR = "android.software.cross_layer_blur";
    field public static final String FEATURE_INCREMENTAL_DELIVERY = "android.software.incremental_delivery";
    field @Deprecated public static final String FEATURE_INCREMENTAL_DELIVERY = "android.software.incremental_delivery";
    field public static final String FEATURE_INCREMENTAL_DELIVERY_VERSION = "android.software.incremental_delivery_version";
    field public static final String FEATURE_REBOOT_ESCROW = "android.hardware.reboot_escrow";
    field public static final String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock";
    field public static final String FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION = "android.hardware.telephony.ims.singlereg";
+18 −1
Original line number Diff line number Diff line
@@ -3592,14 +3592,31 @@ public abstract class PackageManager {
     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device has
     * the requisite kernel support to support incremental delivery aka Incremental FileSystem.
     *
     * @see IncrementalManager#isEnabled
     * @see IncrementalManager#isFeatureEnabled
     * @hide
     *
     * @deprecated Use {@link #FEATURE_INCREMENTAL_DELIVERY_VERSION} instead.
     */
    @Deprecated
    @SystemApi
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_INCREMENTAL_DELIVERY =
            "android.software.incremental_delivery";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
     * feature not present - IncFs is not present on the device.
     * 1 - IncFs v1, core features, no PerUid support. Optional in R.
     * 2 - IncFs v2, PerUid support, fs-verity support. Required in S.
     *
     * @see IncrementalManager#isFeatureEnabled and IncrementalManager#isV2()
     * @hide
     */
    @SystemApi
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_INCREMENTAL_DELIVERY_VERSION =
            "android.software.incremental_delivery_version";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}:
     * The device has tuner hardware to support tuner operations.
+8 −0
Original line number Diff line number Diff line
@@ -240,6 +240,13 @@ public final class IncrementalManager {
        return nativeIsEnabled();
    }

    /**
     * Checks if device supports V2 calls (e.g. PerUid).
     */
    public static boolean isV2Available() {
        return nativeIsV2Available();
    }

    /**
     * Checks if Incremental installations are allowed.
     * A developer can disable Incremental installations by setting the property.
@@ -439,6 +446,7 @@ public final class IncrementalManager {

    /* Native methods */
    private static native boolean nativeIsEnabled();
    private static native boolean nativeIsV2Available();
    private static native boolean nativeIsIncrementalPath(@NonNull String path);
    private static native byte[] nativeUnsafeGetFileSignature(@NonNull String path);
}
+2 −0
Original line number Diff line number Diff line
@@ -1236,6 +1236,8 @@ public class SystemConfig {

        if (IncrementalManager.isFeatureEnabled()) {
            addFeature(PackageManager.FEATURE_INCREMENTAL_DELIVERY, 0);
            addFeature(PackageManager.FEATURE_INCREMENTAL_DELIVERY_VERSION,
                    IncrementalManager.isV2Available() ? 2 : 1);
        }

        if (PackageManager.APP_ENUMERATION_ENABLED_BY_DEFAULT) {
+10 −6
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ static jboolean nativeIsEnabled(JNIEnv* env, jobject clazz) {
    return IncFs_IsEnabled();
}

static jboolean nativeIsV2Available(JNIEnv* env, jobject clazz) {
    return !!(IncFs_Features() & INCFS_FEATURE_V2);
}

static jboolean nativeIsIncrementalPath(JNIEnv* env,
                                    jobject clazz,
                                    jstring javaPath) {
@@ -53,11 +57,11 @@ static jbyteArray nativeUnsafeGetFileSignature(JNIEnv* env, jobject clazz, jstri
    return result;
}

static const JNINativeMethod method_table[] = {{"nativeIsEnabled", "()Z", (void*)nativeIsEnabled},
                                               {"nativeIsIncrementalPath", "(Ljava/lang/String;)Z",
                                                (void*)nativeIsIncrementalPath},
                                               {"nativeUnsafeGetFileSignature",
                                                "(Ljava/lang/String;)[B",
static const JNINativeMethod method_table[] =
        {{"nativeIsEnabled", "()Z", (void*)nativeIsEnabled},
         {"nativeIsV2Available", "()Z", (void*)nativeIsV2Available},
         {"nativeIsIncrementalPath", "(Ljava/lang/String;)Z", (void*)nativeIsIncrementalPath},
         {"nativeUnsafeGetFileSignature", "(Ljava/lang/String;)[B",
          (void*)nativeUnsafeGetFileSignature}};

int register_android_os_incremental_IncrementalManager(JNIEnv* env) {