[HowTo] Add a Reboot option to the power menu (Froyo) - Captivate Android Development

Advanced users only!
I get soo many PM's asking how to do this, even tho I have never done anything like this before, so, here it is;
Grab baksmali/smali
Grab a deodexed version of android.policy.jar, or do it yourself.
Open the jar file with a zip program and extract classes.dex (7zip)
Decompile classes.dex
java -jar baksmali1.2.4.jar -o classout/ classes.dex
Navigate to \classout\com\android\internal\policy\impl
Make a copy of GlobalActions$4.smali in the same directory
Name it GlobalActions$8.smali
Open GlobalActions$8.smali in a decent text editor (Notepad++)
Find and replace all instances of GlobalActions$4 with GlobalActions$8
Replace the onPress method with this one:
Code:
.method public onPress()V
.registers 3
const-string v0, "Reboot Now"
invoke-static {v0}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
.end method
save and close
Open GlobalActions.smali
In the createDialog method we need to increase the array length by 1
Find: (line 430)
Code:
const/4 v9, 0x4
Change to:
Code:
const/4 v9, 0x5
next we add the new menu item
Add before "const/4 v1, 0x3" on line 508
Code:
const/4 v1, 0x4 # position in the menu array
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$8;
const v3, 0x1080030 # power icon
const v4, 0x010402d7 # reboot string
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
save and close
Compile a new classes.dex
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Open the jar file with a zip program and add the new classes.dex overwritting the old one (7zip)
Push it back to your phone and reboot!
All done!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Thanks to untermensch in the Vibrant forum for his original mod.

Nice writeup...again lol. May be handy

smokestack76 said:
Nice writeup...again lol. May be handy
Click to expand...
Click to collapse
Thanks
NiXXed is making a n00b friendly pre-edited version...

smokestack76 said:
Nice writeup...again lol. May be handy
Click to expand...
Click to collapse
Nice write up indeed.
for me, i'll have to settle with mobile terminal and "reboot" command.

ppl dun bother DG. he's busy.. lol
Just use switch pro.
Sent from my SAMSUNG-SGH-I897 using XDA App

