summaryrefslogtreecommitdiffstats
path: root/rs/java
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2015-03-24 02:59:12 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-24 02:59:12 +0000
commitab452f70fc658fbc0b93da77ef8e67596dec2954 (patch)
tree45d93df71d9cbc626cca50df70c3e6ef292dc703 /rs/java
parent568e39187231d1e5bac620b3369087587be61db8 (diff)
parent2b30b73b017f10bc2ce514981b577c2efaeab739 (diff)
downloadframeworks_base-ab452f70fc658fbc0b93da77ef8e67596dec2954.zip
frameworks_base-ab452f70fc658fbc0b93da77ef8e67596dec2954.tar.gz
frameworks_base-ab452f70fc658fbc0b93da77ef8e67596dec2954.tar.bz2
am 2b30b73b: am 6f6f44b0: am b2b0c4c2: Merge "[RenderScript] Add create(Context, int) to be compatible with the thunker layer & minor tweaks."
* commit '2b30b73b017f10bc2ce514981b577c2efaeab739': [RenderScript] Add create(Context, int) to be compatible with the thunker layer & minor tweaks.
Diffstat (limited to 'rs/java')
-rw-r--r--rs/java/android/renderscript/RenderScript.java43
1 files changed, 36 insertions, 7 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index 8562288..e8e942c 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -1351,7 +1351,7 @@ public class RenderScript {
}
/**
- * calls create(cts, ContextType.NORMAL, CREATE_FLAG_NONE)
+ * calls create(ctx, ContextType.NORMAL, CREATE_FLAG_NONE)
*
* See documentation for @create for details
*
@@ -1363,7 +1363,7 @@ public class RenderScript {
}
/**
- * calls create(cts, ct, CREATE_FLAG_NONE)
+ * calls create(ctx, ct, CREATE_FLAG_NONE)
*
* See documentation for @create for details
*
@@ -1375,7 +1375,8 @@ public class RenderScript {
return create(ctx, ct, CREATE_FLAG_NONE);
}
- /**
+
+ /**
* Gets or creates a RenderScript context of the specified type.
*
* The returned context will be cached for future reuse within
@@ -1397,21 +1398,49 @@ public class RenderScript {
*/
public static RenderScript create(Context ctx, ContextType ct, int flags) {
int v = ctx.getApplicationInfo().targetSdkVersion;
- if (v < 23) {
- return internalCreate(ctx, v, ct, flags);
+ return create(ctx, v, ct, flags);
+ }
+
+ /**
+ * calls create(ctx, sdkVersion, ContextType.NORMAL, CREATE_FLAG_NONE)
+ *
+ * Used by the RenderScriptThunker to maintain backward compatibility.
+ *
+ * @hide
+ * @param ctx The context.
+ * @param sdkVersion The target SDK Version.
+ * @return RenderScript
+ */
+ public static RenderScript create(Context ctx, int sdkVersion) {
+ return create(ctx, sdkVersion, ContextType.NORMAL, CREATE_FLAG_NONE);
+ }
+
+ /**
+ * Gets or creates a RenderScript context of the specified type.
+ *
+ * @hide
+ * @param ctx The context.
+ * @param ct The type of context to be created.
+ * @param sdkVersion The target SDK Version.
+ * @param flags The OR of the CREATE_FLAG_* options desired
+ * @return RenderScript
+ */
+ public static RenderScript create(Context ctx, int sdkVersion, ContextType ct, int flags) {
+ if (sdkVersion < 23) {
+ return internalCreate(ctx, sdkVersion, ct, flags);
}
synchronized (mProcessContextList) {
for (RenderScript prs : mProcessContextList) {
if ((prs.mContextType == ct) &&
(prs.mContextFlags == flags) &&
- (prs.mContextSdkVersion == v)) {
+ (prs.mContextSdkVersion == sdkVersion)) {
return prs;
}
}
- RenderScript prs = internalCreate(ctx, v, ct, flags);
+ RenderScript prs = internalCreate(ctx, sdkVersion, ct, flags);
prs.mIsProcessContext = true;
mProcessContextList.add(prs);
return prs;