Side effects of Settings.Secure.putInt

364
March 09, 2017, at 03:16 AM

I want to disable USB access to an android device.

If the device is connected to a computer it should only charge and prevent any data transmission. So no one can access the data on this device.

I read here, that I can change the usb settings by changing entries in the settings database.

I want to do this programmatically, because I want to turn usb access on and off (the button for this will be secured by a password).

My app runs as system app and has the permission to executute the following function.

Settings.Secure.putInt

After changing "mount_play_not_snd" with above function, I looked into the database using adb shell. The entry

5|mount_play_not_snd|1 

was gone. But I found a new entry:

37|mount_play_not_snd|0

So I think the old entry was deleted and the new one was inserted at the end of the table instead of altering the existing entry.

Are there any side effects of the changed _ID? Or is there a way to manipulate this database programmatically without changing the _IDs of its entries?

My device runs Android 4.4.4. Maybe the bahavior is different on other systems.

READ ALSO
unable to upload image to firebase using asynctask and a headless fragment

unable to upload image to firebase using asynctask and a headless fragment

i have an asynctask running in a headless fragment, i want to upload an image to firebase storage but i am not getting any errors and am not able to upload the imageHeres my fragment with an asynctask:

310
BLE peripheral pairing pin on android

BLE peripheral pairing pin on android

I implemented a GATT Server and Client App on AndroidThe connection is working and I forced pairing by adding PERMISSION_READ/WRITE_ENCRYPTED_MITM to all of the GattCharacteristics

347
Storing directly to file in android? [on hold]

Storing directly to file in android? [on hold]

I have been working on a child monitoring app and i dont know as to how to store/write fetched call logs directly into a file in external/internal storage

341
libVLC for Android 4K Content

libVLC for Android 4K Content

Summary: I'm using libVLC on Android to play back various video/image filesSome videos are in HD, while some are in 4K content

931