Merge "Add support for LoggingOnly changes" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e9e7d56cd9
@@ -30,6 +30,7 @@ public class CompatibilityChangeInfo implements Parcelable {
|
||||
private final @Nullable String mName;
|
||||
private final int mEnableAfterTargetSdk;
|
||||
private final boolean mDisabled;
|
||||
private final boolean mLoggingOnly;
|
||||
private final @Nullable String mDescription;
|
||||
|
||||
public long getId() {
|
||||
@@ -49,17 +50,22 @@ public class CompatibilityChangeInfo implements Parcelable {
|
||||
return mDisabled;
|
||||
}
|
||||
|
||||
public boolean getLoggingOnly() {
|
||||
return mLoggingOnly;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
public CompatibilityChangeInfo(
|
||||
Long changeId, String name, int enableAfterTargetSdk, boolean disabled,
|
||||
String description) {
|
||||
boolean loggingOnly, String description) {
|
||||
this.mChangeId = changeId;
|
||||
this.mName = name;
|
||||
this.mEnableAfterTargetSdk = enableAfterTargetSdk;
|
||||
this.mDisabled = disabled;
|
||||
this.mLoggingOnly = loggingOnly;
|
||||
this.mDescription = description;
|
||||
}
|
||||
|
||||
@@ -68,6 +74,7 @@ public class CompatibilityChangeInfo implements Parcelable {
|
||||
mName = in.readString();
|
||||
mEnableAfterTargetSdk = in.readInt();
|
||||
mDisabled = in.readBoolean();
|
||||
mLoggingOnly = in.readBoolean();
|
||||
mDescription = in.readString();
|
||||
}
|
||||
|
||||
@@ -82,6 +89,7 @@ public class CompatibilityChangeInfo implements Parcelable {
|
||||
dest.writeString(mName);
|
||||
dest.writeInt(mEnableAfterTargetSdk);
|
||||
dest.writeBoolean(mDisabled);
|
||||
dest.writeBoolean(mLoggingOnly);
|
||||
dest.writeString(mDescription);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ public final class OverrideAllowedState implements Parcelable {
|
||||
DISABLED_NOT_DEBUGGABLE,
|
||||
DISABLED_NON_TARGET_SDK,
|
||||
DISABLED_TARGET_SDK_TOO_HIGH,
|
||||
PACKAGE_DOES_NOT_EXIST
|
||||
PACKAGE_DOES_NOT_EXIST,
|
||||
LOGGING_ONLY_CHANGE
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface State {
|
||||
@@ -60,6 +61,10 @@ public final class OverrideAllowedState implements Parcelable {
|
||||
* Package does not exist.
|
||||
*/
|
||||
public static final int PACKAGE_DOES_NOT_EXIST = 4;
|
||||
/**
|
||||
* Change is marked as logging only, and cannot be toggled.
|
||||
*/
|
||||
public static final int LOGGING_ONLY_CHANGE = 5;
|
||||
|
||||
@State
|
||||
public final int state;
|
||||
@@ -118,6 +123,10 @@ public final class OverrideAllowedState implements Parcelable {
|
||||
"Cannot override %1$d for %2$s because the package does not exist, and "
|
||||
+ "the change is targetSdk gated.",
|
||||
changeId, packageName));
|
||||
case LOGGING_ONLY_CHANGE:
|
||||
throw new SecurityException(String.format(
|
||||
"Cannot override %1$d because it is marked as a logging-only change.",
|
||||
changeId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user