OSDN Git Service

Merge "Add checks against incorrect context use in sysui tests" into oc-dev am: 227e6...
authorJason Monk <jmonk@google.com>
Thu, 1 Jun 2017 20:22:03 +0000 (20:22 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Thu, 1 Jun 2017 20:22:03 +0000 (20:22 +0000)
am: b629460f33

Change-Id: I5695d4b2361bdf4ec9abe054418780572e660d2a

1  2 
tests/testables/src/android/testing/ViewUtils.java

@@@ -39,17 -31,10 +39,15 @@@ public class ViewUtils 
                  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);
      }
  
 +    /**
 +     * Causes the view (and its children) to have {@link View#onDetachedFromWindow()} called.
 +     *
 +     * This is currently done by removing the view from a window.
 +     */
      public static void detachView(View view) {
-         InstrumentationRegistry.getContext()
-                 .getSystemService(WindowManager.class).removeViewImmediate(view);
+         view.getContext().getSystemService(WindowManager.class).removeViewImmediate(view);
      }
  }