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

This commit is contained in:
TreeHugger Robot
2021-02-12 16:37:01 +00:00
committed by Android (Google) Code Review
5 changed files with 40 additions and 8 deletions

View File

@@ -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";

View File

@@ -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.

View File

@@ -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);
}

View File

@@ -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) {

View File

@@ -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,12 +57,12 @@ 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",
(void*)nativeUnsafeGetFileSignature}};
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) {
return jniRegisterNativeMethods(env, "android/os/incremental/IncrementalManager",