Save and Restore java.io.tmpDir Property

Bug 5498103

OldFileTest seemed to change this property causing a bunch of
failures in OldFormatterTest.

Change-Id: Ib569d8545046cf1924f25630637341ec262e3c99
diff --git a/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java b/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java
index 49a3f9d..d426290 100644
--- a/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java
+++ b/tests/core/runner/src/android/test/InstrumentationCtsTestRunner.java
@@ -121,6 +121,7 @@
             private long startTime;
 
             private Locale defaultLocale;
+            private String javaIoTmpDir;
 
             @Override
             public void startTest(Test test) {
@@ -132,15 +133,24 @@
                 Thread.currentThread().setContextClassLoader(
                         test.getClass().getClassLoader());
 
-                defaultLocale = Locale.getDefault();
+                save();
 
                 startTime = System.currentTimeMillis();
             }
 
+            private void save() {
+                defaultLocale = Locale.getDefault();
+                javaIoTmpDir = System.getProperty("java.io.tmpdir");
+            }
+
+            private void restore() {
+                Locale.setDefault(defaultLocale);
+                System.setProperty("java.io.tmpdir", javaIoTmpDir);
+            }
+
             @Override
             public void endTest(Test test) {
-                Locale.setDefault(defaultLocale);
-
+                restore();
                 if (test instanceof TestCase) {
                     cleanup((TestCase)test);