拒绝猴子集成的权限

发布于 2024-12-09 20:00:56 字数 4242 浏览 2 评论 0原文

我尝试将猴子集成到我的应用程序中,但总是出现以下错误:

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

我的manifex xml:(我已经添加了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>

在我的测试服务中,我启动猴子命令来测试包“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();
    }
}

如何解决这个问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文