diff options
author | Alex Klyubin <klyubin@google.com> | 2013-10-24 15:12:44 -0700 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2013-10-24 15:29:24 -0700 |
commit | 7ec3dc12fb9734fb3dbba68976641218b69a54a8 (patch) | |
tree | 5de8953a83437a1b81cb038136c726562724af76 /libdvm/src/main/java/dalvik | |
parent | 569ee5e9d7be50257e96409d0886f0c899f718e6 (diff) | |
download | libcore-7ec3dc12fb9734fb3dbba68976641218b69a54a8.zip libcore-7ec3dc12fb9734fb3dbba68976641218b69a54a8.tar.gz libcore-7ec3dc12fb9734fb3dbba68976641218b69a54a8.tar.bz2 |
Add VMRuntime.getTargetSdkVersion.
The goal is to enable libcore to adjust its behavior based on the
target SDK version / API Level of the app.
Change-Id: I63fa337a8e4175b64485cec432dd493111db8d4a
Diffstat (limited to 'libdvm/src/main/java/dalvik')
-rw-r--r-- | libdvm/src/main/java/dalvik/system/VMRuntime.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libdvm/src/main/java/dalvik/system/VMRuntime.java b/libdvm/src/main/java/dalvik/system/VMRuntime.java index 71098be..48685f6 100644 --- a/libdvm/src/main/java/dalvik/system/VMRuntime.java +++ b/libdvm/src/main/java/dalvik/system/VMRuntime.java @@ -30,6 +30,8 @@ public final class VMRuntime { */ private static final VMRuntime THE_ONE = new VMRuntime(); + private int targetSdkVersion; + /** * Prevents this class from being instantiated. */ @@ -111,9 +113,23 @@ public final class VMRuntime { * app starts to run, because it may change the VM's behavior in * dangerous ways. Use 0 to mean "current" (since callers won't * necessarily know the actual current SDK version, and the - * allocated version numbers start at 1). + * allocated version numbers start at 1), and 10000 to mean + * CUR_DEVELOPMENT. */ - public native void setTargetSdkVersion(int targetSdkVersion); + public synchronized void setTargetSdkVersion(int targetSdkVersion) { + this.targetSdkVersion = targetSdkVersion; + setTargetSdkVersionNative(this.targetSdkVersion); + } + + /** + * Gets the target SDK version. See {@link #setTargetSdkVersion} for + * special values. + */ + public synchronized int getTargetSdkVersion() { + return targetSdkVersion; + } + + private native void setTargetSdkVersionNative(int targetSdkVersion); /** * This method exists for binary compatibility. It was part of a |