Introduce listUIChanges API for developer UI

Filter out changes that are: logging only, older then enabled after P,
newer then enabled after Q.
Added missing @Test that broke builds.

Test: atest com.android.server.compat.PlatformCompatTest
Bug: 151299145
Change-Id: Ic4c12ceec3f4018a1f206b8498e8216466ecf960
Merged-In: Ic4c12ceec3f4018a1f206b8498e8216466ecf960
This commit is contained in:
atrost
2020-03-17 20:53:33 +00:00
parent 8281abfdb6
commit a5363153f3
4 changed files with 113 additions and 0 deletions

View File

@@ -93,6 +93,43 @@ public class CompatibilityChangeInfo implements Parcelable {
dest.writeString(mDescription);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CompatibilityChangeInfo(")
.append(getId());
if (getName() != null) {
sb.append("; name=").append(getName());
}
if (getEnableAfterTargetSdk() != -1) {
sb.append("; enableAfterTargetSdk=").append(getEnableAfterTargetSdk());
}
if (getDisabled()) {
sb.append("; disabled");
}
if (getLoggingOnly()) {
sb.append("; loggingOnly");
}
return sb.append(")").toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || !(o instanceof CompatibilityChangeInfo)) {
return false;
}
CompatibilityChangeInfo that = (CompatibilityChangeInfo) o;
return this.mChangeId == that.mChangeId
&& this.mName.equals(that.mName)
&& this.mEnableAfterTargetSdk == that.mEnableAfterTargetSdk
&& this.mDisabled == that.mDisabled
&& this.mLoggingOnly == that.mLoggingOnly
&& this.mDescription.equals(that.mDescription);
}
public static final Parcelable.Creator<CompatibilityChangeInfo> CREATOR =
new Parcelable.Creator<CompatibilityChangeInfo>() {

View File

@@ -221,6 +221,14 @@ interface IPlatformCompat
*/
CompatibilityChangeInfo[] listAllChanges();
/**
* List the compatibility changes that should be present in the UI.
* Filters out certain changes like e.g. logging only.
*
* @return An array of {@link CompatChangeInfo}.
*/
CompatibilityChangeInfo[] listUIChanges();
/**
* Get an instance that can determine whether a changeid can be overridden for a package name.
*/