Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27f3913c authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Fix leakage of unit test on large screen/foldable device" into main

parents 8d008336 c870133b
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -384,7 +384,16 @@ public class SystemServicesTestRule implements TestRule {
    }

    private void tearDown() {
        mWmService.mRoot.forAllDisplayPolicies(DisplayPolicy::release);
        for (int i = mWmService.mRoot.getChildCount() - 1; i >= 0; i--) {
            final DisplayContent dc = mWmService.mRoot.getChildAt(i);
            // Unregister SettingsObserver.
            dc.getDisplayPolicy().release();
            // Unregister SensorEventListener (foldable device may register for hinge angle).
            dc.getDisplayRotation().onDisplayRemoved();
            if (dc.mDisplayRotationCompatPolicy != null) {
                dc.mDisplayRotationCompatPolicy.dispose();
            }
        }

        // Unregister display listener from root to avoid issues with subsequent tests.
        mContext.getSystemService(DisplayManager.class)