diff options
Diffstat (limited to 'rs/java/android/renderscript/ScriptGroup2.java')
-rw-r--r-- | rs/java/android/renderscript/ScriptGroup2.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rs/java/android/renderscript/ScriptGroup2.java b/rs/java/android/renderscript/ScriptGroup2.java index 8b9f73e..858a957 100644 --- a/rs/java/android/renderscript/ScriptGroup2.java +++ b/rs/java/android/renderscript/ScriptGroup2.java @@ -549,11 +549,17 @@ public class ScriptGroup2 extends BaseObj { /** * Creates a script group * + * @param name name for the script group. Legal names can only contain letters, digits, + * '-', or '_'. The name can be no longer than 100 characters. * @param outputs futures intended as outputs of the script group * @return a script group */ - public ScriptGroup2 create(Future... outputs) { + public ScriptGroup2 create(String name, Future... outputs) { + if (name == null || name.isEmpty() || name.length() > 100 || + !name.equals(name.replaceAll("[^a-zA-Z0-9-]", "_"))) { + throw new RSIllegalArgumentException("invalid script group name"); + } ScriptGroup2 ret = new ScriptGroup2(mRS, mClosures, mInputs, outputs); return ret; } |