[Guide][JB 4.2] Remove stock battery indicator - Android Software Development

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.

Related

[HOW TO]Add/Remove Quick Settings to Sense 2.1 SystemUI.apk [UPDATED 2/7 STREAMLINED]

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

[MOD]Swipe to Clear Notifications(GB 2.3.3)

Swipe To Clear Notification
Working on O1​
HERE IS THE LINK
http://forum.xda-developers.com/showthread.php?t=1483193
THANX To​hansip87
Hi there, I want to share this tutorial for implementing Swipe-to-Remove Notification feature found in CyanogenMod to stock ROM (Gingerbread or earlier ROM). Sure it will be available on ICS but for those who like to add one to their custom ROM here's how Currently i don't know to whom should i give credit to, if anybody knows please post below and i'll add the link for the original modder. Thanks to:
1. like-p for help showing me what files to be edited
2. LeoMar75 for some info on how to control Stub switch case
This mod is based on Sony Ericsson Xperia Ray, so take care when adding to another device, some code might be different though so no direct copy paste, please learn some of the line first.
Requirement:
1. decompiled Framework.jar with Baksmali manager
2. decompiled SystemUI.apk with APK Multi Tool
3. Some Basic understanding about editing xml file and smali code.
4. WinMerge or other comparison tool (to better editing and comparing with my sample file)
5. Backup the framework.jar and SystemUI.apk first!
Files to be edited:
in SystemUI.apk
res/anim/
res/layout/status_bar_latest_event.xml
res/values/public.xml
smali/com/android/systemui/statusbar/LatestItemContainer$1.smali
smali/com/android/systemui/statusbar/LatestItemContainer.smali
smali/com/android/systemui/statusbar/StatusBarService$7.smali (or depends on your numbering, could be $8 or larger)
smali/com/android/systemui/statusbar/StatusBarService.smali
in framework.jar:
smali/com/android/internal/statusbar/IStatusBarService$Stub$Proxy.smali
smali/com/android/internal/statusbar/IStatusBarService$Stub.smali
smali/com/android/internal/statusbar/IStatusBarService.smali
UPDATE: This is the additional guide for other device when editing StatusBarService.smali. See here:
1. HTC based
2. Samsung based
Alright, let's mod one by one
1. Editing SystemUI.apk
1.1 Editing res/anim
We are registering anim object here, so swipe animation can be done.
Create folder anim (if not exists yet) inside /res folder
Create 2 file named slide_out_left_basic.xml and slide_out_right_basic.xml inside res/anim folder
for slide_out_left_basic.xml, edit the file and fill with this
Code:
<?xml version="1.0" encoding="utf-8"?>
<translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0.0" android:toXDelta="-100.0%p"
xmlns:android="http://schemas.android.com/apk/res/android" />
for slide_out_right_basic.xml, edit the file and fill with this
Code:
<?xml version="1.0" encoding="utf-8"?>
<translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0.0" android:toXDelta="100.0%p"
xmlns:android="http://schemas.android.com/apk/res/android" />
Save both
Update: Mirko ddd (&shoman94 have pointed that out before but i have no idea where to change, sorry mate) have given me the tip to improve the gesture. read his post here Thanks mate, both of you!
1.2 Editing res/layout/status_bar_latest_event.xml
We are replacing LinearLayout object used in StatusBar with LatestItemContainer here, so notification can be removed. We handle the Styling first by editing this .xml first. Here are the steps:
Change the code from Original code to this (change the bold one)
Code:
<?xml version="1.0" encoding="utf-8"?>
<[B]com.android.systemui.statusbar.LatestItemContainer [/B]android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="65.0sp"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.systemui.statusbar.LatestItemView android:id="@id/content" android:background="@android:drawable/status_bar_item_background" android:paddingRight="6.0sp" android:focusable="true" android:clickable="true" android:layout_width="fill_parent" android:layout_height="64.0sp" android:shadowColor="#ff000000" android:shadowDx="0.0" android:shadowDy="1.0" android:shadowRadius="2.0" />
<View android:background="@drawable/divider_horizontal_light_opaque" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<[B]/com.android.systemui.statusbar.LatestItemContainer[/B]>
Save
1.3 Editing res/values/public.xml
This one is for registering anim file that we made on step 1.1 to be available publicly and to be recognized in .smali program. Here are the steps:
Recompile your apk after putting anim file into /res folder
Decompile again the resulting apk
Inside /res/values/public.xml, you'll found something like this:
Code:
<resources>
.
.
.
[B]
<public type="anim" name="slide_out_left_basic" id="0x7f0c0000" />
<public type="anim" name="slide_out_right_basic" id="0x7f0c0001" />
[/B]
</resources>
[*]Remember the ID for both anim lines. This will be applied again on the step 1.4
1.4 Adding smali/com/android/systemui/statusbar/LatestItemContainer$1.smali and smali/com/android/systemui/statusbar/LatestItemContainer.smali
This is the class of LatestItemContainer that will be used to handle the notification list instead of LatestItemView. Here are the steps:
Please download from the attachment
insert the files inside to mentioned folder above
Inside LatestItemContainer$1.smali, there's an id that references the anim from step1.2. please edit it if you have different id for anim left or anim from previous step.
Code:
.line 53
:cond_0
const/high16 v1, [B]0x7f0c[/B]
and
Code:
.line 51
const v1, [B]0x7f0c0001[/B]
1.5 Add smali/com/android/systemui/statusbar/StatusBarService$7.smali (or depends on your existing framework numbering, could be $8 or larger)
This is additional function for StatusBarService to handle onClearNotification function. Here are the steps:
Extract the StatusBarService$7.smali from attachment
If StatusBarService$7.smali does not exist before, just place it inside, if not, skip this step.
If StatusBarService$7.smali exists, Please rename the file to StatusBarService$8.smali (or whatever higher number that is unused) and rename all the line inside the file from
Code:
StatusBarService$7
to
Code:
StatusBarService$8
1.6 Edit smali/com/android/systemui/statusbar/StatusBarService.smali
UPDATE: This is the additional guide for other device when editing StatusBarService.smali. See here:
1. Generic java readout
2. HTC based
3. Samsung based
This is the file that generate NotificationView. Please take care of the changes here more carefully because there might be some differences between vendors in this file. Here are the steps:
Open StatusBarService.smali and find this function
Code:
.method makeNotificationView(Lcom/android/internal/statusbar/StatusBarNotification;Landroid/view/ViewGroup;)[Landroid/view/View;
Find this code in the makeNotificationView function body:
Code:
invoke-virtual {v0, v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object v18
const v4, 0x7f0b0014
move-object/from16 v0, v18
move v1, v4
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v10
Insert the bold code below between the existing code:
Code:
invoke-virtual {v0, v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object v18
[B] check-cast v18, Lcom/android/systemui/statusbar/LatestItemContainer;
.line 516
.local v18, row:Lcom/android/systemui/statusbar/LatestItemContainer;
move-object/from16 v0, v16
iget v0, v0, Landroid/app/Notification;->flags:I
move v4, v0
and-int/lit8 v4, v4, 0x2
if-nez v4, :cond_swno
move-object/from16 v0, v16
iget v0, v0, Landroid/app/Notification;->flags:I
move v4, v0
and-int/lit8 v4, v4, 0x20
if-nez v4, :cond_swno
new-instance v4, Lcom/android/systemui/statusbar/StatusBarService$7;
move-object v0, v4
move-object/from16 v1, p0
move-object/from16 v2, p1
invoke-direct {v0, v1, v2}, Lcom/android/systemui/statusbar/StatusBarService$7;-><init>(Lcom/android/systemui/statusbar/StatusBarService;Lcom/android/internal/statusbar/StatusBarNotification;)V
move-object/from16 v0, v18
move-object v1, v4
invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setOnSwipeCallback(Ljava/lang/Runnable;)V
.line 735
:cond_swno[/B]
const v4, 0x7f0b0014
move-object/from16 v0, v18
move v1, v4
[B] invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->findViewById(I)Landroid/view/View;[/B]
move-result-object v10
Once again, change
Code:
StatusBarService$7
to
Code:
StatusBarService$8
line if you happened to have StatusBarService$8.smali as the result of renaming on the previous step.
IMPORTANT LOGIC TO BE UNDERSTOOD: This step tells the function to:
1. cast the already made View Object to LatestItemContainer instead of using LatestView class.
2. Filter if the Notification is removable or not
3. the LatestItemContainer object (v18) is assigned with onSwipeCallback(new StatusBarService$7)
Change the following (still on the same function body):
Code:
move v1, v4
invoke-virtual {v0, v1}, Landroid/view/View;->setDrawingCacheEnabled(Z)V
.line 542
const/4 v4, 0x3
to
Code:
move v1, v4
[B] invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setDrawingCacheEnabled(Z)V
[/B]
.line 542
const/4 v4, 0x3
Please note:
StatusBarService.smali might be different between vendor, so please adapt with your .smali to implement the above coding.
2. Editing framework.jar
2.1 editing smali/com/android/internal/statusbar/IStatusBarService$Stub.smali
Here are the steps:
Add this code on variable declaration part inside the file
Code:
.field static final TRANSACTION_onClearAllNotifications:I = 0xb
[B].field static final TRANSACTION_onNotificationClear:I = 0xc[/B]
.field static final TRANSACTION_onNotificationClick:I = 0x9
.field static final TRANSACTION_onNotificationError:I = 0xa
If the 0xc is already used on another static value, you must change it so it remains unique.
Find this code:
Code:
.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.registers 14
.parameter "code"
.parameter "data"
.parameter "reply"
.parameter "flags"
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.prologue
.line 39
sparse-switch p1, :sswitch_data_124
change to
Code:
.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.registers 14
.parameter "code"
.parameter "data"
.parameter "reply"
.parameter "flags"
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.prologue
.line 39
[B]sparse-switch p1, :sswitch_data_13e[/B]
Insert/replace this code (it is at the end of the file):
Code:
.line 176
const/4 v0, 0x1
goto/16 :goto_7
.line 39
:sswitch_data_124
.sparse-switch
0x1 -> :sswitch_f
0x2 -> :sswitch_1c
0x3 -> :sswitch_29
0x4 -> :sswitch_42
0x5 -> :sswitch_5f
0x6 -> :sswitch_7b
0x7 -> :sswitch_8d
0x8 -> :sswitch_c7
0x9 -> :sswitch_d5
0xa -> :sswitch_ef
0xb -> :sswitch_116
0x5f4e5446 -> :sswitch_8
.end sparse-switch
to
Code:
[B]
.line 176
const/4 v0, 0x1
goto/16 :goto_7
.end local v1 #_arg0:Ljava/lang/String;
.end local v2 #_arg1:Ljava/lang/String;
.end local v3 #_arg2:I
:sswitch_124
const-string v0, "com.android.internal.statusbar.IStatusBarService"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
.line 177
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v1
.line 178
.restart local v1 #_arg0:Ljava/lang/String;
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v2
.line 179
.restart local v2 #_arg1:Ljava/lang/String;
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v3
.line 180
.restart local v3 #_arg2:I
invoke-virtual {p0, v1, v2, v3}, Lcom/android/internal/statusbar/IStatusBarService$Stub;->onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.line 181
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
.line 182
const/4 v0, 0x1
goto/16 :goto_7[/B]
.line 39
:sswitch_data_13e
.sparse-switch
0x1 -> :sswitch_f
0x2 -> :sswitch_1c
0x3 -> :sswitch_29
0x4 -> :sswitch_42
0x5 -> :sswitch_5f
0x6 -> :sswitch_7b
0x7 -> :sswitch_8d
0x8 -> :sswitch_c7
0x9 -> :sswitch_d5
0xa -> :sswitch_ef
0xb -> :sswitch_116
[B]0xc -> :sswitch_124[/B]
0x5f4e5446 -> :sswitch_8
.end sparse-switch
it's important to note this
Code:
[B]0xc -> :sswitch_124[/B]
If you rename the static at the previous steps, please change the 0xc accordingly.
2.2 Editing smali/com/android/internal/statusbar/IStatusBarService$Stub$Proxy.smali
Here are the steps:
Insert these function code to the file:
Code:
.method public onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.registers 9
.parameter "pkg"
.parameter "tag"
.parameter "id"
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.prologue
.line 359
invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;
move-result-object v0
.line 360
.local v0, _data:Landroid/os/Parcel;
invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;
move-result-object v1
.line 362
.local v1, _reply:Landroid/os/Parcel;
:try_start_8
const-string v2, "com.android.internal.statusbar.IStatusBarService"
invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V
.line 363
invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 364
invoke-virtual {v0, p2}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 365
invoke-virtual {v0, p3}, Landroid/os/Parcel;->writeInt(I)V
.line 366
iget-object v2, p0, Lcom/android/internal/statusbar/IStatusBarService$Stub$Proxy;->mRemote:Landroid/os/IBinder;
const/16 v3, 0xa
const/4 v4, 0x0
invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.line 367
invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
:try_end_21
.catchall {:try_start_8 .. :try_end_21} :catchall_28
.line 370
invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V
.line 371
invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V
.line 373
return-void
.line 370
:catchall_28
move-exception v2
invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V
.line 371
invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V
throw v2
.end method
Please inspect the code for this part:
Code:
[B]const/16 v3, 0xa[/B]
const/4 v4, 0x0
invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
The bold one must match on one of the switch case value at the end of IStatusBarService$Stub.smali,
in my phone actually the valid one is the TRANSACTION_onNotificationError (0xa) so if your NotificationError is not 0xa but 0xb for example, please change the bold one to 0xb
Save
2.3 editing smali/com/android/internal/statusbar/IStatusBarService.smali
Insert this function code to the file. Here are the steps:
Insert these function code to the file:
Code:
.method public abstract onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.end method
Save
There you have it AFAIK, the files that you need to take care more than others are:
1. smali/com/android/systemui/statusbar/StatusBarService.smali
2. res/values/public.xml
The rest can be applied from the attachment below directly. Ok that's all, after you are done, compile both SystemUI.apk and Framework.jar.
How to Compile the right way?
1. SystemUI.apk ->
Compile with APK Multi Tool, press y and y twice with all the requested input,
delete modified file from keep folder, and after that continue compiling.
Copy from original APK the META-INF and AndroidManifest.xml to the unsignedSystemUI.apk
rename unsignedSystemUI.apk to signedSystemUI.apk
select Zipalign from APK Multi Tool to optimize apk.
Rename to SystemUI.apk (move the original one just in case)
2. framework.jar ->
Smali inside Baksmali Manager
Replace classes.dex inside framework.jar with the generated one.
and apply on your phone.
Hope this helps you (programmer ofc, not end user ) to implement on your device.
G'day!

[GUIDE] How to port SONY Small Apps/Taskswitcher Plugin Xperia Z1 to CM10.2/4.3.1

How to port SONY Small Apps/Taskswitcher plugin Xperia Z1 Android 4.3 for CM10.1 or CM10.2​
{
"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"
}
CyanogenMod 10.1 with Small Apps Z1 on my mango!​
Hello I'm @lukakas.
I made this guide that will help you to mod your ROM for support fully Small Apps from Xperia Z1 4.3 (Include taskswitcher plugin mod). Works only for CM10.1/CM10.2 and maybe 4.2.2/4.3 based devices (Confirmed for working).
Small Apps Z1 4.3 is latest version of Sony, it bring us new features like:
Small Apps support.
Favorite list (Called taskswitcher plugin view) of small apps and "floatings" widgets on 'Recents Apps' (Taskswitcher).
Widget floating window supported. (Like if converted homescreen widgets to small apps).
Multiple windows by default from Z1, watch this vídeo: http://www.youtube.com/watch?v=PfspA0-YcYY
Latest features of small apps ported from Xperia Z1 with Android 4.3 version.
And much more to find.
Watch this video for looking these features working on CM10.1:​
Information:
android.policy.jar, framework.jar and framework-res.apk port is based from @sandy7 guide with some updates made by me for support Z1 4.3 small app version.
Link @sandy7 guide http://forum.xda-developers.com/showthread.php?t=2228969
Port Taskswitcher plugin (inside of SystemUI.apk) guide is made by me @lukakas.
Click to expand...
Click to collapse
Let's go to mod:
Step 1 - Decompile android.policy.jar
And open smali\com\android\internal\policy\impl\PhoneWindowManager.smali
Find for method 'checkAddPermission' and replace all method to this lines below::
For CM11
Code:
.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;[I)I
.locals 4
.parameter "attrs"
.parameter "outAppOp"
.prologue
const/4 v2, 0x0
.line 1455
iget v1, p1, Landroid/view/WindowManager$LayoutParams;->type:I
.line 1457
.local v1, type:I
const/4 v3, -0x1
aput v3, p2, v2
.line 1459
const/16 v3, 0x7d0
if-lt v1, v3, :cond_0
const/16 v3, 0xbb7
if-le v1, v3, :cond_1
.line 1497
:cond_0
:goto_0
return v2
.line 1463
:cond_1
const/4 v0, 0x0
.line 1464
.local v0, permission:Ljava/lang/String;
sparse-switch v1, :sswitch_data_0
.line 1489
const-string v0, "android.permission.INTERNAL_SYSTEM_WINDOW"
.line 1491
:goto_1
:sswitch_0
if-eqz v0, :cond_0
.line 1492
iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-virtual {v3, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
move-result v3
if-eqz v3, :cond_0
.line 1494
const/4 v2, -0x8
goto :goto_0
.line 1481
:sswitch_1
const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"
.line 1482
const/16 v3, 0x18
aput v3, p2, v2
goto :goto_1
.line 1486
:sswitch_2
const-string v0, "com.sony.smallapp.permission.SMALLAPP"
.line 1487
goto :goto_1
.line 1464
nop
:sswitch_data_0
.sparse-switch
0x7d2 -> :sswitch_1
0x7d3 -> :sswitch_1
0x7d5 -> :sswitch_0
0x7d6 -> :sswitch_1
0x7d7 -> :sswitch_1
0x7da -> :sswitch_1
0x7db -> :sswitch_0
0x7dd -> :sswitch_0
0x7e7 -> :sswitch_0
0x7ee -> :sswitch_0
0xbb5 -> :sswitch_2
0xbb6 -> :sswitch_2
.end sparse-switch
.end method
For CM10.2
Code:
.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;[I)I
.locals 4
.parameter "attrs"
.parameter "outAppOp"
.prologue
const/4 v2, 0x0
.line 1367
iget v1, p1, Landroid/view/WindowManager$LayoutParams;->type:I
.line 1369
.local v1, type:I
const/4 v3, -0x1
aput v3, p2, v2
.line 1371
const/16 v3, 0x7d0
if-lt v1, v3, :cond_0
const/16 v3, 0xbb7
if-le v1, v3, :cond_1
.line 1408
:cond_0
:goto_0
return v2
.line 1375
:cond_1
const/4 v0, 0x0
.line 1376
.local v0, permission:Ljava/lang/String;
sparse-switch v1, :sswitch_data_0
.line 1400
const-string v0, "android.permission.INTERNAL_SYSTEM_WINDOW"
.line 1402
:goto_1
:sswitch_0
if-eqz v0, :cond_0
.line 1403
iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-virtual {v3, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
move-result v3
if-eqz v3, :cond_0
.line 1405
const/4 v2, -0x8
goto :goto_0
.line 1392
:sswitch_1
const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"
.line 1393
const/16 v3, 0x18
aput v3, p2, v2
goto :goto_1
.line 1397
:sswitch_2
const-string v0, "com.sony.smallapp.permission.SMALLAPP"
.line 1398
goto :goto_1
.line 1376
nop
:sswitch_data_0
.sparse-switch
0x7d2 -> :sswitch_1
0x7d3 -> :sswitch_1
0x7d5 -> :sswitch_0
0x7d6 -> :sswitch_1
0x7d7 -> :sswitch_1
0x7da -> :sswitch_1
0x7db -> :sswitch_0
0x7dd -> :sswitch_0
0x7e7 -> :sswitch_0
0xbb5 -> :sswitch_2
0xbb6 -> :sswitch_2
.end sparse-switch
.end method
For CM10.1
Code:
.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;)I
.locals 4
.parameter "attrs"
.prologue
const/4 v2, 0x0
.line 1315
iget v1, p1, Landroid/view/WindowManager$LayoutParams;->type:I
.line 1317
.local v1, type:I
const/16 v3, 0x7d0
if-lt v1, v3, :cond_0
const/16 v3, 0xbb7
if-le v1, v3, :cond_1
.line 1353
:cond_0
:goto_0
return v2
.line 1321
:cond_1
const/4 v0, 0x0
.line 1322
.local v0, permission:Ljava/lang/String;
sparse-switch v1, :sswitch_data_0
.line 1345
const-string v0, "android.permission.INTERNAL_SYSTEM_WINDOW"
.line 1347
:goto_1
:sswitch_0
if-eqz v0, :cond_0
.line 1348
iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
invoke-virtual {v3, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
move-result v3
if-eqz v3, :cond_0
.line 1350
const/4 v2, -0x8
goto :goto_0
.line 1338
:sswitch_1
const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"
.line 1339
goto :goto_1
.line 1342
:sswitch_2
const-string v0, "com.sony.smallapp.permission.SMALLAPP"
.line 1343
goto :goto_1
.line 1322
:sswitch_data_0
.sparse-switch
0x7d2 -> :sswitch_1
0x7d3 -> :sswitch_1
0x7d5 -> :sswitch_0
0x7d6 -> :sswitch_1
0x7d7 -> :sswitch_1
0x7da -> :sswitch_1
0x7db -> :sswitch_0
0x7dd -> :sswitch_0
0x7e7 -> :sswitch_0
0xbb5 -> :sswitch_2
0xbb6 -> :sswitch_2
.end sparse-switch
.end method
Save your modifications and recompile it.
Step 2 - Decompile framework.jar
Open folder smali/com/
For CM10.2
Code:
Paste 'Sony' folder (provided [URL=http://d-h.st/YUr]SmallApps_Z1-4.3Resources.zip - 16.98 KB[/URL] file attached in folder resources/framework)
Save your modifications and recompile it.
For CM10.1
Code:
Paste 'Sony' folder (provided [URL=http://d-h.st/jTp]SmallApps_Z1-4.2.2_Resources.zip - 17.71 KB[/URL] file attached in folder resources/framework)
Save your modifications and recompile it.
Step 3 - Decompile framework-res.apk
And open AndroidManifest.xml
Add these lines:
Code:
<permission android:name="com.sony.smallapp.permission.CONTROL_SMALLAPP" android:protectionLevel="system|signature" />
<permission android:label="@string/permlab_smallapp" android:name="com.sony.smallapp.permission.SMALLAPP" android:protectionLevel="dangerous" android:description="@string/permdesc_smallapp" />
<permission android:label="@string/permlab_taskSwitcherPluginView" android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_taskSwitcherPluginView" />
<permission android:name="com.sonymobile.permission.ACCESS_BEACON_MANAGER" android:protectionLevel="system|signature" />
Like this marked in red lines:
Code:
<permission android:label="@string/permlab_serialPort" android:name="android.permission.SERIAL_PORT" android:protectionLevel="system|signature" android:description="@string/permdesc_serialPort" />
<permission android:label="@string/permlab_accessContentProvidersExternally" android:name="android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY" android:protectionLevel="signature" android:description="@string/permdesc_accessContentProvidersExternally" />
<permission android:label="@string/permlab_updateLock" android:name="android.permission.UPDATE_LOCK" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_updateLock" />
<uses-permission android:name="android.permission.CONFIRM_FULL_BACKUP" />
[COLOR="Red"]<permission android:name="com.sony.smallapp.permission.CONTROL_SMALLAPP" android:protectionLevel="system|signature" />
<permission android:label="@string/permlab_smallapp" android:name="com.sony.smallapp.permission.SMALLAPP" android:protectionLevel="dangerous" android:description="@string/permdesc_smallapp" />
<permission android:label="@string/permlab_taskSwitcherPluginView" android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_taskSwitcherPluginView" />
<permission android:name="com.sonymobile.permission.ACCESS_BEACON_MANAGER" android:protectionLevel="system|signature" />[/COLOR]
<application android:label="@string/android_system_label" android:icon="@drawable/ic_launcher_android" android:allowClearUserData="false" android:hasCode="false" android:persistent="true" android:process="system" android:backupAgent="com.android.server.SystemBackupAgent" android:killAfterRestore="false" android:supportsRtl="true">
<activity android:theme="@style/Theme.Holo.Dialog.Alert" android:name="com.android.internal.app.ChooserActivity" android:multiprocess="true" android:excludeFromRecents="true" android:finishOnCloseSystemDialogs="true">
<intent-filter>
<action android:name="android.intent.action.CHOOSER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:theme="@style/Theme.Holo.Dialog" android:label="@string/heavy_weight_switcher_title" android:name="com.android.internal.app.HeavyWeightSwitcherActivity" android:process=":ui" android:excludeFromRecents="true" android:finishOnCloseSystemDialogs="true" />
Then, go to res/values/strings.xml and add these lines at the end:
Code:
<string name="permlab_taskSwitcherPluginView">Provide plugin-view to the task-switcher</string>
<string name="permdesc_taskSwitcherPluginView">Allows the application to provide a plugin-view to the task-switcher.</string>
<string name="permlab_smallapp">Small application overlay</string>
<string name="permdesc_smallapp">Allows running movable small applications on top of other applications.</string>
Save your modifications and recompile it.
Now we go to most difficult part: Porting TaskSwitcher in SystemUI.apk.
Step 4 - Decompile SystemUI.apk
1 - Open AndroidManifest.xml
Add these lines:
Code:
<uses-permission android:name="com.sonymobile.permission.XSSM_PROVIDER" />
<uses-permission android:name="com.sonymobile.permission.XSSM" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="com.sony.smallapp.app.widget.permission.BIND_SMALLAPP_WIDGET_MANAGER" />
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPPMANAGER_CONTROL" />
<uses-permission android:name="com.sony.smallapp.launcher.permission.ACCESS_DATABASE" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<permission android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" />
Like this marked in blue:
Code:
<uses-permission android:name="android.permission.SET_ORIENTATION" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.READ_DREAM_STATE" />
<uses-permission android:name="android.permission.WRITE_DREAM_STATE" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
[COLOR="blue"]<uses-permission android:name="com.sonymobile.permission.XSSM_PROVIDER" />
<uses-permission android:name="com.sonymobile.permission.XSSM" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="com.sony.smallapp.app.widget.permission.BIND_SMALLAPP_WIDGET_MANAGER" />
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPPMANAGER_CONTROL" />
<uses-permission android:name="com.sony.smallapp.launcher.permission.ACCESS_DATABASE" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<permission android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" />[/COLOR]
<application android:label="@string/app_label" android:icon="@*android:drawable/platlogo" android:allowClearUserData="false" android:persistent="true" android:allowBackup="false" android:hardwareAccelerated="true">
<service android:name="SystemUIService" android:exported="true" />
<service android:name=".screenshot.TakeScreenshotService" android:exported="false" android:process=":screenshot" />
<service android:name=".LoadAverageService" android:exported="true" />
<service android:name=".ImageWallpaper" android:permission="android.permission.BIND_WALLPAPER" android:exported="true" />
<receiver android:name=".BootReceiver" androidprv:primaryUserOnly="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
Add this line in 'RecentsActivity' activity:
Code:
<action android:name="com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER" />
Like this below of "<action android:name="com.android.systemui.TOGGLE_RECENTS" />" marked in red:
Code:
<activity android:theme="@style/RecentsStyle" android:label="@string/accessibility_desc_recent_apps" android:name=".recent.RecentsActivity" android:exported="true" android:excludeFromRecents="true" android:launchMode="singleInstance">
<intent-filter>
<action android:name="com.android.systemui.TOGGLE_RECENTS" />
[COLOR="Red"]<action android:name="com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER" />[/COLOR]
</intent-filter>
</activity>
2 - Go to res/values/attrs.xml
Add this line:
Code:
<attr name="lookupKey" format="string" />
Like this marked in blue:
Code:
<resources>
<attr name="keyCode" format="integer" />
<attr name="keyRepeat" format="boolean" />
<attr name="glowBackground" format="reference" />
<attr name="text" format="string" />
<attr name="insetLeft" format="dimension" />
<attr name="rowHeight" format="dimension" />
<attr name="recentItemLayout" format="reference" />
<attr name="minSize" format="dimension" />
<attr name="maxSize" format="dimension" />
<attr name="holdTime" format="integer" />
<attr name="decayTime" format="integer" />
<attr name="orientation">
<enum name="horizontal" value="0" />
<enum name="vertical" value="1" />
</attr>
[COLOR="Blue"]<attr name="lookupKey" format="string" />[/COLOR]
</resources>
3 - Go to res/values/ids.xml
Add these lines at the end:
Code:
<item type="id" name="recents_inject_custom_view">false</item>
<item type="id" name="recents_layout">false</item>
<item type="id" name="recents_pluginview_container">false</item>
Like this marked in red:
Code:
<resources>
...
<item type="id" name="notification_inspect_item">false</item>
<item type="id" name="recent_remove_item">false</item>
<item type="id" name="recent_inspect_item">false</item>
[COLOR="red"]<item type="id" name="recents_inject_custom_view">false</item>
<item type="id" name="recents_layout">false</item>
<item type="id" name="recents_pluginview_container">false</item>
[/COLOR]
</resources>
4 - Open res/values/public.xml
ATTENTION: Don't duplicate "hex id", create always next "hex id" from the last type of the name, it's for previne duplicate.
Where's hex id?
For example:
Code:
<public type="attr" name="lookupKey" id="[COLOR="Blue"]0x7f01000c[/COLOR]" />
"Hex id" is: 0x7f01000c marked in blue
Save all hex id yours created because we need it later:
For example, where's the last type of 'attr'? See in public.xml, the last type of 'attr' marked in green and name is"orientation" like this marked in red:
Code:
<resources>
<public type="attr" name="keyCode" id="0x7f010000" />
<public type="attr" name="keyRepeat" id="0x7f010001" />
<public type="attr" name="glowBackground" id="0x7f010002" />
<public type="attr" name="text" id="0x7f010003" />
<public type="attr" name="insetLeft" id="0x7f010004" />
<public type="attr" name="rowHeight" id="0x7f010005" />
<public type="attr" name="recentItemLayout" id="0x7f010006" />
<public type="attr" name="minSize" id="0x7f010007" />
<public type="attr" name="maxSize" id="0x7f010008" />
<public type="attr" name="holdTime" id="0x7f010009" />
<public type="attr" name="decayTime" id="0x7f01000a" />
[COLOR="Red"]<public type="[COLOR="SeaGreen"]attr[/COLOR]" name="orientation" id="[COLOR="blue"]0x7f01000b[/COLOR]" />[/COLOR]
<public type="drawable" name="bugdroid" id="0x7f02000e" />
<public type="drawable" name="cid_angry" id="0x7f02000f" />
<public type="drawable" name="cid_confused" id="0x7f020010" />
<public type="drawable" name="cid_normal" id="0x7f020011" />
<public type="drawable" name="cidlogo" id="0x7f020012" />
It comes with an id=0x7f01000b marked in blue, it's like hex numeral. Then, the next id should be 0x7f01000c like this marked in blue:
Code:
<resources>
<public type="attr" name="keyCode" id="0x7f010000" />
<public type="attr" name="keyRepeat" id="0x7f010001" />
<public type="attr" name="glowBackground" id="0x7f010002" />
<public type="attr" name="text" id="0x7f010003" />
<public type="attr" name="insetLeft" id="0x7f010004" />
<public type="attr" name="rowHeight" id="0x7f010005" />
<public type="attr" name="recentItemLayout" id="0x7f010006" />
<public type="attr" name="minSize" id="0x7f010007" />
<public type="attr" name="maxSize" id="0x7f010008" />
<public type="attr" name="holdTime" id="0x7f010009" />
<public type="attr" name="decayTime" id="0x7f01000a" />
<public type="attr" name="orientation" id="0x7f01000b" />
[COLOR="Red"]<public type="attr" name="lookupKey" id="[COLOR="Blue"]0x7f01000c[/COLOR]" /> [/COLOR]
<public type="drawable" name="bugdroid" id="0x7f02000e" />
<public type="drawable" name="cid_angry" id="0x7f02000f" />
<public type="drawable" name="cid_confused" id="0x7f020010" />
<public type="drawable" name="cid_normal" id="0x7f020011" />
<public type="drawable" name="cidlogo" id="0x7f020012" />
Easy way for everybody to get next HEX ID by @Android-Andi can be found here: http://forum.xda-developers.com/showpost.php?p=46131055&postcount=103
You'll add this line with next id marked in blue that you find the last attr type in your public.xml (Don't duplicate "hex ids"):
Code:
<public type="attr" name="lookupKey" id="[COLOR="Blue"]NEXT HEX ID PUT HERE[/COLOR]" />
You will do the same with others types, add these lines as instructed below marked in red and put your next id marked in blue:
Code:
...lines to skip until last layout type... (Don't copy this line)
[COLOR="Red"]<public type="layout" name="plugin_view" id="[COLOR="Blue"]NEXT HEX ID PUT HERE[/COLOR]" />[/COLOR]
...much lines to skip until last id type...(Don't copy this line)
[COLOR="red"]<public type="id" name="recents_inject_custom_view" id="[COLOR="Blue"]NEXT HEX ID PUT HERE[/COLOR]" />[/COLOR]
[COLOR="red"]<public type="id" name="recents_layout" id="[COLOR="Blue"]NEXT HEX ID PUT HERE[/COLOR]" />[/COLOR]
[COLOR="red"]<public type="id" name="recents_pluginview_container" id="[COLOR="Blue"]NEXT HEX ID PUT HERE[/COLOR]" />
[/COLOR]
5 - Go to res/layout/ (Check Resources files attached in OP for copy necessary files.)
plugin_view.xml - paste this file from resource/res-files/layout/
status_bar_recents_panel.xml - paste and replace this file from resource/res-files/layout/
6 - Go to res/layout-land
status_bar_recents_panel.xml - paste and replace this file from resource/res-files/layout-land/.
7 - Go to smali/com/android/systemui/ - paste and replace all files from 'resources/smali-files/R/' folder.
8 - Go to smali/com/android/systemui/recent/ - paste and replace all files from 'resources/smali-files/RecentsActivity/' folder.
10 - Go to smali/com/android/systemiu/recent/ and open RecentsActivity.smali
Find these names below:
recents_pluginview_container
recents_layout
plugin_view
status_bar_recent_panel
recents_root
config_recent_item_min_alpha
recents_pluginview_container
recents_return_to_launcher_enter
recents_return_to_launcher_exit
You'll replace these names with "hex id" from res/values/public.xml, it need to match the same name for replace "hex id", for example recents_pluginview_container is marked in blue that you find in RecentsActivity.smali:
Code:
.line 310
invoke-static {}, Lcom/android/systemui/recent/RecentsActivity;->detachPluginView()V
.line 311
const v3, [COLOR="Blue"]recents_pluginview_container[/COLOR]
invoke-virtual {p0, v3}, Lcom/android/systemui/recent/RecentsActivity;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/view/ViewGroup;
Find for recents_pluginview_container in res/values/public.xml and copy your hex id:
Code:
[COLOR="blue"]<public type="id" name="recents_pluginview_container" id="[COLOR="Red"]COPY YOUR ID HEX[/COLOR]" />
[/COLOR]
Replace recents_pluginview_container with your hex id that you find in public.xml, like this:
Code:
.line 310
invoke-static {}, Lcom/android/systemui/recent/RecentsActivity;->detachPluginView()V
.line 311
const v3, [COLOR="Blue"]"PASTE YOUR ID HEX"[/COLOR]
invoke-virtual {p0, v3}, Lcom/android/systemui/recent/RecentsActivity;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/view/ViewGroup;
My port looked like this, I copied this code in red: (Don't do that just see as working)
Code:
[COLOR="blue"]<public type="id" name="recents_pluginview_container" id="[COLOR="Red"]0x7f0900e7[/COLOR]" />
[/COLOR]
And I replaced recents_pluginview_container to 0x7f0900e7 in RecentsActivity.smali like this marked in blue:
Code:
.line 310
invoke-static {}, Lcom/android/systemui/recent/RecentsActivity;->detachPluginView()V
.line 311
const v3, [COLOR="Blue"]0x7f0900e7[/COLOR]
invoke-virtual {p0, v3}, Lcom/android/systemui/recent/RecentsActivity;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/view/ViewGroup;
Click to expand...
Click to collapse
You'll do the same with others names:
recents_layout
plugin_view
status_bar_recent_panel
recents_root
config_recent_item_min_alpha
recents_pluginview_container
recents_return_to_launcher_enter
recents_return_to_launcher_exit
11 - Go to smali/com/android/systemui/ and open R$styleable.smali
Find for lookupKey like this marked in blue:
Code:
.line 2536
new-array v0, v3, [I
const v1, [COLOR="Blue"]lookupKey[/COLOR]
aput v1, v0, v2
sput-object v0, Lcom/android/systemui/R$styleable;->RemotePluginView:[I
Find lookupKey in res/values/public.xml and copy your hex id:
Code:
<public type="attr" name="lookupKey" id="[COLOR="Red"]COPY YOUR ID HEX[/COLOR]" />
Replace lookupKey with your hex id that you find in public.xml, like this:
Code:
.line 2536
new-array v0, v3, [I
const v1, [COLOR="Blue"]"PASTE YOUR ID HEX"[/COLOR]
aput v1, v0, v2
sput-object v0, Lcom/android/systemui/R$styleable;->RemotePluginView:[I
Save all modifications and recompile SystemUI.apk!
Step 5 -
For CM10.2
Now add these files recompiled in flashable zip attached
SystemUI.apk to system/app
android.policy.jar, framework.jar, framework-res.apk to system/framework
For CM10.1
Now add these files recompiled in flashable zip attached
SystemUI.apk to system/app
android.policy.jar, framework.jar, framework-res.apk to system/framework
Done! Your ROM already support small apps Z1 with taskswitcher working!
Changelog:
07/02/2014 (Click here)
-Support for CM10.2
-Based from latest small apps taskswitcher plugin from Xperia Z1 - 4.3
-Multiple windows by default from Z1, watch this vídeo: http://www.youtube.com/watch?v=PfspA0-YcYY
-Latest small apps from Xperia Z1 4.3 system
-Improvements of small app manager code and library.
-Layout fixes.
-Guide separate for CM10.1 and CM10.2
10/10/2013 (Click here)
-Based from latest small apps taskswitcher plugin from Xperia Z1
-Multiple windows by default from Z1, watch this vídeo: http://www.youtube.com/watch?v=PfspA0-YcYY
-Latest small apps from Xperia Z1 system
-Fixed rotate orientation close small app
-Improvements of small app manager code and library.
-Add step 12 of SystemUI.apk step 5
Click to expand...
Click to collapse
If you have difficulty to port SystemUI.apk follow this video guide, it will help you to mod
(Recommended to use Virtuous Ten Studio)​
Part 2:
Video-Tutorial on How to port SONY Small Apps/Taskswitcher plugin to CM10.1/4.2.2 using "Android Multitool" from @Flextrick by @Android-Andi
http://forum.xda-developers.com/showpost.php?p=46058006&postcount=75​
Screenshots:
If you liked my work, just click on Thanks button.:laugh:
Credits:
Thanks sandy7 for provide this tutorial gave me possibility to port small app 4.3 version only.
Me (Lukakas) for port Taskswitcher plugin and latest version of Small Apps (Xperia Z1 Android 4.3)
Sony for create this awesome feature.
Serajr for some tips.
Click to expand...
Click to collapse
Xperia 2011 port thread: http://forum.xda-developers.com/showthread.php?t=2421678
Addons:
@chotu222 have made a flashable zip of all the latest small apps.
The zip includes:
Smallapps
-Camera
-Mirror
-Toggle
-Walkman
-Web
-Google
update v2 with
-Latest voiceout
-Unit converter
-Currency converter
Download: LatestSmallapps-updatev2.zip
Post thread: http://forum.xda-developers.com/showpost.php?p=46003105&postcount=42
Click to expand...
Click to collapse
If anyone got working, please post screenshots in this thread!
Working reports with screenshot:
Confirmed for working by @chotu222 from Xperia T and Galaxy Grand DUOS screenshots:
Confirmed for working by @CressKH from Xperia ZR C5503:
Confirmed for working by @Android-Andi from Galaxy Tab 2 - P3110 and others screenshots (Tablet UI working too):
Working on some stock 4.2.2 Roms by @Koloses
If you are using my Guide Mod in your ROM modded with small apps, please give me credits by mention my username @lukakas and post thread link guide
Click to expand...
Click to collapse
Very well written,
thanks a lot my friend :good:
iiandskater said:
Very well written,
thanks a lot my friend :good:
Click to expand...
Click to collapse
Thanks my friend, I think I can make the mod more compatible with other ROMS, but this needs to increase instructions guide maybe need create some smali code
Masterpiece!! :good:
I update OP because I missed lookupkey to replace id in R$styable.smali.
Nice explanation...good work
Sent from my C5302 using XDA Premium 4 mobile app
Thank you very much lukakas.
Btw you got featured!!
help
lukakas said:
I update OP because I missed lookupkey to replace id in R$styable.smali.
Click to expand...
Click to collapse
bro
I'm trying to do for motorola atrix cm10.1 4.2.2
and I skip this error
any idea?
thanks.
Noob Q
I Have to decompile but i cant find the files (android.policy.jar , framework.jar , framework-res.apk) in your attachments that you said you've modified them to support 4.2.2 "android.policy.jar, framework.jar and framework-res.apk port is based from @sandy7 guide with some updates made by me for support 4.2.2 small app version" ... i am noob if somebody can upload a 'Ready to flash' zip that would be so helpful as we don't have experience in decompiling & recompiling
-and BTW Thank you very much for this awesome guide :good:
D2m_mhd said:
I Have to decompile but i cant find the files (android.policy.jar , framework.jar , framework-res.apk) in your attachments that you said you've modified them to support 4.2.2 "android.policy.jar, framework.jar and framework-res.apk port is based from @sandy7 guide with some updates made by me for support 4.2.2 small app version" ... i am noob if somebody can upload a 'Ready to flash' zip that would be so helpful as we don't have experience in decompiling & recompiling
-and BTW Thank you very much for this awesome guide :good:
Click to expand...
Click to collapse
Not possible, needs to be made for every rom, that's why you need to build it yourself....also anyone got it to work on android 4.3....don't want to switch back to cm just to find out it does not work?
EDIT: pm me the files from your phone, I'l try to mod them for you later when I get home.....
Ranomez said:
Not possible, needs to be made for every rom, that's why you need to build it yourself....also anyone got it to work on android 4.3....don't want to switch back to cm just to find out it does not work?
EDIT: pm me the files from your phone, I'l try to mod them for you later when I get home.....
Click to expand...
Click to collapse
Ok , so i have to PM with only these files (android.policy.jar, framework.jar and framework-res.apk) from my current rom (Liquid smooth 4.2.2) or you may need other stuff ? ... And thanks in advance
D2m_mhd said:
Ok , so i have to PM with only these files (android.policy.jar, framework.jar and framework-res.apk) from my current rom (Liquid smooth 4.2.2) or you may need other stuff ? ... And thanks in advance
Click to expand...
Click to collapse
Those files only and also is your rom CM based, cause I think it will not work if not (I am on aosp+ and would also want it, but I think it needs to be cm) and you may get into a bootloop?
Ranomez said:
Those files only and also is your rom CM based, cause I think it will not work if not (I am on aosp+ and would also want it, but I think it needs to be cm) and you may get into a bootloop?
Click to expand...
Click to collapse
oh .. my rom is AOSP based , i guess it wont work then ..
i have to search for a CM10.1 rom now
Trying to port over to my Nexus 7 2012 cm 10.1.3 but I'm having a hard time.
I am noob editing apks and jar files. I thought I was going well until I reached editing SystemUI.apk.
My SystemUI does not have res/values/ids.xml :s
EDIT: Ok it seems that my apktool was not working as it should, my bad
Click to expand...
Click to collapse
Same error lukakas ...trying to port to Xperia T !
Will it work on miui? the miui i am using is currently based on 4.2.2 cm10.1?
uriel_zo said:
bro
I'm trying to do for motorola atrix cm10.1 4.2.2
and I skip this error
any idea?
thanks.
Click to expand...
Click to collapse
You installed framework-res.apk as framework in apktool to decompile SystemUI.apk?
I suggest you to use Virtuous ten studio.
I'll made an video and post on youtube.
faddys123 said:
Will it work on miui? the miui i am using is currently based on 4.2.2 cm10.1?
Click to expand...
Click to collapse
I think not, because the taskswitch is different and MIUI have MiuiSystemUI.apk instead SystemUI.apk
chotu222 said:
Same error lukakas ...trying to port to Xperia T !
Click to expand...
Click to collapse
Do you copied and replaced RecentsActivity folder provide in Resoures zip attached?
I'm busy now but I'll help all later.

[Guide] [CM12.1/CM12/AOSP]Port Sony Settings Features to your Settings app

Decompile Settings apk
go smali/com/android/settings/
Open R$styleable.smali
1) add below line in [# static fields]
HTML:
.field public static final CheckBoxPreference:[I
.field public static final DependOnPreference:[I
.field public static final IncludePreference:[I
.field public static final IntentPreference:[I
.field public static final RemovePreference:[I
2)Add below lines in #direct method
HTML:
.line 13802
const/4 v0, 0x6
new-array v0, v0, [I
fill-array-data v0, :array_9
sput-object v0, Lcom/android/settings/R$styleable;->CheckBoxPreference:[I
.line 13858
const/16 v0, 0xb
new-array v0, v0, [I
fill-array-data v0, :array_10
sput-object v0, Lcom/android/settings/R$styleable;->DependOnPreference:[I
.line 13890
new-array v0, v3, [I
const v1, 0x7f010028
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->IncludePreference:[I
.line 13930
const/4 v0, 0x6
new-array v0, v0, [I
fill-array-data v0, :array_11
sput-object v0, Lcom/android/settings/R$styleable;->IntentPreference:[I
.line 13959
new-array v0, v3, [I
const v1, 0x7f01003c
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->RemovePreference:[I
3)Add lines in public.xml [this file is in res/xml/]
HTML:
<public type="attr" name="include" id="0x7f010028" />
<public type="attr" name="dependOnResource" id="0x7f010029" />
<public type="attr" name="dependOnIsValidIntent" id="0x7f01002a" />
<public type="attr" name="dependOnHasSystemFeature" id="0x7f01002b" />
<public type="attr" name="dependOnSystemProperty" id="0x7f01002c" />
<public type="attr" name="dependOnSettingsSecure" id="0x7f01002d" />
<public type="attr" name="dependOnSettingsSystem" id="0x7f01002e" />
<public type="attr" name="dependOnIsOwnerOnly" id="0x7f01002f" />
<public type="attr" name="after" id="0x7f010030" />
<public type="attr" name="before" id="0x7f010031" />
<public type="attr" name="targetParentKey" id="0x7f010032" />
<public type="attr" name="hasMetaData" id="0x7f010033" />
<public type="attr" name="chooserTitle" id="0x7f010034" />
<public type="attr" name="summaryValues" id="0x7f010035" />
<public type="attr" name="valueOfSystemProperty" id="0x7f010036" />
<public type="attr" name="valueOfSettingsSystem" id="0x7f010037" />
<public type="attr" name="valueOfSettingsSecure" id="0x7f010038" />
<public type="attr" name="valueOfSettingsGlobal" id="0x7f010039" />
<public type="attr" name="isOrderedBroadcast" id="0x7f01003a" />
<public type="attr" name="valueOnExtraStatusName" id="0x7f01003b" />
<public type="attr" name="targetKey" id="0x7f01003c" />
4) add lines in attrs.xml [this file is in res/xml/]
HTML:
<attr name="include" format="reference" />
<attr name="dependOnResource" format="boolean" />
<attr name="dependOnIsValidIntent" format="boolean" />
<attr name="dependOnHasSystemFeature" format="string" />
<attr name="dependOnSystemProperty" format="string" />
<attr name="dependOnSettingsSecure" format="string" />
<attr name="dependOnSettingsSystem" format="string" />
<attr name="dependOnIsOwnerOnly" format="boolean" />
<attr name="after" format="string" />
<attr name="before" format="string" />
<attr name="targetParentKey" format="string" />
<attr name="hasMetaData" format="boolean" />
<attr name="chooserTitle" format="string" />
<attr name="summaryValues" format="reference" />
<attr name="valueOfSystemProperty" format="string" />
<attr name="valueOfSettingsSystem" format="string" />
<attr name="valueOfSettingsSecure" format="string" />
<attr name="valueOfSettingsGlobal" format="string" />
<attr name="isOrderedBroadcast" format="boolean" />
<attr name="valueOnExtraStatusName" format="string" />
<attr name="targetKey" format="string" />
add array in R$styleable.smali its bunch of public ids of attr
[ you can see array at end of R$styleable ]
(
example:
HTML:
.line 12842
:array_0
.array-data 4
0x1010034
0x1010095
0x1010096
0x1010097
.end array-data
)
array 9
dependOnResource to hasMetaData
array 10
chooserTitle and summaryValues
array 11
valueOfSystemProperty to valueOnExtraStatusName
array 9 , 10, 11 are like this for me
HTML:
.line 13748
:array_9
.array-data 4
0x7f01003a
0x7f01003b
0x7f01003c
0x7f01003d
0x7f01003e
0x7f01003f
0x7f010040
0x7f010041
0x7f010042
0x7f010043
0x7f010044
.end array-data
.line 13768
:array_10
.array-data 4
0x7f010045
0x7f010046
.end array-data
.line 13798
:array_11
.array-data 4
0x7f010047
0x7f010048
0x7f010049
0x7f01004a
0x7f01004b
0x7f01004c
.end array-data
change public id number in RemovePreference
with targetKey public id in xml
change public id number in IncludePreference
with include public id in xml
copy GenericSettingsFragment.smali
and Xperia_connectivity_settings.smali to smali/com/android/settings/
copy sonymobile folder to smali/com/
delete some of lines in public
that says error in compile
public.xml:NNN: error: Public symbol xml/XXXXXXXXXXX declared here is not defined.
delete XXXXXXXXXXX line from public.xml
*) add lines into ids.xml
HTML:
<item type="id" name="estimate">false</item>
<item type="id" name="remaining_time_header">false</item>
<item type="id" name="stamina_mode">false</item>
<item type="id" name="remaining_battery_time">false</item>
<item type="id" name="remaining_standby_time">false</item>
<item type="id" name="tip_header">false</item>
<item type="id" name="tip_text">false</item>
<item type="id" name="usmDescr">false</item>
<item type="id" name="xperia_connectivity_settings">false</item>
<item type="id" name="personalization_settings">false</item>
<item type="id" name="power_settings">false</item>
<item type="id" name="setupguide_settings">false</item>
<item type="id" name="display_settings">false</item>
<item type="id" name="notification_settings">false</item>
*) add lines in strings.xml
HTML:
<string name="advanced_settings_title">LegacyXperiaAOSP Settings</string>
<string name="subs_settings">SUBS Status</string>
<string name="nfc_wallet_edit_txt">Change available services</string>
<string name="power_save_mode_label">Low battery mode</string>
<string name="application_usage_title">App power consumption</string>
<string name="extended_standby_mode_label">STAMINA mode</string>
<string name="power_settings_title">Power management</string>
<string name="settings_certificates_activity_title">Certificates</string>
<string name="usb_settings">USB Connectivity</string>
<string name="media_server_settings">Media Server settings</string>
<string name="docomo_settings">Download internet settings</string>
<string name="system_icons">Quick-Setting icons</string>
<string name="lockscreen_settings">LockScreen Settings</string>
<string name="itelligent_settings">Intelligent Settings</string>
<string name="start_mirrorlink">Start Xperia™ MirrorLink</string>
<string name="playstation_connectivity">DUALSHOCK®4 wireless controller</string>
<string name="seamless_tethering">Tethering Settings</string>
<string name="xperia_throw">Xperia™ Throw</string>
<string name="smart_connect">Smart Connect</string>
<string name="one_touch_setup">One-touch Setup</string>
<string name="theme_dialog_title_select_theme_txt">Select theme</string>
<string name="theme_label_xperia">Themes</string>
<string name="theme_label_summary">Change or download themes</string>
<string name="splitscreen_option_mirror_device">Mirror device</string>
<string name="splitscreen_option_xperia_desktop">Xperia™ desktop</string>
<string name="splitscreen_option_always_ask">Always ask</string>
<string name="external_display_power_save_description_txt">"Keep your device's screen on while connecting to an external screen. Turning this feature off saves battery power."</string>
<string name="external_display_power_save_title_txt">"Keep your device's screen on"</string>
<string name="splitscreen_default_action_dialog_title">Default action</string>
<string name="splitscreen_default_action_menu_title">Xperia™ desktop default action</string>
<string name="wifi_display_settings_summary">Mirror your Xperia™ on your Google Cast compliant TV or device (such as Chromecast)</string>
<string name="screen_mirroring">Screen Mirroring</string>
<string name="screen_mirroring_summary">Mirror your Xperia™ on big Screen</string>
<string name="display_category_personalisation_title">Personalization</string>
<string name="xperia_connectivity">Xperia™ Connectivity</string>
<string name="image_enhancer_txt">Image enhancement</string>
<string name="easy_wakeup_mode_checkbox_title">Tap to wake up</string>
<string name="easy_wakeup_mode_checkbox_summary">Double-tap the screen to wake up the device</string>
<string name="glove_mode_checkbox_title">Glove mode</string>
<string name="glove_mode_checkbox_summary">Allows interaction with touchscreen when wearing gloves</string>
<string name="usm_item_label">Ultra STAMINA mode</string>
<string name="usm_descr">"Ultra STAMINA mode will extend battery lifetime significantly. It can be used when you can't charge your device for a long time.
Note that Internet connection through Wi-Fi and Mobile data will be disabled.
Only a few basic functions, such as Phone and Messaging will be available. Tap \"More info\" for more details."</string>
<string name="tip">Tip!</string>
<string name="tip_text">Activate the power saving tools below to extend battery lifetime</string>
<string name="swiqi_strings_swiqi2_txt">Mobile BRAVIA Engine 2</string>
<string name="swiqi_strings_swiqi3_txt">X-Reality for mobile</string>
<string name="swiqi_strings_swiqi_desc_txt">Improve the viewing quality of photos and videos, giving you clearer, sharper and more natural images</string>
<string name="search_list_no_hits_settings">No matches for \"%s\" found in Settings</string>
<string name="search_list_no_hits_xperia">No matches for \"%s\" found in Xperia™ online support</string>
<string name="wifi_tether_settings_get_started_help">Get started with Mobile Hotspot</string>
<string name="ims_reg_title">IMS registration state</string>
<string name="status_idid">IDID</string>
<string name="wifi_hs2_strings_hotspot2_network_title_txt">Passpoint networks</string>
<string name="wifi_hs2_strings_hotspot2_summary_txt">Auto-connect to available Passpoint networks when Wi-Fi is on</string>
<string name="wifi_hs2_strings_hotspot2_title_txt">Passpoint</string>
<string name="wifi_strings_autoip_description_txt">Assign Auto IP address if DHCP fails</string>
<string name="wifi_strings_autoip_txt">Auto IP support</string>
<string name="usb_tether_settings_get_started_help">Get started with USB tethering</string>
<string name="wifi_tether_settings_subtext">Set up & manage portable Wi-Fi hotspot</string>
<string name="wifi_tether_settings_text">Portable Wi-Fi hotspot settings</string>
<string name="find_my_device">Find my device</string>
<string name="processor_info">Processor info</string>
<string name="certificates_title">Certificates</string>
<string name="usb_sdcard_summary">Lets you transfer media files on the SD card to the computer</string>
<string name="usb_sdcard_title">Mount SD card</string>
<string name="usb_charging_title">Charging</string>
<string name="usb_charging_summary">Lets you disable all data and file transfer connection with computer and put device in charging only mode.</string>
<string name="setupguide_settings_title">Setup guide</string>
<string name="show_operator_name_title">Network name</string>
<string name="show_operator_name_summary">Display network name in status bar</string>
remove some line in fist of strings.xml page those allready in xml
lockscreen_settings is already defined.
usb_sdcard_summary is already defined.
usb_sdcard_title is already defined.
usb_charging_title is already defined.
usb_charging_summary is already defined.
add lines in arrarys.xml
HTML:
<string-array name="splitscreen_default_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="config_searchWhitelist">
<item>com.sonyericsson.soundenhancement</item>
<item>com.sonymobile.multisimsettings</item>
<item>com.sonymobile.intelligent.settings</item>
<item>com.sonymobile.intelligent.rotation</item>
add this lines into bools.xml
HTML:
<bool name="config_showWifiHotspot2CredentialSetting">true</bool>
<bool name="config_addCastScreen">true</bool>
<bool name="config_addSplitScreen">false</bool>
change in color.xml
HTML:
<color name="theme_primary">@android:color/somc_color_primary_light</color>
<color name="theme_primary_dark">@android:color/somc_color_dark_primary_light</color>
<color name="theme_accent">@android:color/somc_color_accent_light</color>
add lines in public.xml at last of type="xml"
HTML:
<public type="xml" name="xperia_connectivity_settings" id="0x7f060051" />
<public type="xml" name="personalization_settings" id="0x7f060052" />
change above ids in following smali
GenericSettingsFragment.smali and Xperia_connectivity_settings.smali
change line in dimen.xml
<dimen name="dashboard_tile_image_size">36.0dip</dimen>
Sample of R$stylable.smali
HTML:
.class public final Lcom/android/settings/R$styleable;
.super Ljava/lang/Object;
.source "R.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/settings/R;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = "styleable"
.end annotation
# static fields
.field public static final BatteryHistoryChart:[I
.field public static final CardView:[I
.field public static final ChartGridView:[I
.field public static final ChartNetworkSeriesView:[I
.field public static final ChartSweepView:[I
.field public static final ChartView:[I
.field public static final CheckBoxPreference:[I
.field public static final DependOnPreference:[I
.field public static final DashboardTile:[I
.field public static final IconPreferenceScreen:[I
.field public static final IncludePreference:[I
.field public static final IntentPreference:[I
.field public static final IntervalSeekBar:[I
.field public static final PercentageBarChart:[I
.field public static final Preference:[I
.field public static final RemovePreference:[I
.field public static final SetupWizardIllustration:[I
.field public static final WifiEncryptionState:[I
# direct methods
.method static constructor <clinit>()V
.locals 6
.prologue
const/4 v5, 0x4
const/4 v4, 0x2
const/4 v3, 0x1
const/4 v2, 0x0
.line 12842
const/16 v0, 0xd
new-array v0, v0, [I
fill-array-data v0, :array_0
sput-object v0, Lcom/android/settings/R$styleable;->BatteryHistoryChart:[I
.line 13014
const/16 v0, 0xb
new-array v0, v0, [I
fill-array-data v0, :array_1
sput-object v0, Lcom/android/settings/R$styleable;->CardView:[I
.line 13230
const/4 v0, 0x5
new-array v0, v0, [I
fill-array-data v0, :array_2
sput-object v0, Lcom/android/settings/R$styleable;->ChartGridView:[I
.line 13292
new-array v0, v5, [I
fill-array-data v0, :array_3
sput-object v0, Lcom/android/settings/R$styleable;->ChartNetworkSeriesView:[I
.line 13378
const/4 v0, 0x7
new-array v0, v0, [I
fill-array-data v0, :array_4
sput-object v0, Lcom/android/settings/R$styleable;->ChartSweepView:[I
.line 13494
new-array v0, v4, [I
fill-array-data v0, :array_5
sput-object v0, Lcom/android/settings/R$styleable;->ChartView:[I
.line 13541
new-array v0, v3, [I
const v1, 0x7f010029
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->DashboardTile:[I
.line 13568
new-array v0, v3, [I
const v1, 0x7f01000f
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->IconPreferenceScreen:[I
.line 13597
new-array v0, v5, [I
fill-array-data v0, :array_6
sput-object v0, Lcom/android/settings/R$styleable;->IntervalSeekBar:[I
.line 13668
new-array v0, v4, [I
fill-array-data v0, :array_7
sput-object v0, Lcom/android/settings/R$styleable;->PercentageBarChart:[I
.line 13718
new-array v0, v4, [I
fill-array-data v0, :array_8
sput-object v0, Lcom/android/settings/R$styleable;->Preference:[I
.line 13759
new-array v0, v3, [I
const v1, 0x7f010010
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->SetupWizardIllustration:[I
.line 13786
new-array v0, v3, [I
const v1, 0x7f01000e
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->WifiEncryptionState:[I
.line 13748
const/16 v0, 0xb
new-array v0, v0, [I
fill-array-data v0, :array_9
sput-object v0, Lcom/android/settings/R$styleable;->CheckBoxPreference:[I
.line 13768
const/4 v0, 0x2
new-array v0, v0, [I
fill-array-data v0, :array_10
sput-object v0, Lcom/android/settings/R$styleable;->DependOnPreference:[I
.line 13890
new-array v0, v3, [I
const v1, 0x7f01004e
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->IncludePreference:[I
.line 13798
const/4 v0, 0x6
new-array v0, v0, [I
fill-array-data v0, :array_11
sput-object v0, Lcom/android/settings/R$styleable;->IntentPreference:[I
.line 13959
new-array v0, v3, [I
const v1, 0x7f01004d
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->RemovePreference:[I
return-void
.line 12842
:array_0
.array-data 4
0x1010034
0x1010095
0x1010096
0x1010097
0x1010098
0x1010161
0x1010162
0x1010163
0x1010164
0x7f010011
0x7f010012
0x7f010013
0x7f010014
.end array-data
.line 13014
:array_1
.array-data 4
0x7f010003
0x7f010004
0x7f010005
0x7f010006
0x7f010007
0x7f010008
0x7f010009
0x7f01000a
0x7f01000b
0x7f01000c
0x7f01000d
.end array-data
.line 13230
:array_2
.array-data 4
0x1010034
0x1010098
0x7f010020
0x7f010021
0x7f010022
.end array-data
.line 13292
:array_3
.array-data 4
0x7f01001f
0x7f010023
0x7f010024
0x7f010025
.end array-data
.line 13378
:array_4
.array-data 4
0x7f010019
0x7f01001a
0x7f01001b
0x7f01001c
0x7f01001d
0x7f01001e
0x7f01001f
.end array-data
.line 13494
:array_5
.array-data 4
0x7f010017
0x7f010018
.end array-data
.line 13597
:array_6
.array-data 4
0x7f01002e
0x7f01002f
0x7f010030
0x7f010031
.end array-data
.line 13668
:array_7
.array-data 4
0x7f010015
0x7f010016
.end array-data
.line 13718
:array_8
.array-data 4
0x7f010027
0x7f010028
.end array-data
.line 13748
:array_9
.array-data 4
0x7f01003a
0x7f01003b
0x7f01003c
0x7f01003d
0x7f01003e
0x7f01003f
0x7f010040
0x7f010041
0x7f010042
0x7f010043
0x7f010044
.end array-data
.line 13768
:array_10
.array-data 4
0x7f010045
0x7f010046
.end array-data
.line 13798
:array_11
.array-data 4
0x7f010047
0x7f010048
0x7f010049
0x7f01004a
0x7f01004b
0x7f01004c
.end array-data
.end method
See files in attached xml zip , and compare with yours
Add those lines (mostly its starts with <com.sonymobile......)
Same compare values folder that i attached
I added new lines at end of xml's (bool.xml , attr.xml, strings.xml etc....)
For style.xml > copy whole xml from mine and replace with yours
Soon i complete this guide (Mostly Done)
Heres my CM12.1 Test Download:
Settings.apk [ https://www.dropbox.com/s/nn4idkuolxe2d17/Settings.apk.zip?dl=0 ]
try this and give feedback...
Great Guide:good:
I'm very interested! Can you make it a little more easy to read?
To avoid confusion, public.xml and attrs.xml are located in /res/values.
I have multiple questions:
1. Shouldn't step # 2 be inside the '.method static constructor'? Also, would it work if I put it before '.locals' and '.prologue'?
2. When adding the arrays, how would I know what to put in each '.line'?
3. In CM12.1, 'include' has the same public id with 'advanced' (0x7f010028). Is that going to be a problem?
elmkzgirxp said:
To avoid confusion, public.xml and attrs.xml are located in /res/values.
I have multiple questions:
1. Shouldn't step # 2 be inside the '.method static constructor'? Also, would it work if I put it before '.locals' and '.prologue'?
2. When adding the arrays, how would I know what to put in each '.line'?
3. In CM12.1, 'include' has the same public id with 'advanced' (0x7f010028). Is that going to be a problem?
Click to expand...
Click to collapse
Public id is different for every builds
this ids of
<public type="attr" name="targetKey" id="0x7f01003c" /> and <public type="attr" name="include" id="0x7f010028" />
these lines are from public.xml
wolfmannight said:
add array in R$styleable.smali its bunch of public ids of attr
[ you can see array at end of R$styleable ]
(
example:
.line NNNNN
array:
XXXXXX
XXXXXX
XXXXXX
XXXXXX
end of array
Click to expand...
Click to collapse
from where i can find NNNNN????
mms6430 said:
from where i can find NNNNN????
Click to expand...
Click to collapse
See guide again i updated...
wolfmannight said:
Heres my CM12.1 Test Download:
Settings.apk [ https://www.dropbox.com/s/nn4idkuolxe2d17/Settings.apk.zip?dl=0 ]
try this and give feedback...
Click to expand...
Click to collapse
I tried this on resurrection lp maybe that's why it didn't work? But I tried installing normally by opening apk, I tried deleting the settings apk and trying again, finally I placed it in /system/priv-app/settings and still no luck.
wolfmannight said:
Heres my CM12.1 Test Download:
Settings.apk [ https://www.dropbox.com/s/nn4idkuolxe2d17/Settings.apk.zip?dl=0 ]
try this and give feedback...
Click to expand...
Click to collapse
Everything is working even the cm theme engine but all settings in xperia connectivity, personalisation,setup guide and some settings in display and light are not working it shows "setting has stop working"
sasukesama said:
Everything is working even the cm theme engine but all settings in xperia connectivity, personalisation,setup guide and some settings in display and light are not working it shows "setting has stop working"
Click to expand...
Click to collapse
See download http://forum.xda-developers.com/crossdevice-dev/sony/port-xperia-z5-settings-t3210891
Other apps are in this zip
Just unzip replace Settings app [which is in zip/system/priv-app/sttings/] and Zip agin then flash
Or Flash zip then replace moded cm12.1 settings app to /system/priv-app/settings/
wolfmannight said:
See download http://forum.xda-developers.com/crossdevice-dev/sony/port-xperia-z5-settings-t3210891
Other apps are in this zip
Just unzip replace Settings app [which is in zip/system/priv-app/sttings/] and Zip agin then flash
Or Flash zip then replace moded cm12.1 settings app to /system/priv-app/settings/
Click to expand...
Click to collapse
I will make a flashable zip just a small question
Can i use the xperia themes?
sasukesama said:
I will make a flashable zip just a small question
Can i use the xperia themes?
Click to expand...
Click to collapse
lol , Technically nope.
But you can convert Xperia Themes to CM Themes..
This is the sample theme [http://forum.xda-developers.com/crossdevice-dev/sony-themes-apps/port-xperia-mad-max-theme-cm-12-x-x-t3184299]
This is Guide [http://forum.xda-developers.com/crossdevice-dev/sony/sony-xperia-lollipop-movie-themes-cm12-t3134112]
So ive made a zip and flashed it but now im stuck on the welcome screen everything i press shows a "startup guide stop working" i reflashed my rom after wiping system but the lock screen and the quick setting panel are not working i think i will do a wipe for the data :'(
---------- Post added at 11:35 AM ---------- Previous post was at 11:34 AM ----------
wolfmannight said:
lol , Technically nope.
But you can convert Xperia Themes to CM Themes..
This is the sample theme [http://forum.xda-developers.com/crossdevice-dev/sony-themes-apps/port-xperia-mad-max-theme-cm-12-x-x-t3184299]
This is Guide [http://forum.xda-developers.com/crossdevice-dev/sony/sony-xperia-lollipop-movie-themes-cm12-t3134112]
Click to expand...
Click to collapse
Wow didnt know this is posable :v thanx
sasukesama said:
Everything is working even the cm theme engine but all settings in xperia connectivity, personalisation,setup guide and some settings in display and light are not working it shows "setting has stop working"
Click to expand...
Click to collapse
Of course it's not going to work - adding switches to control things that aren't there because they don't exist in the framework just results in cluttering the Settings app with broken junk that does nothing.
Also, why the HELL is the OP smali-hacking something for which the original source code is available? Smali-hacking is only for closed-source applications such as the stock frameworks/Settings app.
I have updated the zip from this thread for the cm12.1 with this app and cleaned the updater script.
you can get it from this link.
please update the OP with the new link.
Entropy512 said:
Of course it's not going to work - adding switches to control things that aren't there because they don't exist in the framework just results in cluttering the Settings app with broken junk that does nothing.
Also, why the HELL is the OP smali-hacking something for which the original source code is available? Smali-hacking is only for closed-source applications such as the stock frameworks/Settings app.
Click to expand...
Click to collapse
I do smali-hacking cause , I not able to download whole CM source (I think around 9 to 12 gb) and I'm noob in compiling android build ( haven't tried ). So... I avoid work on source code
I liked to make hack for pure AOSP , I just only done cause some of people PM for guide or for CM12 and i wanted to mod my new updated build that i recently downloaded so was moding that i log my every steps
And I like to hack(port what ever you call ) that nearly like sony developers do So i only made smali port for use those attributes...
I can make those intent and switches as android dev. way, I not do for special purpose , I just do for FUN and to get more knowledge....
@Entropy512 Its all cause HELL is on earth. hahahaha...
@wolfmannight Well, I know this is a very extense work. But, I'm sure you can make it more understanable... Resumming: disorder.
You can make a more friendly post usign tags, don't you think?
PS. 'include' and 'advanced' ids in public.xml are the same... how does this affect?
PS2. When compiling i get:
Code:
public.xml:5682: error: Public symbol xml/personalization_settings declared here is not defined.
public.xml:5681: error: Public symbol xml/xperia_connectivity_settings declared here is not defined.
sebastiandg7 said:
@wolfmannight Well, I know this is a very extense work. But, I'm sure you can make it more understanable... Resumming: disorder.
You can make a more friendly post usign tags, don't you think?
PS. 'include' and 'advanced' ids in public.xml are the same... how does this affect?
PS2. When compiling i get:
Code:
public.xml:5682: error: Public symbol xml/personalization_settings declared here is not defined.
public.xml:5681: error: Public symbol xml/xperia_connectivity_settings declared here is not defined.
Click to expand...
Click to collapse
define this two xmls in public xml , give it a public id
Try a test build i uploaded , if your rom is based on CM12.1
this guide is so complicated , its not for noobs...
theonepharaoh said:
I have updated the zip from this thread for the cm12.1 with this app and cleaned the updater script.
you can get it from this link.
please update the OP with the new link.
Click to expand...
Click to collapse
In some areas mega is bann , try to upload on other place

[Guide][JAN/26] Show/Hide Brightness Slider on notification Quick settings on CM13

Hey there,
first off, I am neither an experienced android-developer in any way nor am I able to support any questions regarding to this tutorial. Im new to this stuff, but kinda good in figuring stuff out, and I made it work. All Props go out to venkat kamesh, a guy over in aSony-Forum, who did a great job in implementing a "Show/Hide Brightness Slider"-Feature; one of the features I wait for the most when it comes to cm13.- The static slider is useless to me, cause I use the "cm hidden slider", this feature where you just swype over the status bar to adjust brigthness.
This workflow was reproducable on 2 international m8 devices running cm13 from Jan. 25, besides the Team M8 Kernel. In the following I will fullquote the original developer, with red comments in brackets on the spots where something differs to the cm13 m8 version of the guide.
As I said, Im not very experienced, and dont really understand everything what is happening there (especially regarding security when it comes to private/protected methods and stuff), so please be kind and feel free to optimize my work as much as you want/can
venkat kamesh said:
Hello guys
Happy new Year for first
This is my first tut in This new year 2016
All you need is Deodexed SystemUI.apk and Settings.apk
1. Decompile SystemUI.apk
2. Open SystemUI.apk/smali/com/android/systemui/qs/QSPanel.smali
3. Find this code (just look for the method name, for me the method was protected, not private)
Code:
.field private mBrightnessPaddingTop:I
Below that add this code
Code:
.field private mBrightnessSliderEnabled:Z
4. Search for this Method
Code:
.method private setDetailRecord(Lcom/android/systemui/qs/QSPanel$Record;)V
and above that method add this complete method
Code:
.method private isBrightnessSliderEnabled()I
.locals 4
const/4 v3, 0x0
iget-object v0, p0, Lcom/android/systemui/qs/QSPanel;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
const-string v1, "brightness_slider_show"
const/4 v2, 0x1
invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v0
if-eqz v0, :cond_0
const/4 v3, 0x1
:cond_0
iput-boolean v3, p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessSliderEnabled:Z
return v3
.end method
5. Search for this method (just look for the method name, for me the method was protected, not private)
Code:
.method private showDetail(ZLcom/android/systemui/qs/QSPanel$Record;)V
Above that method, add this method (for me, there already was a method called "showBrightnessSlider", but I wasnt able to get it to work with the default one, so here, you have to delete the whole existing "showBrightnessSlider" method and paste the new one. Also, the guide states a private method here, but as the following steps include an invoke-virtual, we have to change it to protected)
Code:
.method private [COLOR="red"](protected)[/COLOR] showBrightnessSlider()Z
.locals 5
const/16 v3, 0x8
const/4 v2, 0x0
const v1, 0x7f10012e (for me, as there already was a method called "showBrightnessSlider", I didnt use this hex value here, but instead looked my own actual id up in SystemUI:/res/value/public, then search for "brightness_slider" and use this id)
invoke-direct {p0}, Lcom/android/systemui/qs/QSPanel;->isBrightnessSliderEnabled()I
move-result v4
invoke-virtual {p0, v1}, Lcom/android/systemui/qs/QSPanel;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Lcom/android/systemui/settings/ToggleSlider;
if-eqz v4, :cond_0
iget-boolean v1, p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessSliderEnabled:Z
if-eqz v1, :cond_0
iget-object v1, p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessView:Landroid/view/View;
invoke-virtual {v1, v2}, Landroid/view/View;->setVisibility(I)V
invoke-virtual {v0, v2}, Lcom/android/systemui/settings/ToggleSlider;->setVisibility(I)V
:goto_0
invoke-virtual {p0}, Lcom/android/systemui/qs/QSPanel;->updateResources()V
iget-boolean v1, p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessSliderEnabled:Z
return v1
:cond_0
iget-object v1, p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessView:Landroid/view/View;
invoke-virtual {v1, v3}, Landroid/view/View;->setVisibility(I)V
invoke-virtual {v0, v3}, Lcom/android/systemui/settings/ToggleSlider;->setVisibility(I)V
goto :goto_0
.end method
6. Now Look for this Code (for me the whole code from step 6 was already there, so dont change anything here)
Code:
if-eqz p1, :[COLOR="red"]cond_3[/COLOR]
.line 216
iget-object [COLOR="Red"]v2[/COLOR], p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessController:Lcom/android/systemui/settings/BrightnessController;
Add the code above the .line 216 ( this .line 216 will not be same with all devices ) (as stated above, the here included invoke was already there for me, but with a virtual invoke; but I didnt change a thing here)
Code:
invoke-direct [COLOR="red"][/COLOR]{p0}, Lcom/android/systemui/qs/QSPanel;->showBrightnessSlider()Z
move-result [COLOR="red"]v2[/COLOR]
if-eqz [COLOR="red"]v2[/COLOR], :[COLOR="red"]cond_3[/COLOR]
Finally it looks like
Code:
if-eqz p1, [COLOR="blue"]:cond_3[/COLOR]
[COLOR="Red"] invoke-direct (invoke-virtual){p0}, Lcom/android/systemui/qs/QSPanel;->showBrightnessSlider()Z
move-result [COLOR="blue"]v2[/COLOR]
if-eqz [COLOR="blue"]v2[/COLOR], [COLOR="blue"]:cond_3[/COLOR][/COLOR]
.line 216
iget-object [COLOR="Blue"]v2[/COLOR], p0, Lcom/android/systemui/qs/QSPanel;->mBrightnessController:Lcom/android/systemui/settings/BrightnessController;
After adding that
replace this Public id
<public type="id" name="brightness_slider" id="0x7f10012e" />
6. Now compile the SystemUI.apk and sign it and replace
Now time to add in the settings look for post #2
Click to expand...
Click to collapse
venkat kamesh said:
Welcome to easy part on adding the option to hide/show in settings
Method 1
1. Decompile the settings.apk
2. Download this View attachment 3617395 and merge to your settings
3. Add the below code to your settings ( i had added to my own settings ) and your wish
Code:
<PreferenceScreen android:title="Statusbar Mod" android:key="statusmod" android:fragment="com.android.settings.rz.Statusmod" />
4. Compile it and Decompile and open
Settings.apk/smali/com/android/settings/rz/Statusmod.smali
5. Compare the Public ID and replace it and recompile
6. God you did man,,, now replace and have fun
Method 2 (actually, this method worked like a charm for me, didnt even had to download his file merge the settings)
1. Decompile the Settings.apk
2. Download this View attachment 3606026 and merge to your settings
3. Add the below code to your settings ( i had added to my own settings.xml )
you can add in settings.apk/res/xml/Dispaly_settings.xml
HTML:
<com.android.settings.cyanogenmod.SystemSettingSwitchPreference android:title="Brightness Slider" android:key="brightness_slider_show" android:defaultValue="0" android:summaryOn="Brightness Slider Shown" android:summaryOff="Brightness Slider Hidden" />
and then compile/sign and replace your settings
OR
Try download this ROM Control application (View attachment 3616872 ) where you can Easily control
All you is just install and have fun
Thanks to @daxgirl for the app source ​
now have fun guys
Thanks to cyanogenmod
Dont Forget to mention me if you used my work
that feels me happy
Click to expand...
Click to collapse
And for the noobies like me: If you dont know anything about compiling/decompiling apks, get a can of coffee and make yourself ready to learn, I had fun debugging all this stuff and get this running, and I think now I know a little bit more, and you also will!
Some keywords for you, so you can spare yourself the googling (the parts I as a beginner struggled with): use apktools for de-/compiling, remember to download and install your frameworks from your phone, and for "signing", you have to copy the META-INF folder and the AndroidManifest.xml from the compiled old apk to the compiled new apk (with something like 7zip).
Have fun with it

Categories

Resources