xml and color codes - Android Themes

What program do most use to edit android xmls?
Is there a chart for the colors used in classes.dex?

steveo314 said:
What program do most use to edit android xmls?
Is there a chart for the colors used in classes.dex?
Click to expand...
Click to collapse
I am using xml marker - free on the internet (thanks to thoughtlesskyle for showing me this program)
as for hex codes - I use this website http://www.december.com/html/spec/color.html

How do I swap out the hex codes for the const/high16 v6 code???

steveo314 said:
How do I swap out the hex codes for the const/high16 v6 code???
Click to expand...
Click to collapse
const/high16 sets only first 16 bits of a register, so const/high16 v0, 0xffff is the same as const v0, 0xffff0000

Related

[GUIDE]SystemUi.apk Control Widgets Porting

I'm editing this thread to now be a guide on how I was able port the QP from the i9000.
Here's how it was ported:
First I downloaded the i9000's (SGS) stock deodexed Systemui.apk and decompiled
Next I decompiled the SystemUI.apk from the Nexus S in apk manager 4.7 (4.9 gave me issues when attempting to recompile)
Once you decompile the SystemUI.apk from the i9000, navigate to out/smali/com/android/systemui/statusbar
You'll notice a folder in there called quickpanel. Open the same folder on the decompiled Nexus systemui.apk and copy the entire quickpanel folder to the Nexus. Now you have to edit all the xmls in the res folder, start with status bar expanded.xml in the res/layout. Then ids.xml, then strings.xml, then public.xml in your res/values folder. Basically your going to add in every value from the i9000 that starts with "quickpanel". The public is a doozy, you have to assign the new values their own unique hex value. You should really be familiar with the hex naming scheme in public before attempting this, it's easy to screw up but worse case scenario is it won't compile for you. The status_bar_expanded in the layout folder, you only want to add the top line to your file don't overwrite any of the xml files from the i9000, only merge the pieces of code that call the widget into display.
Next you have to move on to the smali code. Navigate to the decompiled folder res/values/ from both phones and open public.xml. After, navigate to /out/smali/com/android/systemui/statusbar/quickpanel/ from both phones, and open the autorotationsettingbutton.smali. What your going to be looking for first, is the hex codes that appear in public.xml.
Code:
.line 67
.local v2, rootView:Landroid/view/View;
const v5, 0x7f090023
Code:
.line 68
.local v0, icon:Landroid/widget/ImageView;
const v5, 0x7f090025
Code:
.line 82
return-void
.line 72
:pswitch_0
const v1, 0x7f020087
.line 73
const v4, 0x7f020085
.line 74
goto :goto_0
.line 76
:pswitch_1
const v1, 0x7f020086
.line 77
const v4, 0x7f020084
goto :goto_0
Each of these hex codes "0x7f0200xx" match up to a drawable in publix.xml. Start with the i9000 systemui.apk and see what picture it's pointing to by searching the number in the public.xml, then move over to the Nexus S systemui.apk and open the public (That you already modded and added the values in for the quickpanel items) and match to the name of the drawable in the i9000, to the name in public from Nexus, then copy the New hex code from the Nexus public to the autorotationsettingbutton.smali. This way your new smali file will be pointing to the correct drawable in the Nexus systemui.apk. Note all the way at the bottom of the smali file in both phones is 1 more hex value to change. Just scroll down to almost the bottom and look for another number that looks like the previous ones. Change that final hex and save your work. Now open all the other files ie bluetoothsettingsbutton gpssettingsbutton soundsettingsbutton, wifisettingsbutoon. Repeat the same steps for changing the hex values for picture display.
Now open the wifisettingsbutton.smali and we have to mod the code since our phones don't access the wifi the same.
Code:
.line 63
nop
:pswitch_data_0
.packed-switch 0x0
:pswitch_2
:pswitch_1
:pswitch_2
:pswitch_0
[B]:pswitch_1[/B]
.end packed-switch
.end method
In this code in wifisettingsbutton, the final line switch_1 is added, it's not present in the original. You must adjust this value.
Code:
.line 123
iget-object v1, p0, Lcom/android/systemui/statusbar/quickpanel/WifiSettingButton;->mWifiManager:Landroid/net/wifi/WifiManager;
const/4 v2, 0x1
invoke-virtual {v1, v2}, Landroid/net/wifi/WifiManager;->setWifiEnabledDialog(Z)Z
goto :goto_0
.end method
Code:
.line 123
iget-object v1, p0, Lcom/android/systemui/statusbar/quickpanel/WifiSettingButton;->mWifiManager:Landroid/net/wifi/WifiManager;
const/4 v2, 0x1
invoke-virtual {v1, v2}, Landroid/net/wifi/WifiManager;->setWifiEnabled(Z)Z
goto :goto_0
.end method
In the above two codes, the first is the i9000 wifisettingsbutton, notice the line >setWifiEnabledDialogue(Z)Z and under it the >setWifiEnabled(Z)Z, you must edit out the dialogue to keep it from erroing on the Nexus.
Up to now you have the code in place for this all to work, but you don't have the code in place to actually display the widget. Back out of the /quickpanel/ folder in file explorer and you should be in the /statusbar/ folder. Look for the smali file statusbarservice.smali
Search for the line .method private makeStatusBarView(Landroid/content/ContextV.
Mod the first line to look like this:
Code:
.locals 12
.parameter "context"
.prologue
const/4 v11, 0x0
const v10, 0x7f09000d
const/4 v9, 0x0
const/16 v8, 0x8
then your going to scroll down if your using notepad++ you'll look for line #776, you need to add in this line of code from the i9000
Code:
.line 371
const v6, 0x7f030006
invoke-static {p1, v6, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
move-result-object v5
check-cast v5, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
.line 373
.local v5, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
iget-object v6, p0, Lcom/android/systemui/statusbar/StatusBarService;->mExpandedView:Lcom/android/systemui/statusbar/ExpandedView;
invoke-virtual {v6, v5, v11}, Lcom/android/systemui/statusbar/ExpandedView;->addView(Landroid/view/View;I)V
.line 386
return-void
.end method
search for the same code inside the statusbarservice.smali from the i9000 source and you'll notice some changes like the last line invoke-virtual{v6, v5, v11} we can't use the same values as the i9000 because there is more code in that file than we need at the moment in the Nexus, so I had to figure out what numbers were compatible to both the phones. Also take note of this line
.line 371
const v6, 0x7f030006
This is calling an XML file into view that controls how the quickpanel looks on your phone. The number 0x7f03006 may very it depends on when you added the quickpanel items into public.xml, what value you gave the item quickpanelsettings. Quick panel settings is an xml file that can be found in the res/layout/ of the i9000 source systemui.apk and must be transferred over to the Nexus S systemui.apk res/layout/ as well.
This is all a broad guide to get you started, if you need more assistance, don't PM me, post here so everyone can learn together.
Here are all the source files from the i9000 and the properly modded files of the Nexus Systemui.apk
QuickPanel.zip
{
"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"
}
Would the help you're looking for be concurrent with the status bar issues being worked out in cm7?
Sent from my Nexus S 4G using Tapatalk
Have no clue tbh
I'm leaning toward the smali not calling the r.layout.quick_panel_settings.xml is it
Sent from my SPH-D700 using Tapatalk
Have u tried eclipse. It is generally pretty Good at telling u where the missing links are.
Sent from my Nexus S 4G using XDA Premium App
Looks like the framework.jar is going to have to be modded to accomplish this. My eyes are bleeding looking all this smali code but I did find one little snippet of code in the framework classes.dex located in com/android/internal/statusbar/
StatusBarNotification.smali
Code:
.method public isMiniCon()Z
.registers 2
.prologue
.line 126
iget-object v0, p0, Lcom/android/internal/statusbar/StatusBarNotification;->notification:Landroid/app/Notification;
iget v0, v0, Landroid/app/Notification;->twQuickPanelEvent:I
and-int/lit8 v0, v0, 0x1f
if-eqz v0, :cond_a
const/4 v0, 0x1
:goto_9
return v0
:cond_a
const/4 v0, 0x0
goto :goto_9
.end method
I incorporated this into our framework.jar recompiled and flashed. No display in the status bar still but no errors at all from the phone. I'm getting there but have to head to work now
Getting closer
Sent from my Nexus S 4G using Tapatalk
Dang! That looks fantastic! Good work man
suomaf said:
Dang! That looks fantastic! Good work man
Click to expand...
Click to collapse
Thanks been at it long time, can't get the on click listeners to work so the buttons don't click yet they just show up
Sent from my Nexus S 4G using Tapatalk
Now that's progress, good work!
Sent from my Nexus S 4G using XDA Premium App
raiderep said:
Now that's progress, good work!
Sent from my Nexus S 4G using XDA Premium App
Click to expand...
Click to collapse
Care to join in? I need fresh eyes mine are stumped I can catch you up to where I am
Sent from my SPH-D700 using Tapatalk
dreamsforgotten said:
Care to join in? I need fresh eyes mine are stumped I can catch you up to where I am
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
I know what you mean, sometimes you need to step back for a bit. Not sure where you're at on it but I'd be glad to have a look.
raiderep said:
I know what you mean, sometimes you need to step back for a bit. Not sure where you're at on it but I'd be glad to have a look.
Click to expand...
Click to collapse
I'll make you a zip matter of fact pm your email and I'll invite you in my dropbox share to centralize the work. I'll add in a txt change log of what files are modded tell you where I'm stuck, need to track down quick panel container its referenced in id and public
Sent from my Nexus S 4G using Tapatalk
dreamsforgotten said:
I'll make you a zip matter of fact pm your email and I'll invite you in my dropbox share to centralize the work. I'll add in a txt change log of what files are modded tell you where I'm stuck, need to track down quick panel container its referenced in id and public
Sent from my Nexus S 4G using Tapatalk
Click to expand...
Click to collapse
pm ur way...
Sent from my Nexus S 4G using XDA Premium App
Quick question, when you are done.do you think this would work on a nexus s i9100 t? The non 4g version?
suomaf said:
Quick question, when you are done.do you think this would work on a nexus s i9100 t? The non 4g version?
Click to expand...
Click to collapse
I'm sure you'll have to mod the files to match. It won't hurt to flash it and test but you'll have to compare the public.xml hex codes, the smali hex values inthe quick panel smali files.
Sent from my Nexus S 4G using Tapatalk
Progress update:
I'm am definitely on the verge of a release. I was hoping to contain all the code right inside the SystemUi.apk and there is still a slim chance I can mod the smali in there to speak with our framework.jar right. If not you'll have to flash SystemUi.apk and a modded framework.jar. Porting this to the non 4g version should be no harder than this was. I'm not going to port it, however I'll help out anyone who is willing to each step of the way. What works, auto rotation is done, works on and off. Gps is done, works just fine. Sound works 100%. Bluetooth, and wifi; however, do not work. Bluetooth turns on and off but the icon jumps over 1 slot and covers up the gps icon. You can then click the gps icon and get it to return to a gps image but I need to work this out. Wifi, don't work at all. It force closes the entire SystemUi.apk and you loose your status bar. I was able to get some good clean logcats and know where all the issues are located. It's only a matter of time to get this 100%. Now the last thing which is non important and will only take a second, is the length of the widget taking up all the real estate. That will be worked out as well.
dreamsforgotten said:
Progress update:
.. Porting this to the non 4g version should be no harder than this was. I'm not going to port it, however I'll help out anyone who is willing to each step of the way....
Click to expand...
Click to collapse
I would like to have a go at it, but I got no (ZERO/NADA/KAPUT) experience with this at all. I am the sort that believes in learn by doing however, if you are willing to help out, I could always do the grunt work. I have done a few android development tutorials but I don't think that they will help in this.
Very nice progress on this, I'm sure you'll get it done for us
raiderep said:
Very nice progress on this, I'm sure you'll get it done for us
Click to expand...
Click to collapse
I'm trying my ass off I'm using smali compiled for the i9000 sgs, and the handling of bluetooth and wifi are the only two settings that are different however searching through the decompiled frameworks.jar from both I'm just not seeing it.
Sent from my Nexus S 4G using Tapatalk
suomaf said:
I would like to have a go at it, but I got no (ZERO/NADA/KAPUT) experience with this at all. I am the sort that believes in learn by doing however, if you are willing to help out, I could always do the grunt work. I have done a few android development tutorials but I don't think that they will help in this.
Click to expand...
Click to collapse
You can do it with my help you just have to edit what I tell you so far its not too much to edit to point to our phones its hours of searching for the java files that the app is using. When its done there is no searching left I just show you the files. You have to edit public only cause your phone don't have 4g hex codes. Its not hard when you have a guide to do it.
Sent from my Nexus S 4G using Tapatalk

[TouchWiz3][Tutorial] ►Ultimate◄►All In One◄ [Update:8/3/2013]

[TouchWiz3][Tutorial] ►Ultimate◄►All In One◄ [Update:8/3/2013]
ALL IN ONE Guide for all TouchWiz3 Users !​
NOTE : Some of the methods are taken on SpaceCaker's touchwiz thread, but, most of them are new.
What is Touchwiz3 ?
Touchwiz is more than a simple launcher.
It's a framework , a set of functions, developed by and for Samsung, available only to Samsung developers.
Those functions allow them to create Samsung's own launcher, Touchwiz UI, their unique Camera App, a few more apps as well as a whole bunch of Android customization specifically for the SGS3 or any other Android phone they come up with.
Click to expand...
Click to collapse
Post Navigation :
Page Indicators
Homescreen
App drawer
Dock Icons
Special modifications
Click to expand...
Click to collapse
Firstly you need to decompile TouchWiz30Launcher.apk to make all this changes. If you don't know how to decompile simply follow this guide :
http://forum.xda-developers.com/showthread.php?t=2275713
Credits :
- Spacecaker - The best teacher ever had xD
- dali47 for 5 Icon dock , 5x5 Homescreen & Appdrawer
Click to expand...
Click to collapse
Caution : In case keep a secondary launcher if anything goes wrong !
OK , Now let's go ​
PAGE INDICATORS :
How to place Page indicators at the bottom ( As in TouchWiz4 ) :
1) Go to Res/Values-mdpi/Dimens.xml ( Values-xxxx depend on your resolution )
2) Find :
Code:
<dimen name="menu_top_offset">XXXdip</dimen>
Change XXX to any size you want. ( Normally use 6.0 dip )
3) Find :
Code:
<dimen name="workspace_pageindicator_top">XXXdip</dimen>
Again Change XXX to any size you want ( Normally use 385.0 dip )
4) Find :
Code:
<dimen name="pageindicator_top_offset">XXXdip</dimen>
Again Change XXX to any size you want ( Normally used 375.0 dip )
Recompile TouchWiz30Launcher.apk and test.
Click to expand...
Click to collapse
Disable/Enable Autohide of Page Indicators on Homescreen & App drawer :
- Go to Res/Values/Bools.xml
For homescreen change :
Code:
true
( True = Autohide enabled )
to:
Code:
false
( False = Autodhide disabled )
For AppDrawer change :
Code:
true
( True = Autohide enabled )
to :
Code:
false
( False = Autodhide disabled )
Click to expand...
Click to collapse
Remove number on Page Indicator :
Open /smali/com/sec/android/app/twlauncher/PageIndicator$Page.smali and delete :
Code:
invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V
Click to expand...
Click to collapse
HOMESCREEN :
Set default screen counter :
Go to /res/xml-mdpi/launcher_config.xml
Change :
Code:
launcher:defaultScreenCount="3"
Number 3 from "1 to 7"
Click to expand...
Click to collapse
Set default homescreen :
Add this line on build.prop :
Code:
ro.csc.homescreen.defaultscreen=2
Click to expand...
Click to collapse
5x5 Icons Home screen (Widgets will look smaller)
Go to /res/layout-mdpi/workspace_screen.xml
Code:
shortAxisCells="[B]4[/B]"
Change to :
Code:
shortAxisCells="[B]5[/B]"
Here again find :
Code:
cellWidth="[B]80.0dip[/B]"
Change to :
Code:
cellWidth="[B]64.0dip[/B]"
Find again :
Code:
longAxisCells="[B]4[/B]"
Change to :
Code:
longAxisCells="[B]5[/B]"
One last time find :
Code:
cellHeight="[B]100.0dip[/B]"
Change to :
Code:
cellHeight="[B]80.0dip[/B]"
Go to /res/values-mdpi/styles.xml
Find :
Code:
[B]4.0dip[/B]
Change to :
Code:
[B]2.0dip[/B]
Click to expand...
Click to collapse
How to delete the black background of shortcuts :
Decompile TouchWiz30Launcher.apk
Go to res/values-xdpi/colors.xml
Find this :
Code:
<color name="bubble_dark_background">#b2191919</color>
Change to :
Code:
<color name="bubble_dark_background">#00191919</color>
Recompile and test.
Click to expand...
Click to collapse
Post #2
App Drawer :
Transparent app drawer :
Go to /res/values-mdpi/colors.xml
Code:
<color name="menu_background">#FF000000</color>
change FF to 80 (semi-transparent) or 99 (like TouchWiz4)
Click to expand...
Click to collapse
Enable concentration effect in app drawer :
Go to /res/xml-mdpi/launcher_config.xml
Add :
Code:
launcher:usemainmenuconcentrationeffect="true"
above launcher:use16bitwindow="xxx"
Click to expand...
Click to collapse
Enable list view option:
Go to /res/xml-mdpi/launcher_config.xml
add :
Code:
launcher:usemainmenulistmode="true"
Click to expand...
Click to collapse
Adding auto-alphabetical arrangement:
Go to /smali/com/sec/android/app/twlauncher/menumanager.smali
Find :
Code:
invoke-virtual {v0, v6}, lcom/sec/android/app/twlauncher/launchermodel$applicationinfocomparator;->setmode(i)v
.line 1770
[b]iget-object v0, p0, lcom/sec/android/app/twlauncher/menumanager;->mordercomparator:lcom/sec/android/app/twlauncher/launchermodel$applicationinfocomparator;[/b]
Change to :
Code:
invoke-virtual {v0, v6}, lcom/sec/android/app/twlauncher/launchermodel$applicationinfocomparator;->setmode(i)v
.line1770
[B]sget-object v0, lcom/sec/android/app/twlauncher/launchermodel;->app_name_comparator:ljava/util/comparator;[/B]
Click to expand...
Click to collapse
5 Column App drawer ( 5x4 & 5x5 ) :
Go to /res/xml-mdpi/launcher_config.xml
Find:
Code:
menuColumnCount="[B]4[/B]"
Change it to 5 ( This is number of Columns )
Find :
Code:
itemNumOfPage="16"
Change 16 to 20 if you want 5x4 app drawer , or 25 if you want 5x5 app drawer ( This is the number of icons per page )
If you're doing 5x5, do the following. if you're doing 5x4 then skip this.
Go to /res/values-mdpi/dimens.xml
Find :
Code:
<dimen name="menu_item_height">[B]92.0dip[/B]</dimen>
Change it to 73.6dip (this is the height of the drawer element)
Go to res/layout_mdpi/application_boxed.xml
Find :
Code:
maxLines="[B]2[/B]"
Change 2 to 1 (this is the number of lines in the app name in the drawer)
Click to expand...
Click to collapse
Post #3
Dock Icons :
How to add title on dock icons :
Go to smali/com/sec/android/app/twlauncher/AppShortcutZone.smali
Find method :
Code:
.method public changeApplicationsIcon( )V
Find :
Code:
.locals 4
.prologue
Change to :
Code:
.locals 5
.prologue
#0x7f0a003d = change to your string name (homescreenedit_home)
const v4, 0x7f0a003d
In same method find :
Code:
iget-object v2, p0, Lcom/sec/android/app/twlauncher/AppShortcutZone;->mApplicationsDrawableNormal:Landroid/graphics/drawable/Drawable;
invoke-virtual {v1, v2}, Lcom/sec/android/app/twlauncher/MenuItemView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
Nnder them add these :
Code:
invoke-virtual {p0}, Lcom/sec/android/app/twlauncher/AppShortcutZone;->getContext()Landroid/content/Context;
move-result-object v2
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
#
const v3, 0x7f0a0012
invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Lcom/sec/android/app/twlauncher/MenuItemView;->setText(Ljava/lang/CharSequence;)V
Now find :
Code:
iget-object v2, p0, Lcom/sec/android/app/twlauncher/AppShortcutZone;->mApplicationsDrawableMenu:Landroid/graphics/drawable/Drawable;
invoke-virtual {v1, v2}, Lcom/sec/android/app/twlauncher/MenuItemView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
Under them add these lines :
Code:
invoke-virtual {p0}, Lcom/sec/android/app/twlauncher/AppShortcutZone;->getContext()Landroid/content/Context;
move-result-object v2
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
invoke-virtual {v2, v4}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Lcom/sec/android/app/twlauncher/MenuItemView;->setText(Ljava/lang/CharSequence;)V
Now again find :
Code:
iget-object v2, p0, Lcom/sec/android/app/twlauncher/AppShortcutZone;->mApplicationsDrawableEdit:Landroid/graphics/drawable/Drawable;
invoke-virtual {v1, v2}, Lcom/sec/android/app/twlauncher/MenuItemView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
And under them add :
Code:
invoke-virtual {p0}, Lcom/sec/android/app/twlauncher/AppShortcutZone;->getContext()Landroid/content/Context;
move-result-object v2
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v2
invoke-virtual {v2, v4}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Lcom/sec/android/app/twlauncher/MenuItemView;->setText(Ljava/lang/CharSequence;)V
In method .method public makeItemView
Find :
Code:
invoke-direct {v6, v7}, Lcom/sec/android/app/twlauncher/FastBitmapDrawable;->(Landroid/graphics/Bitmap;)V
invoke-virtual {v5, v6}, Lcom/sec/android/app/twlauncher/MenuItemView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
Under those add :
Code:
iget-object v6, p1, Lcom/sec/android/app/twlauncher/ApplicationInfo;->title:Ljava/lang/CharSequence;
invoke-virtual {v5, v6}, Lcom/sec/android/app/twlauncher/MenuItemView;->setText(Ljava/lang/CharSequence;)V
Go to res/values-mdpi/dimens.xml
Find :
Code:
XXXX
( XXXX is a number (dip) but I used this as reference)
Change XXXX to 51.0dip
Now in same file find :
Code:
XXXX
Again change XXXX to
Code:
6.0dip
Click to expand...
Click to collapse
5(6) Icon Dock :
Go to /res/layout-mdpi/launcher.xml
Find :
Code:
iconColumnCount="[B]4[/B]"
Replace 4 with 5 ( Or 6 if you want 6 Icon Dock )
Go to /smali/com/sec/android/app/twlauncher/AppShortcutZone.smali
Find :
Code:
const/4 v8, 0x3
Replace 0x3 with 0x4 ( Or 0x5 for 6 Icon Dock )
Find:
Code:
const/4 v6,[B] 0x3[/B]
Replace0x3 with 0x4 ( Or 0x5 for 6 Icon Dock )
Click to expand...
Click to collapse
Special Modifications
Enable Auto-Rotation :
Go to AndroidManifest.xml
Find :
Code:
1. Change
Code:
screenOrentation="nosensor"
To :
Code:
screebOrentation="user"
Recomile launcher and sign it!
Always sign apks if you edit AndroidManifest.xml!
Click to expand...
Click to collapse
THANKS WOULD BE APPRECIATED :good:
Sniper Killer said:
Another
Click to expand...
Click to collapse
Nice! Will test as soon as i have the time.
awesome..
much needed guide..!!
will surely give it a try after my exams..!
:thumbup: :good:
edit: @ op can u please add the 'click to show conent' or 'spoiler' where possible ??
on mobile takes a bit long to scroll down..
just my opinion..!
Sent from my GT-S5830i using xda app-developers app
srt99 said:
awesome..
much needed guide..!!
will surely give it a try after my exams..!
:thumbup: :good:
edit: @ op can u please add the 'click to show conent' or 'spoiler' where possible ??
on mobile takes a bit long to scroll down..
just my opinion..!
Sent from my GT-S5830i using xda app-developers app
Click to expand...
Click to collapse
Thanks
If i place hide tags it will be a bit trolling for users because it is hard to follow all steps , especially the last guide ( Adding title to dock ) If you forget to make one of that steps touchwiz will FC. Sorry
Sniper Killer said:
Thanks
If i place hide tags it will be a bit trolling for users because it is hard to follow all steps , especially the last guide ( Adding title to dock ) If you forget to make one of that steps touchwiz will FC. Sorry
Click to expand...
Click to collapse
use one hide tag for all stuff under each guide
Sent from my S500 using xda app-developers app
So this modified Touchwiz will be in SGS3 v4?
Awesome, been looking for a guide like this for ages. Thanks. :thumbup:
Sent from my GT-S5830i using xda app-developers app
Press Thanks if i helped!
:good: Nice work bro.
It's modding time! Thanks for the guide... Will test as a weekend project...
Sent from my GT-S5830M using Tapatalk 2
Screens that I must get
Sent from my GT-S5830i using xda app-developers app
Is it? I have it and like
Sent from my GT-S5830i using xda app-developers app
OP Updated! Now with Landscape Mode guide!
OP Updated again! Now you can delete the black background of shortcuts on homescreen to transparent.
Excellent and detailed guide!
I'm gonna try it...
Sent from my GT-S5830i using xda app-developers app
Hey hi sniper thank you so much because of these guide i first time my self i made the app drawer transparent bro thank you so much :thumbup:
One question bro i wanted to change all icons so where i can get the old icons ? In apk ?
Sent from my Ace-i
Simply awesome guide by Snipey... !!
Must try... Good Keep it up. Sooo easy guide for noobs.. Thanks sniper for this guide....
about the dock title
nice work :good: easy to follow
i am wondering how the guide add name to dock work??
Can you give the guide to modify them ( the dock's names) thank you sm
Thanks for cool Guide.
But i have question. How chande text size under shortcuts
Отправлено с моего GT-S5830i через Tapatalk

Guide: enable CRT effect for MT6577 JB phones

so after trying endless number of times including analyzing the smalis of a dozen guides for crt effect and the mysterious libsurfacelinger losing hwcomposer error in logcat which causes the phone to soft reboot after crt animation, i finally have gotten it to work, so let us begin
1st off we need to decompile services.jar and open up smali/com/android/server/PowerManagerService$ScreenBrightnessAnimator.smali
look for this line (code in LIME might look different in your smali)
Code:
.line 2716
.restart local[COLOR="Lime"] v1 [/COLOR] #turningOff:Z
:[COLOR="Lime"]cond_e[/COLOR]
add this after the code, note color in LIME might be different in your smali
Code:
iget-object v4, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x10
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$[COLOR="Lime"]7100[/COLOR](Lcom/android/server/PowerManagerService;I)V
to make sure what access$ yours is, open up PowerManagerService.smali and look for somethings that looks like this
Code:
.method static synthetic access[COLOR="Red"]$XXXX[/COLOR](Lcom/android/server/PowerManagerService;I)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 110
invoke-direct {p0, p1}, Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
return-void
.end method
NOTE the $XXXX in RED as this is what you should put in your PowerManagerService$ScreenBrightnessAnimator.smali
Finally it should look like this afterwards( code in RED is what we added and color in LIME is your access$ which in my case was 7100)
Code:
.line 2716
.restart local v1 #turningOff:Z
:cond_e
[COLOR="Red"] iget-object v4, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x10
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$[COLOR="Lime"]7100[/COLOR](Lcom/android/server/PowerManagerService;I)V[/COLOR]
iget-object v2, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/4 v3, 0x1
#setter for: Lcom/android/server/PowerManagerService;->mWaitKeyguardDraw:Z
invoke-static {v2, v3}, Lcom/android/server/PowerManagerService;->access$2002(Lcom/android/server/PowerManagerService;Z)Z
now recompile and put classes.dex back to android.policy.jar.
and lastly download the attached zip add your android.policy.jar and flash it, or extract and push manually the files to their corresponding folders
reboot, or just run
pkill zygote
from terminal as root and voila you should have crt effect working now,
alternative way is framework-res.apk method, just decompile it and open up /res/values/bools.xml
look for somehing like
config_animateScreenLights
Click to expand...
Click to collapse
and change its value from TRUE to FALSE
and flash the zip, although this method will not show crt effect if your window animations speed is 0.5 and below while smali method crt will work regardless if you set your animations or not in developer settings
CREDITS TO
sorg - for his help in tipping me on whats causing the errors in my logcats
sphinx02 - i based this on his guide
Click to expand...
Click to collapse
Reserved in case I need it for something
Okay so I really did need this for something...
Anyway here is where ill put the devices that didnt work with it
1. Thl w7
the general is, it might not work on mt6577 running android 4.1.2, already have two reports on 4,1,2 as not working
Thats it for now, just report if it didnt work on your device guys
Sent from my H100 using xda app-developers app
thirdzcee said:
so after trying endless number of times including analyzing the smalis of a dozen guides for crt effect and the mysterious libsurfacelinger losing hwcomposer error in logcat which causes the phone to soft reboot after crt animation, i finally have gotten it to work, so let us begin
1st off we need to decompile services.jar and open up smali/com/android/server/PowerManagerService$ScreenBrightnessAnimator.smali
look for this line (code in LIME might look different in your smali)
Code:
.line 2716
.restart local[COLOR="Lime"] v1 [/COLOR] #turningOff:Z
:[COLOR="Lime"]cond_e[/COLOR]
add this after the code, note color in LIME might be different in your smali
Code:
iget-object v4, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x10
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$[COLOR="Lime"]7100[/COLOR](Lcom/android/server/PowerManagerService;I)V
to make sure what access$ yours is, open up PowerManagerService.smali and look for somethings that looks like this
Code:
.method static synthetic access[COLOR="Red"]$XXXX[/COLOR](Lcom/android/server/PowerManagerService;I)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 110
invoke-direct {p0, p1}, Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
return-void
.end method
NOTE the $XXXX in RED as this is what you should put in your PowerManagerService$ScreenBrightnessAnimator.smali
Finally it should look like this afterwards( code in RED is what we added and color in LIME is your access$ which in my case was 7100)
Code:
.line 2716
.restart local v1 #turningOff:Z
:cond_e
[COLOR="Red"] iget-object v4, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x10
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$[COLOR="Lime"]7100[/COLOR](Lcom/android/server/PowerManagerService;I)V[/COLOR]
iget-object v2, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/4 v3, 0x1
#setter for: Lcom/android/server/PowerManagerService;->mWaitKeyguardDraw:Z
invoke-static {v2, v3}, Lcom/android/server/PowerManagerService;->access$2002(Lcom/android/server/PowerManagerService;Z)Z
now recompile and put classes.dex back to android.policy.jar.
and lastly download the attached zip add your android.policy.jar and flash it, or extract and push manually the files to their corresponding folders
reboot, or just run
pkill zygote
from terminal as root and voila you should have crt effect working now,
alternative way is framework-res.apk method, just decompile it and open up /res/values/bools.xml
look for somehing like
and change its value to TRUE
and flash the zip, although this method will not show crt effect if your window animations speed is 0.5 and below while smali method crt will work regardless if you set your animations or not in developer settings
Click to expand...
Click to collapse
goid one bro, i will try...
but for editing framework-res.apk
actually we have to change, true to false... afaik.... btw it doesn't work in my device.... (jb)...
Sent from my IRIS_501 using xda premium
akash akya said:
goid one bro, i will try...
but for editing framework-res.apk
actually we have to change, true to false... afaik.... btw it doesn't work in my device.... (jb)...
Sent from my IRIS_501 using xda premium
Click to expand...
Click to collapse
Oh I wasnt sure, will recheck again as I was just basing it on memory
But
It should work after flashing the zip which contains a more completely built hwcomposer, youll notice if you previously had hwcomposer issues in logcat before theyll go away after flashing the new one
Sent from my H100 using xda app-developers app
thirdzcee said:
Oh I wasnt sure, will recheck again as I was just basing it on memory
But
It should work after flashing the zip which contains a more completely built hwcomposer, youll notice if you previously had hwcomposer issues in logcat before theyll go away after flashing the new one
Sent from my H100 using xda app-developers app
Click to expand...
Click to collapse
working like a charm bro...
akash akya said:
working like a charm bro...
Click to expand...
Click to collapse
Great:thumbup::thumbup::thumbup:
Sent from my H100 using xda app-developers app
Thanks for guide...
Got working on my MMX A110........
thirdzcee said:
so after trying endless number of times including analyzing the smalis of a dozen guides for crt effect and the mysterious libsurfacelinger losing hwcomposer error in logcat which causes the phone to soft reboot after crt animation, i finally have gotten it to work, so let us begin
1st off we need to decompile services.jar and open up smali/com/android/server/PowerManagerService$ScreenBrightnessAnimator.smali
look for this line (code in LIME might look different in your smali)
Code:
.line 2716
.restart local[COLOR="Lime"] v1 [/COLOR] #turningOff:Z
:[COLOR="Lime"]cond_e[/COLOR]
add this after the code, note color in LIME might be different in your smali
Code:
iget-object v4, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x10
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$[COLOR="Lime"]7100[/COLOR](Lcom/android/server/PowerManagerService;I)V
to make sure what access$ yours is, open up PowerManagerService.smali and look for somethings that looks like this
Code:
.method static synthetic access[COLOR="Red"]$XXXX[/COLOR](Lcom/android/server/PowerManagerService;I)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 110
invoke-direct {p0, p1}, Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
return-void
.end method
NOTE the $XXXX in RED as this is what you should put in your PowerManagerService$ScreenBrightnessAnimator.smali
Finally it should look like this afterwards( code in RED is what we added and color in LIME is your access$ which in my case was 7100)
Code:
.line 2716
.restart local v1 #turningOff:Z
:cond_e
[COLOR="Red"] iget-object v4, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x10
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$[COLOR="Lime"]7100[/COLOR](Lcom/android/server/PowerManagerService;I)V[/COLOR]
iget-object v2, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;
const/4 v3, 0x1
#setter for: Lcom/android/server/PowerManagerService;->mWaitKeyguardDraw:Z
invoke-static {v2, v3}, Lcom/android/server/PowerManagerService;->access$2002(Lcom/android/server/PowerManagerService;Z)Z
now recompile and put classes.dex back to android.policy.jar.
and lastly download the attached zip add your android.policy.jar and flash it, or extract and push manually the files to their corresponding folders
reboot, or just run
pkill zygote
from terminal as root and voila you should have crt effect working now,
alternative way is framework-res.apk method, just decompile it and open up /res/values/bools.xml
look for somehing like
and change its value from TRUE to FALSE
and flash the zip, although this method will not show crt effect if your window animations speed is 0.5 and below while smali method crt will work regardless if you set your animations or not in developer settings
Click to expand...
Click to collapse
THANKS A TON!!!!!!!!!!!!!!!!:good::good::good::good::good::good::highfive:
WORKS LIKE A CHARM !!!!!!!!!!!!! AWESOME!..............
Screen Lights On
I tried and working good.
Thanks a lot.
But getting lil bug.
If I screen off in locked screen, it give crt effect screen of den again its light on.
even in any msg light got on even i turned of notification lights.
can you tell me how to fix?
Thank a lot for this mod.
jigarmpattani said:
I tried and working good.
Thanks a lot.
But getting lil bug.
If I screen off in locked screen, it give crt effect screen of den again its light on.
even in any msg light got on even i turned of notification lights.
can you tell me how to fix?
Thank a lot for this mod.
Click to expand...
Click to collapse
Yes it is the only bug as of now , unfortunately I still have not found the proper line where to add the codes in smali due to difference in Samsung framework from ours, but if you leave screen alone screen timeout will just turn screen off without screen turning on again
Sent from my Nexus 7 using XDA Premium HD app
akash akya said:
working like a charm bro...
Click to expand...
Click to collapse
@akash akya buddy can u please make crt effect flash zip for stock 4.1.1 v1.11 jb ... canvas2 .. it would be wonderfull
Thanks
Awesomely Working! Just That When Lock Button Is Pressed After The CRT Again The LockScreen Appears! This Is Surely Gonna Be In My Next Release! Keep Up the Good Work Bro!
ankurbata said:
Awesomely Working! Just That When Lock Button Is Pressed After The CRT Again The LockScreen Appears! This Is Surely Gonna Be In My Next Release! Keep Up the Good Work Bro!
Click to expand...
Click to collapse
Yes but not pressing power and leaving screen alone to timeout will turn screen off without turning on again, will update this when I get the fix for it working
Sent from my H100 using xda app-developers app
One more goodie I have got as temporary solution....
Of there is a button on statusbar for power with keycode value=26 then its not turning the screen.
Like I did in my ui in the screenshot....
"""Hitting Thanks Don't Cost You Anything So Why Don't You Try Hitting It......."""
Sent From Mind Blowing Canvas Using SUVI-Heart Rom.....<3<3<3
BOND1987 said:
One more goodie I have got as temporary solution....
Of there is a button on statusbar for power with keycode value=26 then its not turning the screen.
Like I did in my ui in the screenshot....
"""Hitting Thanks Don't Cost You Anything So Why Don't You Try Hitting It......."""
Sent From Mind Blowing Canvas Using SUVI-Heart Rom.....<3<3<3
Click to expand...
Click to collapse
You can actually use the lidroid toggles lock now toggle instead of adding keycode
Sent from my H100 using xda app-developers app
But then again it would be much easier to put the keycode if you dint have lidroid toggles,,, thanks for the tip bond
Sent from my H100 using xda app-developers app
Guys , instead of editing services.jar .... only edit framework-Res.apk I.e in values / bools --> change config_animatescreenlights = false "
And then compile and flash it the zip containing hwcomposer.mt6577.so given by thirdzcee
Sent from my Micromax A110 using XDA Premium HD app
Akhilendra1711 said:
Guys , instead of editing services.jar .... only edit framework-Res.apk I.e in values / bools --> change config_animatescreenlights = false "
And then compile and flash it the zip containing hwcomposer.mt6577.so given by thirdzcee
Sent from my Micromax A110 using XDA Premium HD app
Click to expand...
Click to collapse
that is already posted in op as the alternate method but be advised if you set your animations speed to x.5 or off crt effect wont show
thirdzcee said:
that is already posted in op as the alternate method but be advised if you set your animations speed to x.5 or off crt effect wont show
Click to expand...
Click to collapse
Actually sir I'm just giving my opinion if someone did not try by framework-res method . And yep by this method as u said setting animation speed off or x.5 then animation won't be shown .
Sent from my Micromax A110 using XDA Premium HD app
so sad..it can't work on JB 4.1.2...can anyone share their hwcomposer of 4.1.2 which already have been edited for crt effect..
Btw, thanks thirdzee for your reply....

[MOD][GUIDE][GB] WIFI & BT ON/OFF Switches on Settings ***HOT***

Hey dudes!
Ace-I Team is back with a new guide. One of the most advanced ICS Features now comes on Gingerbread! Admit it, Everyone has been attracted by this feature! That's why : THIS IS THE MOST WANTED GUIDE FOR GINGERBREAD DEVICES EVER!!
Wifi and bluetooth ON/OFF Switches on Settings!
Requirements :
-APK Multi Tool
-Notepad++
-Sources on the attachments
-High Smali & xml knowledge
-Brain
-Patience
Click to expand...
Click to collapse
Let's go!
PART I
1. Decompile Settings.apk
2. Extract the sources. Copy switch_holo_dark.xml from sources and paste it on drawable folder.
3. Copy the PNGs from the sources and paste them on drawable-mdpi folder.
4. Copy icon_checkbox_preference.xml from the sources and paste it on layout folder.
5. Go to res/values/styles.xml.
Paste this text on the end of the file before
Code:
<style name="Switch">
<item name="android:checkboxStyle">@style/Widget.CompoundButton.CheckBox.Holo.Dark</item>
</style>
<style name="Widget.CompoundButton.CheckBox.Holo.Dark" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/switch_holo_dark</item>
</style>
6. Go to res/values/public.xml
Paste this text on the end of he file before
Code:
<public type="layout" name="icon_checkbox_preference" id="0x7f03005a" />
</resources>
7. Go to xml/Settings.xml
Replace this :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
With this :
Code:
<com.android.settings.IconCheckBoxPreference android:title="WIFI" android:key="toggle_wifi" settings:icon="@drawable/ic_settings_wireless" />
<com.android.settings.IconCheckBoxPreference android:title="Bluetooth" android:key="toggle_bluetooth" settings:icon="@drawable/ic_settings_bluetooth2" />
After editing it will look like this :
8. Recompile Settings.
Click to expand...
Click to collapse
PART II
1. Decompile Settings.apk again
2. Go to smali/com/android/settings
3. Copy icon_checkbox_preference.smali from the source on the that folder.
4. Open R$Styleable
- Find :
Code:
# static fields
.field public static final BatteryHistoryChart:[I
Below that paste :
Code:
.field public static final IconPreference:[I
.field public static final IconPreference_icon:I
Click to expand...
Click to collapse
- Find :
Code:
const v1, 0x7f010001
aput v1, v0, v2
Below that paste :
Code:
sput-object v0, Lcom/android/settings/R$styleable;->IconPreference:[I
.line 6450
new-array v0, v3, [I
const v1, 0x7f010001
aput v1, v0, v2
After the edit it will look like this :
Code:
const v1, 0x7f010001
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->IconPreference:[I
.line 6450
new-array v0, v3, [I
const v1, 0x7f010001
aput v1, v0, v2
sput-object v0, Lcom/android/settings/R$styleable;->IconPreferenceScreen:[I
Click to expand...
Click to collapse
5. Open Settings.smali
Below # instance fields paste this text :
Code:
.field private mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler;
.field private mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;
2 Lines Above # instance fields paste this text :
Code:
# static fields
.field private static final KEY_TOGGLE_BLUETOOTH:Ljava/lang/String; = "toggle_bluetooth"
.field private static final KEY_TOGGLE_WIFI:Ljava/lang/String; = "toggle_wifi"
After edition it will look like this :
Code:
# static fields
.field private static final KEY_TOGGLE_BLUETOOTH:Ljava/lang/String; = "toggle_bluetooth"
.field private static final KEY_TOGGLE_WIFI:Ljava/lang/String; = "toggle_wifi"
# instance fields
.field private mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler;
.field private mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;
.field private mIntentReceiver:Landroid/content/BroadcastReceiver
;
Click to expand...
Click to collapse
- Find :
Code:
invoke-virtual {p0, v4}, Lcom/android/settings/Settings;->addPreferencesFromResource(I)V
- Below that paste this text :
Code:
const-string v0, "toggle_wifi"
invoke-virtual {p0, v0}, Lcom/android/settings/Settings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/CheckBoxPreference;
new-instance v1, Lcom/android/settings/wifi/WifiEnabler;
invoke-direct {v1, p0, v0}, Lcom/android/settings/wifi/WifiEnabler;->(Landroid/content/Context;Landroid/preference/CheckBoxPreference;)V
iput-object v1, p0, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;
const-string v0, "toggle_bluetooth"
invoke-virtual {p0, v0}, Lcom/android/settings/Settings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v0
check-cast v0, Landroid/preference/CheckBoxPreference;
new-instance v1, Lcom/android/settings/bluetooth/BluetoothEnabler;
invoke-direct {v1, p0, v0}, Lcom/android/settings/bluetooth/BluetoothEnabler;->(Landroid/content/Context;Landroid/preference/CheckBoxPreference;)V
iput-object v1, p0, Lcom/android/settings/Settings;->mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler;
- Find :
Code:
.method protected onPause()V
- Replace the whole method with this method :
Code:
.method protected onPause()V
.locals 1
invoke-super {p0}, Landroid/preference/PreferenceActivity;->onPause()V
iget-object v0, p0, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;
invoke-virtual {v0}, Lcom/android/settings/wifi/WifiEnabler;->pause()V
iget-object v0, p0, Lcom/android/settings/Settings;->mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler;
invoke-virtual {v0}, Lcom/android/settings/bluetooth/BluetoothEnabler;->pause()V
iget-object v0, p0, Lcom/android/settings/Settings;->mIntentReceiver:Landroid/content/BroadcastReceiver;
invoke-virtual {p0, v0}, Lcom/android/settings/Settings;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V
.line 78
return-void
.end method
- Find :
Code:
.line 65
invoke-super {p0}, Landroid/preference/PreferenceActivity;->onResume()V
- Below that paste this text :
Code:
iget-object v1, p0, Lcom/android/settings/Settings;->mWifiEnabler:Lcom/android/settings/wifi/WifiEnabler;
invoke-virtual {v1}, Lcom/android/settings/wifi/WifiEnabler;->resume()V
iget-object v1, p0, Lcom/android/settings/Settings;->mBtEnabler:Lcom/android/settings/bluetooth/BluetoothEnabler;
invoke-virtual {v1}, Lcom/android/settings/bluetooth/BluetoothEnabler;->resume()V
Click to expand...
Click to collapse
8. Follow Part III by iamareebjamal
Click to expand...
Click to collapse
Part III : Adding switched and disabling signature check
Adding Buttons in Settings.apk by custom style and Disabling Signature Verification
If you were successful in accomplishing the above procedure. Be happy, but not too much because the key part is left, and that is - Adding those custom ICS Buttons in Settings by overriding the default GB tickview. Or else, you will get checkboxes instead of Switches. You don't wanna do that? Do you?
Enough talking let's roll
Part III (a)
1. Open AndroidManifest.xml located in decompiled Settings.apk
2. Find this:
Code:
<activity android:label="@string/settings_label_launcher" android:name="Settings"
3. Modify it like this:
Code:
<activity android:theme="@style/Switch" android:label="@string/settings_label_launcher" android:name="Settings"
It means you have to add android:theme="@style/Switch" between <activity and android:label="@string/settings_label_launcher"
4. Save the file.
5. Now, as you have edited the AndroidManifest.xml . Android system won't accept your app and refuse to load it as its signature should be changed.
So, sign the recompile the apk and sign it
6. But again, there's one little problem. Android doesn't load system apps with modified signatures for stability of OS, so your app will disappear from app drawer and if you try to open it from any other source, it will say "App isn't installed"
So?
So, sign ALL system apps and framework apps with same key
...OR...
Follow the workaround in (b) part
Click to expand...
Click to collapse
You may have accomplished the above thing but still something needs to be done to complete the procedure. Believe me, it's the last thing
Android System doesn't accept the apks that are signed by default. So we, here, will render that option obsolete by editing some files.
Let's start
Part III (b)
1. Pull services.jar from /system/framework/
2. Extract it's classes.dex and decompile it via my ROM Tolls
3. Go to com/android/server/PackageManagerService.smali
4. Open it and search for
Code:
.method checkSignaturesLP([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
5. Look below it, you should see something like this
Code:
.prologue
.line 1936
if-nez p1, :cond_1
6. Add this below .line 1936
Code:
const/4 v6, 0x0
return v6
Finally, it should look like this:
Code:
.method checkSignaturesLP([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.locals 7
.parameter "s1"
.parameter "s2"
.prologue
.line 1936
const/4 v6, 0x0
return v6
if-nez p1, :cond_1
7. Save the file and recompile classes.dex and then add it to services.jar
8. Now push services.jar and Settings.apk in their respective places and reboot the phone so that signature check changes are affected
9. Enjoy
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Sources
The source : http://www.mediafire.com/download.php?bvcj2fa8r1lv0h7
PNG source only :
- SGS3 : Adding ASAP
-JellyBean/Holo : Adding ASAP
F.A.Q
Q: SGS3 Switches are small even if the image is large enough?
Solution :
1. Go to Res/layout/icon_check box_preference.xml
2. Find android:layout_width="68.0 px"
3. Change it to "85.0 px"
4. Find android:layout_height="20.0px"
5. Change it to "40.0 px"
Actually changing those pixels will not resize the switch pngs. It will make height's and width's available space larger, therefore switches can be strechted easily on their original size.
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Q: On Part II, when editing .method onPause()V, should I delete only the title "method on pause()V" or from method on pause to .end method?
Solution :
You must replace whole method. Delete the on pause()V method then place the code I have written on the same place.
Click to expand...
Click to collapse
Screenshots:
SGS3
Jelly Bean
​
Credits:
Biggest biggest thanks and full credits to b16h22 for making this awesome mod and his open source heart to share it with us and guiding us through on how to accomplish it and giving us permissions to make this thread
loSconosciuto for Signature Verification Disabling Guide
Click to expand...
Click to collapse
Sniper Killer for starting this initiative
iamareebjamal for fixing the AndroidManifest to display the switches in Settings and applying idea of signature verification
Click to expand...
Click to collapse
Ace-i Team for bringing this to you
More UI Changes for Ace-i... Thanks @Sniper Killer :good:
.....
Give a screenshot of those Wifi & BT ON/OFF Switches on Settings in the OP... :fingers-crossed:
brijeshep said:
More UI Changes for Ace-i... Thanks @Sniper Killer :good:
.....
Give a screenshot of those Wifi & BT ON/OFF Switches on Settings in the OP... :fingers-crossed:
Click to expand...
Click to collapse
Y u only Thank him
Wait till the guide is complete
brijeshep said:
More UI Changes for Ace-i... Thanks @Sniper Killer :good:
.....
Give a screenshot of those Wifi & BT ON/OFF Switches on Settings in the OP... :fingers-crossed:
Click to expand...
Click to collapse
SS on the OP.
And btw, thank areeb too as he found the fix of the image. Follow the tut later. I will upload the sources when areeb will complete editing his post.
Cant wait
Sent from my GT-S5830i using xda premium
This is what i am talking about ...wooohoo
All the devs from ace-i section Rockz
Nice team work .
Thanks for the guide.
Sent from my GT-S5830i using xda app-developers app
brijeshep said:
More UI Changes for Ace-i... Thanks @Sniper Killer :good:
.....
Give a screenshot of those Wifi & BT ON/OFF Switches on Settings in the OP... :fingers-crossed:
Click to expand...
Click to collapse
Brijeshep, next version of Ace-i-Sure. Could you put this mod on your next version ROM? I'm got feeling excited!
Hohoho . Guys! Where is the sourses????
Sent from my GT-S5830i using xda premium
misha1996 said:
Hohoho . Guys! Where is the sourses????
Sent from my GT-S5830i using xda premium
Click to expand...
Click to collapse
**** my computer is broken I will fix it today and will upload sources
Sent from my GT-S5830i using Tapatalk 2
If we edit AndroidManifest.xml we must resign all apk of the rom.
If we not do it, app be work before first wipe. And it will work, if we install it from stokk app(settings for example) if we install it for clean system it will say "not installed"
Sent from my GT-S5830i using xda premium
misha1996 said:
If we edit AndroidManifest.xml we must resign all apk of the rom.
If we not do it, app be work before first wipe. And it will work, if we install it from stokk app(settings for example) if we install it for clean system it will say "not installed"
Sent from my GT-S5830i using xda premium
Click to expand...
Click to collapse
Read my post again.
PS - Part III (b) to be specific
Oh....im noob noob noobest in english:banghead:
And i understand only part A
Else....is it be work with stock settings.apk??
Sent from my GT-S5830i using xda premium
---------- Post added at 06:53 PM ---------- Previous post was at 06:50 PM ----------
Also....can try do update-script with textkey, which be resign all apk, what install
Sent from my GT-S5830i using xda premium
misha1996 said:
If we edit AndroidManifest.xml we must resign all apk of the rom.
If we not do it, app be work before first wipe. And it will work, if we install it from stokk app(settings for example) if we install it for clean system it will say "not installed"
Sent from my GT-S5830i using xda premium
Click to expand...
Click to collapse
As @iamareebjamal has already mentioned,
iamareebjamal said:
Android System doesn't accept the apks that are signed by default. So we, here, will render that option obsolete by editing some files.
Click to expand...
Click to collapse
I'd suggest you to read Part III (b) of the guide.
Hope you got your answers.
What about stock settings.apk?
Sent from my GT-S5830i using xda premium
misha1996 said:
What about stock settings.apk?
Sent from my GT-S5830i using xda premium
Click to expand...
Click to collapse
Not tested but you can give it a try.
Sent from my GT-S5830i using Tapatalk 2

[GUIDE][SMALI]S3 - Understanding and Creating Smali Mods

I posted this in S2 section a while ago but after talking with a senior mod I'm posting here as its useful on this device
Firstly I am by no means an expert and am just trying to share what i have learnt about smali as its hard to find much info about general smali. Contributions to the thread are always welcome
For the last year or so I have been developing AllianceROM on the i9100. During this time I have learnt lots about smali through a combination of trial and error and guides I have found here on XDA. The guides are great but one thing that stands out is that they all follow the same pattern of “Find a certain line in a certain file and copy/paste" to replace methods or chunks of code for the desired outcome. Whilst this is a great means to an end it is only a means to that particular end. Most people wont actually understand what they are doing or how it works and will blindly do as instructed.
So I thought that I would try to write some general guides. The aim is to give you the means to dream up your own mods and know how to go about implementing them from scratch by yourself. As I say, I am by no means an expert but hopefully there should be enough here to set you on your way. These are the methods I used to create many of the mods in alliance, lots of which didn’t exist on Touchwiz devices before.
You will need certain tools to do this but I am not going into how to decompile etc. Before attempting this you should have a good knowledge of decompiling apks and modding in general and have the following tools available:
ADB
Notepad ++
A good image editor like Photoshop or GIMP
The guides are in 3 sections:
Coloring stuff with color pickers
Toggling stuff to show or hide
List choices for things like toggles in view etc
For the purposes of these guides I am using an apk from our legendary alliance developer ficeto. He has made this app to enable us to easily add color pickers, checkboxes and lists by adding a single line to an xml. Huge huge thanks to him as he made this a lot easier!! You can use this to test your mods but please dont rename everything from ficeto to "ubermodders" or something and try to pass it off as your own. If you do it will be reported It is to be used as is, not changed or renamed (this causes problems for people installing alliamceMOD) and dont forget to credit ficeto!!
Please feel free to ask general smali questions here too!
So lets get started!!
Coloring Stuff:
Text Colors
There is a ton of stuff in alliance that can be colored, from text to images or backgrounds. Text works by using the setTextColor method and images and backgrounds use setColorFilter to lay a color over the top of an image ot setBackgroundColor to fill the entire background. I will cover one of each in this section starting with text color. The 3 methods use similar code and text color is the easiest to start with.
So….you decide you want to change the color of some text using a picker. For this example I will use the dropdown date. Where do you start? As you probably know dropdown stuff is dealt with by SystemUI.apk. When you decompile that you are faced with a ton of smali files. The best way to start is to use a handy function in Notepad++ called “Find in Files” which will search for certain text within files. Funnily enough its under the Search menu at the top!!
In this case the first port of call would be to search for the obvious word “date”. This returns a ton of results and you should see an obvious file called DateView.smali. If your search doesn’t return much for your specific choice of text then you have a couple of options:
1) look in the layout xml and find the id for the view you want to change. Look the id up in public.xml and then search that using “Find in Files” again. If you are unsure of the text view id then use hierarchy viewer from the tools folder of the sdk which will show you all the views on your screen
2) look through the smali files manually for anything that sounds like it might contain your target
So you think you found the right smali. Open it and search for “setText(Ljava/lang/CharSequenceV”. This will hopefully return a line something like this:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
Scroll up until you see the name of the method. This should give you a good idea if you have the right text. In this case that line was in .method private final updateClock()V which sounds about right!
What this line is doing is calling settext with the parameter Ljava/lang/CharSequence which is the date string. Invoke virtual calls the method and the bit in the brackets {p0, v5} is the date view (p0 means “this file”) and the string (v5). The v is a register. Registers are used to store things. A few lines up in the method you will see something similar to this:
invoke-virtual {v0, v9, v5}, Landroid/content/Context;->getString(I[Ljava/lang/ObjectLjava/lang/String;
move-result-object v5
What that is doing is using getString to get the date and moving it into the register v5. This v5 is then used in our setText call.
So now we have identified our text view in the smali we can use setTextColor to change its color.
A bit of background is useful here. Color pickers do not act directly on any smali. Your phone has a database where it stores its settings. It is located in data/data/com.android.providers.settings/databases/settings.db. You can open it with Root Explorer and take a look. You will see a standard database with entries and values. What color picker code does is put an entry in this database with a “key” and a hex code. The smali then uses this key to look up the hex color it needs to set.
Now we need to add some code to look up that entry and return the color to the smali. There are 3 elements to this:
The ContentResolver
This is used to resolve the entry in the database. In order to use the content resolver we must put it into a register as we mentioned earlier. At the top of the method you will see .locals X where X is a number. This is the number of registers used in the method. So if it says .locals 5 there will be v0,v1,v2,v3 and v4. We need to add 3 to this value as we will be using 3 new registers. One for the resolver, one for the default color (in case there is no entry in the database it needs to have a color to set) and one for the key.
Now we need context in order to get the content resolver. There are a few ways to do this. A lot of files have a field called mContext. This can be used directly like this:
iget-object v5, p0, Lcom/android/systemui/statusbar/policy/BrightnessController;->mContext:Landroid/content/Context;
This is using iget-object to put mContext into v5. As mentioned earlier the p0 mean “this”.
The v5 should be the first of the new registers you added. So if previously .locals was 5 and you changed it to 8 then this would be v5 as v0 to v4 already exist. You can reuse registers but you can run into problems if it is needed further through the code so it is advisable to add new.
Alternatively, smali files whose .super is a view (look at the top of the smali for .super) like the date view we are working with here can use getcontext to get context like this:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v5
Now we have context we can use it to get the content resolver and put it into the register using this line:
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
The Key
Next we need the key that we want to look up in the database. This is as simple as :
const-string v6, "date_color"
This just puts the constant string “date_color” into v6. The text inside the “” can be anything you like but cannot have spaces and the key must match the picker key we will add later.
The Default Value
Next we need a default color for in case there is no entry in the database. For example on a fresh install or after a wipe. The value is hex but in reverse preceded with -0x so ICS blue 33b5e5 becomes -0xcc4a1a because 0 = F, 1 = E, 2 = D etc
0 = F
1 = E
2 = D
3 = C
4 = B
5 = A
6 = 9
7 = 8
8 = 7
9 = 6
A = 5
B = 4
C = 3
D = 2
E = 1
F = 0
We put that into our 3rd new register v7 using:
const v7, -0xcc4a1a
Now we have all the needed elements we can use them to return the color to the smali from the database using:
invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
This uses the getInt method with our parameters. I have colored them so you can see how the registers relate to the getInt method. V5 is the content resolver, v6 is the string and v7 is the integer of the color.
The resultant color from the database is then moved into v5. We can use v5 register again as we no longer need the content resolver.
The color from the database is now stored in v5. From the settext line we found earlier we can see that the text view is referred to as p0:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
The first item in the brackets is the text view. This wont be p0 in all cases. Its only p0 here because we are working with a smali that has a view as its super so the smali is effectively the text view. If working with something like ToggleSlider for example we may have something like:
invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
So in this case the text view is in v2.
We can now use setTextColor on our date which is p0 with the color which we put in v5:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setTextColor(I)V
The full code looks like this:
invoke-virtual {p0, v3}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v5
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v6, "date_color"
const v7, -0xcc4a1a
invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setTextColor(I)V
Oh and just so you know the big V at the end of lines like ;->setText(Ljava/lang/CharSequenceV and ;->setTextColor(I)V means the method returns void or nothing.
Hopefully the apk will now compile and you can test the result. In order for something to change immediately you need observers but I wont go into that here. This will only change when the updateClock method runs. A reboot will also trigger it to update the color.
I know I have written a lot to take in here. But hopefully this will give you a good basic understanding of how methods are called with parameters in smali.
Next stop…..choosing the color!
Thanks to ficeto this part is REALLY easy!
Decompile the attached apk. You will find a file called preferences.xml in the xml folder. Open it with Notepad++. Each instance of this line will add another picker…
<com.ficeto.colorpicker.ColorPickerPreference android:title="Dropdown Date Color" android:key="date_color" android:summary="Select Color" android:dialogTitle="Select Color" />
Change the android:title to what you want your picker to be called and change android:key=“date_color” to whatever the key you used earlier was. So if your smali was....
const-string v6, "clock_color"
Then the android:key would be “clock_color”.
That’s it. Compile and push the apk or install as a system app and it will show in your app drawer as custom settings. Now go test your new mod!!
Any questions or problems please ask (with logs and files if possible) as its impossible to cover all eventualities in a guide.
OK....time for part 2
COLORING IMAGES
This part will cover two things. Coloring images in a similar way to setting text colors from part 1 and also how to create a method and pass it context. Sometimes you wont be able to use mContext or getcontext but most smali files have context already in their init so you can use that and pass it to a new method. Using your own method is more efficient as you can run your code to get the color from the database just once and use it on multiple items and in multiple places.
There are three main ways to color an image. Using the method setColorFilter(I)V which is in android/widget/ImageView smali in framework2.jar, using method public final setColorFilter(ILandroid/graphics/PorterDuff$ModeV in the same file and using method public setColorFilter(ILandroid/graphics/PorterDuff$ModeV in android/graphics/drawable/Drawable smali in framework.jar. It depends what and where the image is as to which you use. All three methods overlay a color on an existing image and the two with porterduffmode have a means of choosing what effect the overlay has. There is more about this at the bottom of the post.
Lets start....
Things are stored in fields in a smali. At the top of the file you will see them like this:
Code:
.field protected mType:Ljava/lang/String;
.field protected mView:Landroid/view/View;
.field protected mIcon:I
These fields can be used to store things of their type. So in the ones shown above you would put a string, a view and an integer respectively. You can see the type a field should hold after the :
In order to use your own method to get the color from the database we need to add a new field to store the value in so we can use it in another method. For this example i am going to use the toggle icons in lidroids toggle mod but this can be done on pretty much any image you want.
At the top of the smali with the other instance fields add your new field. You can call it whatever you want and it is going to store an integer so you will need an I after the colon. Im calling this one mToggleColor for obvious reasons:
Code:
.field private mToggleColor:I
We now have somewhere to put our value so now we can write the new method. At this point you should refer to the text color guide for explanations about the content resolver, context and registers as I will assume you have an idea about these now.
You can call your method anything you want. It will need 3 registers to store the resolver, default value and integer. This method has no context parameter (in the brackets after the method name) so you would need to use getcontext or mContext....
Code:
.method color_toggles()V
.locals 3
If you are going to use existing context and pass it to your method it would look like this. As you can see the method is expecting context as its parameter when called...
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
Now we get the content resolver so we need context. If using the first method then you would need to call your view and invoke getcontext like this in stock toggles:
Code:
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
As metioned in the text color guide your contentresolver is now in v1.
If you are passing context to your method then the context is the parameter of the method. Each item in brackets after methods name is stored in a p. So in this case the context would be in p1. All you need to do is use it to get the resolver:
Code:
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
Again...resolver now in v1.
The next part is identical to the text color guide so i wont repeat it. But you should have now something that looks like this:
Code:
.method color_toggles()V
.locals 3
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
const-string v2, "theme_color"
const v3, -0x4d06ff
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
or if passing context:
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "theme_color"
const v3, -0xcc4a1a
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
Both of the above now have your color stored in v1. We can now put it into your new field that you created earlier using iput:
Code:
iput v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mToggleColor:I
This puts the integer in v1 into the field in p0 (this file) and stores it as mToggleColor
Your method is not expected to return anything meaning something doesnt call it and ask for a value in reply so after this we need:
Code:
return-void
....and then to finish the method....
Code:
.end method
The final methods look like this:
Code:
.method color_toggles()V
.locals 3
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
const-string v2, "theme_color"
const v3, -0x4d06ff
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
iput v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mToggleColor:I
return-void
.end method
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "theme_color"
const v3, -0xcc4a1a
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
iput v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
return-void
.end method
Now your color can be put into your new field we need to invoke your new method. Otherwise it will just be an empty field. You can do this in a number of places. Either directly before you use it or in the methods init. We will come back to this.
In order to color an image you need to find it first. There are ways of calling the image by its id but looking for it this way will familiarise you more with smali. Images can be set using setImageResource and setImageDrawable. If you search firstly for the images id in the smalis to find the correct file and if that doesnt find anything then have a look at file names and see what you can find that looks like it might be right. In this case PowerButton smali has a method called :
Code:
.method private updateImageView(II)V
...which uses setImageResource(I)V. Sounds like a good place to start!
Code:
.method private updateImageView(II)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
return-void
.end method
We need to invoke your new method. If you are not passing context you can just do this:
Code:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->color_toggles()V
...which will invoke your new method and put your color in your field.
Or to pass context you would do:
Code:
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/alliance/systemui/quickpanel/PowerButton;->color_toggles(Landroid/content/Context;)V
In the above code the method you are in has a Landroid/view/View; stored in v1. You can use getContext on this and then invoke your method. The invoke says to call your method color_toggles(Landroid/content/ContextV which is in this file (p0) with the parameter v1 (the context). Now your method has run we can use iget to get the color from the field:
Code:
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
You can see in the original updateImage method that the imageView is in v0. We can now apply the color (in v1) to the image (v0).
Code:
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
Final methods would look like this:
Code:
.method private updateImageView(II)V
.locals 2
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->color_toggles()V
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
return-void
.end method
or
Code:
.method private updateImageView(II)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/alliance/systemui/quickpanel/PowerButton;->color_toggles(Landroid/content/Context;)V
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
return-void
.end method
Your source image should be white. You can make them semi transparent so the color is not as bright. For example the off toggles could be 50% transparent so they will only appear dim compared to the on ones.
You will notice in PowerButton smali there is another method....
Code:
.method private updateImageView(ILandroid/graphics/drawable/Drawable;)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
return-void
.end method
This is the same except it uses 2 parameters (in the brackets after the name) of and (I)nteger and Landroid/graphics/drawable/Drawable rather than two (I)ntegers.
You don't HAVE to use your own method. You could just use identical code to the textColor code straight after the setImageResource and invoke setColorFilter on the ImageView rather than setTextColor on a TextView. But I think it is good practice to use a new method
PorterDuffMode
Sometimes when you implement a color picker you will get an outcome you dont want like a battery that had a a white centre and the fill in a color wouldnt show the level as it would all have the same color overlay. Instead of using setColorFilter(I)V you can use setColorFilter(ILandroid/graphics/PorterDuff$ModeV.
If you are familiar with Photoshop you may be better than me at this but basically it changes the way the color is laid over. Using different modes will give different results. As Im not great with Photoshop for me its more trial and error!
There are lots of different modes:
PorterDuff.Mode ADD Saturate(S + D)
PorterDuff.Mode CLEAR [0, 0]
PorterDuff.Mode DARKEN [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)]
PorterDuff.Mode DST [Da, Dc]
PorterDuff.Mode DST_ATOP [Sa, Sa * Dc + Sc * (1 - Da)]
PorterDuff.Mode DST_IN [Sa * Da, Sa * Dc]
PorterDuff.Mode DST_OUT [Da * (1 - Sa), Dc * (1 - Sa)]
PorterDuff.Mode DST_OVER [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc]
PorterDuff.Mode LIGHTEN [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)]
PorterDuff.Mode MULTIPLY [Sa * Da, Sc * Dc]
PorterDuff.Mode OVERLAY
PorterDuff.Mode SCREEN [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
PorterDuff.Mode SRC [Sa, Sc]
PorterDuff.Mode SRC_ATOP [Da, Sc * Da + (1 - Sa) * Dc]
PorterDuff.Mode SRC_IN [Sa * Da, Sc * Da]
PorterDuff.Mode SRC_OUT [Sa * (1 - Da), Sc * (1 - Da)]
PorterDuff.Mode SRC_OVER [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc]
PorterDuff.Mode XOR [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
The letters in CAPITALS are the what you put as the parameter.
I have found that MULTIPLY is the most useful. SRC_ATOP is used as default in setColorFilter(I)V
To use one you need to put the mode into a register. You do that using sget:
Code:
sget-object v1, Landroid/graphics/PorterDuff$Mode;->MULTIPLY:Landroid/graphics/PorterDuff$Mode;
Then you call the porterduff setcolorfilter method instead of the normal one. Like this:
invoke-virtual {v6, v12, v1}, Landroid/widget/ImageView;->setColorFilter(ILandroid/graphics/PorterDuff$ModeV
...instead of this:
invoke-virtual {v6, v12}, Landroid/widget/ImageView;->setColorFilter(I)V
There is a good article here
Please ask if anything is unclear.
Toggles
You have learnt how to get a value from the database creating a toggle is pretty straightforward. For this example I will use toggling the text on lidroid toggles but you can use this on anything from settings button in statusbar to things stopping auto scroll on toggles etc.
Again we start by finiding the method we need to mod. Look at the top of smali files for the field names. This may help you to find the item you wish to toggle. Method names will also help you find your place. In this example we can see in PowerButton smali there is a method called:
Code:
.method protected updateText()V
Obvious huh! It wont always be that easy to find so i will cover how to call something by it's ID later in this post.
In this method you can see that the text is set by calling the setText method. There are two ways to do this. The obvious thing to do is not to run this line so the text will not be set. This is the first way i will cover and it is the way that things are toggled such as ink effect or crt etc rather than showing/hiding things. I will get to that later.
TURNING THINGS ON/OFF
We need to read that value into our smali. This is done in exactly the same way as a color so if you are not sure please go back and read those posts.
This would be added the line before the setText call....
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
...dont forget to add to .locals if you are using a new register!! That gets us context so now we can...
Code:
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
...which gets the value from the database which will be 1 or 0 for on/off and puts it into v3.
To toggle something we then act on that value. The if-nez checks if a value is non-zero. So the next line would be:
Code:
if-nez v3, :cond_skip_text
....as you can see, if v3 is non-zero then it goes to the condition skip_text.
All we need to do now is make a new cond called skip_text after the setText line so it effectively does just that.....skips the setText. Right before return-void put:
Code:
:cond_skip_text
That's it. All you have to do with a toggle to turn something on or off is skip the chunk of text that does what you want to stop. So as long as your new cond comes after it then it should work
SHOWING/HIDING
This works in exactly the same way as above but instead of skipping code you are going to use setVisibility(I)V method.
We have got the value from the database as we did before:
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_show_text
To hide something we must set visibility of the item to "gone". The value for this is 0x8. Visible is 0x1. If the database value returns 0 then the item is unchecked and so should be hidden. If it returns 1 then the item should be visible.
If the value from the database was 1 and the checkbox was ticked then you can use the value in v3 as the value for setVisibility. If it was 0 then the value needs to be set to 0x8 for "gone". We can put 0x8 into v4 here because the line will be skipped if the checkbox was checked:
Code:
const v3, 0x8
....now we add the new cond:
Code:
:cond_show_text
and invoke the set visibility which now has either 0x1 or 0x8 in it.
Code:
invoke-virtual {v1, v3}, Landroid/widget/TextView;->setVisibility(I)V
This tells the code to find the place labelled :goto_new so we add that straight after the code that sets visibility to shown. The full code would look like this....
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_show_text
const v4, 0x8
:cond_show_text
invoke-virtual {v1, v4}, Landroid/widget/TextView;->setVisibility(I)V
Thats it!
CALLING THINGS BY ID
Say you wanted to make a show/hide for the recents button that can be added to dropdown header. You can call it by it's public ID and then use setvisibility. Create a new method like you did for coloring images (refer to that guide if unsure), get a value from the database, test for non-zero and skip to cond. You can use mCcontext here from in Phonestatusbar:
Code:
.method Update_recents()V
.locals 6
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "recents_button"
const/4 v3, 0x1
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_1
const v3, 0x8
Now to get the image we can use findViewById method. In order to use it we need the parent view that contains the image. In Phonestatusbar you can get to most stuff by using the field mStatusBarWindow.
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
Now we get the id of the image from public.xml and put it into a register:
Code:
const v5, 0x7f0d0014
....and then findViewById. This method expects an integer as a parameter which we have in v5...
Code:
invoke-virtual {v4, v5}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
Now we have the item we can setVisibility with the value in v3:
Code:
:cond_1
invoke-virtual {v4, v3}, Landroid/widget/LinearLayout;->setVisibility(I)V
In this case I used LinearLayout but you can use imageView or whatever depending what you are doing. The full method would look like this:
Code:
.method Update_recents()V
.locals 6
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "recents_button"
const/4 v3, 0x1
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_1
const/4 v3, 0x8
:cond_1
iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
const v6, 0x7f0d0014
invoke-virtual {v5, v6}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
invoke-virtual {v4, v3}, Landroid/widget/LinearLayout;->setVisibility(I)V
return-void
.end method
All we need to do now is to call the method. The best place for this is during makestatusbarview. I put it right after the settings button is set but you can put it in loads of places. It just invokes update_recents_button in p0 (this file):
Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButton:Landroid/widget/ImageView;
iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButtonListener:Landroid/view/View$OnClickListener;
invoke-virtual {v9, v10}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V
[COLOR="Red"] invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->update_recents_button()V[/COLOR]
Thats all for now
USEFUL POSTS:
NOTEPAD++ SMALI HIGHLIGHTING - Thanks to @majdinj
LIST OF DALVIK OPCODES - Thanks to @majdinj
good work Goldie, 5st
Goldie said:
USEFUL POSTS:
NOTEPAD++ SMALI HIGHLIGHTING - Thanks to @majdinj
LIST OF DALVIK OPCODES - Thanks to @majdinj
Click to expand...
Click to collapse
this is great! im good with xml, scripting, binary etc etc, Im starting to learm smali and honestly this guide is perfect to the T! thanks!
Thank you very much, sir!
Keep that great work up.

Categories

Resources