12

Can you suggest me a widget for toggling usb debugging mode for Android? Or could you code it and upload to market, please?

(I need it because of HTC Desire and HD's init process consuming 100% cpu bug. When toggled, it resets to 0)

samthebrand
  • 295
  • 6
  • 15
ahmet alp balkan
  • 223
  • 1
  • 2
  • 7
  • 1
    I've had usb debugging mode enabled since this fix was first mentioned and other than the annoying missing driver popup from Windows when I plug it in, I've not noticed amy adverse effects. Why do you need to toggle it on and off? – Matt H Jan 16 '11 at 14:45
  • As I said before, If I do not keep USB debugging mode ON, init process starts to consume 100% cpu in htc desire phones. – ahmet alp balkan Jan 20 '11 at 10:59

3 Answers3

7

Here installer for easy installation or widget only for manual installation


INSTALLATION INSTRUCTION


Prerequisites:

  1. You must be rooted
  2. You must be able to write to /system/app/ folder. USB Debugging is a "Secure" setting, so this widget must be installed as a system apps. It will not work if you install to the standard install location even in rooted device.


Easy Instruction (Recommended)

  1. Nico have written an easy-to-use installer to automate installation to /system/app/; download it here and run the installer app.
  2. Add the widget to your home screen like regular widget.


Manual installation

If the easy instruction doesn't work, try the manual installation:

  1. Download ADBWidget.apk and save it to your computer
  2. Copy ADBWidget.apk to /system/app

    • Method 1 -- Using Android Debug Bridge (ADB)

      1. Remount /system/app to read-write (see Additional Instructions section below)
      2. adb push ADBWidget-x.x.apk /system/app/ADBWidget.apk (replace x.x with the appropriate version number)
      3. Remount /system/app to read-only
    • Method 2 -- Using Recovery's update.zip (have not been tested yet)

    • Method 3 -- Using Root Explorer (have not been tested yet)
  3. Add ADBWidget to your home screen


Upgrade Instruction

If you're upgrading from a previous version, you do not need to do all of the above again. You can simply install an update on regular application directory by using regular installation methods (e.g. opening the apk from a file explorer). As long as there is a previous version of the widget in the /system/app directory with the same signing key (i.e. my key, if you used the apk download above), Android will give the updated version in /data/app the same permission.


USAGE INSTRUCTION

Click on the widget to toggle USB debugging. Blue USB icon means that USB debugging is inactive, red USB icon means that USB debugging is enabled.


UNINSTALL INSTRUCTION

Since the widget is installed to /system/app, you cannot remove it using standard application uninstaller. So, simply delete the .apk from /system/app.

su
remount /system as read write
rm /system/app/ADBWidget.apk
remount /system as read only


ADDITIONAL INSTRUCTION


Remounting /system/ as read-write

  1. Open "Terminal Emulator" or "adb shell"
  2. Get root permission, type su
  3. Get the device name, type mount | grep /system
  4. You should see something similar to:

    /dev/<device-name> on /system type rfs (ro,codepage=utf8,vfat,fcache(blks)=128,xattr,check=no)

  5. Take note of the <device-name>, and type: mount -o remount,rw /dev/<device-name> /system


Remounting /system/ as read-only

  1. Step 1, 2, 3, 4 same as above
  2. type: mount -o remount,ro /dev/<device-name> /system


TROUBLESHOOTING

  • Sometimes the widget froze and do not responds to clicks. If this happens, removing and re-adding the Widget usually will fix the problem.


NOTE

  • Don't complain about the ugly default icon and widget button, but if you can send me a better icon/widget image, I'd be happy to add it. Now we have an icon, thanks to @Jay.
  • Do not trust strangers that asks you to install an application to /system/app
  • Tested on Samsung Spica i5700 SpicagenMod Froyo.
Lie Ryan
  • 19,073
  • 6
  • 65
  • 83
  • Awesome, thanks! You are very fast! But why do we require root access? AFAIK manually enabling it does not require root access. Thanks anyway. – ahmet alp balkan Jan 20 '11 at 11:00
  • @Ahmet Alp Balkan: the Settings application (the manual way) is a system application, i.e. it is installed in /system/app. In unrooted Android phones, this partition is read-only to maintain the system's integrity and security, and applications which are not installed in /system/app cannot obtain "write secure settings" permission. This widget requires root access only so you can install to /system/app so the widget can obtain the "write secure settings" permission, I don't think you need root for actually using the permission, though I haven't tested on derooted phone yet. – Lie Ryan Jan 20 '11 at 14:49
  • In short, USB Debugging is a "Secure" setting, only system apps can obtain "write Secure setting" permission, system apps need to be installed in /system/app, only rooted phones can write to /system/app, therefore this app requires root. The Settings app does not require root since it is preinstalled in /system/app. Alternatively, I can easily launch Setting app so you can disable the USB Debugging yourself, but that takes 3 clicks (1 on the widget/icon, 1 on USB debugging, 1 on confirmation) instead of 1 click on widget, just doing that won't require root but is still a hassle. – Lie Ryan Jan 20 '11 at 17:14
  • Works great, but man that icon is ugly! :-p In the next version, any way to make it indicate that the toggle was successful or indicate whether or not USB debugging is enabled or disabled? (i.e. perhaps the icon is one color for enabled, another for disabled.) Just a thought, but thanks! –  Feb 21 '11 at 15:40
  • Hi,

    I look your source code and try to add this option to my application (Widgetsoid) but it's not work for me. I have

    02-22 11:26:07.260: WARN/Settings(3652): Setting adb_enabled has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value. 02-22 11:26:07.260: WARN/Settings(3652): Setting adb_enabled has moved from android.provider.Settings.System to android.provider.Settings.Secure, value is unchanged.

    What I have doing wrong ?

    Thanks for helping me. Regards Jim

    –  Feb 22 '11 at 14:33
  • You're using the old Settings.System.ADB_ENABLED, change it to Settings.Secure.ADB_ENABLED. Also, you must install your program into /system/app/; root permission alone won't allow you to change Settings.Secure.* settings (or more precisely, with root alone, you can change the system's sqlite database to whatever values you want, but Android won't notice this underhanded change to its settings database and won't start adbd unless you reboot the system (which kinda misses the point of having a convenient widget)). – Lie Ryan Feb 22 '11 at 14:33
  • Great work. A truely excellent/useful widget. Just loaded it into my Samsung i9100 using the first method. Was using it in combinatiion with Widgetsoid but now it stands all on its own proud self. After loading it I had to reboot and got a few messages to the effect "thsi ... needs root priviliges".. but it continued and all works fine ( phone is rooted ). Thank again. Jay –  Sep 15 '11 at 10:15
  • I didn't get Easy Installation to work on Galaxy SII (I9100M) but using Root Explorer I remounted /system/app to R/W and pasted it there.

    Should add a note that once the .apk is pasted in the folder, you do not have to click and "Install"

    Great answer and great tool. +1

    – Vian Esterhuizen Mar 15 '12 at 18:15
0

There are some apps which do this. But all of them need to be made system app. I didn't want to do this. So I made a widget myself which works just like any other widget. You can get it from here:

https://github.com/alseambusher/adb-toggle

2991ambusher
  • 121
  • 1
  • 1
  • 4
0

If you have 2.1 or above you can use the drop down notification area to quickly disable debug mode. Sadly that is all I got, turning it on will have to be done manually. I searched and was unable to find a widget.

Supercereal
  • 603
  • 4
  • 10