我在实际设备上进行测试,屏幕解锁。这是我的代码:
public class TouchUtilsTest extends ActivityInstrumentationTestCase2<MainActivity> {
Activity mActivity;
Instrumentation mInstrumentation;
public TouchUtilsTest() {
super(MainActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
setActivityInitialTouchMode(false);
mActivity = getActivity();
mInstrumentation = getInstrumentation();
}
public void testTapOnView() {
View v = mActivity.findViewById(3);
Log.d("testTapOnView", "weee");
TouchUtils.tapView(this, v);
}
}
即使使用这个简单的代码,我也遇到了以下问题:
java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
我不确定我做错了什么......感谢任何建议。