1

My device uses a Qualcomm chip, Android 7 (SDK 25). I am coding an app that uses a USB camera (webcam) to record and capture. To hold permanent permission for my app. My problem is, the first time plugging the USB cam into my device, a dialog appears and I have to tick "Use by default for this USB device".

My device has no screen, to do that I need to use ADB debug, connect WiFi, and use Vysor to access the device.

I tried setting my app as a system app but it did not solve my problem.

I wonder how to make my app auto-accepts the dialog.

3
  • If you have root access to the device you could use inotify tools to detect where the system writes when you accept the dialog so you could make the change before the UI is ever shown. BTW: Android is designed to have a display, may be you should reconsider your OS choice. A simple Linux system may be a better choice.
    – Robert
    Commented Oct 27, 2022 at 7:54
  • @Robert thank for your suggest. ya, I have root access. Do you know where is normal permission file saved or what is their name? Seem inotify tools is hard to use with my knowledge. Can you give me some commands to detect that. I just familiar with adb command
    – Jamebes
    Commented Nov 7, 2022 at 9:39
  • I would start using inotifywait in recursive monitor mode on /data/data. You may need to increase the maximum files if inotifywait shows an error. Then you will see all file operations (open, read, write) on files within /data/data. When you change the setting there should be a file operation at the same time so this way you can identify the file.
    – Robert
    Commented Nov 7, 2022 at 9:46

1 Answer 1

1

Finally, I found the storage USB permission file on

/data/system/users/0/usb_device_manager.xml

I pulled it onto my desktop

adb pull /data/system/users/0/usb_device_manager.xml D://YourFolder

And lastly, I pushed the file that has the USB camera info into the new device and restart.

adb push D://YourFolder/usb_device_manager.xml /data/system/users/0

It worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .