Add checks against incorrect context use in sysui tests
Fix incorrect usages found by this check.
Test: runtest systemui
Bug: 62251903
Change-Id: I45a762f96838e617833c1cbe003e583087bb8176
diff --git a/tests/testables/src/android/testing/ViewUtils.java b/tests/testables/src/android/testing/ViewUtils.java
index 5a651aa..fca44ae 100644
--- a/tests/testables/src/android/testing/ViewUtils.java
+++ b/tests/testables/src/android/testing/ViewUtils.java
@@ -31,12 +31,10 @@
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
LayoutParams.TYPE_APPLICATION_OVERLAY,
0, PixelFormat.TRANSLUCENT);
- InstrumentationRegistry.getContext()
- .getSystemService(WindowManager.class).addView(view, lp);
+ view.getContext().getSystemService(WindowManager.class).addView(view, lp);
}
public static void detachView(View view) {
- InstrumentationRegistry.getContext()
- .getSystemService(WindowManager.class).removeViewImmediate(view);
+ view.getContext().getSystemService(WindowManager.class).removeViewImmediate(view);
}
}