Introduce Build.VERSION.KNOWN_CODENAMES.

See go/mainline-sdk-codenames-issue.

Known values are to be used to distinguish multiple pre-release
codenames, and to allow in development artifacts to be installable
on released versions of the platform for testing going forward.

This does not change pre-T behaviour at large however.

Bug: 211747008
Test: presubmit
Change-Id: I0c8df8e767ea61b27bb53da53fb6c9b2c842dbbc
This commit is contained in:
satayev
2022-01-31 20:30:12 +00:00
committed by Artur Satayev
parent 86e1a45b56
commit 434ef186e6
2 changed files with 14 additions and 0 deletions

View File

@@ -7829,6 +7829,7 @@ package android.os {
}
public static class Build.VERSION {
field @NonNull public static final java.util.Set<java.lang.String> KNOWN_CODENAMES;
field @NonNull public static final String PREVIEW_SDK_FINGERPRINT;
}

View File

@@ -31,6 +31,7 @@ import android.sysprop.DeviceProperties;
import android.sysprop.SocProperties;
import android.sysprop.TelephonyProperties;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Slog;
import android.view.View;
@@ -39,6 +40,7 @@ import dalvik.system.VMRuntime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -396,6 +398,17 @@ public class Build {
*/
public static final String CODENAME = getString("ro.build.version.codename");
/**
* All known codenames starting from {@link VERSION_CODES.Q}.
*
* <p>This includes in development codenames as well.
*
* @hide
*/
@SystemApi
@NonNull public static final Set<String> KNOWN_CODENAMES =
new ArraySet<>(new String[]{"Q", "R", "S", "Sv2", "Tiramisu"});
private static final String[] ALL_CODENAMES
= getStringList("ro.build.version.all_codenames", ",");