silentsolo / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

another application requires INJECT_EVENTS permission #640

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

 i can't add inject permission in mainfest as it need system app. so how can i  resolve this problem
Soucce:
WindowManager wm = FPUtil.solo.getCurrentActivity().getWindowManager();
        int width = wm.getDefaultDisplay().getWidth();
        int height = wm.getDefaultDisplay().getHeight();

        int x1 = width/6;
        int y = (height/16) * 15;       
        int x2 = width/3;
        int x2 = width/3;

        PointF point1 = new PointF();
        point1.set(x1, y);
        PointF point2 = new PointF();
        point1.set(x2, y + 2);

        solo.swipe(point2, point2, point1, point1);

Exception:
junit.framework.AssertionFailedError: Click at (160.0, 252.5) can not be 
completed! (java.lang.SecurityException: Injecting to 

another application requires INJECT_EVENTS permission)
at com.robotium.solo.Clicker.clickOnScreen(Clicker.java:113)
at com.robotium.solo.Clicker.clickOnScreen(Clicker.java:212)
at com.robotium.solo.Clicker.clickOnScreen(Clicker.java:177)
at com.robotium.solo.Solo.clickOnView(Solo.java:1059)
at com.flypos.test.utils.FPUtil$AW.clickById(FPUtil.java:598)
at com.flypos.test.model.Login.enterIntoLoginMain(Login.java:56)
at com.flypos.test.model.Login.isExist(Login.java:39)
at com.flypos.test.cases1.TestDemo.testDemo(TestDemo.java:27)
at 
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at 
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at 
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:192)
at com.flypos.test.utils.FPUtil.runBare(FPUtil.java:912)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
5)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1763)

What version of the product are you using? On what operating system?

Robotium-5.2.2
OS: WIN7
Please provide any additional information below.

Original issue reported on code.google.com by hexns...@gmail.com on 27 Nov 2014 at 4:58

GoogleCodeExporter commented 9 years ago
This is due to Instrumentation and there is no way around it.

Original comment by renasr...@gmail.com on 27 Nov 2014 at 4:27