Use different .so names in a debug context

Bug: 37670543
Bug: 36006390
Bug: 37679566
Bug: 37636434

In debug context, a script is forced to be recompiled every time it
is initialized.
To avoid the same .so file being written to by another thread,
while it is being loaded and used by one thread, do not save the .so
file. Delete it right after loading it.

Test: RefocusTest and RSTest (including ScriptGroup2 tests) with
      debug.rs.debug set to 1 and CTS on Angler

Change-Id: If63e3d21e3d9abd007a66e0ec79c9e6f1c9f13a0
diff --git a/cpu_ref/rsCpuScript.h b/cpu_ref/rsCpuScript.h
index 1814d5f..dc96f8b 100644
--- a/cpu_ref/rsCpuScript.h
+++ b/cpu_ref/rsCpuScript.h
@@ -171,4 +171,26 @@
 
 } // namespace android
 
+namespace {
+
+inline bool is_force_recompile() {
+  char buf[PROP_VALUE_MAX];
+
+  // Re-compile if floating point precision has been overridden.
+  android::renderscript::property_get("debug.rs.precision", buf, "");
+  if (buf[0] != '\0') {
+    return true;
+  }
+
+  // Re-compile if debug.rs.forcerecompile is set.
+  android::renderscript::property_get("debug.rs.forcerecompile", buf, "0");
+  if ((::strcmp(buf, "1") == 0) || (::strcmp(buf, "true") == 0)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+}  // anonymous namespace
+
 #endif  // RSD_CPU_SCRIPT_H