Add cleanup to the @After method in StatusBarManagerTest

`togglePanels` helpfully toggles the state of the panel, so calling it
only once during the test means that it's never collapsed by the end of
the tests. This change adds a few cleanup methods to @After.

I found that the cleanup only works when pausing ~100ms, which is an
unfortunate reality that we should find a way around, but for now this
keeps the tests hermetic.

Test: manual; `atest StatusBarManagerTest` and check the phone to make
sure the panel is fully collapsed
Bug: 229623669

Change-Id: I82c38d0cf1872ee11a01f19f3130cc826615867d
diff --git a/tests/app/src/android/app/cts/StatusBarManagerTest.java b/tests/app/src/android/app/cts/StatusBarManagerTest.java
index 3557ac1..1422ecc 100644
--- a/tests/app/src/android/app/cts/StatusBarManagerTest.java
+++ b/tests/app/src/android/app/cts/StatusBarManagerTest.java
@@ -69,13 +69,22 @@
     }
 
     @After
-    public void tearDown() {
+    public void tearDown() throws Exception {
 
         if (mStatusBarManager != null) {
             // Adopt again since tests could've dropped it
             mUiAutomation.adoptShellPermissionIdentity(PERMISSION_STATUS_BAR);
+
+            // Give the UI thread a chance to finish any animations that happened during the test,
+            // otherwise it seems to just drop these calls
+            // (b/233937748)
+            Thread.sleep(100);
+
+            mStatusBarManager.collapsePanels();
             mStatusBarManager.setDisabledForSetup(false);
+            mStatusBarManager.setExpansionDisabledForSimNetworkLock(false);
         }
+
         mUiAutomation.dropShellPermissionIdentity();
     }