androidwso2device-ownerdpmwso2-iot

Error: Unknown admin: ComponentInfo


The manifest file can be found here.

DeviceAdminReceiver class can be found here

agent_device_xml is as defined below:

<?xml version="1.0" encoding="utf-8"?>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
    <limit-password />
    <watch-login />
    <reset-password />
    <force-lock />
    <wipe-data />
    <expire-password />
    <encrypted-storage />
    <disable-camera />
</uses-policies>

Command executed and error:

adb shell dpm set-device-owner org.wso2.iot.agent.services/.AgentDeviceAdminReceiver
Error: Unknown admin: ComponentInfo{org.wso2.iot.agent.services/org.wso2.iot.agent.services.AgentDeviceAdminReceiver}

This is the logcat.

06-21 13:58:54.053 11499-12787/org.wso2.iot.agent E/Volley: [714] NetworkDispatcher.run: Unhandled exception java.lang.SecurityException: Admin ComponentInfo{org.wso2.iot.agent/org.wso2.iot.agent.services.AgentDeviceAdminReceiver} does not own the device
                                                        java.lang.SecurityException: Admin ComponentInfo{org.wso2.iot.agent/org.wso2.iot.agent.services.AgentDeviceAdminReceiver} does not own the device
                                                            at android.os.Parcel.readException(Parcel.java:1689)
                                                            at android.os.Parcel.readException(Parcel.java:1641)
                                                            at android.app.admin.IDevicePolicyManager$Stub$Proxy.setAutoTimeRequired(IDevicePolicyManager.java:6759)
                                                            at android.app.admin.DevicePolicyManager.setAutoTimeRequired(DevicePolicyManager.java:3377)
                                                            at org.wso2.iot.agent.services.operation.OperationManagerDeviceOwner.setAutoTimeRequired(OperationManagerDeviceOwner.java:681)
                                                            at org.wso2.iot.agent.services.operation.OperationProcessor.doTask(OperationProcessor.java:219)
                                                            at org.wso2.iot.agent.services.operation.OperationProcessor.setPolicyBundle(OperationProcessor.java:267)
                                                            at org.wso2.iot.agent.services.operation.OperationProcessor.doTask(OperationProcessor.java:125)
                                                            at org.wso2.iot.agent.services.MessageProcessor.performOperation(MessageProcessor.java:130)
                                                            at org.wso2.iot.agent.services.MessageProcessor.onReceiveAPIResult(MessageProcessor.java:327)
                                                            at org.wso2.iot.agent.proxy.APIController$9.parseNetworkResponse(APIController.java:383)
                                                            at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:123)
06-21 13:58:54.054 11499-11499/org.wso2.iot.agent E/APIController: com.android.volley.VolleyError: java.lang.SecurityException: Admin ComponentInfo{org.wso2.iot.agent/org.wso2.iot.agent.services.AgentDeviceAdminReceiver} does not own the device

How can i fix this isssue to make the application a device owner.


Solution

  • At a quick glance it looks like you're missing the ".services" in the receiver's name and the package name should not contain ".services".

    Try: adb shell dpm set-device-owner org.wso2.iot.agent/.services.AgentDeviceAdminReceiver