Add a new feature to store IncFs version.
And deprecating the old feature which didn't have versioning support. V2 means that the new features are either required if the device was shipped with S, or available if device updated kernel to S. Bug: 180010901 Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest Change-Id: If037f0eb23260f354b0929ff7afaf1af9627e5fa
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user