Handle null cache directory

data/android directory doesn't exist sometimes, and hence cache
directory creation fails. Don't crash the process due to that.

Change-Id: I22d7ed5df9c70f021a87029e89a13a11b4b0303b
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 28c5abd..b8e16c5 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4070,10 +4070,14 @@
         if (!Process.isIsolated()) {
             final File cacheDir = appContext.getCacheDir();
 
-            // Provide a usable directory for temporary files
-            System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
-
-            setupGraphicsSupport(data.info, cacheDir);
+            if (cacheDir != null) {
+                // Provide a usable directory for temporary files
+                System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
+    
+                setupGraphicsSupport(data.info, cacheDir);
+            } else {
+                Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory");
+            }
         }
         /**
          * For system applications on userdebug/eng builds, log stack