1

My goal: I am developing a kiosk application on an odroid n2 board. This will be sold in future. I want to prevent the usage of external keyboards, so the user is not able to breakout with shortcuts (ex: home+b for browser ...)

Expected Result: When a USB HID device gets plugged in and the user presses keys - nothing happens.

Actual Results: After deleting shortcut files and layout files, it's still possible to use some shortcuts.

What I've tried: I tried to delete the driver, but were not able to, due to permissions (even with root) Removed Keyboard layout files and shortcut files - still some shortcuts are possible I disallowed USB_FILE__TRANSFER, but it doesn't prevent HID to communicate with android.

public static public void setUSBEnabled(boolean enabled, Context c) {
        ComponentName deviceAdmin = new ComponentName(c, AdminReceiver.class);
        DevicePolicyManager dpm = (DevicePolicyManager) c.getSystemService(Context.DEVICE_POLICY_SERVICE);
        if (dpm.isDeviceOwnerApp(c.getPackageName())) {
            Toast.makeText(c, "DISABLED USB", Toast.LENGTH_LONG).show();
            dpm.addUserRestriction(deviceAdmin, UserManager.DISALLOW);
        } else {
            Toast.makeText(c, "ENABLED USB", Toast.LENGTH_LONG).show();
            dpm.clearUserRestriction(deviceAdmin, UserManager.DISALLOW_USB_FILE_TRANSFER);
        }
    }
RFLX
  • 43
  • 3

0 Answers0