Guide: Adding/Removing Quick Settings to Stock Sense 2.1 SystemUI.apk On The ThunderBolt
Written by orkillakilla
Thanks to Ihtpf69 for his work on the extra quick settings and helping me add them.
Thanks also to Thunderstick for his help in showing me how to add them.
THIS IS NOT FOR BEGINNERS!!!!!
NOTE: This will not work on the newest MR4 leak, which has Sense 3.0. I'm am currently working on getting the quick settings added to that, but is taking some time to figure things out and work out the kinks. I will update the guide when I have everything working.
I will be using apktool for this guide. I don’t like apkmanager. I will be demonstraighting how to add Flashlight and Reboot. (7n1 Volume, Task Manager, Auto-Rotate, and Brightness are enabled by some edits already made to the modded QuickSettings.smali)
Prerequisites:
apktool (and knowledge of how to use it)
SystemUI.apk
xml editor (i use gedit)
ADB (to push apk for testing)
Quick Settings smali files and graphics:
http://thisismyandroid.com/?dir=orkillakilla/Quick Setting Files (please note that these files are the work of Ihtpf69 of TeamBAMF and he has given me permission to mirror the files for this guide)
Important
To have the Task Manager quick setting work properly, you must install the HTC Task Manager apk which is available at the quicksetting files link above (easiest way is to push via adb to /system/app or to add to /system/app when cooking a ROM)
To have the reboot options work correctly, you must be on a ROM that has the extended reboot options already enabled, or add the additional reboot smali files found with the other quick settings files you downloaded earlier to android.policy.jar:
replace PhoneWindowManager.smali and PhoneWindowManager$Reboot Receiver.smali found in /smali/android/internal/policy/impl/ with the ones you downloaded.
The section for removing quick settings is located at the very bottom of the post. (Thanks to Thunderstick for showing me how)
Step One:
First you will need to decompile SystemUI.apk Once you have that done, navigate to /res/drawable-hdpi. This is where all the icons for the notification bar and pulldown menu are stored.
You will need to place all the pgn files for Flashlight and Volume. No need to add anything for the other quicksettings as they are already there, just not implemented.
Step Two:
You will now navigate to /res/layout/quick_settings.xml and open it. What you are going to work with is this section:
Code:
<include android:id="@id/volume" layout="@layout/status_bar_preference" />
<include android:id="@id/brightness" layout="@layout/status_bar_preference" />
<include android:id="@id/rotation" layout="@layout/status_bar_preference" />
<include android:id="@id/wifi" layout="@layout/status_bar_preference" />
<include android:id="@id/hotspot" layout="@layout/status_bar_preference" />
<include android:id="@id/network" layout="@layout/status_bar_preference" />
<include android:id="@id/wimax" layout="@layout/status_bar_preference" />
<include android:id="@id/bluetooth" layout="@layout/status_bar_preference" />
<include android:id="@id/gps" layout="@layout/status_bar_preference" />
<include android:id="@id/settings" layout="@layout/status_bar_preference" />
<include android:id="@id/task_manager" layout="@layout/status_bar_preference" />
This determined which options are shown where. You can move them around to your preference. Say if you want the brightness above the volume, simply move the brightness entry above the volume entry.
To add the flashlight and reboot, you will need to manually add them, keeping the same style that is already there:
Code:
<include android:id="@id/flashlight" layout="@layout/status_bar_preference" />
And the same for reboot. Put them where you want them to show up.
Step Three:
You will now navigate to /res/values/ids.xml
At the bottom right above , you need to add ids for reboot and volume.
Code:
<item type="id" name="flashlight">false</item>
and same for reboot. It doesn’t matter which you add first.
Step Four:
Navigate to /res/values/strings.xml You will need to add a string for Flashlight, so that the word Flashlight appears on the quick setting.
At the bottom, add the following:
Code:
<string name="status_bar_quick_settings_flashlight">Flashlight</string>
Step Five:
Note: The resource ids I will be using are for a stock Sense 2.1 SystemUI.apk. Resource ids must be in acending order, and you cannot skip numbers, or create your own random id.
Navigate to /res/values/public.xml
This is one of the tricky parts. You have to give everthing you’ve added so far (all the drawable icons, the ids, and the string) a resource id.
We will start with the ids. At the very bottom of the xml file, above </resources>, add the id’s for reboot and flashlight:
Code:
<public type="id" name="flashlight" id="0x7f0a0055" />
the id number is an example.
You will need to make the flashlight id number one more than the previous. For example:
If the id “close” has and id number of 0x7f0a0054, then flashlight needs to be 0x7f0a0055, and reboot needs to be 0x7f0a0056. You cannot skip numbers, or make your own.
Now we will give the string and id number. Scroll to the last string entry, and add flashlight right below it:
Code:
<public type="string" name="status_bar_quick_settings_flashlight" id="0x7f080034" />
Again, if the string above the new flashlight string’s id is 0x7f080033, then flashlight must be 0x7f080034
Here is the tedious part. We must give all the drawable icons a resource id.
Scroll to the last drawable entry, and begin adding your icons. The name must be the exa
Reason for Editing:
ct name of the icons file name.
Begin with the flashlight icons:
Code:
<public type="drawable" name="widget_flashlight_off" id="0x7f020190" />
<public type="drawable" name="widget_flashlight_on" id="0x7f020191" />
Now the Volume icons:
Code:
<public type="drawable" name="widget_icon_sound_alarm" id="0x7f020192" />
<public type="drawable" name="widget_icon_sound_bluetooth" id="0x7f020193" />
<public type="drawable" name="widget_icon_sound_dtmf" id="0x7f020194" />
<public type="drawable" name="widget_icon_sound_media" id="0x7f020195" />
<public type="drawable" name="widget_icon_sound_notifications" id="0x7f020196" />
<public type="drawable" name="widget_icon_sound_ringtone" id="0x7f020197" />
<public type="drawable" name="widget_icon_sound_settings" id="0x7f020198" />
<public type="drawable" name="widget_icon_sound_voice" id="0x7f020199" />
Step Six:
We will now be moving from the /res folder, to the /smali folder.
Navigate to /smali/com/android/systemui/statusbar/preference
You will now add the smali files you downloaded here. Delete the original QuickSettings.smali and add the modded one, renaming it to QuickSettings.smali
Now open the QuickSettings.smali.
Scroll down to .line 59 You will see under that “new-instance”. When you see that, a new quick settings has started.
Scroll down till you see:
Code:
new-instance v4, Lcom/android/systemui/statusbar/preference/BT;
We are going to use this for our flashlight.
Copy the following to the clipboard:
Code:
new-instance v4, Lcom/android/systemui/statusbar/preference/BT;
iget-object v5, p0, Lcom/android/systemui/statusbar/preference/QuickSettings;->mContext:Landroid/content/Context;
const v6, 0x7f0a001f
invoke-virtual {p0, v6}, Lcom/android/systemui/statusbar/preference/QuickSettings;->findViewById(I)Landroid/view/View;
move-result-object v6
invoke-direct {v4, v5, v6}, Lcom/android/systemui/statusbar/preference/BT;->(Landroid/content/Context;Landroid/view/View;)V
aput-object v4, v2, v3
.line 62
iget-object v2, p0, Lcom/android/systemui/statusbar/preference/QuickSettings;->mSettingItems:[Lcom/android/systemui/statusbar/preference/StatusBarPreference;
const/4 v3, 0x3
Now paste it right below const/4 v3, 0x3
You are now going to change BT to Flashlight (there are two of them). You will also change the following:
const v6, 0x7f0a001f
To the resource id you gave the id flashlight earlier in public.xml. For this example, it will be 0x7f0a0055
Now you will scroll down and find:
Code:
new-instance v4, Lcom/android/systemui/statusbar/preference/Settings;
You will copy this to the clipboard:
Code:
new-instance v4, Lcom/android/systemui/statusbar/preference/Settings;
iget-object v5, p0, Lcom/android/systemui/statusbar/preference/QuickSettings;->mContext:Landroid/content/Context;
const v6, 0x7f0a0021
invoke-virtual {p0, v6}, Lcom/android/systemui/statusbar/preference/QuickSettings;->findViewById(I)Landroid/view/View;
move-result-object v6
invoke-direct {v4, v5, v6}, Lcom/android/systemui/statusbar/preference/Settings;->(Landroid/content/Context;Landroid/view/View;)V
aput-object v4, v2, v3
.line 66
iget-object v2, p0, Lcom/android/systemui/statusbar/preference/QuickSettings;->mSettingItems:[Lcom/android/systemui/statusbar/preference/StatusBarPreference;
const/4 v3, 0x7
Again, you will change Settings to Reboot both times, and change the it to 0x7f0a0056.
Step Seven:
Now navigate to /smali/com/android/systemui/statusbar/preference/Flashlight.smali
Scroll down till you find this:
const v1, 0x7f080032
You will need to change that id to the one you gave your flashlight string. In this case it would be 0x7f080034.
Scroll down a bit more and find:
const v1, 0x7f02004a
and change that id to the id you gave your widget_flashlight_off icon. In this case it would be 0x7f020190.
Now near the bottom you will see:
const v1, 0x7f080032
again change it to 0x7f080034
Now navigate to /smali/com/android/systemui/statusbar/preference/Flashlight$1.smali
Scroll down till you see:
const v1, 0x7f020049
Change this id to the id you gave widget_flashlight_on. In this case it would be 0x7f020191.
Scroll down a bit more and change
const v1, 0x7f02004a
to const v1, 0x7f020190
Step Eight:
Navigate to /smali/com/android/systemui/statusbar/preference/Volume.smali
This is one of the trickiest parts.
If you scroll down, you will find an array that looks like this:
Code:
0x51t 0x0t 0x2t 0x7ft
0x52t 0x0t 0x2t 0x7ft
0x57t 0x0t 0x2t 0x7ft
0x53t 0x0t 0x2t 0x7ft
0x54t 0x0t 0x2t 0x7ft
0x55t 0x0t 0x2t 0x7ft
0x56t 0x0t 0x2t 0x7ft
0x52t 0x0t 0x2t 0x7ft
0x58t 0x0t 0x2t 0x7ft
These are actually the resource ids for your sound icons you’ve added.
Take the first line of the array, and read it right to left.
0x7ft is the first part of the resource id, (0x7f)020192. 0x2t is the next part 0x7f(02)0192. 0x0 is 0x7f02(00)92, which needs to be changed to 0x1. So now your resource id is 0x7f02(01)92.
The last part is the last 2 digits of the resource id.
So for the first line, if your resource id is 0x7f020192, then that line of the array should look like this:
Code:
0x92 0x1t 0x2t 0x7ft
Also, so you know what order the id's should go in, if you look a few lines up, you'll see this:
Code:
.local v8, res:Landroid/content/res/Resources;
const/4 v1, 0x0
const-string/jumbo v2, "Voice Volume"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string/jumbo v2, "System Volume"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string/jumbo v2, "Ringer Volume"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string/jumbo v2, "Media Volume"
aput-object v2, v0, v1
const/4 v1, 0x4
const-string/jumbo v2, "Alarm Volume"
aput-object v2, v0, v1
const/4 v1, 0x5
const-string/jumbo v2, "Notification Volume"
aput-object v2, v0, v1
const/4 v1, 0x6
const-string/jumbo v2, "Bluetooth Volume"
aput-object v2, v0, v1
const/4 v1, 0x7
const-string/jumbo v2, "System Volume"
aput-object v2, v0, v1
const/16 v1, 0x8
const-string/jumbo v2, "DTMF Volume"
aput-object v2, v0, v1
That is the order in which the resource id's should read.
Step Nine:
Compile your app with apktool. If you followed this to the t, you shouldn’t get any errors.
If you don't want to sign the apk, take the Meta-INF and AndroidManifest.xml from the ORIGINAL apk and add them to the /SystemUI/build/apk folder, and recompile again. This ensures the apk is signed properly.
Now push your modded SystemUI.apk to your phone through adb.
Reboot.
When you boot up, you should have your additional quick settings.
How To Remove Quick Settings:
I prefer to remove some quick settings that I don't ever use, like the hotspot and bluetooth. I will now show you how to remove them. It's pretty simple.
Step One:
Navigate to /res/layout and open quick_settings.xml
Remove the line of the quick setting(s) you would like to remove.
Example: If you want the Hotspot quick setting removed, you would remove the following line:
Code:
<include android:id="@id/hotspot" layout="@layout/status_bar_preference" />
You may remove however many you wish.
Step Two:
Now you will navigate to /smali/com/android/systemui/statusbar/preference and open QuickSettings.smali
At the top, you will remove the entry for whatever quick settings you're removing.
Example:
Code:
.field private static final HOTSPOT:I = 0x5
Now search for Hotspot, or whatever quick setting your removing, and remove the following lines of code:
Code:
iget-object v2, p0, Lcom/android/systemui/statusbar/preference/QuickSettings;->mSettingItems:[Lcom/android/systemui/statusbar/preference/StatusBarPreference;
new-instance v3, Lcom/android/systemui/statusbar/preference/HotSpot;
iget-object v4, p0, Lcom/android/systemui/statusbar/preference/QuickSettings;->mContext:Landroid/content/Context;
const v5, 0x7f0a001c
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/preference/QuickSettings;->findViewById(I)Landroid/view/View;
move-result-object v5
invoke-direct {v3, v4, v5}, Lcom/android/systemui/statusbar/preference/HotSpot;-><init>(Landroid/content/Context;Landroid/view/View;)V
aput-object v3, v2, v9
Save and recompile and your quick settings are gone. Enjoy!
Great write up man much thanks!
Awesome write up!!!
The steps should be the same for Sense 3.5 (still Gingerbread), correct?
I just got my Rezound and miss the CM7 notification bar to change settings, so I thought modifying the "Quick Settings" section would be the easiest. There are a lot of options in there I don't need, and many more I plan to add.
spitzaf said:
The steps should be the same for Sense 3.5 (still Gingerbread), correct?
I just got my Rezound and miss the CM7 notification bar to change settings, so I thought modifying the "Quick Settings" section would be the easiest. There are a lot of options in there I don't need, and many more I plan to add.
Click to expand...
Click to collapse
I haven't tried then on sense 3.5 but I would imagine it would be he same. Note that the resource ids would probably be different.
Sent from my HTC ThunderBolt powered by KillaSense 3.6
Thank you very much, orkillakilla! I own a Desire and have been trying to fix a bug with our port of quicksettings. Your guide proved invaluable to me, as i had problems with signing the SystemUI.apk.
Glad I can help devs of other devices!
orkillakilla said:
Glad I can help devs of other devices!
Click to expand...
Click to collapse
Hey man excellent writeup...I do have a couple questions regarding this.
I went through all the steps verbatim and my SystemUI would not rebuild. Then I figured I would further investigate. It seems that most, if not all roms with this built in, there is an error decompiling and then it will not recompile. The errors are always as follows:
Code:
Error occured while disassembling class Lcom.android.systemui.statusbar.preference.Reboot$1$1; - skipping class
java.lang.ArrayIndexOutOfBoundsException: 8
at org.jf.dexlib.Debug.DebugInstructionIterator.DecodeInstructions(DebugInstructionIterator.java:199)
at org.jf.baksmali.Adaptors.MethodDefinition.addDebugInfo(MethodDefinition.java:495)
at org.jf.baksmali.Adaptors.MethodDefinition.getMethodItems(MethodDefinition.java:297)
at org.jf.baksmali.Adaptors.MethodDefinition.writeTo(MethodDefinition.java:130)
at org.jf.baksmali.Adaptors.ClassDefinition.writeMethods(ClassDefinition.java:322)
at org.jf.baksmali.Adaptors.ClassDefinition.writeVirtualMethods(ClassDefinition.java:307)
at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:136)
at brut.androlib.mod.BaksmaliMod.disassembleDexFile(BaksmaliMod.java:188)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:48)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:33)
at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:68)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:85)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
I am using apktool 1.4.2 and have also tried 1.4.1 no luck. I am also using baksmali/smali 1.3.2 .I want to know if you try to re-decompile the SystemUI.apk from a rom that you have done this to, if you run into these areas. I am trying to find out if my smali/baksmali is out of date or what the issue is.
Thanks
dhemke17 said:
Hey man excellent writeup...I do have a couple questions regarding this.
I went through all the steps verbatim and my SystemUI would not rebuild. Then I figured I would further investigate. It seems that most, if not all roms with this built in, there is an error decompiling and then it will not recompile. The errors are always as follows:
Code:
Error occured while disassembling class Lcom.android.systemui.statusbar.preference.Reboot$1$1; - skipping class
java.lang.ArrayIndexOutOfBoundsException: 8
at org.jf.dexlib.Debug.DebugInstructionIterator.DecodeInstructions(DebugInstructionIterator.java:199)
at org.jf.baksmali.Adaptors.MethodDefinition.addDebugInfo(MethodDefinition.java:495)
at org.jf.baksmali.Adaptors.MethodDefinition.getMethodItems(MethodDefinition.java:297)
at org.jf.baksmali.Adaptors.MethodDefinition.writeTo(MethodDefinition.java:130)
at org.jf.baksmali.Adaptors.ClassDefinition.writeMethods(ClassDefinition.java:322)
at org.jf.baksmali.Adaptors.ClassDefinition.writeVirtualMethods(ClassDefinition.java:307)
at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:136)
at brut.androlib.mod.BaksmaliMod.disassembleDexFile(BaksmaliMod.java:188)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:48)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:33)
at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:68)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:85)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
I am using apktool 1.4.2 and have also tried 1.4.1 no luck. I am also using baksmali/smali 1.3.2 .I want to know if you try to re-decompile the SystemUI.apk from a rom that you have done this to, if you run into these areas. I am trying to find out if my smali/baksmali is out of date or what the issue is.
Thanks
Click to expand...
Click to collapse
Yeah, apktool doesn't like a few of the added smali files, so you can't properly decompile a SystemUI.apk with these already implemented. It is best to keep the working folder, that way if you want to make changes, you can.
Updated step nine to be more specific with the icon array in Volume.smali
Guide updated. I streamlined the process by removing a step that isn't necessary. Also added how to remove quick settings located at the bottom of the OP. Also fixed a few code bits that mysteriously disappeared...
Hello
I used your tutorial an now i have flashlight in quick settings.
But also i have 2 problems and maybe you can help me:
1) The text under the flashlight is not "on or off" it is "enter and space" . Screenshot in attach.
2) SystemUI.apk i took from user "m1ndh4x8r" who posted in his rom but it has a bug: when the gps is locked instead of a gps icon appears a charging battery icon!
Also great tutorial! Keep up the good work!
efl2009 said:
Hello
I used your tutorial an now i have flashlight in quick settings.
But also i have 2 problems and maybe you can help me:
1) The text under the flashlight is not "on or off" it is "enter and space" . Screenshot in attach.
2) SystemUI.apk i took from user "m1ndh4x8r" who posted in his rom but it has a bug: when the gps is locked instead of a gps icon appears a charging battery icon!
Also great tutorial! Keep up the good work!
Click to expand...
Click to collapse
For the flashlight, you'll need to change a few resource id's in flashlight smali, and instead of digging through the framework to find the strings, you should just add them to the public.xml and string.xml in the SystemUI.apk
In strings.xml, add the following:
Code:
<string name="status_bar_quick_settings_flashlight_off">OFF</string>
<string name="status_bar_quick_settings_flashlight_on">ON</string>
Then head on over to public.xml and register them underneath the flashlight string you had previously entered.
Now go into flashlight.smali. Your going to have to play around with them a little bit, but the resource id's that look like:
const v1, 0x10402f2
are the ones your going to be changing. You'll change I think 5 of them throughout Flashlight.smali and Flashlight$1.smali
The first should be OFF, then next ON, then OFF, then ON then OFF, but I'd have to actually play around with them to figure out which is which.
As far as the battery icon instead of the GPS Icon, I would look in HtcCdmaStatusBar.smali and search for line 117. There is a resource ID below it that might be the one for the icon, in which case you would just have to replace it with the correct one.
However, if the ROM your using is stock Sense 2.1, then you can just start from scratch with your own and it will work.
Thank you for the info. I also added with success Volume option.
I sorry if I'm buzzing but I don't have anyone else to ask about this kind o things.
So can you tell me how i can enable Recent Apps in notification statusbar in Sense 2.1? Or how ca i enable hotspot if it is disabled?
Yeah ill send you a pm later today about it, I've got a lot of stuff to do right now
Sent from my ADR6400L using xda premium
Hi
I solved GPS bug by changing 1 id from StatusBarPolicy.smali. It was wrong and I looked for the right one in the framework-res.apk.
Flashlight text is ok now cause i changed 0x10402f2 with 0x1040315 and 0x10402f1 with 0x10402f2.
So if you can help me to enable recent apps and hotspot it will be great.
Thank you for your help!
P.S. I also I thanked you on my thread.
efl2009 said:
Hi
I solved GPS bug by changing 1 id from StatusBarPolicy.smali. It was wrong and I looked for the right one in the framework-res.apk.
Flashlight text is ok now cause i changed 0x10402f2 with 0x1040315 and 0x10402f1 with 0x10402f2.
So if you can help me to enable recent apps and hotspot it will be great.
Thank you for your help!
P.S. I also I thanked you on my thread.
Click to expand...
Click to collapse
Sorry I haven't gotten back to you. I can definitely help you with the hotspot. I don't know how to do the recent apps, but I know someone who can so I'll find out and let you know.
Sent from my ADR6400L using xda premium
Hi
So finally I enabled recent apps but now the problem that I can't solve at all is adding Silent Mode. I mean I added to quick setting but the text is wrong and is not working to enable or disable. I thing the ids are not correct but i don't know what it each means.
Can you help me please?
Wow amazing work
Sent from my HTC ThunderBolt using Tapatalk
efl2009 said:
Hi
So finally I enabled recent apps but now the problem that I can't solve at all is adding Silent Mode. I mean I added to quick setting but the text is wrong and is not working to enable or disable. I thing the ids are not correct but i don't know what it each means.
Can you help me please?
Click to expand...
Click to collapse
What I always do is look at the smali file for, in this case silent mode, and look at the resource ids. Copy then and search in public.xml for it. Look at what is actually there, then look on your status bar. This will kinda show you what is where, and what you need to change. If you have to, add some strings to strings.xml and public.xml and put them in the smali.
Sent from my ADR6400L using xda premium
This is based on a pure AOSP build, so it might not work for you or require minor modifications.
There are a lot of apps and/or mods providing "better" battery indicators, so it's sometimes conveniant to remove the stock one and freeing up the space in the status bar. Here's how to do it on JB 4.2.
Get SystemUI.apk from /system/app, decompile it using apktool, then rename ist to SystemUI.zip
Edit res/layout/status_bar.xml, change the following line:
Code:
<ImageView android:id="@id/battery" android:paddingLeft="4.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
to
Code:
<ImageView android:id="@id/battery" android:layout_width="wrap_content" android:layout_height="wrap_content" />
Edit smali/com/android/systemui/statusbar/policy/BatteryController.smali:
in .method private batteryChange()V change the lines reading
Code:
invoke-virtual {v3, v8}, Landroid/widget/ImageView;->setVisibility(I)V
to
Code:
invoke-virtual {v3, [COLOR="Red"]v11[/COLOR]}, Landroid/widget/ImageView;->setVisibility(I)V
and
Code:
invoke-virtual {v3, v8}, Landroid/widget/TextView;->setVisibility(I)V
to
Code:
invoke-virtual {v3, [COLOR="Red"]v11[/COLOR]}, Landroid/widget/TextView;->setVisibility(I)V
in .method private batteryChange(Landroid/content/Context;Landroid/content/IntentV change the lines reading
Code:
const/4 v11, 0x0
invoke-virtual {v10, v11}, Landroid/widget/ImageView;->setVisibility(I)V
to
Code:
const/[COLOR="Red"]16[/COLOR] v11, 0x[COLOR="red"]8[/COLOR]
invoke-virtual {v10, v11}, Landroid/widget/ImageView;->setVisibility(I)V
and
Code:
const/4 v11, 0x0
invoke-virtual {v10, v11}, Landroid/widget/TextView;->setVisibility(I)V
to
Code:
const/[COLOR="Red"]16[/COLOR] v11, 0x[COLOR="red"]8[/COLOR]
invoke-virtual {v10, v11}, Landroid/widget/TextView;->setVisibility(I)V
rebuild apk with apktool
copy classes.dex, resources.dex and res/layout/status_bar.xml from build/apk/ to SystemUI.zip, using your favorite zip tool
rename it back to SystemUI.apk and place it in /system/app/
Hints:
In case something goes wrong, keep your original SystemUI.apk somewhere on your SD card. Copy it back to /system/app, if things are still messed up wipe dalvik-cache from recovery.
Step 2 is probably unnecessary, because the smali changes make the icon invisible and i think invisible Views don't get a padding anyways, but I didn't test it. In this case, copying classes.dex in step 5 would be enough.
Disclaimer: I'm not responsible for you losing data or rendering your phone unusable -- only try this if you know what you do. If you are not familiar with apktool, try to read about it and understand what it does first.
edit: Sorry, first version also made the battery tile in quick settings disfunctional, this is fixed now.
Hey Guys,
after a few hours of searching and learning how xpose is working i did my first module.
This module will enable auto rotation for the Z5 Stock Launcher (not tested on others...).
Install instructions
1. download attached Z5LauncherAutoRotate.apk and put it on your phone
2. install apk
3. enable module in xposed installer
4. restart phone
Sourcecode
Everyone can use my Sourcecode in his own modules, please short message and a mention of me in the credits.
Have fun
Nice work, works flawless on my Z2
Keep it up the good work!!
Thx... Works good on my XZ C6603
Thank you man.. ?
__BJ__ said:
Hey Guys,
after a few hours of searching and learning how xpose is working i did my first module.
This module will enable auto rotation for the Z5 Stock Launcher (not tested on others...).
Install instructions
1. download attached Z5LauncherAutoRotate.apk and put it on your phone
2. install apk
3. enable module in xposed installer
4. restart phone
Sourcecode
Everyone can use my Sourcecode in his own modules, please short message and a mention of me in the credits.
Have fun
Click to expand...
Click to collapse
could you explain me how to do this changes straigh in the apk?. cheers
juanpirulo said:
could you explain me how to do this changes straigh in the apk?. cheers
Click to expand...
Click to collapse
Here are some solutions. (decompiled apk needed)
My solution is not the best, but resource replacement didn't work for me and I don't know why but thats a xposed thing... So if you want my solution find the following method in com.sonymobile.home.HomeFragment:
Code:
private static void setRequestedOrientationIfChanged(Activity activity, int i)
{
if (activity.getRequestedOrientation() != i)
{
activity.setRequestedOrientation(i);
}
}
and change it to:
Code:
private static void setRequestedOrientationIfChanged(Activity activity, int i)
{
i = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
if (activity.getRequestedOrientation() != i)
{
activity.setRequestedOrientation(i);
}
}
Better solution find the bool values in the resources should /res/values/bool.xml and change portrait_only to false
Code:
<bool name="portrait_only">false</bool>
You could also change mPortraitModeOnly to false on the onCreate method in HomeFragment. There is the position where it gets this resource.
NOTICE FOR XPERIA PHONES: If you change the launcher apk you have to disable signature verification! If you do not the system doesn't accept this apk and your launcher won't work. You can patch service.jar or use superusermod from xperia xposed.
I found theses lines are hidden the icon to autorotate on C:\Users\smali\com\sonymobile\home\settings\HomeSettingsActivity$HomeSettingsFragment.smali
Code:
.line 59
.local v0, "preferenceScreen":Landroid/preference/PreferenceScreen;
invoke-virtual {p0}, Lcom/sonymobile/home/settings/HomeSettingsActivity$HomeSettingsFragment;->getResources()Landroid/content/res/Resources;
move-result-object v1
const v2, 0x7f0c0005
invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getBoolean(I)Z
move-result v1
if-eqz v1, :cond_0
.line 60
const-string v1, "user_settings_allow_auto_rotation"
invoke-virtual {p0, v1}, Lcom/sonymobile/home/settings/HomeSettingsActivity$HomeSettingsFragment;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z
.line 71
:cond_0
invoke-direct {p0, v0}, Lcom/sonymobile/home/settings/HomeSettingsActivity$HomeSettingsFragment;->initSummary(Landroid/preference/Preference;)V
If i simple delete these lines icon shows up on home settings but doesnt rotate. Can i change in here any value?. cheers
juanpirulo said:
I found theses lines are hidden the icon to autorotate on C:\Users\smali\com\sonymobile\home\settings\HomeSettingsActivity$HomeSettingsFragment.smali
Code:
.line 59
.local v0, "preferenceScreen":Landroid/preference/PreferenceScreen;
invoke-virtual {p0}, Lcom/sonymobile/home/settings/HomeSettingsActivity$HomeSettingsFragment;->getResources()Landroid/content/res/Resources;
move-result-object v1
const v2, 0x7f0c0005
invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getBoolean(I)Z
move-result v1
if-eqz v1, :cond_0
.line 60
const-string v1, "user_settings_allow_auto_rotation"
invoke-virtual {p0, v1}, Lcom/sonymobile/home/settings/HomeSettingsActivity$HomeSettingsFragment;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z
.line 71
:cond_0
invoke-direct {p0, v0}, Lcom/sonymobile/home/settings/HomeSettingsActivity$HomeSettingsFragment;->initSummary(Landroid/preference/Preference;)V
If i simple delete these lines icon shows up on home settings but doesnt rotate. Can i change in here any value?. cheers
Click to expand...
Click to collapse
Nope won't work. Sorry i can't read smali file
If you just change the resource file for boolean values and set portrait_only to false the settings for auto rotation will display automaticaly! The launcher hides the auto rotation settings in its preference screen if portrait_only is true (what it is!). So no need to go in the sources, just change the resources!
I read many of the source files from the launcher and it is completly ignoring any settings about rotation if this portait_only is true
__BJ__ said:
Nope won't work. Sorry i can't read smali file
If you just change the resource file for boolean values and set portrait_only to false the settings for auto rotation will display automaticaly! The launcher hides the auto rotation settings in its preference screen if portrait_only is true (what it is!). So no need to go in the sources, just change the resources!
I read many of the source files from the launcher and it is completly ignoring any settings about rotation if this portait_only is true
Click to expand...
Click to collapse
The thing is that portrait_only is allready set on false and it doesnt come up the settings for autorotate. thats why i dont understand
Code:
bool name="abc_action_bar_embed_tabs_pre_jb">false</bool>
<bool name="abc_config_allowActionMenuItemTextWithIcon">false</bool>
<bool name="actionbar_use_vertical_mode">false</bool>
<bool name="desktop_pagination_autohide">false</bool>
<bool name="abc_action_bar_embed_tabs">true</bool>
<bool name="portrait_only">false</bool>
<bool name="autoRotate">false</bool>
<bool name="is_large_screen">false</bool>
<bool name="support_alternate_resources">false</bool>
<bool name="transparent_status_and_nav_bar">true</bool>
<bool name="cui_grid_show_header">false</bool>
juanpirulo said:
The thing is that portrait_only is allready set on false and it doesnt come up the settings for autorotate. thats why i dont understand
Code:
bool name="abc_action_bar_embed_tabs_pre_jb">false</bool>
<bool name="abc_config_allowActionMenuItemTextWithIcon">false</bool>
<bool name="actionbar_use_vertical_mode">false</bool>
<bool name="desktop_pagination_autohide">false</bool>
<bool name="abc_action_bar_embed_tabs">true</bool>
<bool name="portrait_only">false</bool>
<bool name="autoRotate">false</bool>
<bool name="is_large_screen">false</bool>
<bool name="support_alternate_resources">false</bool>
<bool name="transparent_status_and_nav_bar">true</bool>
<bool name="cui_grid_show_header">false</bool>
Click to expand...
Click to collapse
Did you rebuild the apk? Because I've seen a decompiler which couldn't decompile the boolean resources correctly at setted them to false per default.
But as you can see also in the smali file its reading the resources and the portrait_only and if it is false it would display the settings.
__BJ__ said:
Did you rebuild the apk? Because I've seen a decompiler which couldn't decompile the boolean resources correctly at setted them to false per default.
But as you can see also in the smali file its reading the resources and the portrait_only and if it is false it would display the settings.
Click to expand...
Click to collapse
Is set originally false as default, on home-release form z1 doesnt shows a line like portrait_only and the settings are ok, thats why i am thinking must be smali code that change this value. Thanks anyway for your help. cheers
juanpirulo said:
Is set originally false as default, on home-release form z1 doesnt shows a line like portrait_only and the settings are ok, thats why i am thinking must be smali code that change this value. Thanks anyway for your help. cheers
Click to expand...
Click to collapse
The Xperia Xposed module only replace the resource portrait_only and its working too. I did also read the resource while developing the module here and if i logged the value everytime there was true in the console. And I read the resource not the variable in the class!