Due to the project needs, the release version of the default open debug mode, modified as follows:
1. Open Developer mode
Context.getsharedpreferences (developmentsettings.pref_file,context.mode_private). Edit (). PutBoolean (
Developmentsettings.pref_show, True). Apply ();
2. Tick USB debug
Settings.Global.putInt (Context.getcontentresolver (), Settings.Global.ADB_ENABLED, 1);
3. Remove the authorization prompt when USB is plugged in
Modify the following content for Frameworks\base\packages\systemui\src\com\android\systemui\usb\usbdebuggingactivity.java:
@Override public void OnReceive (Context content, Intent Intent) { String action = intent.getaction (); if (! UsbManager.ACTION_USB_STATE.equals (ACTION)) { return; } /*boolean connected = Intent.getbooleanextra (usbmanager.usb_connected, false); if (!connected) { mactivity.finish (); } */ Boolean connected = false; Assign a value to connect, turn off UI if (!connected) { mactivity.finish (); } try {IBinder b = servicemanager.getservice (usb_service); Iusbmanager service = IUsbManager.Stub.asInterface (b); Service.allowusbdebugging (True, Mkey); } catch (Exception e) {log.e (TAG, "Unable to notify USB service", e); } }
Android User version default on debug mode