Fix an issue where the oom catcher wouldn't reboot.

On o+, there's a threadlocal variable for getDevice() in
SecurityTestCase.java. Since the oom detection and reboot is on
another thread, getDevice() returns null, failing to reboot and clear
the oom status from the device-side app.

Bug: 111403569
Test: on o+, cause an oom and assert there's no nullpointerexception
Change-Id: Ic64098645a8869992af74846d1fc6ec501b7d66b
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java b/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java
index eeeb4fe..cd39c56 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java
@@ -127,7 +127,7 @@
             oomCatcher = new BackgroundDeviceAction(
                     "logcat -c && logcat OomCatcher:V *:S",
                     "Oom Catcher background thread",
-                    getDevice(), new OomReceiver(), 0);
+                    getDevice(), new OomReceiver(getDevice()), 0);
 
             oomCatchers.put(getDevice().getSerialNumber(), new WeakReference<>(oomCatcher));
             oomCatcher.start();
@@ -191,8 +191,13 @@
      */
     class OomReceiver extends MultiLineReceiver {
 
+        private ITestDevice device = null;
         private boolean isCancelled = false;
 
+        public OomReceiver(ITestDevice device) {
+            this.device = device;
+        }
+
         @Override
         public void processNewLines(String[] lines) {
             for (String line : lines) {
@@ -205,9 +210,8 @@
                         oomDetected = true;
                     }
                     try {
-
-                        getDevice().nonBlockingReboot();
-                        getDevice().waitForDeviceOnline(60 * 2 * 1000); // 2 minutes
+                        device.nonBlockingReboot();
+                        device.waitForDeviceOnline(60 * 2 * 1000); // 2 minutes
                         context.updateKernelStartTime();
                     } catch (Exception e) {
                         Log.e(LOG_TAG, e.toString());