Hi, this is my first post here, and usually I will not worry, but I see no one wanted to give you an answer, despite the fact that there are several ways to do this. This is all from my application, I am "idone" on xda-dev btw. Also some of this code, perhaps Samsung MSMxxxx
If you have root, you really can. And here are 3 ways to do this, despite the fact that other people say differently Method 1 (secret secret code) Method 2 (set sys.usb.config) Method 3 (setting global settings adb_enabled 1)
public String[] SET_DM_PORT_STATUS_LIST = new String[9];{ SET_DM_PORT_STATUS_LIST[0] = "setMTP"; SET_DM_PORT_STATUS_LIST[1] = "setMTPADB"; SET_DM_PORT_STATUS_LIST[2] = "setPTP"; SET_DM_PORT_STATUS_LIST[3] = "setPTPADB"; SET_DM_PORT_STATUS_LIST[4] = "setRNDISDMMODEM"; SET_DM_PORT_STATUS_LIST[5] = "setRMNETDMMODEM"; SET_DM_PORT_STATUS_LIST[6] = "setDMMODEMADB"; SET_DM_PORT_STATUS_LIST[7] = "setMASSSTORAGE"; SET_DM_PORT_STATUS_LIST[8] = "setMASSSTORAGEADB";} public String[] SET_DM_PORT_CONFIG_LIST = new String[9];{ SET_DM_PORT_CONFIG_LIST[0] = "mtp"; SET_DM_PORT_CONFIG_LIST[1] = "mtp,adb"; SET_DM_PORT_CONFIG_LIST[2] = "ptp"; SET_DM_PORT_CONFIG_LIST[3] = "ptp,adb"; SET_DM_PORT_CONFIG_LIST[4] = "rndis,acm,diag"; SET_DM_PORT_CONFIG_LIST[5] = "rmnet,acm,diag"; SET_DM_PORT_CONFIG_LIST[6] = "diag,acm,adb"; SET_DM_PORT_CONFIG_LIST[7] = "mass_storage"; SET_DM_PORT_CONFIG_LIST[8] = "mass_storage,adb";} Process su = Runtime.getRuntime().exec("su"); DataOutputStream outputStream = new DataOutputStream(su.getOutputStream()); outputStream.writeBytes("am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://" + SET_DM_PORT_STATUS_LIST[paramInt]+"\n"); outputStream.writeBytes("setprop sys.usb.config " + SET_DM_PORT_CONFIG_LIST[paramInt]+"\n"); if(SET_DM_PORT_STATUS_LIST[paramInt].contains("adb")){ outputStream.writeBytes("settings put global adb_enabled 1\n"); }
I am trying to modify IOTHIDDENMENU.apk and recreate its methods, but without the internal and hidden api that it uses.
idone
source share