Back to my LGE-K500UM (LMK500, LG K51, mdh30lm), android 9. So interesting thing...I was able to set an application to debug in developer settings... without the application being "debuggable". I use the app 'Settings Database Editor' on every device I own. I also purchased the plugin that persists settings I edit/change, across reboots. So I was able to:
Code:
adb shell settings put global debug_app com.package.name
Now without root, and in order for this setting to persist you need the paid feature option for 'Settings Database Editor' and set the module to run in the background and place in icon in the notification bar that will persist your chosen setting. The command below should spit out the value of that global setting.
Code:
adb shell settings get global debug_app
In my case it's com.kingroot.kinguser, though I imagine you could probably enter any package name though this is the only one I have tried at the moment. On this device for the moment I can't see any effect though I have not looked at any of the logs since enabling this. Assuming it works it would at least allow you to 'run-as' without root privileges.
It would be cool if anyone knew what else I might be able to do with this handy little feature. For example, on the 2017 Amazon tablets, there was a system application in which the developers forgot or didn't care about removing a boolean from a stock APK that when decompiled, you could change the value of that boolean from 0 to 1 (false to true) for "application_is_debuggable" and then was able to use a script to escalate privileges for root access.