[MOD][PORT][4G Reboot Fix][3/27/11] Power Control Widgets for Sense - 3.70 OTA

Status
Not open for further replies.
Search This thread

JsChiSurf

Inactive Recognized Developer
Feb 5, 2010
2,416
1,396
Hacksville
Deprecated: Version 2.0 is now LIVE! (12/17/2010), this version is still based on 3.29x ROM OTA, as I wanted to see this through from start to finish, rather than drop what I have been working on for many weeks, and start over again.

Deprecated: Version 2.1 is now LIVE! (12/19/2010), this version is based on 3.70x ROM OTA. Pick your poison based on the ROM you are running. There are no feature differences between 2.0/2.1, 2.1 is simply a port to the newer 3.70 OTA framework / release.

Update 3/27/2011:Version 2.2 is now LIVE, this is a maintenance release for the most part, including a fix for 4g toggle state persistence between reboots. That is, when disabling 4g via its toggle, it will remain disabled after a reboot, nice! Also, this version incorporates the fix for toggling the sprint wifi access point (toggleWifiAp). I am releasing in 2 versions. The complete mod for those that are flashing new, or the services.jar file only, which is the only file affected by this maintenance release. See towards the end of post for your applicable file.

See Here for installing the PowerWidgets Configuration Application, for controlling behavior of various widgets.

This thread supersedes the v1.0 (original) thread found here. As mentioned in the v1.0 thread, thanks to the CyanogenMod team for the original creation that this is based upon.

It should be noted that all of the various customizations found in the original thread will have to be re-done / re-incorporated into the v2.0/2.1 files attached, and I have more on my plate that I can tackle in terms of trying to provide each and every individual request for specific customizations.

New in v2.0/2.1 is the inclusion/addition of my custom built 4G toggle (toggleWimax), as well as a nice fix for keeping the icon and indicator bars in sync with the actual state of the various services controlled by the widget. This is accomplished by auto-refreshing the widgets each time the notification window is dragged open/close. This mod requires running a deodexed Sprint based ROM.

So, now, as opposed to v1.0, if you change the state of a given service elsewhere on the phone, when you drag open the notification window, your icons and indicator bar will be in sync with the actual state, without having to manually toggle a random widget to refresh. Nice!

Much of what follows is copy/paste from the original thread, for everyone's edification, with, as referenced above, mention that to add 4G toggle to your list of available power control widgets, place "toggleWimax" in your widget.txt file.

So, what does this look like you say? Below is a screen shot of the default widgets that this mod comes with:

pc_widget_6_default.png


The 6 default widgets, from left-to-right are:

toggleGPS | toggleWifi | toggleBluetooth | toggleMobileData| toggleFlashlight | toggleSound

What's great about this mod, however, is that you can override this set of default widgets in favor of any of the 13 14 15 currently available widgets through a process I've built into the mod (explained later).

The power control bar allows for up to 6 different widgets to be specified. You can have less, but no more than 6 (as designed in the original CM version). As mentioned, there are a total of 15 widgets that I've ported or created successfully so far. Here are a few more screen captures of some of the remaining available widgets:

pc_widget_4.png


The 4 widgets, from left-to-right are:

toggleAirplane | toggleAutoRotate (disable landscape mode) | toggleBrightness (3 tiers) | toggleScreenTimeout (prevent screen from going black)

And the 4 remaining available widgets, from left-to-right are:

pc_widget_4g.png


toggleWimax | toggleSleepMode (put phone to sleep) | toggleSync | toggleLockScreen (disable lockscreen)

Not included in the current crop of screen captures if the toggle for the built-in Sprint wifi access point toggle (toggleWifiAp).

Take note of the naming convention I've used above for each widget. This is how Android, internally, is referencing each widget for use / display in the power control bar. This is important, since, as mentioned, you can override the 6 widgets this mod provides out of the box.

How you ask?

By creating a pipe delimited list (|) of widgets in a one-line text file named widget.txt, and dropping this file into the '/system/customize/' folder on your phone.

So, say you want your power control bar to contain 4 widgets for 4G, Wifi, Bluetooth, and Sync. You would create a one-line file using the following syntax:

Code:
toggleWimax|toggleWifi|toggleBluetooth|toggleSync