Working on this now for my existing mods (http://forum.xda-developers.com/showthread.php?t=799511).
I'll have a version up shortly for:
-JI6 stock + reboot now only
-Android/Tap lock + reboot now
-Android/Tap lock + reboot now deodexed

NiXXeD said:
Working on this now for my existing mods (http://forum.xda-developers.com/showthread.php?t=799511).
I'll have a version up shortly for:
-JI6 stock + reboot now only
-Android/Tap lock + reboot now
-Android/Tap lock + reboot now deodexed
Click to expand...
Click to collapse
Nice job NiXXeD!

This was already/originally posted by untermensch on the vibrant forums...
http://forum.xda-developers.com/showthread.php?t=811532

rafyvitto said:
This was already/originally posted by untermensch on the vibrant forums...
http://forum.xda-developers.com/showthread.php?t=811532
Click to expand...
Click to collapse
Not sure what your intent is, but...
Read the op, credit was given, also read the code, its not the same, I also posted in his thread saying I ported it over.

Can we get this worked into CDE pls. I was searching forever for this
Sent from my SAMSUNG-SGH-I897 using Tapatalk

irtehun said:
Can we get this worked into CDE pls. I was searching forever for this
Sent from my SAMSUNG-SGH-I897 using Tapatalk
Click to expand...
Click to collapse
NiXXeD is making some files you can just push onto the phone, I was going to post mine buy it has stock lock as well...
http://forum.xda-developers.com/showthread.php?t=799511
He will be posting them soon I am sure.

I'm too chicken to try this myself, but I would love to see it in Cog Beta 8

xtremeskier said:
I'm too chicken to try this myself, but I would love to see it in Cog Beta 8
Click to expand...
Click to collapse
It is already in
Doing some other stuff too, will be a couple days...

designgears said:
Not sure what your intent is, but...
Read the op, credit was given, also read the code, its not the same, I also posted in his thread saying I ported it over.
Click to expand...
Click to collapse
What a Hater.... Thanks dg I'm going to give this a shot... I appreciate your work..
Sent from my SAMSUNG-SGH-I897 using Tapatalk

designgears said:
It is already in
Doing some other stuff too, will be a couple days...
Click to expand...
Click to collapse
You da man DG! Love your work. Keep fighting the good fight!

designgears said:
It is already in
Doing some other stuff too, will be a couple days...
Click to expand...
Click to collapse
I'm starting to fear my phones strength. Cant wait to flash beta 8.

JBLogic said:
I'm starting to fear my phones strength. Cant wait to flash beta 8.
Click to expand...
Click to collapse
As long as it doesn't become self aware I think we are safe. But with DG (and the others) on the job who knows what's coming in the next ROM

I tried to work it into CDE Beta 3, but the GlobalActions.smali portion was different; i couldn't find the code to change. I found simularities, but it resulted in a hardcrash whenever I tried to bring the menu up. Anyone have any insight on how to do this in CDE Beta 3?

geokhentix said:
I tried to work it into CDE Beta 3, but the GlobalActions.smali portion was different; i couldn't find the code to change. I found simularities, but it resulted in a hardcrash whenever I tried to bring the menu up. Anyone have any insight on how to do this in CDE Beta 3?
Click to expand...
Click to collapse
Hmm, should be the same, that it was I used to start with.

designgears said:
Hmm, should be the same, that it was I used to start with.
Click to expand...
Click to collapse
Code:
const/4 v0, 0x4
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
was nowhere to be found in the document, the closest i could find was
Code:
new-array v0, v9, [Lcom/android/internal/policy/impl/GlobalActions$Action;
and const/4 v0, 0x4 is nowhere near that line.
Late edit; this is the only time in my GlobalActions.smalo where "new-array" exists;
Code:
.line 222
new-array v0, v9, [Lcom/android/internal/policy/impl/GlobalActions$Action;
const/4 v1, 0x0
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v2, v0, v1

Related

[FIX] Home Button Haptic (JPY i9000 Roms Only!)

I see MikeyMike01(all credit goes to him) has figured this out, so I thought I would share how it was done since his thread doesn't go into how he did it.
DEVS ONLY!!
(Don't ask for compiled versions in here)
(I am doing this in Linux)
Decompile android.policy.jar:
Copy out the classes.dex file somewhere
java -jar baksmali.jar -o classout/ classes.dex
Go to classout/com/android/internal/policy/impl
Apply the patch (attached below):
patch -p1 < ../path/to/homehaptic.patch
Recompile android.policy.jar:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Copy new-classes.dex back into the jar file as classes.dex
Push android.policy.jar back to your phone, reboot and enjoy haptic feedback on your home button on JPY!
SWEET. Can we get a precompiled version for Perception? </troll>
smmalis37 said:
SWEET. Can we get a precompiled version for Perception?
Click to expand...
Click to collapse
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
designgears said:
Click to expand...
Click to collapse
I'm going to make that my wallpaper
Sent from my liberated Captivate via XDA App.
Damn DG you beat me to it, I was staring at the following screen and couldn't figure it out for the life of me.
Was I at least close?
Left = Mikey's V8
Right = Mikey's V9
http://psfreedom.com/images/compare.png
smmalis37 said:
SWEET. Can we get a precompiled version for Perception? </troll>
Click to expand...
Click to collapse
Editing your post afterwards doesn't fix your stupidity.
>Iwasonlypretendingtoberetarded.jpg
TheEscapist said:
Editing your post afterwards doesn't fix your stupidity.
>Iwasonlypretendingtoberetarded.jpg
Click to expand...
Click to collapse
And that's why it works.
devz3r0 said:
Damn DG you beat me to it, I was staring at the following screen and couldn't figure it out for the life of me.
Was I at least close?
Left = Mikey's V8
Right = Mikey's V9
http://psfreedom.com/images/compare.png
Click to expand...
Click to collapse
These highlighted lines were present on Captivate ROMs and not on i9000 ones.
Ipso facto.
http://img64.imageshack.us/img64/2695/33554972.png
I knew I had to be looking in the right place
I also knew it was 8 lines that was inserted. I guess I just got cross-eyed :/
Either way great job finally figuring out this mystery!
As MikeyMike can attest... I'm retarded still when it comes to android. But this, I am excited for!
Good work MikeyMike!
why is dg posting this if all credit goes to the other dude? just curious!
Mike fixed it but didn't write it up. DG found his fix and wrote it up so all could benefit. Sometimes it's nice to have someone else write stuff up when you're too busy...
It wasn't too hard to figure out though. It only took about an hour of looking through phone window manager.smali to find out where the code need to be inserted.
Mikey was the brave one though and tested out some random code insertion lol. It just happened to work first try. Else I would have tested a couple other methods in the smali.
Good job Mikey
Can someone recreate patch for my JPB firmware, if i give a file for now? Can't use android sdk and java for some time...
Yuna said:
Can someone recreate patch for my JPB firmware, if i give a file for now? Can't use android sdk and java for some time...
Click to expand...
Click to collapse
Post it up, ill take a look
okay, but i have my rom odexed (forgot to mention it)...
http://rapidshare.com/files/441310491/android.policy.zip
thanks
I tried it, the patch doesn't seem to work on JPY android.policy.jar, not sure what is being patched here. I did try several different ones too. Then I gave up trying to use the patch, grabbed Mikeys android.policy.jar and did a diff with my JPY policy. What I saw there made a whole lot more sense and was about 20 lines of code, so i just copied the PhoneWindowManager.smali from Mikey to mine and recompiled. There were a lot less differences between Mikeys and JPY then there were from the patch and jpy.
For example: The patch wants to change line 4248 from cond_152 to cond_163. Both JPY and Mikey read cond_12.
If anyone can do this for JW4, I don't have access to any Linux/Windows(Cygwin) at the moment. If you can't, thanks for trying. I will get to it later.

[MOD] MyVerizon For LTE

EDIT: these changes have to be made using baksmali/smali by someone that knows how to do it. I do not post apks on XDA, unless they are mine, I have permission, or are part of the stock rom.
Please don't post the APK links in my thread, this is solely for educational purposes, I don't recommend you run a patched app on your phone. Running a patched verzion of this could be harmful to your device, or Verizon's network. I don't run it.
We were notified by a confirmed Verizon developer that this might cause damage to your phone. Don't use it. Leaving it here for historical knowledge.
I am posting the patch details not the apk. So hate all you want, someone else can apply it and upload if they want.
Credit to vinylfreak
Change
com/vzw/hss/myverizon/main/mediator/SplashMediator.smali
line: 789
Code:
if-eqz v4, :cond_1
change to
Code:
if-nez v4, :cond_1
re-assemble.
Might not work for all, might not have all features working, but works for me on 3g.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Wow...nice
*sigh* need to fix my vmware to get me dev environment back. Wish someone would mod it. If I got to it first (doubtful) I'll upload.
Wow this thread is going places....
Sent from my ADR6400L using Tapatalk
So back on topic! Any reason we can see why verizon won't release this officially? Any know issues with this?
Jcase,
You should know there are hundreds of people who enjoy your work and it works for them so well they never post.
You know what they say, someone with something negative to say is ten times more likely to talk about it than someone with a positive opinion.
I've been meaning to get off my butt and learn how to do this stuff anyway, so its just as well you didn't post the apk. Thx for the tip!
Jaywan: you do know women contribute to / frequent xda too, right? Respect them much?
Sent from my ADR6400L using Tapatalk
So back on topic again. Anyone willing to hack this so I can save me some time?
since it was my idea... im kinda working on its... its half working... dont wanna post something that i'll get *****ed at about...
my changes: DeviceManager$LTE Checker.smali
.line 558
if-nez v2, :cond_69
if-nez v1, :cond_69
const/4 v4, 0x1
to
.line 558
if-nez v2, :cond_69
if-nez v1, :cond_69
const/4 v4, 0x0
and....
.line 558
:cond_69
const/4 v4, 0x1
to
.line 558
:cond_69
const/4 v4, 0x0
vinylfreak89 said:
since it was my idea... im kinda working on its... its half working... dont wanna post something that i'll get *****ed at about...
my changes: DeviceManager$LTE Checker.smali
.line 558
if-nez v2, :cond_69
if-nez v1, :cond_69
const/4 v4, 0x1
to
.line 558
if-nez v2, :cond_69
if-nez v1, :cond_69
const/4 v4, 0x0
and....
.line 558
:cond_69
const/4 v4, 0x1
to
.line 558
:cond_69
const/4 v4, 0x0
Click to expand...
Click to collapse
I cheated on my version haha
yea but it still works better than mine right now LOL
Great patch jcase! Question: Where the heck does all of that 377GB go? One last thing...
377GB, wow that is impressive. Tether much? lol
necosino said:
377GB, wow that is impressive. Tether much? lol
Click to expand...
Click to collapse
That is only ~368 MB. A few days worth of streaming pandora
Pretty sad that the community fixed verizon's app before them
evillozer said:
That is only ~368 MB. A few days worth of streaming pandora
Click to expand...
Click to collapse
Yup.. That's what I get for just glancing over the photo and reading posts, lol..
luniz7 said:
Pretty sad that the community fixed verizon's app before them
Click to expand...
Click to collapse
Ha that is what I thought..
Bolted.....
Anyway we can get this in a .apk or a flashable zip?
first edit was extraneous... still not 100 % on it working tho. certainly does over wifi. 3g/4g.... im still getting errors... will continue to look in to it.
.line 558
:cond_69
const/4 v4, 0x1
to
.line 558
:cond_69
const/4 v4, 0x0
is the only needed edit.
where on the phone do u make these changes???
poloboogie said:
where on the phone do u make these changes???
Click to expand...
Click to collapse
Changes are being made in My Verizon App

[Guide]Change Recent Apps panel button

after some playing with some files i had figured out something fun
when you long press home button
you will see a popup panel like this
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
as you know when you press the big button with task manager on it you would be directed to the taskmanager
well ive figured out how to change that to any other app like you want * NOTE you will need to play with some codes Also This is For SAMSUNG roms only *
Files to Mod
1) Android.policy.jar -> smali\com\android\internal\policy\impl\RecentApplicationsDialog.smali
2) Framework-res.apk ->
layout/recent_apps_dialog.xml
values/Strings.xml
values/public.xml
1)Decompile Android.Policy.jar
go to android.policy.jar.out\smali\com\android\internal\policy\impl
then open the RecentApplicationsDialog.smali
and find
# static fields
Click to expand...
Click to collapse
then under it find
.field public static final INTENT_ACTION_JOB_MANAGER:Ljava/lang/String; = "com.sec.android.app.controlpanel.MAIN"
Click to expand...
Click to collapse
the com.sec.android.app.controlpanel.MAIN is the thing we will need to change since this is the APK package name of taskmanager menu
i will be changing the button to redirect to my Music Player app. so when i press it will be going to music player
my APK packagename of music player is com.android.music.PLAYBACK_VIEWER
so we will need to change
.field public static final INTENT_ACTION_JOB_MANAGER:Ljava/lang/String; = "com.sec.android.app.controlpanel.MAIN"
Click to expand...
Click to collapse
To
.field public static final INTENT_ACTION_JOB_MANAGER:Ljava/lang/String; = "com.android.music.PLAYBACK_VIEWER"
Click to expand...
Click to collapse
so if we have done that we go to next step
Find
.method private isJobManagerInstalled()Z
Click to expand...
Click to collapse
under it find
const-string v3, "com.sec.android.app.controlpanel.MAIN"
Click to expand...
Click to collapse
change com.sec.android.app.controlpanel.MAIN to com.android.music.PLAYBACK_VIEWER
so it will be like
const-string v3, "com.android.music.PLAYBACK_VIEWER"
Click to expand...
Click to collapse
Now find
const-string v7, "com.sec.android.app.controlpanel.MAIN"
Click to expand...
Click to collapse
and again change
const-string v7, "com.sec.android.app.controlpanel.MAIN"
Click to expand...
Click to collapse
to
const-string v7, "com.android.music.PLAYBACK_VIEWER"
Click to expand...
Click to collapse
Now we are Finished With the button assignement
*Note * you can change the app to anything else you want
just decompile the wanted apk and check android.manifest.xml and look for the packagename and maybe also wich layout you want like go to music UI or Music Browser etc
Now Compile Android.Policy.jar
2) Now we go and change the taskmanager text inside
Framework-res.apk
open
recent_apps_dialog.xml
Click to expand...
Click to collapse
and search for
<Button android:textAppearance="?textAppearanceMedium" android:layout_gravity="center" android:id="@id/zzz_button_job_manager_second " android:layout_width="242.0dip" android:layout_height="wrap_content" android:layout_marginTop="2.0dip" android:text="@string/job_manager" />
Click to expand...
Click to collapse
*NOTE* this code can be little diffrent
what we are going to do is modify the
android:text="@string/job_manager"
Click to expand...
Click to collapse
now its going to be a little tricky we will need to open
values/Strings.xml
Click to expand...
Click to collapse
values/Public.xml
Click to expand...
Click to collapse
keep the
recent_apps_dialog.xml
Click to expand...
Click to collapse
open
Search in Public.xml for
job_manager
Click to expand...
Click to collapse
you will see something like
<public type="string" name="job_manager" id="0x01040438" />
Click to expand...
Click to collapse
we will need to change the
job_manager
Click to expand...
Click to collapse
to anything else like i want music player so i do
music_playerui
Click to expand...
Click to collapse
so it will be
<public type="string" name="music_playerui" id="0x01040438" />
Click to expand...
Click to collapse
now go to Strings.xml and add
<string name="music_playerui">Music Player</string>
Click to expand...
Click to collapse
*NOTE* u need to change the music_playerui inside the string tag to the same name as you have entered in the public.xml
this will link to each so it will work perfectly
Now for the last part we will be going back to
recent_apps_dialog.xml
Click to expand...
Click to collapse
again
and change
android:text="@string/job_manager"
Click to expand...
Click to collapse
to
android:text="@string/music_playerui"
Click to expand...
Click to collapse
do this for both
android:text="@string/job_manager"
Click to expand...
Click to collapse
*i have 2 in my recent_apps_dialog.xml *
Now compile the framework-res.apk
And Youre ready to use
*NOTE* test it first since you may need to change the packagename files to others when it isnt working correctly
Post your result below with a screenie if possible
I will try to help you all as much possible
Please Use apktool
so if you have problems while compiling i can see the error properly
* Here i will post my Flashable Zip package for user to replace it with there own files
also i will upload a premade mod with my Music Player edit
So you can compare what i did *
Replace with your own files -> Download Here
How to place your files in the zip
1) Extract the zip
2) Go to the framework folder wich is inside system
3) Then put your files in it * Android.Policy.jar and Framework-res.apk
4) Then go back to the folder where u see
META-INF
System
5) Select them both and press archive
6) Then type a name and press zip
7) DONT compress the zip
XWKTR -> Download Here
How to Flash ?
1) Mount System
2) Mount Data
3) Install ZIP From SD Card
4) Reboot
1st nice guide dude!!!
Sent from my GT-S5830 using xda app-developers app
TechNoJerky said:
1st nice guide dude!!!
Sent from my GT-S5830 using xda app-developers app
Click to expand...
Click to collapse
thanks
Post a screenie Mate! :b
Awesome!! Great guide Robinz
Nice, but I think you had too much free time..
Peteragent5 said:
Nice, but I think you had too much free time..
Click to expand...
Click to collapse
Lol
Sent from my GT-S5830 using xda premium
Great guide
Controversies,controversies everywhere :what:
Cool Guiide Robin can you make recent apps popup screen bigger to hold more than 6 apps as in CM Roms
Ahmed hamouda said:
Cool Guiide Robin can you make recent apps popup screen bigger to hold more than 6 apps as in CM Roms
Click to expand...
Click to collapse
thats possible
will look into it later
i have found some lines that just needs 0x8 to 0x16
etc
thanks for this guide ;D
is there a possibility we can copy paste the taskmanager smali twice and rename it so we can have 2 buttons in recents view >
like 1 for taskmanager and 1 for Settings ?
is there any way that 2 buttons can be added? like task manager and one more...
U
lokeshsaini94 said:
is there any way that 2 buttons can be added? like task manager and one more...
Click to expand...
Click to collapse
Ive been exploring it
And i think yes
Maybe by making new .methods
And instead of taskswitcher method add
Custom method
But it is possible for sure
Unlimited recent apps (i don't try it on Ace)
http://forum.xda-developers.com/showthread.php?t=1902411
SpaceCaker said:
U
Ive been exploring it
And i think yes
Maybe by making new .methods
And instead of taskswitcher method add
Custom method
But it is possible for sure
Click to expand...
Click to collapse
I think it would editing xml (to add new button) and new method (like task manager button).
_FroX_ said:
Unlimited recent apps (i don't try it on Ace)
http://forum.xda-developers.com/showthread.php?t=1902411
I think it would editing xml (to add new button) and new method (like task manager button).
Click to expand...
Click to collapse
Jup
Will try tgat unlimuted task switch mode
But we since we run gb
We need to add unlimited IDs for the layout since we only have 6 /8ids
While on ics it loads tasks whole differently
Sent from my ST25i using xda app-developers app
Robin, check pm

[Tutorial] Adding new Activity Header/Sub Menu to Settings.apk

Hi Geeks
Here's a tutorial on how to add an Activity Header to Settings.apk​
Requirements:
1.Settings.apk
2.Notepad ++ or Editor Alternatives
3.Apktool to Decompile apk
4.A Little Common sense
Tutorial:
1. Decompile Settings.apk
2.Open to res/xml/settings_headers.xml
3.Lets take an example i want to Add "Maddy" as a activity header
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
add this line
Code:
<header android:icon="[COLOR="Brown"]@drawable/ic_settings_maddy[/COLOR]" android:id="[COLOR="SeaGreen"]@id/maddy_settings[/COLOR]" android:title="[COLOR="Purple"]@string/maddy_settings[/COLOR]" android:fragment="[COLOR="DarkOrange"]com.android.settings.Maddy[/COLOR]" />
The layout in settings_headers.xml is categorized. If you want submenu "Maddy" to appear after 'Apps' as shown,add the line after the line that says <header android:icon="@drawable/ic_settings_applications"..... as shown
Code:
<header android:icon="@drawable/ic_settings_applications" android:id="@id/application_settings" android:title="@string/applications_settings" android:fragment="com.android.settings.applications.ManageApplications" />
<header android:icon="@drawable/ic_settings_maddy" android:id="@id/maddy_settings" android:title="@string/maddy_settings" android:fragment="com.android.settings.Maddy" />
3.1-@drawable/ic_settings_maddy=This refers to the png in res/drawable-*dpi/ folder
Add a new png named ic_settings_maddy.png in res/drawable-*dpi/
It will be the Image that will show up in settings menu (The Wifi like icon in my case)
* = hdpi / mdpi /xhdpi /xxhdpi /xxxhdpi (Depends on your device)
3.2-@id/maddy_settings=This refers to id value in /res/values/ids.xml
Open res/values/ids.xml and add this code
Code:
<item type="id" name="maddy_settings">false</item>
3.3 - @string/maddy_settings = Refers to a string in res/values/strings.xml
Open strings.xml and add this code
Code:
<string name="maddy_settings">Your String here</string>
Add the string you wish to see in settings Submenu in place of 'Your String Here'
3.4-com.android.settings.Maddy = Refers to the smali file in smali/com/android/settings/
4. Open res/values/public.xml
and find the last line that says
<public type="xml" ...
like
Code:
<public type="xml" name="[I]somethig_something[/I]" id="[COLOR="Blue"]0x7f050053[/COLOR]" />
Note the Hex code in Blue.It can be different for you
and now add this line just after the last line of type="xml"
Code:
<public type="xml" name="maddy_settings" id="[COLOR="Red"]0x7f050054[/COLOR]" />
Also Note that the previous address in my case was 0x7f050053
so the new address will be "Previous address + 1(Hex addition)" i.e 0x7f050054
Replace 0x7f050054 with your calculated Address.
If your Address is 0x7f050039
Next Addres = 0x7f05003a
if your address is 0x7f05003f
next address = 0x7f050040
and so on..
5.Go to res/xml/
and add a new file named maddy_settings.xml
This xml would contain the Apps/Actions you wish to see inside the Submenu "Maddy"
Just like you see
Brightness
Screen timeout
etc etc
options when you click Display in Settings Menu
an example of what maddy_settings.xml may contain
PHP:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/maddy_settings"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<com.sonymobile.settings.preference.PreferenceCategory android:title="@string/uipref_title">
<PreferenceScreen android:icon="@drawable/cust_bar_wallpapers" android:title="@string/wallpaper_settings_title" android:key="wallpaper" android:fragment="com.android.settings.WallpaperTypeSettings" />
<com.sonymobile.settings.preference.IntentPreference android:icon="@drawable/ic_lighteffects" android:title="@string/light_effects_settings_title" android:key="light_effects" settings:dependOnIsValidIntent="true" settings:after="theme">
<intent android:targetPackage="com.sonymobile.settings.illumination" android:action="android.intent.action.MAIN" android:targetClass="com.sonymobile.settings.illumination.IlluminationSetting" />
</com.sonymobile.settings.preference.IntentPreference>
<com.sonymobile.settings.preference.IntentPreference android:icon="@drawable/homescreen_application_launcher" android:key="lockscreen" settings:dependOnIsValidIntent="true" settings:hasMetaData="true">
<intent android:action="com.sonyericsson.settings.intent.action.LOCKSCREEN" />
</com.sonymobile.settings.preference.IntentPreference>
</com.sonymobile.settings.preference.PreferenceCategory>
<com.sonymobile.settings.preference.PreferenceCategory android:title="@string/systemuipref_title">
<com.sonymobile.settings.preference.IntentPreference android:icon="@drawable/ic_systemui1" android:key="quicksettings" settings:dependOnIsValidIntent="true" settings:hasMetaData="true">
<intent android:action="com.sonymobile.intent.action.TOOLBAR_SETTINGS" />
</com.sonymobile.settings.preference.IntentPreference>
<com.sonymobile.settings.preference.IntentPreference android:icon="@drawable/ic_systemui2" android:key="power_toggles" settings:dependOnIsValidIntent="true" settings:hasMetaData="true">
<intent android:action="com.serajr.powertoggles.preferences.intent.PREFERENCES" />
</com.sonymobile.settings.preference.IntentPreference>
</com.sonymobile.settings.preference.PreferenceCategory>
</PreferenceScreen>
To Add these Apps/shortcuts to the submenu you just created,refer this guide [Tutorial] How to add any App/Option in Settings.apk by saqib nazm
Just use the new maddy_settings.xml to link your new apps/actions.
6.Open smali/com/android/settings/ and add a new file named Maddy.smali
paste this code in it
Code:
.class public Lcom/android/settings/Maddy;
.super Lcom/android/settings/SettingsPreferenceFragment;
.source "Maddy.java"
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 17
invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 1
.parameter "savedInstanceState"
.prologue
.line 21
invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V
.line 23
const v0, [COLOR="Blue"]0x7f050054[/COLOR]
invoke-virtual {p0, v0}, Lcom/android/settings/Maddy;->addPreferencesFromResource(I)V
.line 24
return-void
.end method
Find and replace "Maddy" with your smali name.
Smali names should always start with Capital Letters.
Also note the Hex code you added in Step 5.
replace 0x7f050054 with your Hex value.
7.Recompile your Apk and Done!
Note:
Should work with any versions of Xperia.
Also may work on other Devices,Please try and report.
Credits:
Saqib nazm : For teaching me all this!
DbcCabuslay : For Smali ideas
Jishnu Sur™ : For some Advice
Hit Thanks and Rate Good if you find it helpful and Motivate :good:​
Great guide, very nicely explained and elaborated :good: I hope this will help lots of users
saqib nazm said:
Great guide, very nicely explained and elaborated :good: I hope this will help lots of users
Click to expand...
Click to collapse
Thank you sir,for teachin me all this.
Good stuff.. glad to see you going ahead slowly..
Sent from my Nexus 5 using Tapatalk
Keep going Good work :good: All the Best !
Sent from my Nexus 5 using Tapatalk
Useful guide. Keep sharing this kind of stuffs.
vishal_android freak said:
Good stuff.. glad to see you going ahead slowly..
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Thank you!
Yes,the word slowly is so very important
Aman_Arora said:
Keep going Good work :good: All the Best !
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
BDFreak said:
Useful guide. Keep sharing this kind of stuffs.
Click to expand...
Click to collapse
Thank you Aman and Bd
Very good guide. Simple but very detailed. Better than many of the clustered one's! Congratulations..Keep up the good work!
Nice guide I was looking for something like this just this day.
Is it the same when adding sub menu inside another header like device_info_settings.xml?
Jishnu Sur™ said:
Very good guide. Simple but very detailed. Better than many of the clustered one's! Congratulations..Keep up the good work!
Click to expand...
Click to collapse
Thank you Jishnu
knightzero07 said:
Nice guide I was looking for something like this just this day.
Is it the same when adding sub menu inside another header like device_info_settings.xml?
Click to expand...
Click to collapse
This one is only for adding sub menus in main settings
For sub menu in device info,try studing "status" or "legal info" inside About to get an idea of how its referenced
Sent from my MT27i using Tapatalk
ok thanks @Madaditya
I was checking on that too. I'm adding codes without android:key
I guess it needs a key so it won't get fc.
Madaditya said:
Hi Geeks
Here's a tutorial on how to add an Activity Header to Settings.apk​
Click to expand...
Click to collapse
Why are you creating a new setting fragment? This is useless and complicated
You could have used this:
Code:
android:fragment="com.sonymobile.settings.GenericSettingsFragment"
This have been added by Sony since JB 4.2 and is allowing to create any new header with sub menus
Cheers
Great job !!!
Amazing tut, really useful!!!
@Pandemic ... was not exactly what were you needing?
niaboc79 said:
Why are you creating a new setting fragment? This is useless and complicated
You could have used this:
Code:
android:fragment="com.sonymobile.settings.GenericSettingsFragment"
This have been added by Sony since JB 4.2 and is allowing to create any new header with sub menus
Cheers
Click to expand...
Click to collapse
Wasn't aware of it
Thank you for guiding
Ill update this to the tut as well if the one doesn't exist
serajr said:
Amazing tut, really useful!!!
@Pandemic ... was not exactly what were you needing?
Click to expand...
Click to collapse
Thank u serajr
Yeah,pandemic got it.
We talked over the pm
Sent from my MT27i using Tapatalk
serajr said:
Amazing tut, really useful!!!
@Pandemic ... was not exactly what were you needing?
Click to expand...
Click to collapse
Yes bro @serajr
but i have it already i have moonwalker xposed in my settings with Xposed Modules and Xperia Xposed ^^
Brothers @serajr & @Madaditya
Sorry for spam but here just awesome ^^
Verstuurd vanaf mijn LT22i met Tapatalk
Pandemic said:
Brothers @serajr & @Madaditya
Sorry for spam but here just awesome ^^
Verstuurd vanaf mijn LT22i met Tapatalk
Click to expand...
Click to collapse
Wow... great bro... you got it!!
Once again, @Madaditya ... great job!
This kind of thread we want to see over xda!!
bro when i want recompaile i have this errors :
..\3-Out\Settings.apk\smali\com\android\settings\Maddy.smali[21,4] Error for input '.parameter': Invalid directive
..\3-Out\Settings.apk\smali\com\android\settings\Maddy.smali[21,15] mismatched input '"savedInstanceState"' expecting END_METHOD_DIRECTIVE
.
alinolaw71 said:
bro when i want recompaile i have this errors :
..\3-Out\Settings.apk\smali\com\android\settings\Maddy.smali[21,4] Error for input '.parameter': Invalid directive
..\3-Out\Settings.apk\smali\com\android\settings\Maddy.smali[21,15] mismatched input '"savedInstanceState"' expecting END_METHOD_DIRECTIVE
.
Click to expand...
Click to collapse
Are you using apktool 2? If so, you need to be using 1.5.2..
Sent from my C6603 using Tapatalk
Ticklefish said:
Are you using apktool 2? If so, you need to be using 1.5.2..
Sent from my C6603 using Tapatalk
Click to expand...
Click to collapse
bro pls send link to me.

[TUT]How To Change The Battery Icon On Stock Xperia KitKat..UPDATED!!

(***NOW UPDATED WITH CHARGING ICONS!!****)​
** THIS GUIDE IS FOR STOCK XPERIA KITKAT ROMS ONLY. IF YOU'RE ON A KK ROM THAT ISN'T MADE BY SONY, LOOK AT MY FRIEND @Erhany'S GUIDE HERE: http://forum.xda-developers.com/showpost.php?p=56300485&postcount=1 **
Changing the battery icon on a stock KitKat rom isn't easy. Google have changed how the icon is created and it's no longer possible to just change some icons and a few xml files.
Or is it?
Sony have put their own spin on KitKat and, if you've got an official stock Xperia 4.4 rom, you can still change the icon very easily. You just have to do something a little different to before..
How To Do It
So this is what the stock icon looks like:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
It's okay..but we wouldn't be here if we weren't the sort who liked to change things.
First, you'll need to decompile your SystemUI.apk.
I'm not going to tell you how to do that, there's lots of guides already on xda. Although I do recommend taking a look at Tickle My Android (tinyurl.com/ticklemyandroid). It's made by a very good friend of mine..
You're also going to need four types of tiles:
a lot of files called 'stat_sys_battery_100.png', 'stat_sys_battery_99.png', 'stat_sys_battery_98.png', etc
a lot of files called 'stat_sys_battery_charge_anim100.png', 'stat_sys_battery_charge_anim99.png, 'stat_sys_battery_charge_anim98.png, etc
a file called 'stat_sys_battery.xml'
and a file called 'stat_sys_battery_charge.xml'
You'll find those all over xda as well. I've attached the ones I've used in this post, just so you can try them out.
Adding The Images
You'll need to copy those image files into your 'drawable-?dpi' folder. This will vary according to your device, on my XZ it's 'drawable-xxhdpi'.
This will give Android images to use as your battery icon.
Then comes the fun part.
Editing The XML
Normally, you'll copy 'stat_sys_battery.xml' and 'stat_sys_battery_charge.xml' into your drawable folder, overwriting the files that are already there.
There is no 'stat_sys_battery.xml' or 'stat_sys_battery_charge.xml' in KitKat.
Instead, rename 'stat_sys_battery.xml' to 'somc_sys_battery.xml'. And rename 'stat_sys_battery_charge.xml to 'somc_sys_charging.xml'. Then copy them into your drawable folder.
This will tell Android which images to use for each amount of charge in the battery.
Now edit status_bar.xml and change this piece of code:
Code:
<LinearLayout android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginStart="4.0dip">
<ImageView android:layout_gravity="center_vertical" android:id="@id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<LinearLayout android:id="@id/battery_meter" android:layout_width="wrap_content" android:layout_height="fill_parent">
<ImageView android:layout_gravity="center_vertical" android:id="@id/battery_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:layout_gravity="center_vertical" android:id="@id/stamina_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/somc_sys_powersaver" />
</LinearLayout>
<FrameLayout android:id="@id/battery_percent" android:layout_width="wrap_content" android:layout_height="fill_parent">
<com.sonymobile.systemui.statusbar.BatteryImage android:layout_gravity="start|center" android:id="@id/battery_percent_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout>
to:
Code:
<LinearLayout android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginStart="4.0dip">
<LinearLayout android:id="@id/battery_meter" android:layout_width="wrap_content" android:layout_height="fill_parent">
<ImageView android:layout_gravity="center_vertical" android:id="@id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:layout_gravity="center_vertical" android:id="@id/battery_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:layout_gravity="center_vertical" android:id="@id/stamina_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/somc_sys_powersaver" />
</LinearLayout>
<FrameLayout android:id="@id/battery_percent" android:layout_width="wrap_content" android:layout_height="fill_parent">
<com.sonymobile.systemui.statusbar.BatteryImage android:layout_gravity="start|center" android:id="@id/battery_percent_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout>
This will place the charging icon next to the battery icon, inside the @id/battery_meter Layout. This will cause the charging icon to vanish if you turn on the percentage option in the Settings app.
We're nearly there..
Editing The Smali
Now comes the really fun part. It's time to edit some smali!
For this part, we need to do some detective work. Open your 'res/values/public.xml' and find these two lines:
<public type="drawable" name="somc_sys_battery" id="0x7f0200c9" />
<public type="drawable" name="somc_sys_charging" id="0x7f0200d6" />
Click to expand...
Click to collapse
They might be next to each other...or they might not.
The parts in red are the hex references that we're going to need to look for in our smali. It's likely the references will be different in your rom to mine.
Edit 'com\android\systemui\statusbar\policy\BatteryController.smali' and look for your 'somc_sys_charging' reference. The code you'll find should look like this:
const v11, 0x7f0200d6
invoke-virtual {v10, v11}, Landroid/widget/ImageView;->setImageResource(I)V
goto/16 :goto_3
Click to expand...
Click to collapse
You'll want to change this so it looks like this:
.local v10, "icon":Landroid/widget/ImageView;
const v11, 0x7f0200d6
invoke-virtual {v10, v11}, Landroid/widget/ImageView;->setImageResource(I)V
move-object/from16 v0, p0
iget v11, v0, Lcom/android/systemui/statusbar/policy/BatteryController;->mLevel:I
invoke-virtual {v10, v11}, Landroid/widget/ImageView;->setImageLevel(I)V
goto/16 :goto_3
Click to expand...
Click to collapse
Make sure you change the code in red to your own reference!
This will make Android change the charging icon when the battery level changes.
Then look for your 'somc_sys_battery' reference. The code you'll find should look like this:
.local v5, "icon":Landroid/widget/ImageView;
const v11, 0x7f0200c9
invoke-virtual {v5, v11}, Landroid/widget/ImageView;->setImageResource(I)V
Click to expand...
Click to collapse
Change it to:
.local v5, "icon":Landroid/widget/ImageView;
move-object/from16 v0, p0
iget-boolean v11, v0, Lcom/android/systemui/statusbar/policy/BatteryController;->mPlugged:Z
if-nez v11, :cond_40
const/4 v11, 0x0
goto: cond_50
:cond_40
const/16 v11, 0x8
:cond_50
invoke-virtual {v5, v11}, Landroid/widget/ImageView;->setVisibility(I)V
const v11, 0x7f0200c9
invoke-virtual {v5, v11}, Landroid/widget/ImageView;->setImageResource(I)V
Click to expand...
Click to collapse
Again, make sure you change the code in red to your own reference!
This will make the battery icon vanish when your phone's charging.
Now just save, recompile and push to your device as normal. Wait a while for it to reboot and...
(You'll also need to disable the battery percentage in the Settings app, if you haven't already.)
Of course, these aren't perhaps the best icons I could have chosen for these screenshots. I didn't have much time for this post, I just picked some at random and it looks a little lost. But that's the fun of battery icons..there are so many to choose from!
**HUGE Thanks Go To The Master, @serajr, For The Smali Help!**
**Thanks also go to @krzycho96 for their YouTube video**​
Amazing!!!
Great job bro!!!!! ... as always!!!
Masterpiece.... always dazzling our Xperias with mods!
Good job, but the hardest thing is make icon look good when stamina is activated , and low-battery mode activated,and when battery charging. I'm trying to do that
devilmaycry2020 said:
Good job, but the hardest thing is make icon look good when stamina is activated , and low-battery mode activated,and when battery charging. I'm trying to do that
Click to expand...
Click to collapse
I can take a look at this tomorrow, right now I'm away from computer.
The stamina icon could just be redrawn. Maybe we could reuse the one from 4.3?
Charging is a bit more complicated. In stock, a lightning bolt is displayed. I think we might be able to replace that with the same sort of level-list we had before..
Sent from my C6603 using Tapatalk
Great work bro :good: as what Ive expected again
hi all
i want the battery charging icon flashing like as video below, someone can help me. thanks
http://youtu.be/qkOgedJCKCI
devilmaycry2020 said:
hi all
i want the battery charging icon flashing like as video below, someone can help me. thanks
http://youtu.be/qkOgedJCKCI
Click to expand...
Click to collapse
I've got an idea about that. I'm trying something right now, in fact. Watch this space!
Ticklefish said:
I've got an idea about that. I'm trying something right now, in fact. Watch this space!
Click to expand...
Click to collapse
What's news ?
devilmaycry2020 said:
What's news ?
Click to expand...
Click to collapse
Not much, unfortunately. I tried changing a stat_sys_battery_charging.xml to somc_sys_charging.xml. But it didn't work the way I wanted.
The level-list was ignored and only the first drawable was shown. Which is a bit of a puzzle.
Hi, is there a chance to modify the Z2 systemUI into something like this? Please guide me to do this.
XPS_93 said:
Hi, is there a chance to modify the Z2 systemUI into something like this? Please guide me to do this.
Click to expand...
Click to collapse
Should be simple enough. Can you share your status_bar.xml please?
Sent from my C6603 using Tapatalk
Awesome Guide but something off-topic
How did you change the font of the lockScreen
Ticklefish said:
Should be simple enough. Can you share your status_bar.xml please?
Sent from my C6603 using Tapatalk
Click to expand...
Click to collapse
Alright, this is it. Is pulling it out from systemui.apk using winrar enough or I have to decompile the apk for it?
Edit: I've reuploaded the xml file decompiled from systemui.apk
XPS_93 said:
Alright, this is it. Is pulling it out from systemui.apk using winrar enough or I have to decompile the apk for it?
Click to expand...
Click to collapse
no no, you have to decompile system.apk, take out by winrar can not use because it was encrypted
John98Zakaria said:
Awesome Guide but something off-topic
How did you change the font of the lockScreen
Click to expand...
Click to collapse
I didn't. There isn't a picture of my lockscreen in this thread..
XPS_93 said:
Alright, this is it. Is pulling it out from systemui.apk using winrar enough or I have to decompile the apk for it?
Edit: I've reuploaded the xml file decompiled from systemui.apk
Click to expand...
Click to collapse
Thanks, I'll check it out. You know, xml files aren't exactly big. There's no need to archive them.
Sent from my C6603 using Tapatalk
That font isn't usual ?
John98Zakaria said:
That font isn't usual ?
Click to expand...
Click to collapse
Oh, you mean my clock widget. I made it using 'Make Your Clock Widget' and a font called Respective.
I used the same font for my dock icons and my softkeys.
Sent from my C6603 using Tapatalk
Ticklefish said:
Thanks, I'll check it out. You know, xml files aren't exactly big. There's no need to archive them.
Sent from my C6603 using Tapatalk
Click to expand...
Click to collapse
You're welcome, and sorry I wasn't able to upload it straight as xml attachment isn't allowed in post so simply I compressed it. :laugh: I'm looking forward for your guidance, thank you :good:
XPS_93 said:
You're welcome, and sorry I wasn't able to upload it straight as xml attachment isn't allowed in post so simply I compressed it. :laugh: I'm looking forward for your guidance, thank you :good:
Click to expand...
Click to collapse
That's okay.
There's nothing unusual or different about your XML. Which is good.
The easiest thing to do is use this mod here: http://forum.xda-developers.com/showthread.php?t=2356012
You'll be wanting to put the new line just under the signal_cluster line.
Sent from my C6603 using Tapatalk

Categories

Resources