Friday, October 28, 2016

Is there a good USB debugging toggle widget for Android?


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)



Answer



Here installer for easy installation or widget only for manual installation






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.




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.




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




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/ on /system type rfs (ro,codepage=utf8,vfat,fcache(blks)=128,xattr,check=no)




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






Remounting /system/ as read-only



  1. Step 1, 2, 3, 4 same as above

  2. type: mount -o remount,ro /dev/ /system





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






  • 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.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...