Note: there CANNOT be any spaces between each widget defined, and the pipe delimiter is only placed between each instance, but not at the beginning or end. The syntax has to be EXACT, and case must match EXACTLY. If you have an error in your list, the slot / position where the error exists will result in an empty slot on your power control bar. If you fubar it bad enough, you'll probably bootloop your phone, so please use caution and check your work.

Once you've created your file, again, named widget.txt, all lower-case, using adb, push to your phone (the following commands assume your widget.txt file is in the same folder where you are issuing the adb commands):

Code:
adb remount
adb push widget.txt /system/customize/
adb reboot

Alternatively, drop your 'widget.txt' file on your sdcard, and use root explorer to copy the file to your clipboard, navigate to your '/system/customize/' folder, mount as r/w, paste the file in place, make sure permissions on the new file are set to 'read', at a minimum, and reboot.

If you are not comfortable with either of these options, you can create a signed zip of your widget.txt file to flash to your phone via recovery instead.

Want to go back to the default widget setting? Simply rename or delete the 'widget.txt' file in your '/system/customize/' folder and reboot.

I know not everyone has (maybe most) 4G service, so I did not include 4G as a default widget. For those that do, here is a flashable zip to easily change your widgets to the following, which is what I run:

toggleGPS | toggleWifi | toggleWimax | toggleBluetooth | toggleFlashlight | toggleSound

Widget Bar with Wimax <--- Flash via recovery AFTER applying the actual mod linked below.

For your reference, when creating your 'widget.txt' file, here is the complete list of available widgets with correct syntax that you can copy / paste into your file (don't forget to pipe delimit them):

Code:
toggleWifiAp
toggleWimax
toggleAirplane
toggleAutoRotate
toggleBluetooth
toggleBrightness
toggleFlashlight
toggleGPS
toggleLockScreen
toggleMobileData
toggleScreenTimeout
toggleSleepMode
toggleSound
toggleSync
toggleWifi

FYI, I've added in toast notification messages when toggling WiFi, Bluetooth, and 4G, so as to acknowledge your button press, as these options take a bit to instantiate. Since 4G takes even longer to establish a connection, if you attempt to toggle while it is still working, a toast notification will also display indicating that the toggle is still in progress.

This port / mod involves massive edits to your framework files, including framework.jar, services.jar, and framework-res.apk. As such, by flashing this mod, you will undo most mods / themes you have applied to your phone. There is no choice in the matter. Consider this your new / base / stock set of framework files if you wish to use, and modify to incorporate your own themes / mods accordingly. Or, if you don't want to lose your customizations, wait for your ROM dev, or themer to grab this port as a starting point to apply their changes.

You CANNOT flash this mod to implement the power control widget, and then flash a theme back over top it, if the theme replaces the framework-res.apk file (most likely do), as it will likely completely bork your phone, resulting in bootloops, as the theme will partially undo this mod, resulting in breaking both the mod and your phone

If the theme is a MetaMorph file, assuming the MetaMorph does not change any of the XML or other files that this mod does, and only changes images, etc, you should be safe in applying.

It should be noted that in the framework files provided in the flashable zip at the end of this post, the following additional mods have been included by default in the services.jar & framework.jar file:

  • Allow for transparent notification menu background (xeudoxus & fxn)
  • Remove USB Debugging icon
  • Remove GPS off reticle icon, retain GPS on reticle
  • USB Tether / Hotspot Fix (aamikam)

Download Notification Window Power Control Widget v2.2 for 3.70x OTA Based ROMs <--- Flash via Recovery for entire mod. If you are already running previous v2.1, flash the services.jar file only, linked below.*

Download Services.jar Patch (v2.2) for 3.70x OTA Based ROMs <--- Flash via Recovery, ONLY if you are already running the previous v2.1, to update your services.jar file only.*

*Since this replaces framework files, your initial boot will take some time. Please be patient and NANDROID before flashing. I've also seen it take 2 boots, rather than one, to come up fully after the initial install. This is a major rework to the included files and it is certainly possible that it is incompatible with your specific setup. YMMV.

**This is provided stock. If you want a different look, colors, icons, etc, this is up to you and/or your favorite dev to have at it :cool:.
 
Last edited:

JsChiSurf

Inactive Recognized Developer
Feb 5, 2010
2,416
1,396
Hacksville
Just wanted to say thanks for your continued dedication/inspiration. Fabulous work as always. :D
Thank you kindly. I am really pleased with this version, the smoothness of how 4G toggle works, and the improvement in the accurate display of state. It really should address most issues out there, assuming it works for everyone :)

