Commit 7ffb9fdd authored by Tobias Sargeant's avatar Tobias Sargeant Committed by Commit Bot

Update isAtLeast* and targetsAtLeast* methods

Change-Id: Ib41d0b741d76a2dc5dfc70f2369263e16980974b
Reviewed-on: https://chromium-review.googlesource.com/796410Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Tobias Sargeant <tobiasjs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520143}
parent c82891ca
......@@ -128,14 +128,70 @@ public class BuildInfo {
// The markers Begin:BuildCompat and End:BuildCompat delimit code
// that is autogenerated from Android sources.
// Begin:BuildCompat O,OMR1,P
/**
* @return Whether the current device is running Android O release or newer.
*
* @deprecated Please inline this method where possible.
* Checks if the device is running on a pre-release version of Android O or newer.
* <p>
* @return {@code true} if O APIs are available for use, {@code false} otherwise
* @deprecated Android O is a finalized release and this method is no longer necessary. It will
* be removed in a future release of the Support Library. Instead use
* {@code Build.SDK_INT >= Build.VERSION_CODES#O}.
*/
@Deprecated
public static boolean isAtLeastO() {
return VERSION.SDK_INT >= Build.VERSION_CODES.O;
return VERSION.SDK_INT >= 26;
}
/**
* Checks if the device is running on a pre-release version of Android O MR1 or newer.
* <p>
* @return {@code true} if O MR1 APIs are available for use, {@code false} otherwise
* @deprecated Android O MR1 is a finalized release and this method is no longer necessary. It
* will be removed in a future release of the Support Library. Instead, use
* {@code Build.SDK_INT >= Build.VERSION_CODES#O_MR1}.
*/
@Deprecated
public static boolean isAtLeastOMR1() {
return VERSION.SDK_INT >= 27;
}
/**
* Checks if the device is running on a pre-release version of Android P or newer.
* <p>
* <strong>Note:</strong> This method will return {@code false} on devices running release
* versions of Android. When Android P is finalized for release, this method will be deprecated
* and all calls should be replaced with {@code Build.SDK_INT >= Build.VERSION_CODES#P}.
*
* @return {@code true} if P APIs are available for use, {@code false} otherwise
*/
public static boolean isAtLeastP() {
return VERSION.CODENAME.equals("P");
}
/**
* Checks if the application targets at least released SDK O
*/
@Deprecated
public static boolean targetsAtLeastO() {
return ContextUtils.getApplicationContext().getApplicationInfo().targetSdkVersion >= 26;
}
/**
* Checks if the application targets at least released SDK OMR1
*/
@Deprecated
public static boolean targetsAtLeastOMR1() {
return ContextUtils.getApplicationContext().getApplicationInfo().targetSdkVersion >= 27;
}
/**
* Checks if the application targets pre-release SDK P
*/
public static boolean targetsAtLeastP() {
return isAtLeastP()
&& ContextUtils.getApplicationContext().getApplicationInfo().targetSdkVersion
== Build.VERSION_CODES.CUR_DEVELOPMENT;
}
// End:BuildCompat
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment