Permission denial on monkey integration

1k views Asked by At

I try to integrate monkey to my APP, while following error always comes:

10-13 09:16:24.682: INFO/System.out(274): :Monkey: seed=0 count=500...
10-13 09:16:24.682: INFO/System.out(274): :Monkey: seed=0 count=500...
10-13 09:16:24.704: INFO/System.out(274): :AllowPackage: org.example.tabdemo...
10-13 09:16:24.712: INFO/System.out(274): AllowPackage: org.example.tabdemo...
10-13 09:16:24.723: INFO/System.out(274): :IncludeCategory:   android.intent.category.LAUNCHER...
10-13 09:16:24.762: INFO/System.out(274): IncludeCategory: android.intent.category.LAUNCHER...
10-13 09:16:24.773: INFO/System.out(274): :IncludeCategory: android.intent.category.MONKEYER...
10-13 09:16:24.783: INFO/System.out(274): IncludeCategory: android.intent.category.MONKEYER...
10-13 09:16:24.872: WARN/ActivityManager(58): Permission Denial:   setActivityController() from pid=290, uid=10036 requires android.permission.SET_ACTIVITY_WATCHER
10-13 09:16:24.903: DEBUG/AndroidRuntime(290): Shutting down VM
10-13 09:16:24.912: WARN/dalvikvm(290): threadid=1: thread exiting with uncaught 

exception (group=0x4001d850)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
10-13 09:16:25.112: ERROR/AndroidRuntime(290): java.lang.SecurityException: Permission Denial: setActivityController() from pid=290, uid=10036 requires android.permission.SET_ACTIVITY_WATCHER
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at android.os.Parcel.readException(Parcel.java:1247)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at android.os.Parcel.readException(Parcel.java:1235)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at android.app.ActivityManagerProxy.setActivityController(ActivityManagerNative.java:2450)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at com.android.commands.monkey.Monkey.getSystemInterfaces(Monkey.java:780)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at com.android.commands.monkey.Monkey.run(Monkey.java:433)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at com.android.commands.monkey.Monkey.main(Monkey.java:360)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at com.android.internal.os.RuntimeInit.finishInit(Native Method)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
10-13 09:16:25.112: ERROR/AndroidRuntime(290): at dalvik.system.NativeStart.main(Native Method)
10-13 09:16:25.133: ERROR/JavaBinder(290): Unknown binder error code. 0xfffffff7
10-13 09:16:25.133: INFO/Process(290): Sending signal. PID: 290 SIG: 9
10-13 09:16:25.252: DEBUG/dalvikvm(132): GC_EXPLICIT freed 315 objects / 15400 bytes in 160ms

My manifex xml:(I alread add the permission of SET_ACTIVITY_WATCHER)

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.wukong"
        android:versionCode="1"
        android:versionName="1.0">

        <uses-sdk android:minSdkVersion="8" />

        <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
            <activity android:name=".TestMain" android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <service android:name=".TestService"></service>   
        </application>

        <uses-permission android:name="android.permission.READ_PHONE_STATE" >
        </uses-permission>

        <uses-permission android:name="android.permission.SET_ACTIVITY_WATCHER" >
        </uses-permission>   

    </manifest>

In my test service I start monkey command to test package "org.example.tabdemo":

public void startMonkeyTest(){
    String result=null;    
    CMDExecute cmdexe = new CMDExecute();

    try {
        String[] args = { "/system/bin/monkey", "-p org.example.tabdemo -v 500" };
        result = cmdexe.run(args, "/system/bin/");
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

How to solve this issue?

0

There are 0 answers