Note, as mentioned many times, I am no graphics expert, so the 4G on/off icons are, in my opinion, adequate, but not perfect...
 
Last edited:

wingzfan

Senior Member
May 14, 2008
660
109
Ok I have a favor that I normally wouldnt ask but would anyone be willing to add this to my current files to get it working with my matted theme? Ive been at this for hours and I got everything working and added except it breaks my battery percentage. No matter what I try the battery percentage shows 100% always and when I charge it just shows a thin red line.
 

xlGmanlx

Senior Member
Jul 21, 2010
6,803
546
www.life360.com
you are a beast. This is one of those subtle mods that doesn't get a lot of fanfare, but probably besides my rosie mod's for obvious reasons gets used the MOST on my phone, period. after i buy this house, i will donate and like it
 

JsChiSurf

Inactive Recognized Developer
Feb 5, 2010
2,416
1,396
Hacksville
you are a beast. This is one of those subtle mods that doesn't get a lot of fanfare, but probably besides my rosie mod's for obvious reasons gets used the MOST on my phone, period. after i buy this house, i will donate and like it
Lol, thanks man. I've grown accustomed to having the widgets there, and don't realize how much I depend on them until I grab my wife's Hero w/o them.
 

xlGmanlx

Senior Member
Jul 21, 2010
6,803
546
www.life360.com
i hear you, even with my 4x5 screen it just feels silly now to have widgets to toggle that stuff, plus i can get to it from any screen etc. looking forward to the udpated stuff. On a side note, i didn't realize until later that i could switch around the order which was awsome and i did it right away!
 
  • Like
Reactions: snkycool

JsChiSurf

Inactive Recognized Developer
Feb 5, 2010
2,416
1,396
Hacksville
i hear you, even with my 4x5 screen it just feels silly now to have widgets to toggle that stuff, plus i can get to it from any screen etc. looking forward to the udpated stuff. On a side note, i didn't realize until later that i could switch around the order which was awsome and i did it right away!
Yep, the widget.txt file allows you to order them as you wish, and obviously, add/remove as you wish as well.

That is one of the benefits of this approach, though it is more "manual", since in the CM ROM (original), you can add/remove, but not control the order, via the gui.
 

DrRyder

Senior Member
Aug 22, 2009
1,118
233
New Port Richey, FL
rydertech.us
This is pretty sweet. Are you going to include versions of the framework that have the different battery mods? I'd like to keep my super circle battery, but don't wanna try and copy files from the old framework in case I might break something.
 

martonikaj

