Move to smart pointers for refcounting RS contexts

Change-Id: I0dc6adc4e02c7427a4234c549d3555a501fe5f90
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index b291045..18e4af2 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -250,8 +250,14 @@
     bitcodeLen = BT->getTranslatedBitcodeSize();
 #endif
 
+    if (!cacheDir) {
+        // MUST BE FIXED BEFORE ANYTHING USING C++ API IS RELEASED
+        cacheDir = getenv("EXTERNAL_STORAGE");
+        ALOGV("Cache dir changed to %s", cacheDir);
+    }
+
     // ensure that cache dir exists
-    if (!createCacheDir(cacheDir)) {
+    if (cacheDir && !createCacheDir(cacheDir)) {
       return false;
     }