Package com.android.sdklib
Class AndroidTargetHash
- java.lang.Object
-
- com.android.sdklib.AndroidTargetHash
-
public abstract class AndroidTargetHash extends java.lang.ObjectHelper methods to manipulate hash strings used byIAndroidTarget.hashString().
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPLATFORM_HASH_PREFIXPrefix used to build hash strings for platform targetsstatic java.lang.StringSYSTEM_IMAGE_PREFIXPrefix used to build hash strings for system image targets
-
Constructor Summary
Constructors Constructor Description AndroidTargetHash()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetAddonHashString(java.lang.String addonVendorDisplay, java.lang.String addonNameDisplay, com.android.sdklib.AndroidVersion version)Returns the hash string for a given add-on.static com.android.sdklib.AndroidVersiongetAddOnVersion(java.lang.String hashString)static java.lang.StringgetPlatformHashString(com.android.sdklib.AndroidVersion version)Returns the hash string for a given platform version.static com.android.sdklib.AndroidVersiongetPlatformVersion(java.lang.String hashString)Returns theAndroidVersionfor the given hash string, if it represents a platform.static java.lang.StringgetTargetHashString(IAndroidTarget target)Returns the hash string for a given target (add-on or platform.)static com.android.sdklib.AndroidVersiongetVersionFromHash(java.lang.String hashString)Gets the API level from a hash string, either a platform version or add-on version.static booleanisPlatform(java.lang.String hashString)Given a hash string, indicates whether this is a platform hash string.static booleanisSystemImage(java.lang.String hashString)
-
-
-
Field Detail
-
PLATFORM_HASH_PREFIX
public static final java.lang.String PLATFORM_HASH_PREFIX
Prefix used to build hash strings for platform targets
-
SYSTEM_IMAGE_PREFIX
public static final java.lang.String SYSTEM_IMAGE_PREFIX
Prefix used to build hash strings for system image targets- See Also:
- Constant Field Values
-
-
Method Detail
-
getPlatformHashString
@NonNull public static java.lang.String getPlatformHashString(@NonNull com.android.sdklib.AndroidVersion version)Returns the hash string for a given platform version.- Parameters:
version- A non-null platform version.- Returns:
- A non-null hash string uniquely representing this platform target.
-
getPlatformVersion
@Nullable public static com.android.sdklib.AndroidVersion getPlatformVersion(@NonNull java.lang.String hashString)Returns theAndroidVersionfor the given hash string, if it represents a platform. If the hash string represents a preview platform, the returnedAndroidVersionwill have an unknown API level (set to 1 or a known matching API level.)- Parameters:
hashString- the hash string (e.g. "android-19" or "android-CUPCAKE") or a pure API level for convenience (e.g. "19" instead of the proper "android-19")- Returns:
- a platform, or null
-
getAddOnVersion
@Nullable public static com.android.sdklib.AndroidVersion getAddOnVersion(@NonNull java.lang.String hashString)
-
getVersionFromHash
@Nullable public static com.android.sdklib.AndroidVersion getVersionFromHash(@NonNull java.lang.String hashString)Gets the API level from a hash string, either a platform version or add-on version.
-
getAddonHashString
public static java.lang.String getAddonHashString(@NonNull java.lang.String addonVendorDisplay, @NonNull java.lang.String addonNameDisplay, @NonNull com.android.sdklib.AndroidVersion version)Returns the hash string for a given add-on.- Parameters:
addonVendorDisplay- A non-null vendor. When using anIdDisplaysource, this parameter should be theIdDisplay.getDisplay().addonNameDisplay- A non-null add-on name. When using anIdDisplaysource, this parameter should be theIdDisplay.getDisplay().version- A non-null platform version (the addon's base platform version)- Returns:
- A non-null hash string uniquely representing this add-on target.
-
getTargetHashString
public static java.lang.String getTargetHashString(@NonNull IAndroidTarget target)Returns the hash string for a given target (add-on or platform.)- Parameters:
target- A non-null target.- Returns:
- A non-null hash string uniquely representing this target.
-
isPlatform
public static boolean isPlatform(@NonNull java.lang.String hashString)Given a hash string, indicates whether this is a platform hash string. If not, it's an addon hash string.- Parameters:
hashString- The hash string to test.- Returns:
- True if this hash string starts by the platform prefix.
-
isSystemImage
public static boolean isSystemImage(@NonNull java.lang.String hashString)
-
-