wso2 / cdmf-agent-android

84 stars 97 forks source link

Restrictions are not being enforced #53

Open MayukhaC opened 7 years ago

MayukhaC commented 7 years ago

I have system service app installed and it is the device owner. I am also able to do the silent install of apps, wipe. But I am unable to enforce restrictions on the device except for the camera. Is there anything I am missing to be configured ? any of the restrictions like screenshot disabling, bluetooth, wifi, vpn mobile network etc configurations does not work.

With system app as device owner, I get the following log:

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

It says the Agent app is not a device owner, But if I make Agent app a device owner, it still doesnt work. It executes OperationManagerOlderSdk as there is no check for device owner of Agent app in org.wso2.iot.agent.services.operation.OperationManagerFactory. What can be done to make all the restrictions work?

MayukhaC commented 7 years ago

@kasundananjaya Hi, Can you please let me know about this? It would of great help to me!

kasundananjaya commented 7 years ago

Can you let me know your device OS version? Because some of these restrictions are working only for Android 6.1+ versions.

MayukhaC commented 7 years ago

@kasundananjaya I am using a phone with Android Version 7.1.1

I have made a small video to have a record of the error . Please find it here and let me know any mistake I have done. I have signed the applications with platform keys as suggested by Spathire

MayukhaC commented 7 years ago

Have I been doing any mistake in the above process. Without this I cannot proceed to the next step. So, it would be great if you can help me debug it. Thank you