EnvironmentTest: make sure TMPDIR isn't set.

Bug: 5756891
Change-Id: I88d7ee5ad35b0ee8eb2f9cceea5f824b7023d8ff
diff --git a/tests/tests/os/src/android/os/cts/EnvironmentTest.java b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
index 2081cba..711306e 100644
--- a/tests/tests/os/src/android/os/cts/EnvironmentTest.java
+++ b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
@@ -70,4 +70,15 @@
         assertTrue(Environment.getDownloadCacheDirectory().isDirectory());
         assertTrue(Environment.getDataDirectory().isDirectory());
     }
+
+    /**
+     * TMPDIR being set prevents apps from asking to have temporary files
+     * placed in their own storage, instead forcing their location to
+     * something OS-defined. If TMPDIR points to a global shared directory,
+     * this could compromise the security of the files.
+     */
+    public void testNoTmpDir() {
+        assertNull("environment variable TMPDIR should not be set",
+                System.getenv("TMPDIR"));
+    }
 }