0

I'm compiling an AOSP image from source and I have seen that if I connect the device using USB I can access to the modem and perform AT commands to it using putty as a COM port handler. It appears in the Device Administrator on windows, under Modems category.

I have been search from quite some time and I haven't seen any solution. I suppose that this can be disabled inside the AOSP code before compilation, but I don't know where.

1 Answers1

0

This can currently be achieved only in device owner/profile owner mode. To make your app a device owner you can follow this thread : How to make my app a device owner?

You can use the following code after granting device owner access :

  DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
  ComponentName mDeviceAdmin =  new ComponentName(context, AdminReceiver.class);
  dpm.addUserRestriction(mDeviceAdmin, UserManager.DISALLOW_USB_FILE_TRANSFER);
Nivil Boban
  • 286
  • 1
  • 13