Senior Member
Nov 20, 2010
7,872
1,670
Seattle, WA
So if u understand this ccorrectly, all I need to do is flash the zip in the first post, then create the widget.txt file with the order and type of Widgets I want, then naviagte and drop that txt into the system directory noted in the first post? Clarify if I've missed something here.
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 59
    Deprecated: Version 2.0 is now LIVE! (12/17/2010), this version is still based on 3.29x ROM OTA, as I wanted to see this through from start to finish, rather than drop what I have been working on for many weeks, and start over again.

    Deprecated: Version 2.1 is now LIVE! (12/19/2010), this version is based on 3.70x ROM OTA. Pick your poison based on the ROM you are running. There are no feature differences between 2.0/2.1, 2.1 is simply a port to the newer 3.70 OTA framework / release.

    Update 3/27/2011:Version 2.2 is now LIVE, this is a maintenance release for the most part, including a fix for 4g toggle state persistence between reboots. That is, when disabling 4g via its toggle, it will remain disabled after a reboot, nice! Also, this version incorporates the fix for toggling the sprint wifi access point (toggleWifiAp). I am releasing in 2 versions. The complete mod for those that are flashing new, or the services.jar file only, which is the only file affected by this maintenance release. See towards the end of post for your applicable file.

    See Here for installing the PowerWidgets Configuration Application, for controlling behavior of various widgets.

    This thread supersedes the v1.0 (original) thread found here. As mentioned in the v1.0 thread, thanks to the CyanogenMod team for the original creation that this is based upon.

    It should be noted that all of the various customizations found in the original thread will have to be re-done / re-incorporated into the v2.0/2.1 files attached, and I have more on my plate that I can tackle in terms of trying to provide each and every individual request for specific customizations.

    New in v2.0/2.1 is the inclusion/addition of my custom built 4G toggle (toggleWimax), as well as a nice fix for keeping the icon and indicator bars in sync with the actual state of the various services controlled by the widget. This is accomplished by auto-refreshing the widgets each time the notification window is dragged open/close. This mod requires running a deodexed Sprint based ROM.

    So, now, as opposed to v1.0, if you change the state of a given service elsewhere on the phone, when you drag open the notification window, your icons and indicator bar will be in sync with the actual state, without having to manually toggle a random widget to refresh. Nice!

    Much of what follows is copy/paste from the original thread, for everyone's edification, with, as referenced above, mention that to add 4G toggle to your list of available power control widgets, place "toggleWimax" in your widget.txt file.

    So, what does this look like you say? Below is a screen shot of the default widgets that this mod comes with:

    pc_widget_6_default.png


    The 6 default widgets, from left-to-right are:

    toggleGPS | toggleWifi | toggleBluetooth | toggleMobileData| toggleFlashlight | toggleSound

    What's great about this mod, however, is that you can override this set of default widgets in favor of any of the 13 14 15 currently available widgets through a process I've built into the mod (explained later).

    The power control bar allows for up to 6 different widgets to be specified. You can have less, but no more than 6 (as designed in the original CM version). As mentioned, there are a total of 15 widgets that I've ported or created successfully so far. Here are a few more screen captures of some of the remaining available widgets:

    pc_widget_4.png


    The 4 widgets, from left-to-right are:

    toggleAirplane | toggleAutoRotate (disable landscape mode) | toggleBrightness (3 tiers) | toggleScreenTimeout (prevent screen from going black)

    And the 4 remaining available widgets, from left-to-right are:

    pc_widget_4g.png


    toggleWimax | toggleSleepMode (put phone to sleep) | toggleSync | toggleLockScreen (disable lockscreen)

    Not included in the current crop of screen captures if the toggle for the built-in Sprint wifi access point toggle (toggleWifiAp).

    Take note of the naming convention I've used above for each widget. This is how Android, internally, is referencing each widget for use / display in the power control bar. This is important, since, as mentioned, you can override the 6 widgets this mod provides out of the box.

    How you ask?

    By creating a pipe delimited list (|) of widgets in a one-line text file named widget.txt, and dropping this file into the '/system/customize/' folder on your phone.

    So, say you want your power control bar to contain 4 widgets for 4G, Wifi, Bluetooth, and Sync. You would create a one-line file using the following syntax:

    Code:
    toggleWimax|toggleWifi|toggleBluetooth|toggleSync

    Note: there CANNOT be any spaces between each widget defined, and the pipe delimiter is only placed between each instance, but not at the beginning or end. The syntax has to be EXACT, and case must match EXACTLY. If you have an error in your list, the slot / position where the error exists will result in an empty slot on your power control bar. If you fubar it bad enough, you'll probably bootloop your phone, so please use caution and check your work.

    Once you've created your file, again, named widget.txt, all lower-case, using adb, push to your phone (the following commands assume your widget.txt file is in the same folder where you are issuing the adb commands):

    Code:
    adb remount
    adb push widget.txt /system/customize/
    adb reboot

    Alternatively, drop your 'widget.txt' file on your sdcard, and use root explorer to copy the file to your clipboard, navigate to your '/system/customize/' folder, mount as r/w, paste the file in place, make sure permissions on the new file are set to 'read', at a minimum, and reboot.

    If you are not comfortable with either of these options, you can create a signed zip of your widget.txt file to flash to your phone via recovery instead.

    Want to go back to the default widget setting? Simply rename or delete the 'widget.txt' file in your '/system/customize/' folder and reboot.

    I know not everyone has (maybe most) 4G service, so I did not include 4G as a default widget. For those that do, here is a flashable zip to easily change your widgets to the following, which is what I run:

    toggleGPS | toggleWifi | toggleWimax | toggleBluetooth | toggleFlashlight | toggleSound

    Widget Bar with Wimax <--- Flash via recovery AFTER applying the actual mod linked below.

    For your reference, when creating your 'widget.txt' file, here is the complete list of available widgets with correct syntax that you can copy / paste into your file (don't forget to pipe delimit them):

    Code:
    toggleWifiAp
    toggleWimax
    toggleAirplane
    toggleAutoRotate
    toggleBluetooth
    toggleBrightness
    toggleFlashlight
    toggleGPS
    toggleLockScreen
    toggleMobileData
    toggleScreenTimeout
    toggleSleepMode
    toggleSound
    toggleSync
    toggleWifi

    FYI, I've added in toast notification messages when toggling WiFi, Bluetooth, and 4G, so as to acknowledge your button press, as these options take a bit to instantiate. Since 4G takes even longer to establish a connection, if you attempt to toggle while it is still working, a toast notification will also display indicating that the toggle is still in progress.

    This port / mod involves massive edits to your framework files, including framework.jar, services.jar, and framework-res.apk. As such, by flashing this mod, you will undo most mods / themes you have applied to your phone. There is no choice in the matter. Consider this your new / base / stock set of framework files if you wish to use, and modify to incorporate your own themes / mods accordingly. Or, if you don't want to lose your customizations, wait for your ROM dev, or themer to grab this port as a starting point to apply their changes.

    You CANNOT flash this mod to implement the power control widget, and then flash a theme back over top it, if the theme replaces the framework-res.apk file (most likely do), as it will likely completely bork your phone, resulting in bootloops, as the theme will partially undo this mod, resulting in breaking both the mod and your phone

    If the theme is a MetaMorph file, assuming the MetaMorph does not change any of the XML or other files that this mod does, and only changes images, etc, you should be safe in applying.

    It should be noted that in the framework files provided in the flashable zip at the end of this post, the following additional mods have been included by default in the services.jar & framework.jar file:

    • Allow for transparent notification menu background (xeudoxus & fxn)
    • Remove USB Debugging icon
    • Remove GPS off reticle icon, retain GPS on reticle
    • USB Tether / Hotspot Fix (aamikam)

    Download Notification Window Power Control Widget v2.2 for 3.70x OTA Based ROMs <--- Flash via Recovery for entire mod. If you are already running previous v2.1, flash the services.jar file only, linked below.*

    Download Services.jar Patch (v2.2) for 3.70x OTA Based ROMs <--- Flash via Recovery, ONLY if you are already running the previous v2.1, to update your services.jar file only.*

    *Since this replaces framework files, your initial boot will take some time. Please be patient and NANDROID before flashing. I've also seen it take 2 boots, rather than one, to come up fully after the initial install. This is a major rework to the included files and it is certainly possible that it is incompatible with your specific setup. YMMV.

    **This is provided stock. If you want a different look, colors, icons, etc, this is up to you and/or your favorite dev to have at it :cool:.
    3
    Glad to see you finally got the 4G toggle working. Can't wait for you to have this available for the 3.70 update.
    If all goes successfully (there are no guarantees), it should come out the same time the newest Fresh release hits.
    2
    Just wanted to say thanks for your continued dedication/inspiration. Fabulous work as always. :D
    Thank you kindly. I am really pleased with this version, the smoothness of how 4G toggle works, and the improvement in the accurate display of state. It really should address most issues out there, assuming it works for everyone :)

    Note, as mentioned many times, I am no graphics expert, so the 4G on/off icons are, in my opinion, adequate, but not perfect...
    2
    you are a beast. This is one of those subtle mods that doesn't get a lot of fanfare, but probably besides my rosie mod's for obvious reasons gets used the MOST on my phone, period. after i buy this house, i will donate and like it
    Lol, thanks man. I've grown accustomed to having the widgets there, and don't realize how much I depend on them until I grab my wife's Hero w/o them.
    2
    i hear you, even with my 4x5 screen it just feels silly now to have widgets to toggle that stuff, plus i can get to it from any screen etc. looking forward to the udpated stuff. On a side note, i didn't realize until later that i could switch around the order which was awsome and i did it right away!
    Yep, the widget.txt file allows you to order them as you wish, and obviously, add/remove as you wish as well.

    That is one of the benefits of this approach, though it is more "manual", since in the CM ROM (original), you can add/remove, but not control the order, via the gui.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone