Update: This thread has been deprecated in favor of v2.0 with 4G toggle and other fixes. See Here for updated version.
As some of you who were following the
progress thread know, over the past few weeks, I have been working on porting the CyanogenMod set of power control widgets, embedded into the notification window, over to Sense based ROMs (Fresh 3.4.0.1 is my base, confirmed working on fresh install, YMMV on other ROMS). While I hit a number of roadblocks, and while I've spent more time on this mod/port than I care to ever admit (I wouldn't be exaggerating in saying I probably have 100+ hours of dev time in this one), I am pleased to announce that
Houston, we have lift-off . Thanks to the CyanogenMod team for the original creation that this is based upon.
So, what does this look like you say? Below is a screen shot of the default widgets that this mod comes with:
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 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 mentioned, there are a total of 13 widgets that I've ported successfully so far. Here are a few more screen captures of the 7 remaining available widgets, shown in a set of 4, and a set of 3:
The 4 widgets, from left-to-right are:
toggleAirplane | toggleAutoRotate (disable landscape mode) | toggleBrightness (3 tiers) | toggleScreenTimeout (prevent screen from going black)
And the 3 remaining available widgets, from left-to-right are:
toggleSleepMode (put phone to sleep) | toggleSync | toggleLockScreen (disable lockscreen)
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 Airplane Mode, Wifi, Bluetooth, and Sync. You would create a one-line file using the following syntax:
Code:
toggleAirplane|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, post what you want in the thread, and I can whip up a flashable zip for you that will do the same, automatically.
Want to go back to the default widget setting? Simply rename or delete the 'widget.txt' file in your '/system/customize/' folder and reboot.
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:
toggleAirplane
toggleAutoRotate
toggleBluetooth
toggleBrightness
toggleFlashlight
toggleGPS
toggleLockScreen
toggleMobileData
toggleScreenTimeout
toggleSleepMode
toggleSound
toggleSync
toggleWifi
FYI, I've added in toast notification messages when toggling WiFi and Bluetooth, so as to acknowledge your button press, as these two options take a bit to instantiate.
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 Fix (Calkulin)
- Browser back button FC Fix (aamikam)
Quirk: If you toggle on/off any of the settings you have specified in your widget bar via a mechanism other than the widget bar itself, the state of that icon may become out of sync with the actual state of the feature you have toggled. By either waiting for the change to be picked up, or simply toggling any widget in your power control bar, all icons will be immediately updated to reflect their correct state. This does not affect functionality in any way. Remember, this is a port, I didn't code this from source, that would have been much easier
.
Download Notification Window Power Control Widget for Sense ROMs <--- Flash via Recovery*
*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
.
EDIT: See Here if, after flashing the above, you want to apply the super circle battery mod shown
here, and
See Here if, after flashing the above, you want to apply the super rectangle battery mod shown
here.
EDIT 2: See Here to apply battery or clock removal mods after flashing the above.
EDIT 3: Want it in
RED instead of blue?
See Here.
What I released above is stock, intentionally, to be consistent with the original design from CM. This can be themed and "prettied up" as desired. For example, here's what I've done for my own phone to "buttonize" each widget and add a little more height / spacing between each (icons courtesy of djmcnz):
Download Buttonized Notification Window Power Control Widget for Sense ROMs <--- Flash via Recovery
Want buttonized with super circle? Flash the above, then
See Here.