We are working on an Android app which is intended to replace the default Android dialer and handle by itself all the calls going on in the device. So far, the app works as expected and we are able to both handle incoming calls and make calls by launching ACTION_CALL
intents.
However, this app is intended to be run in kiosk mode via Android Management API. Whenever we fire the ACTION_CALL
intent, kiosk mode blocks it, although the app is set as default dialer.
After some debugging we discovered the problem is that, when launching the intent, before our app takes back the control of the request, the systems tries to start com.android.server.telecom/.components.UserCallActivity
. As our app runs in kiosk mode, we got following error in logcat
:
10-25 20:29:44.560 1186 3677 E ActivityTaskManager: Attempted Lock Task Mode violation mStartActivity=ActivityRecord{e45f03 u0 com.android.server.telecom/.components.UserCallActivity t24}
We have tries different workaround, but none seems to work. We have messed with Android Managment API parameters such as persistentPreferredActivities
or delegatedScopes
. Right now, we think our best bet is trying to add com.android.server.telecom
to the locktask whitelist, with something like this:
var dpm = (DevicePolicyManager)MainActivity.GetSystemService(Context.DevicePolicyService);
if (dpm.IsDeviceOwnerApp(MainActivity.PackageName)){
dpm.SetLockTaskPackages(XXX, new[] { MainActivity.PackageName, "com.android.server.telecom"})
}
but this approach makes necessary to set our app as device admin, something that we don't know if is possible as long as we are using Android Management API. We have also tried calling directly the DPC package, but again without any success.
Any help will be appreciated.