{TUTORIAL}[How To] 4-Way Reboot + Theminig MediaTeK Devices - MTK & Low End Device - Android Themes

{TUTORIAL}[How To] 4-Way Reboot + Theminig MediaTeK Devices - MTK & Low End Device
Hello Everyone,
First Of All and Everything, Let me Thank Some People First To made it possible what I am posting Today.
Credits​@iBotPeaches - Without Him Decompiling and Recompiling any apk is a dream. So we must thank him for this (ApkTool).
@Ticklefish - For His Wonderful Tool TMA. Just loving to work with that at ease,
@Adi Aisiteru Reborn - A Wonderful Person, Very Helpful and have so many nice guides to go through and learn.
@majdinj- A wonderful Guide to get 4-way reboot method.
@bombaybadboy - A nice person and a really a nice contributor to this community.
@joehanh88 - A Good Guide to follow and will help you in everything you do.
@akash akya- A good friend who helped me in doing some nice thing for MediaTek Device and So many guides are also by him to follow with.
@ XDA Forum - Can't Say anything, As Its my school and being a student I will never like to hear anything wrong related to it.
@ To All Other Dev Who Made It possible or If I am including anything from yours so please PM to mention your name in Credits. Please....
Now Let's Star With this Guide :-
-: Transparent Status bar & Notification Full Down:-
​
The Most Common thing to get first but then also a difficult thing to figure it out.
Decompile your SystemUI.apk and go to SystemUI/res/values--
So the First thing is Changing the "Drawables.xml" -
Find this
Code:
<item type="drawable" name="status_bar_background">#[COLOR=Red]3f000000[/COLOR]</item>
Change this RED Values with anything that you want to as accordingly with the HEX Color values.
Wait we are not done with that.
Now Copy these lines at the end of drawable before this line "</resources>"
Code:
<item type="drawable" name="notification_header_bg">#[COLOR=Red]88000000[/COLOR]</item>
<item type="drawable" name="notification_panel_bg">#[COLOR=Red]88000000[/COLOR]</item>
<item type="drawable" name="status_bar_bg_tile">#[COLOR=Red]00000000[/COLOR]</item>
Again Same Change RED values with what your need is.
Now Open "Colors.xml"
and change this line -
Code:
<color name="notification_panel_solid_background">#[COLOR=Red]3f000000[/COLOR]</color>
The Transparency Values are like :-
Code:
#00000000 - black with 100% transparency
#3F000000 - black with 75% transparency
#7F000000 - black with 50% transparency
#BF000000 - black with 25% transparency
Now You need to find some ".9.png" and delete it.
So Go to - SystemUI/res/drwable-hdpi (as per the resolution of your devices).
Notification_panel_bg.9.png
Status_bar_bg_tile.9.png
Notification_header_bg.9.png
Delete this image where ever you find it in your SystemUI.apk
"Notification_panel_bg.9.png"
Deleting this will give you your notification panel transparency.
Now Lets Move To Editing Smali. So now go to SystemUI/smali/com/android/systemui/statusbar/phone/
And Open "PhoneStatusBar$FastColorDrawable.smali"
Find this
Code:
.parameter "canvas"
And in that method change this line
Code:
iget v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$FastColorDrawable;->mColor:I
To This
Code:
const v0, 0x[COLOR=Red]00000000[/COLOR]
. Again change RED to the transparency level to suit your need.
Now Decompile your "android.policy.jar"
And go to android.poliy.jar.out/smali/com/android/internal/policy/impl/---
Open "PhoneWindowManager.smali"
There do like mentioned below.
Delete RED Lines
Code:
.line 2627 ------*******
iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemBottom:I
iput v0, p1, Landroid/graphics/Rect;->bottom:I ------ Find This line.
[COLOR=Red]
.line 3061
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mStatusBar:Landroid/view/WindowManagerPolicy$WindowState;
if-eqz v0, :cond_1b
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mStatusBar:Landroid/view/WindowManagerPolicy$WindowState;
invoke-interface {v0}, Landroid/view/WindowManagerPolicy$WindowState;->getSurfaceLayer()I
move-result v0
.line 3063
:goto_1a
return v0
.line 3062
:cond_1b
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBar:Landroid/view/WindowManagerPolicy$WindowState;
if-eqz v0, :cond_26
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mNavigationBar:Landroid/view/WindowManagerPolicy$WindowState;
invoke-interface {v0}, Landroid/view/WindowManagerPolicy$WindowState;->getSurfaceLayer()I
move-result v0
goto :goto_1a
[/COLOR]
.line 3063 ------- *****This line number can be different in yours .
:cond_26
const/4 v0, 0x0
[COLOR=Blue]goto :goto_1a[/COLOR] -------- Change this to "[COLOR=Blue]return v0[/COLOR]"
.end method
Make Sure that the line marked with "******" will have a difference of 3.
So After Doing this it will look like this
Code:
.line 2627
iget v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemBottom:I
iput v0, p1, Landroid/graphics/Rect;->bottom:I
.line 2630
:cond_1
const/4 v0, 0x0
return v0
.end method
Now Recompile your SystemUI.apk & android.policy.jar and flash it.
4-Way Reboot Menu - Thanks to majdinj sir​
Decompile Your "android.policy.jar"
Go To android.poliy.jar.out/smali/com/android/internal/policy/impl/
Open GlobalActions$3.smali and find this-***
Code:
invoke-interface {v0, v1}, Landroid/view/WindowManagerPolicy$WindowManagerFuncs;->reboot(Z)V
If its there then proceed and if not then find above line in all files with name "GlobalActions$#.smali" where "#" will be number.
Ok you find that so lets proceed.
Now in the same folder open "GlobalActions.smali"
And Change the lines (There will be two lines only) -
Code:
Lcom/android/internal/policy/impl/GlobalActions$3
Please Note :- You have to find the number same as in which you find the above *** mentioned lines.
So please make sure for this.
Now Change the "3" or "#" to "99" where "#" is the number in which you find the *** lines.
Done That.
Now Open - "GlobalActions$SinglePressAction.smali"
And Do like given -
Add the BLUE lines in that like its given below
Code:
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/internal/policy/impl/GlobalActions;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x40a
name = "SinglePressAction"
.end annotation
[COLOR=Blue][COLOR=Black] -----------------------Make Sure the gap will be of 2(two) lines[/COLOR]
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]
[COLOR=Blue][COLOR=Black] -----------------------Make Sure the gap will be of 2(two) lines[/COLOR][/COLOR]
# instance fields
.field private final mIcon:Landroid/graphics/drawable/Drawable;
Now Find "#direct methods"
and paste these lines just after this and whithout any gap between "#direct methods" and the lines you pasted.
Code:
.method static constructor <clinit>()V
.registers 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Normal Reboot"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Soft Reboot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Hard Reboot"
aput-object v2, v0, v1
const/4 v1, 0x3
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method
Now Download the given zip file and extract it. Copy all the files of the zip to -
"android.poliy.jar.out/smali/com/android/internal/policy/impl/ here" (here=files downloaded from this guide).
Done That. Now Recompile it and Flash it. Make sure to make a backup before you flash any MOD.
You Successfully Modded these things then Don't Forget To Hit "THANKS" Button for all the persons mentioned in the "CREDITS" section and to Me Also p) and Rate This Thread 5 star.
If you Got in Trouble then post it here. I will be there to help you out. I work as machine but very Unfortunate to say that I am also a human being and I too have Office work, personal life, friends, families, etc. So please have patience. The Time I will see your post, I promise, I will try my best to help you out.
Need More Guides- Find those in post #3.

Want To See My Contributions [ SuperDroid-BOND ]
Though I know, I haven't contributed much to the Community, but here are few of my Works:-
Older Ones (Till 2015)
External Apps Modded :-
SlimKat Camera for CM11 & CM12 ROMs
ROM :-
TURBO-Zet™ ROM for Micromax A110
SLT-Nexus-TSUNAMI for Micromax A110
SLT-HYBRID-Rainbow for Micromax A110
RECOVERY :-
Carliv Touch Recovery & CWM Recovery 6.0.4.0 for Micromax A110 | Cynus T2 | Wiko Cing King
Cannibal Open Touch [COT] Recovery for Micromax A110 | Cynus T2 | Wiko Cing King
MODS :-
1) Sony Xperia Small App For 4.2.2
2) Sony Small Apps For 4.1.1
3) The Hybrid-UI MOD
4) The Transparency MOD
5) The Lockscreen MOD
GUIDES :-
1) The Power Menu + Screenshot GUIDE
2) The 4-Way Reboot Menu Guide
3) The Extra Theme to Device and Moving Toggles to Bottom
#@# My Dev-Host Account
Newer Ones [Since 2017]
MODs :-
1) Sultan SnapCam
ROMs :-
1) Vanir AOSP for OnePlus 3/T Unified
2) ColtOS for OnePlus 3/T Unified

Usefull Links - For MediaTek Buddies & Other Low End Devices
1) MTK Referrence Thread By @akash akya
2) Moving Toggles To the Bottom of Pull Down Menu By BOND1987.
More Will be Added After wards. Just Have Patience......:victory::victory::victory:

BOND1987 said:
1) MTK Referrence Thread By @akash akya
2) Moving Toggles To the Bottom of Pull Down Menu By BOND1987.
More Will be Added After wards. Just Have Patience......:victory::victory::victory:
Click to expand...
Click to collapse
good one... :good:
small tip, also make sure in dimensions (res/values/dimen.xml) :
Code:
<item type="dimen" name="status_bar_icon_drawing_alpha">100.0%</item>
else transparency look bit odd...

Nice work m8 and a well put together guide, here is your first 5☆ :thumbup:
Sent from my GT-I9100 using xda premium

bombaybadboy said:
Nice work m8 and a well put together guide, here is your first 5☆ :thumbup:
Sent from my GT-I9100 using xda premium
Click to expand...
Click to collapse
All of your works sir but with MTK modification.
akash akya said:
good one... :good:
small tip, also make sure in dimensions (res/values/dimen.xml) :
Code:
<item type="dimen" name="status_bar_icon_drawing_alpha">100.0%</item>
else transparency look bit odd...
Click to expand...
Click to collapse
Will add that also brother. I know it's auto dimming feature by "daxgirl".
""Hitting Thanks Don't Cost You Anything, then, Why You All Are Getting Bothered in Doing So. Hitting Thanks Increases My Motivation to Work for this Community....""

Hi Bond, Very nice guide.. Now i'll also give it a try.. :good:

Implementing Auto-Close SystemUI feature
@ Devs @BOND1987 , @akash akya ,
There is no need to edit any thing else but only systemuiservice.smali.....
I have taken these resources from Suvi v12 rom by bsuhas. So actual credits to bsuhas
Just Replace your entire OnClick Method by the below method:-
Code:
[B][COLOR="black"].method public [COLOR="red"]SettingsButton[/COLOR](Landroid/view/View;)V
.locals 3
.parameter "v"
.prologue
.line 2431
new-instance v0, Landroid/content/Intent;
invoke-direct {v0}, Landroid/content/Intent;-><init>()V
.line 2432
const-string v1, "[COLOR="Red"]com.android.settings[/COLOR]"
const-string v2, "[COLOR="red"]com.android.settings.Settings[/COLOR]"
invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
const/high16 v2, 0x1000
invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
move-result-object v0
.line 2433
invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
const-string v1, "statusbar"
invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/StatusBarManager;
[COLOR="red"]invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V[/COLOR]
.line 1720
return-void
.end method[/COLOR][/B]
and then make the following changes
* replace red ones with the following -
in the 1st line, give any name to the button u want to define . eg:- .method public ProfileButton(Landroid/view/ViewV
in const-string v1, " * put target class name here*
in const - string v2, " * put the target class name as well as an activity to call it *
for eg:-
in const - string v1 ----- target class is to call the complete app ---------> com.android.contacts
and in const - string v2 ----- add package name + an activity to call it --------> com.android.contacts.activities.PeopleActivity
Lets take an example for defining a method and calling it . i'll call Settings here
Code:
.method public [COLOR="red"]settingsButton[/COLOR](Landroid/view/View;)V
.locals 3
.parameter "v"
.prologue
.line 2431
new-instance v0, Landroid/content/Intent;
invoke-direct {v0}, Landroid/content/Intent;-><init>()V
.line 2432
const-string v1, "[COLOR="red"]com.android.settings[/COLOR]"
const-string v2, "[COLOR="red"]com.android.settings.Settings[/COLOR]"
invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
const/high16 v2, 0x1000
invoke-virtual {v0, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;
move-result-object v0
.line 2433
invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
const-string v1, "statusbar"
invoke-virtual {p0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/StatusBarManager;
invoke-virtual {v0}, Landroid/app/StatusBarManager;->collapse()V
.line 1720
return-void
.end method
after this we have to call it on clicking a tile . so lets define it in the quickpanel_quick_settings_space.xml
Add this wherever you want the tile to appear .
Code:
<RelativeLayout android:id="@id/settings_button" android:background="@drawable/tile_toggle" android:layout_width="125.0px" android:layout_height="150.0px" android:layout_weight="1.0">
<Button android:layout_gravity="center_horizontal" android:background="@drawable/set" android:layout_width="wrap_content" android:layout_height="wrap_content" [COLOR="Red"][SIZE="4"]android:onClick="settingsButton"[/SIZE][/COLOR] />
<TextView android:textSize="14.0dip" android:textColor="#ffffffff" android:gravity="center" android:background="#00000000" android:layout_width="240.0px" android:layout_height="wrap_content" android:layout_marginBottom="3.0px" android:text="Settings" android:singleLine="true" android:layout_alignParentBottom="true" />
</RelativeLayout>
Video to Confirm it working. :highfive:
Sorry if the above explaination is too long :fingers-crossed::fingers-crossed:

easy & nice tut...
@BOND1987
-: Transparent Status bar & Notification Full Down:-
Click to expand...
Click to collapse
4-Way Reboot Menu - Thanks to majdinj sir
Click to expand...
Click to collapse
I've successfully made my own transparent statusbar & 4 way rebooter according to ur guide & works very charm on my stock deodex rom.
thanks alot bro... :good::good:
1 question: how to increase statusbar height?

sir
recovery reboot doesn't work please help

Hi, I tried the 4-way reboot menu and it just replaced the shutdown function on the dialog box. It says reboot, but when I tap it, phone shutsdown. I'm on MT6575 running GB 2.3.6 which doesn't have reboot/restart function.

iZLeeP said:
Hi, I tried the 4-way reboot menu and it just replaced the shutdown function on the dialog box. It says reboot, but when I tap it, phone shutsdown. I'm on MT6575 running GB 2.3.6 which doesn't have reboot/restart function.
Click to expand...
Click to collapse
OK brother,
Upload you android policy. Jar and I'll try to solve this in my free time.
WinchyHanepp said:
recovery reboot doesn't work please help
Click to expand...
Click to collapse
Brother,
Regarding your problem, I asked my ""MAGIC BOWL"" that what's the problem, but....
Come on Guys,
I'm not a astrologer to judge what's gone wrong. I need logs and apps for checking what's the problem.
Sent from my A110 using Tapatalk

SuperDroid-BOND said:
OK brother,
Upload you android policy. Jar and I'll try to solve this in my free time.
Attached file as requested. Thanks mate.
Click to expand...
Click to collapse

Hey @SuperDroid-BOND sir... I tried for transparency but when i recompile the apk then gets this error.. Please can you help me.. Hope you will help me..
See error here :::-
{
"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"
}

Abhinav_Rocks said:
Hey @SuperDroid-BOND sir... I tried for transparency but when i recompile the apk then gets this error.. Please can you help me.. Hope you will help me..
See error here :::-
Click to expand...
Click to collapse
Brother,
You have mentioned notification_header_bg two times in your drawable.xml inside the values folder.
Try deleting it. It will recompile easily.
Sent from my A110 using Tapatalk

SuperDroid-BOND said:
Brother,
You have mentioned notification_header_bg two times in your drawable.xml inside the values folder.
Try deleting it. It will recompile easily.
Sent from my A110 using Tapatalk
Click to expand...
Click to collapse
No sir.. Its only one time, See ::

Abhinav_Rocks said:
No sir.. Its only one time, See ::
Click to expand...
Click to collapse
If it's not there then how apktool is giving it's entries 2 times at line number 3 and 14.
If it's not there then get to compile it and if error occurs then give screenshot of the full error.
Sent from my A110 using Tapatalk

SuperDroid-BOND said:
If it's not there then how apktool is giving it's entries 2 times at line number 3 and 14.
If it's not there then get to compile it and if error occurs then give screenshot of the full error.
Sent from my A110 using Tapatalk
Click to expand...
Click to collapse
Sorry sir i m doing mistake.. really sorry.. mistake is that you say.. sorry again.. and now SystemUI.apk is recompiling done..
But in jar file recompiling this error, please help me out ::-
Here is my android.policy.jar file ::- Download
---------- Post added at 01:46 AM ---------- Previous post was at 12:54 AM ----------
Now trying once again.. working awesome.. Thanks a lot bro.. I m beginner and you are GURU of mine and i m CHELA.. I have learn so much from you.. Thanks again sir for this awesome thread with simple steps..
---------- Post added at 02:41 AM ---------- Previous post was at 01:46 AM ----------
Sir.. Can you please tell me whats the work of these lines.. please sir.. and check screen that i m right or wrong..?? If i m wrong then please guide me.. Thanks in advance sir..

Sir please reply.. its only take 2 mint.. Please..

SuperDroid /QUOTE said:
..\Decompiled_jar\android.policy\com\android\internal\policy\impl\GlobalActions$99$1.smali[27,4] Error for input '.parameter': Invalid directive
..\Decompiled_jar\android.policy\com\android\internal\policy\impl\GlobalActions$99$1.smali[42,4] Error for input '.parameter': Invalid directive
..\Decompiled_jar\android.policy\com\android\internal\policy\impl\GlobalActions$99$1.smali[43,4] Error for input '.parameter': Invalid directive
..\Decompiled_jar\android.policy\com\android\internal\policy\impl\GlobalActions$99$1.smali[42,15] mismatched input '"dialog"' expecting END_METHOD_DIRECTIVE
..\Decompiled_jar\android.policy\com\android\internal\policy\impl\GlobalActions$99.smali[78,4] Invalid literal value: 260. Low 16 bits must be zeroed out.
hmmm any advice?
Click to expand...
Click to collapse

Related

[REF] How to add Reboot to power menu (updated 10/21/2010)

this is the final method that will add reboot,recovery and download options
to the power menu updated 10/21/2010
============================================================
Step 1.
the first thing we need to do is add string and image resources to framwork-res
for this example I am using a stock JI6 ROM your resource id's will be different
if on another ROM
use apk_manager to decompile framework-res
open "values\strings.xml" and add our string resources
Code:
<string name="reboot_recovery">Recovery</string>
<string name="reboot_download">Download</string>
<string name="reboot">Reboot</string>
save and close
open "values\public.xml" and assign our strings resource id's
scroll until you get to the end of the "<public type="string"" id list
note the id of the last string, in this example it is "10403c2" sometimes
the id's are out of order so search for "10403c2 + 1" or "10403c3"
if the next id is unused then we can start assigning id's to the strings
we added.
Code:
<public type="string" name="reboot_recovery" id="0x010403c3" />
<public type="string" name="reboot_download" id="0x010403c4" />
<public type="string" name="reboot" id="0x010403c5" />
now is a good time to add the image resources so add your icons to
"res\drawable-hdpi"
and assign id's to them the same way we did for the strings
in this example, using the example icons in the zip file I had
Code:
<public type="drawable" name="reboot" id="0x010803aa" />
<public type="drawable" name="recovery" id="0x010803ab" />
<public type="drawable" name="download" id="0x010803ac" />
save and close
now framework-res has the resources needed for this mod use
apk_manager to compile.
============================================================
Step 2.
next we need to modify Samsung's shutdown method to accept 3 more options
so decompile framework and open "com\android\internal\app\ShutdownThread.smali"
since we are going to pass an integer to ShutdownThread and then evaluate
that integer when the code runs we have to have a spot for the integer so
add this to line 37
Code:
.field public static mReboot:I
then in method run at line 1463 add this code before "invoke-static {}, Landroid/os/Power;->shutdown()V"
Code:
sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I
const/4 v2, 0x1
if-eq v1, v2, :reboot
const/4 v2, 0x2
if-eq v1, v2, :rebootRecovery
const/4 v2, 0x3
if-eq v1, v2, :rebootDownload
then after this code on about line 1477
Code:
.line 531
invoke-static {}, Landroid/os/Power;->shutdown()V
.line 532
return-void
add this code
Code:
:reboot
const-string v4, "now"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
:rebootRecovery
const-string v4, "recovery"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
:rebootDownload
const-string v4, "download"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
save and close
compile framework
============================================================
Step 3.
now we are going to add the extra options to the power menu
decompile android.policy
open "com\android\internal\policy\impl\GlobalActions.smali"
the first thing that we need to do is increase the array length by 3
so in method createDialog on line 431 change this
Code:
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
to this
Code:
const/4 v0, 0x6
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
now add the new menu items this is where the resource id's that we added
to framework-res com into play so on line 457 after "aput-object v2, v0, v1"
add this code
Code:
const/4 v1, 0x3
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$7;
const v3, 0x10803aa # reboot icon resource id
const v4, 0x10403c5 # reboot string resource id
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x4
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$8;
const v3, 0x10803ab # recovery icon resource id
const v4, 0x10403c3 # recovery string resource id
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x5
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$9;
const v3, 0x10803ac # download icon resource id
const v4, 0x10403c4 # download string resource id
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$9;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
make sure to change the resource id's to match what you added to to framework-res
save and close
next add the code that runs when the menu item is pressed
copy GlobalActions$3.smali and name it GlobalActions$7.smali
open GlobalActions$7 and replace all instances of GlobalActions$3
with GlobalActions$7 then add this code to line 52 before
"invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V"
Code:
const/4 v2, 0x1
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close
copy GlobalActions$3.smali and name it GlobalActions$8.smali
open GlobalActions$8 and replace all instances of GlobalActions$3
with GlobalActions$8 then add this code to line 52 before
"invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V"
Code:
const/4 v2, 0x2
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close
copy GlobalActions$3.smali and name it GlobalActions$9.smali
open GlobalActions$9 and replace all instances of GlobalActions$3
with GlobalActions$9 then add this code to line 52 before
"invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V"
Code:
const/4 v2, 0x3
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close
compile android.policy
done test on the phone.
flash the attached update.zip with the stock updater.
Anyway to get this in a flashable zip? I don't know how to decompile files
BabyBoi.JN said:
Anyway to get this in a flashable zip? I don't know how to decompile files
Click to expand...
Click to collapse
bump Bump bump please
Nice
Sent from my vibrant
BabyBoi.JN said:
Anyway to get this in a flashable zip? I don't know how to decompile files
Click to expand...
Click to collapse
I second that. I miss that option
where is policy file
how to decompile
i use ubuntu
thx
Sent from my SGH-T959 using XDA App
sounds like a great add-in if could be made flashable
adm1jtg said:
sounds like a great add-in if could be made flashable
Click to expand...
Click to collapse
Either that or a how to for dummies version
Sent from Vibrant Frankin Twiz Update3 JI2 modem.bin jac kernel with voodoo lagfix on XDA app with no fc's FINALLY!
daddysays said:
Either that or a how to for dummies version!
Click to expand...
Click to collapse
EXACTLY!!! That's what I need LOL
untermensch said:
someone asked for this so here it is.
decompile android.policy
make a copy of GlobalActions$3.smali and name it to GlobalActions$7.smali open GlobalActions$7.smali
and replace all instances of GlobalActions$3 with GlobalActions$7
replace method onPress with this
Code:
.method public onPress()V
.registers 3
const-string v0, "Reboot Now"
invoke-static {v0}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
.end method
save and close
now open GlobalActions.smali
and in method createDialog
the first thing that we need to do is increase the array length by 1 so find this
Code:
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
and change to
Code:
const/4 v0, 0x4
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
next we add the new menu item so on line 457 we add this next bit of code after "aput-object v2, v0, v1"
Code:
const/4 v1, 0x3 # position in the menu array
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$7;
const v3, 0x1080030 # power icon
const v4, 0x10402af # reboot string
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
framework-res already has a string for reboot so no modifications are needed to framework-res
save and close then compile android.policy
Click to expand...
Click to collapse
Hi,
Thanks so much for this, absolutely fantastic work like always!
For anyone that doesn't know how to decompile/compile apk files search for either APK Manager, or smali/baksmali tutorial/help/etc., it should help you out greatly.
And for those that want a flashable .zip, well, here you go, BUT, I'm lazy, so it requires some conditions:
1) You use a rom based on JI6 that's fully deodexed
2) you have previously flashed (or your custom rom included) the epic/puzzle lockscreen mod (also from untermensch)
3) You disable voodoo (if you use it) prior to flashing since this zip attempts to wipe your dalvik-cache
That said, zip should flash fine from clockwork, and all it does is replace your android.policy.jar with one pre-modded for lockscreen & reboot option support, and it wipes your dalvik-cache since that's the safest thing to do after applying any mod, period.
Cheers, =)
s0niqu3 said:
Hi,
Thanks so much for this, absolutely fantastic work like always!
For anyone that doesn't know how to decompile/compile apk files search for either APK Manager, or smali/baksmali tutorial/help/etc., it should help you out greatly.
And for those that want a flashable .zip, well, here you go, BUT, I'm lazy, so it requires some conditions:
1) You use a rom based on JI6 that's fully deodexed
2) you have previously flashed (or your custom rom included) the epic/puzzle lockscreen mod (also from untermensch)
3) You disable voodoo (if you use it) prior to flashing since this zip attempts to wipe your dalvik-cache
That said, zip should flash fine from clockwork, and all it does is replace your android.policy.jar with one pre-modded for lockscreen & reboot option support, and it wipes your dalvik-cache since that's the safest thing to do after applying any mod, period.
Cheers, =)
Click to expand...
Click to collapse
I was just about to upload the zip...
Oh well, beat me to it
s0niqu3 said:
Hi,
Thanks so much for this, absolutely fantastic work like always!
For anyone that doesn't know how to decompile/compile apk files search for either APK Manager, or smali/baksmali tutorial/help/etc., it should help you out greatly.
And for those that want a flashable .zip, well, here you go, BUT, I'm lazy, so it requires some conditions:
1) You use a rom based on JI6 that's fully deodexed
2) you have previously flashed (or your custom rom included) the epic/puzzle lockscreen mod (also from untermensch)
3) You disable voodoo (if you use it) prior to flashing since this zip attempts to wipe your dalvik-cache
That said, zip should flash fine from clockwork, and all it does is replace your android.policy.jar with one pre-modded for lockscreen & reboot option support, and it wipes your dalvik-cache since that's the safest thing to do after applying any mod, period.
Cheers, =)
Click to expand...
Click to collapse
You sir are a gentleman and a scholar
b0ricuaguerrero said:
You sir are a gentleman and a scholar
Click to expand...
Click to collapse
lol,
Appreciate the thought, but wrong gender, =)
b0ricuaguerrero said:
You sir are a gentleman and a scholar
Click to expand...
Click to collapse
LOL perhaps you meant you maam are a babe and a diva. Either way thanks so much for this.
Very nice, thank's for sharing.
Looks like I'm disabling Voodoo once again.
great job. done
Sent from my SGH-T959 using XDA App
Fyi the reboot after install takes longer than after installing a new rom
Sent from my SGH-T959
Many thanks for the file!
...but because I'm lazy and if I'm reading the file poster's req's correctly her version requires I flash a lockscreen I don't currently have, would any Gentleman or Lady be kind enough to build a .zip file which will work on a Stock Vibrant JI6 install?
Thnx!
I just got done flashing and it works great ty
Sent from bionix 1.9.1 jacs oc/uv vodoo kernel

[Guide]Official MIUI Port Guide Translation

Hi guys,i translated the key part of this guide,untill now,this guide is not completed ,if it updated ,i'll update this thread too
and until now,our MIUI PORT TEAM have these guys:
me,gabwerkz,redy2006
N00BY0815 and SquaDrive after read this post and if you want to join in plz let me know anyone else wants to join in are welcomed
===========================================line
1.A Sample For Smali
imagane that there's a Hello worlk application,we install the apk and open it,we can see a blackscreen and at the first line written:Hello world!
ok,this is a simple app.now we decompile it.
===================
we get a folder,then find the HelloActivity.smali,there's its content:
Code:
.class public Lcom/example/android/helloactivity/HelloActivity;
.super Landroid/app/Activity;
.source "HelloActivity.java"
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 27
invoke-direct {p0}, Landroid/app/Activity;-><init>()V
return-void
.end method
# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
.locals 2
.parameter "savedInstanceState"
.prologue
.line 33
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
.line 37
const/high16 v1, 0x7f03
invoke-virtual {p0, v1},
Lcom/example/android/helloactivity/HelloActivity;->setContentView(I)V
.line 38
const/high16 v1, 0x7f05
invoke-virtual {p0, v1},
Lcom/example/android/helloactivity/HelloActivity;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/TextView;
.line 39
.local v0, txtView:android/widget/TextView;
const/high16 v1, 0x7f04
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V
.line 40
return-void
.end method
"#" refers to notes.
begin with a dot named "annotations".
".line" means line number,it mainly used for debug.
.metho and .end method means a method's starting and endding.
more code plz goto http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html
now we want to change the "Hello,world!" into "Happy,Craker!",what should we do?
in this smali
.lne 39 is
Code:
.local v0, txtView:android/widget/TextView;
const/high16 v1, 0x7f04
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(I)V
and actually the source code is
Code:
txtView.setText(R.string.hello_activity_text_text)
here we can see it define a textview with R.string.hello_activity_text_text ,and i guess the string "Hello world!" is in it.
now we could not change the string,but we can replace it by change it directly
but how we do it in smali?
here we go
Code:
.line 39
.local v0, txtView:android/widget/TextView;
const-string v1, "Happy, Cracker!"
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
ps.i can't explane it more clearly,but we can see we replace the id with our string.
==========================
2.Porting MIUI Framework
Before starting i should tell us :all porting is based on deodexed files.and there's a stock android rom and miui rom to show you a example to understand how we make the porting work.
the main idea is change the smali code to port it.cause we can't get the souce code of miui,and by this way we can port it to our phone too.
the three files we should touch is :framework.jar ,android.policy.jar andservices.jar.they are the "core" of android system
there's an attach file download and open it we can see:
porting-miui/
|-----------------android
|------------framework.jar
|------------services.jar
|------------android.policy.jar
|------------------miui
|----------framework.jar
|----------services.jar
|----------android.policy.jar
|-----------framework-res/
|-----------framework-miui-res.apk
the android folder is from stock android ,miui folder is miui's files,and we need your phone's files here too.and in this guide we assume your phone is I9100.now we should decompile all of them and compare,to "patch" miui things to your phone.
that means ,we need to compare stock files with our files,compare stock files with miui files
i.porting resources
decompile framework-res.apk,all the resources in miui we need porting to our rom,so copy them to your compiled framework-res folder and then recompile it.
framework-miui-res.apk is a resouces package,all the miui apps need it.in our rom we can find RES_cappuccino.apk,RES_sui.apk and RES_model.apk.
usually miui's resource's id is started with 0x03,and the stock rom has two resouce package,framework-res.apk is started with 0x01 and another is started with 0x02.so if your phone has more than two package,you need contact with us.in the future we'll considering make the resouce's id started with 0x06 in miui.
ii.after we finish the decompile we can use the script rmline.sh to delete all the lines started with .line to make us more easier to compare the difference with two smali code.but backup the original decomplied files first plz.we can debug from it.
then,if you based on linux,you'd try meld to compare,if you are on windows,use beyoun compare
between stock and miui,we can see there's a lot of new classes which started with Miui,and a new miui folder,just copy those new files and folders to our stock folders(with .line)
in the attach file,there's a change-list file,which list what miui did change.maybe it's a little different with what we compared by ourselves,but it's nop (dummy instruction),it caused by apktool,so we don't need to care it,just compare listed files.
there are 3 solutions
1.ex. ActivityThread.smali,miui changed the method "getTopLevelResources",but i9100's and stock is the same,this is the easiest situation and we can replace the miui code into our files happily
2.also in ActivityThread.smali,miui changed the another method "applyConfigurationToResourcesLocked",and after comparation,we can see miui changed this method,so i9100 does.then what should we do?let's see the miui's code first
Code:
.method final applyConfigurationToResourcesLocked(Landroid/content/res/Configuration;)Z
invoke-virtual {v5, p1}, Landroid/content/res/Configuration;->updateFrom(Landroid/content/res/Configuration;)I
move-result v0
.local v0, changes:I
invoke-static {v0}, Landroid/app/MiuiThemeHelper;->handleExtraConfigurationChanges(I)V
invoke-virtual {p0, v7}, Landroid/app/ActivityThread;->getDisplayMetricsLocked(Z)Landroid/util/DisplayMetrics;
move-result-object v1
.local v1, dm:Landroid/util/DisplayMetrics;
at line 5 is what miui changed.before that,we should know some rule about smali
all the local variable is started with "v"
.locals 8 means this method use 8 local variables.
all the parameters are started by "p".and local variable and parameters started from 0.for all the nonstatic method,p0 means itself,i.e "this" pointer.
here we can see miui added a new static method,the code like this we call it linear code.it as one entry and one exit.and in compiler it called basic block.
so we just need to copy this block and paste into 9100's files at the same position,and we done.
3.for example,in Resources.smali,miui changed the "loadDrawable" method.here's the code
Code:
.method loadDrawable(Landroid/util/TypedValue;I)Landroid/graphics/drawable/Drawable;
.end local v8 #e:Ljava/lang/Exception;
.end local v13 #rnf:Landroid/content/res/Resources$NotFoundException;
:cond_6
invoke-virtual/range {p0 .. p2},
Landroid/content/res/Resources;->loadOverlayDrawable(Landroid/util/TypedValue;I)Landroid/graphics/drawable/Drawable;
move-result-object v6
if-nez v6, :cond_1
:try_start_1
move-object/from16 v0, p0
from line 6 to line 9 is what miui added.then we compare 9100 and stock android,we can find it's totally different.then how should we do now?
the key is find the added code's entry and exit.
at line 4 we see a ":cond_6",it says there should be a goto command to this :cond_6.so we got to find where used the :cond_6 and we finally got this:
Code:
const-string v15, ".xml"
invoke-virtual {v9, v15}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v15
if-eqz v15, :cond_6
read this code block carefully,and seems it is check if the string "v9" is ending with ".xml",if not,goto :cond_6 .ok ,let's go to see 9100's framework.
so we search ".xml" in the loadDrable method.find this:
Code:
const-string v17, ".xml"
move-object v0, v10
move-object/from16 v1, v17
invoke-virtual {v0, v1}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v17
if-eqz v17, :cond_b
the logic is same as which in miui hmm?so goto :cond_b ,what we can see is totally same as miui's :cond_6 right? so we are sure this is where miui changed
look at the exit,miui has two exit point
one is if-nez v6, :cond_1 ,if so,goto :cond_1,if not,go on.so let's see what the :cond_1 did
here's cond_1's code
Code:
:cond_1
:goto_1
if-eqz v6, :cond_2
move-object/from16 v0, p1
iget v0, v0, Landroid/util/TypedValue;->changingConfigurations:I
and in 9100's file we can find this
Code:
:cond_1
:goto_1
if-eqz v7, :cond_2
move-object/from16 v0, p1
iget v0, v0, Landroid/util/TypedValue;->changingConfigurations:I
this time it check the v7's value,so we should add this into 9100
Code:
invoke-virtual/range {p0 .. p2},
Landroid/content/res/Resources;->loadOverlayDrawable(Landroid/util/TypedValue;I)Landroid/graphics/drawable/Drawable;
move-result-object v7
if-nez v7, :cond_1
a little dizzy hmm?take a break time and go back
iii.and the last we'll talk about inner class.
every inner class have a separete smali file.
e. ActivityThread$1.smali
if it is a Anonymous class,the name should be "outer class+$+number",else it should be "outer class+$+inner class"as its name.
if a inner class use outer class's privte method,the compiler will auto fill a static function like this:
Code:
public class Hello {
public class A {
void func() {
setup();
}
}
private void setup() {
}
we use the outer class's setup method in inner class A's "func" method.and we'll get the smali code:
part of Hello$A.smali
Code:
# virtual methods
.method func()V
.locals 1
.prologue
.line 5
iget-object v0, p0, LHello$A;->this$0:LHello;
#calls: LHello;->setup()V
invoke-static {v0}, LHello;->access$000(LHello;)V
.line 6
return-void
.end method
part of Hello.smali
Code:
.method static synthetic access$000(LHello;)V
.locals 0
.parameter
.prologue
.line 1
invoke-direct {p0}, LHello;->setup()V
return-void
.end method
we can see the compiler auto made a access$000 method,if we use a outer class's private method in a more complicate inner class,it'll made a new method,but every class may have various new class name,it changes a lot .compare it carefully,find the private method and find a name that you ever seened.
iiii.Finally there are some advices:
1.careful,find where to add miui's code
2.notice the local variable number
3.step by step,if you done a part of port,recompile it to see if it work
4.find a problem is not neccessary,use adb logcat and find what caused the problem.
5.more practice and you'll handle the smali code
==================================
because of my bad english ,if you can understand what i mean,plz point me out and i'll correct it as i can
if you think this post may help you,press the thanks button
here's the attachment:
http://www.multiupload.com/I33A07PRTF
For God Sake..
ahahahaha...
My head goin crazy...><..
maybe i need a little walk by learn..
after read those stuff i got fired up..
i want to learn Android from this..
can u guys teaching me little by little??
if so, count me on..i'm ready for testing every single build
and ready to burst my brain to learn this stuff..
SquaDrive said:
For God Sake..
ahahahaha...
My head goin crazy...><..
maybe i need a little walk by learn..
after read those stuff i got fired up..
i want to learn Android from this..
can u guys teaching me little by little??
if so, count me on..i'm ready for testing every single build
and ready to burst my brain to learn this stuff..
Click to expand...
Click to collapse
just use search...
after i tranlated this guide,i'd say i've understand a part of the "how to",and i'll gonna have a try based on v20n
dxdiag32 said:
after i tranlated this guide,i'd say i've understand a part of the "how to",and i'll gonna have a try based on v20n
Click to expand...
Click to collapse
Nice... and I'm just waiting here for your progress... LOL
Man, you got moves like jagger.
good luck dxdiag
Is there some progress?
Sent from my LG-P970 using XDA App
I would like to help, but I have too work now...
Good luck!
I think Huexxx should start porting MIUI to ours blacks xd His rom is good at this moment so he can make some break and create MIUI
doooh !
I really would offer my help but the only dev related thing I know is scripting with nsis. I don't know coding even if I'm pretty sure scripting and coding have similar principles. I don't even know what deodexing / zipaligning mean
As I learned everything by myself I know that all guides can't do 100% of the job. Learning is the key.
So I'm not sure if I can contribute but it will be a pleasure to join to your work.
Any news guys ?
Sent from my LG-P970 using xda premium

[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

[HOW TO] New Power Menu With Screenshot Option {Legacy & MTK Devices}

Hello Everyone,
Here, being on XDA, is like learning new things in a school and getting project homework on daily basis. And Speaking for this, I really like it.
So here is the project that I cleared today morning at around 4.30 AM IST (Indian Standard Time).
But before beginning for project let me THANK few IDOLS of XDA.
@tdunham - You are the master of Power menu Sir. Compared files with your guide. @Adi Aisiteru Reborn - The GOD of MOD & Guides for CM / AOSP / AOKP @ankurbata- For the files I used for comparing.
@Dzol Cp- You are the One brother who taught me these things.
@bombaybadboy-Awesome Thread by You Sir. Got everything working whenever I take help from your thread.
@Goldieking- For helping me in rectifying error.
@Ticklefish- Awesome and Simplest tool for Themers and noobs like me.
@My Wife - My Life's Companion, Dearest Friend, My Love & Encouragement. I love you Sweet-Heart. @Xda Forum- The School for New born Techie child like me.
Before beginning to this guide, please make sure that you followed this guide by tdunham line by line and you failed doing so.
I tried this on my Stock ROMs and Other ported ROMs of My Device forum and got this working.
PART-1​
1st Step:-
Decompile Your framework-res.apk and go to - res/value/strings.xml
add this line at the end.
Code:
<string name="global_action_screenshot_txt">Screenshot</string>
<string name="global_action_recovery_txt">BOND Recovery</string>
And add the png attached in this thread to - res/value/drawable-hdpi/mdpi/xhdpi (any one folder you can choose to add the images as according to your device resolution).
Step-2
Now recompile the framework-res.apk and then again decompile the newly compiled framework-res.apk
Then go to - res/values/public.xml and leave it open.
PART-2
Step-1
Now Decompile your stock "android.policy.jar" and add the attached "android.policy" files to - "android.policy.jar\smali\com\android\internal\policy\impl"
Now open GlobalActions.smali.
and find this lines.
Code:
.field private mRingerModeReceiverRegistered:Z
Just below this line make space for a line just like as its there (One space above the line & One space below)
Then Add these lines
Code:
.field mScreenshotConnection:Landroid/content/ServiceConnection;
.field final mScreenshotLock:Ljava/lang/Object;
.field final mScreenshotTimeout:Ljava/lang/Runnable;
Now find this line
Code:
iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
Add these line below that.
Code:
.line 315
new-instance v4, Ljava/lang/Object;
invoke-direct {v4}, Ljava/lang/Object;-><init>()V
iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotLock:Ljava/lang/Object;
.line 317
const/4 v4, 0x0
iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotConnection:Landroid/content/ServiceConnection;
.line 318
new-instance v4, Lcom/android/internal/policy/impl/GlobalActions$12;
invoke-direct {v4, p0}, Lcom/android/internal/policy/impl/GlobalActions$12;-><init>(Lcom/android/internal/policy/impl/GlobalActions;)V
iput-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotTimeout:Ljava/lang/Runnable;
Now Find This line -
Code:
.method static synthetic access$1800(Lcom/android/internal/policy/impl/GlobalActions;)V
.locals 0
.parameter "x0"
.prologue
.line 68
invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->handleShow()V
return-void
.end method
And Add the line below end method.
Code:
.method static synthetic access$1900(Lcom/android/internal/policy/impl/GlobalActions;)V
.locals 0
.parameter "x0"
.prologue
.line 64
invoke-direct {p0}, Lcom/android/internal/policy/impl/GlobalActions;->takeScreenshot()V
return-void
.end method
Now find this line
Code:
invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
And add this line below this method and above the line starting with-".line XXX"
Code:
.line 232
move-object/from16 v0, p0
iget-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;
const v3, 0x1080691 [COLOR=Lime]<-------- This is the ID of "bond_screenshot"[/COLOR]
const v4, 0x1040516 [COLOR=Red] <-------- This is the ID of "global_action_screenshot_txt"[/COLOR]
move-object/from16 v0, p0
invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
move-object/from16 v0, p0
iget-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$14;
const v3, 0x1080692[COLOR=Lime] <-------- This is the ID of "bond_recovery"[/COLOR]
const v4, 0x1040517 [COLOR=Red]<-------- This is the ID of "global_action_recovery_txt"[/COLOR]
move-object/from16 v0, p0
invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$14;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
Now Find this line--
Code:
# virtual methods
And add this lines just above it with gap of 2(two) Space between "end method" & "Virtual methods"
Code:
.method private takeScreenshot()V
.locals 8
.prologue
.line 330
iget-object v4, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotLock:Ljava/lang/Object;
monitor-enter v4
.line 331
:try_start_0
iget-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotConnection:Landroid/content/ServiceConnection;
if-eqz v3, :cond_0
.line 332
monitor-exit v4
.line 391
:goto_0
return-void
.line 334
:cond_0
new-instance v0, Landroid/content/ComponentName;
const-string v3, "com.android.systemui"
const-string v5, "com.android.systemui.screenshot.TakeScreenshotService"
invoke-direct {v0, v3, v5}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V
.line 336
.local v0, cn:Landroid/content/ComponentName;
new-instance v2, Landroid/content/Intent;
invoke-direct {v2}, Landroid/content/Intent;-><init>()V
.line 337
.local v2, intent:Landroid/content/Intent;
invoke-virtual {v2, v0}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;
.line 338
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$BondB;
invoke-direct {v1, p0}, Lcom/android/internal/policy/impl/GlobalActions$BondB;-><init>(Lcom/android/internal/policy/impl/GlobalActions;)V
.line 386
.local v1, conn:Landroid/content/ServiceConnection;
iget-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mContext:Landroid/content/Context;
const/4 v5, 0x1
invoke-virtual {v3, v2, v1, v5}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z
move-result v3
if-eqz v3, :cond_1
.line 387
iput-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotConnection:Landroid/content/ServiceConnection;
.line 388
iget-object v3, p0, Lcom/android/internal/policy/impl/GlobalActions;->mHandler:Landroid/os/Handler;
iget-object v5, p0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenshotTimeout:Ljava/lang/Runnable;
const-wide/16 v6, 0x2710
invoke-virtual {v3, v5, v6, v7}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z
.line 390
:cond_1
monitor-exit v4
goto :goto_0
.end local v0 #cn:Landroid/content/ComponentName;
.end local v1 #conn:Landroid/content/ServiceConnection;
.end local v2 #intent:Landroid/content/Intent;
:catchall_0
move-exception v3
monitor-exit v4
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v3
.end method
Few Things to remeber:-
1) The ID's Need to be Same as in public.xml or else boot loop will shake your hands.
2) The register values like - v0,v1,v2.... need to be managed like what it is in your GlobalActions.smali. For the Comparison I have attached My-GlobalActions.smali for comparison.
Just change the extention from zip to smali.
3) I am also human and will be here after my daily life. So please have patience. I will try to get you out of your problem, if and only if you have a adb logcat.
4) If you find any difficulties then post it in the thread.
The Results after successful completion of this will be same as screenshot.
http://dl.xda-developers.com/attach.../7/6/5/2/2/Screenshot_2013-08-09-02-00-21.jpg
Last But Not Least - Don't get bothered to hit thanks. It will not cost you anything but will surely increase my courage to work and try new things.
Awesome Guide My Brother!!
Happy Eid Mubarak to You and rest of your family
Dzol Cp said:
Awesome Guide My Brother!!
Happy Eid Mubarak to You and rest of your family
Click to expand...
Click to collapse
Thanks a lot brother...
Happy EID to you and The whole XDA family of ours brother...
"""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
"Happy EID to you all and the whole XDA Family "
Hey, i want to ask something. What is the meaning of line 315 on this ".line315 new-instance v4, Ljava/lang/Object;"? Sorry, just want to know a bit java programming Thanks for your help
i manage to make it bro..sadly after pressing screenshot my phone reboots..but recovery is working just fine..great tut..
BOND1987 said:
Thanks a lot brother...
Happy EID to you and The whole XDA family of ours brother...
"""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
I did as your followers. click on the menu button to display the power source immediately my phone reboot
Looking forward to your help
vuong95vjpboy said:
I did as your followers. click on the menu button to display the power source immediately my phone reboot
Looking forward to your help
Click to expand...
Click to collapse
Upload you global actions.smali and public.xml of framework....
"" Hitting Thanks Will Not Cost You Anything, So, Why Don't You Try Hitting It Once.....""
Sent While Checking The "AMOI 4.2.2 Beast".....
BOND1987 said:
Upload you global actions.smali and public.xml of framework....
"" Hitting Thanks Will Not Cost You Anything, So, Why Don't You Try Hitting It Once.....""
Sent While Checking The "AMOI 4.2.2 Beast".....
Click to expand...
Click to collapse
Hi sir, my GlobalActions.smali has different with your file, so i dont know put the code in what line
Can you help me? I attach my original GlobalActions.smali, can you mod the code help me? Thanks!
The id in my framework is:
Code:
<public type="drawable" name="bond_recovery" id="0x010805ef" />
<public type="drawable" name="bond_screenshot" id="0x010805f0" />
<public type="string" name="global_action_screenshot_txt" id="0x010404d5" />
<public type="string" name="global_action_recovery_txt" id="0x010404d6" />
My phone was use MTK chipset, ICS 4.0.4. Here is my power menu screenshot
Thanks!
^
^
 @BOND1987 Can you help me sir? Thanks!
sieuan said:
^
^
@BOND1987 Can you help me sir? Thanks!
Click to expand...
Click to collapse
Yes brother,
Of course I'll help you. Yesterday night I corrupted my windows so brother you have to wait for today and tomorrow I'll do this for you.
BOND1987 said:
Yes brother,
Of course I'll help you. Yesterday night I corrupted my windows so brother you have to wait for today and tomorrow I'll do this for you.
Click to expand...
Click to collapse
Thanks sir!
After follow the guide in this thread: http://forum.xda-developers.com/showthread.php?t=2225970, I succes add 3-Way boot to Power Menu, and it work good
Before:
After:
Now, can you help me add screenshot option into Power Menu, sir? Here is my GlobalActions.smali. Thanks!
sieuan said:
Thanks sir!
After follow the guide in this thread: http://forum.xda-developers.com/showthread.php?t=2225970, I succes add 3-Way boot to Power Menu, and it work good
Before:
After:
Now, can you help me add screenshot option into Power Menu, sir? Here is my GlobalActions.smali. Thanks!
Click to expand...
Click to collapse
I absolutely love your set up. What ROM / Theme is that?
babalonius508 said:
I absolutely love your set up. What ROM / Theme is that?
Click to expand...
Click to collapse
A Vietnamese ROM, for a Chinese phone, modify by me with light holo theme, apex launcher and miui v5 icon pack.
That's a very cool setup! Thanks!
I can't seem to open the GlobalActions.smali in the OP for comparison because it says its corrupt? Any one else have this problem?
babalonius508 said:
That's a very cool setup! Thanks!
I can't seem to open the GlobalActions.smali in the OP for comparison because it says its corrupt? Any one else have this problem?
Click to expand...
Click to collapse
Brother,
Change the extension of zip to .Smali.
Or try opening with notepad++ and you will be able to coordinate with the guide as well.
If you get any problems further to this, just let me know by post it in this thread.
BOND1987 said:
Brother,
Change the extension of zip to .Smali.
Or try opening with notepad++ and you will be able to coordinate with the guide as well.
If you get any problems further to this, just let me know by post it in this thread.
Click to expand...
Click to collapse
Thanks a lot man! I missed that part of the instructions. Does this modification work for all devices?
babalonius508 said:
Thanks a lot man! I missed that part of the instructions. Does this modification work for all devices?
Click to expand...
Click to collapse
I think brother,
Other than TouchWiz, it will work on all AOSP based devices. Though I'm not sure for this but you can try. If you are in trouble, just let me know.
BOND1987 said:
I think brother,
Other than TouchWiz, it will work on all AOSP based devices. Though I'm not sure for this but you can try. If you are in trouble, just let me know.
Click to expand...
Click to collapse
Thank you for all your help!
For some reason, after I finish the modification, I hold the power button and my phone just reboots. I'm not sure what I'm doing wrong.
Here is my framework-res.apk: https://db.tt/xy0QGFiH
And my androidpolicy.jar: https://db.tt/IOe6JAkn
And a logcat: https://db.tt/EiN6Qcot
Thank you again!
babalonius508 said:
Thank you for all your help!
For some reason, after I finish the modification, I hold the post menu and my phone just reboots. I'm not sure what I'm doing wrong.
Here is my framework-res.apk: https://db.tt/xy0QGFiH
And my androidpolicy.jar: https://db.tt/IOe6JAkn
And a logcat: https://db.tt/EiN6Qcot
Thank you again!
Click to expand...
Click to collapse
Brother,
Give me 24 hours only to take look on your files. And I will revert you back as soon as possible. Thanks for posting it here. I appreciate your support brothers.
That sounds great! Thank you! I really hope I can get it working.
Sent from my Nexus 4

[Guide] How to add a Settings Observer to your Rom

[Guide] How to add a SettingsObserver to your Rom
This will allow you to add a settings observer to existing smali.
Adding a settings observer allows you to create a real-time update to an existing mod such as colors and toggles so the modification takes effect instantly without any other user intervention such as reboots, etc.
Huge credits @remuntada for all the information included in this guide.
Probably the most utilized settings observer is present for the PhoneStatusBar.smali in SystemUI.apk so we will provide this as an example:
Also see here for example of how to add a RegObserver to QSPanel
RegObserver Guide
SettingsObserver Guide
SystemUI.apk smali edits:
\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali
New code is in BLUE
Code:
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$PmsBrightnessEnableObserver;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$EasyModeEnableObserver;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BrightnessEnableObserver;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$BatteryTextObserver;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$DozeServiceHost;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$ShadeUpdates;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$FastColorDrawable;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$MyTicker;,
[COLOR="Blue"]Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;,[/COLOR]
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$H;,
Lcom/android/systemui/statusbar/phone/PhoneStatusBar$EmergencyModeObserver;,
}
.end annotation
Same smali, add new code in BLUE
The edit is about halfway into the smali. Make sure the values of the new code match the surrounding values. Note that after that :cond_0 there may be additional code in your smali. Just insert the new code where indicated.
Code:
.method public start()V
.
.
.
:cond_0[COLOR="Blue"]
new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;
iget-object v1, p0, Lcom/android/systemui/statusbar/BaseStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;
invoke-direct {v0, p0, v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/os/Handler;)V
invoke-virtual {v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->observe()V[/COLOR]
new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mCastController:Lcom/android/systemui/statusbar/policy/CastControllerImpl;
invoke-direct {v0, v1, v2}, Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;-><init>(Landroid/content/Context;Lcom/android/systemui/statusbar/policy/CastController;)V
iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mIconPolicy:Lcom/android/systemui/statusbar/phone/PhoneStatusBarPolicy;
Same smali, add YOUR new method.
This is just an example method of a mod I added to change the dateview color that gets invoked from the SettingsObserver:
Code:
.method setDateTextViewColor()V
.locals 8
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 v2
const-string v3, "pulldown_date_color"
const v1, -0x111112
invoke-static {v2, v3, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v7
iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
const v6, 0x7f0d02b8 ## [COLOR="Green"]<public type="id" name="date_expanded"
[/COLOR]
invoke-virtual {v5, v6}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
check-cast v4, Landroid/widget/TextView;
invoke-virtual {v4, v7}, Landroid/widget/TextView;->setTextColor(I)V
return-void
.end method
Add the PhoneStatusBar$SettingsObserver.smali file already attached at the bottom of this post to the same folder as PhoneStatusBar.smali.
Now lets look in the PhoneStatusBar$SettingsObserver.smali to see how we made the changes to it.
Note the text in BLUE, this where we check for changes to the key string and in the second method is where the new method gets launched to update the view if changes have been detected to that key.
Note the text in GREEN, this is how you would add two more mods to the settings observer with two additional methods to invoke in PhoneStatusBar. They are only present as an example.
Code:
.class Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;
.super Landroid/database/ContentObserver;
.source "PhoneStatusBar.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = "SettingsObserver"
.end annotation
# instance fields
.field final synthetic this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
# direct methods
.method constructor <init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/os/Handler;)V
.locals 0
iput-object p1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
invoke-direct {p0, p2}, Landroid/database/ContentObserver;-><init>(Landroid/os/Handler;)V
return-void
.end method
# virtual methods
.method observe()V
.locals 3
const/4 v2, 0x0
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
iget-object v1, v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
[COLOR="Blue"]const-string v1, "pulldown_date_color"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver[/COLOR](Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
[COLOR="Green"]const-string v1, "second_settings_key_goes_here"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
const-string v1, "third_settings_key_goes_here"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V[/COLOR]
return-void
.end method
.method public onChange(Z)V
.locals 1
[COLOR="Blue"] iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setDateTextViewColor()V
[/COLOR]
[COLOR="Green"]iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setSecondMethod()V
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/statusbar/phone/PhoneStatusBar;
invoke-virtual {v0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setThirdMethod()V
[/COLOR] return-void
.end method
Modifying and adding a Settings Observer to most other smalis:
For smali where #annotations does not exist, add a new one right below the .source line like in this example. If #annotations already exist, add the line to #annotations as in the PhoneStatusBar.smali example above.
Note the highlighted text in RED, this path must match the smali you are working in (the green highlighted path).
Code:
.class public [COLOR="Green"]Lcom/android/incallui/dialpad/DialpadView[/COLOR];
.super Landroid/widget/LinearLayout;
.source "DialpadView.java"
[COLOR="Blue"]# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
[COLOR="Red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR]$SettingsObserver;
}
.end annotation[/COLOR]
Search for either one of these methods:
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
And add the new code in BLUE (and Red) before the return-void at the end of the method.
Note that the paths in RED have to match the smali you're working in.
Note that I had to increase the .locals value to accommodate the new entry which I did in this example.
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
[COLOR="Blue"].locals 3[/COLOR]
const/4 v0, 0x0
invoke-direct {p0, p1, p2, v0}, Lcom/android/incallui/dialpad/DialpadView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
[COLOR="blue"]new-instance v1, [COLOR="red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR]$SettingsObserver;
new-instance v2, Landroid/os/Handler;
invoke-direct {v2}, Landroid/os/Handler;-><init>()V
invoke-direct {v1, p0, v2}, [COLOR="red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR]$SettingsObserver;-><init>([COLOR="Red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR];Landroid/os/Handler;)V
invoke-virtual {v1}, [COLOR="red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR]$SettingsObserver;->observe()V
[/COLOR]
return-void
.end method
Important note:
Wouldn't you know it, the smali I chose to use as an example does not support mcontext so I used getContext here and in the attached DateView$SettingsObserver.smali
After the last .method public constructor method (or with the rest of the access$xxx methods, if they exist) insert this method.
Note the path highlighted in RED must match the smali you are working with.
Code:
.method static synthetic access$001([COLOR="Red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR];)Landroid/content/Context;
.locals 1
invoke-virtual {p0}, [COLOR="red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR];->getContext()Landroid/content/Context;
move-result-object v0
return-object v0
.end method
Important note:
Use this one instead if your smali DOES support mcontext:
Code:
.method static synthetic access$001([COLOR="red"]Lcom/android/keyguard/sec/SecKeyguardClockSingleView[/COLOR];)Landroid/content/Context;
.locals 1
iget-object v0, p0, [COLOR="red"]Lcom/android/keyguard/sec/SecKeyguardClockSingleView[/COLOR];->mContext:Landroid/content/Context;
return-object v0
.end method
How to create a new YourFile$SettingsObserver
I don't recommend using
PhoneStatusBar$SettingsObserver.smali or DateView$SettingsObserver.smali
as your templates. The first is specifically for PhoneStatusBar.smali and use DateView$SettingsObserver.smali if your smali does not support mcontext.
Using one of the attached $SettingsObserver files as a template, do the following edits throughout the ENTIRE $SettingsObserver.smali (only highlighting first few lines for brevity).
Find and replace all 14 of the paths to correspond with the smali you are working in.
The .source line is the smali name only. Change this to match the smali you are working in also.
The completed SettingsObserver.smali gets placed in the same folder as the parent smali we are working with.
Code:
.class public [COLOR="Red"]Lcom/android/incallui/dialpad/DialpadView[/COLOR]$SettingsObserver;
.super Landroid/database/ContentObserver;
.source "[COLOR="red"]DialpadView[/COLOR].java"
SettingsObserver example files have been attached to this post.
** some MM guide discussions begin here: http://forum.xda-developers.com/showpost.php?p=66480317&postcount=70
Reserved
I am totally open to alternate methods and critique on improving on this folks so don't be shy with the input.
tdunham said:
I am totally open to alternate methods and critique on improving on this folks so don't be shy with the input.
Click to expand...
Click to collapse
Are you??? tomorrow we will add our observer then ???
Sent from my awesome g920f powered by 6thGear
daxgirl said:
Are you??? tomorrow we will add our observer then ???
Click to expand...
Click to collapse
Awesome!
I am fairly new to adding observers but I thought it was necessary to start this discussion with the established method and work our way up from there.
How would it be to change in real time with this guide ?: [How-to Guide] Colorize main dialpad Android letters & digits L
Do I have to create the settings observer?
tdunham said:
Awesome!
I am fairly new to adding observers but I thought it was necessary to start this discussion with the established method and work our way up from there.
Click to expand...
Click to collapse
No doubt!!! Keep it up! You're making xda tolerable again!
Sent from my awesome g920f powered by 6thGear
I have to say most of the work comes from the suggestion given to me by @CNexus here http://forum.xda-developers.com/showpost.php?p=50961314&postcount=527
Add the smali DateView$SettingsObserver to smali/com/android/dialer/dialpad and change all the routes to which it belongs.
Changing the .class public.
Should I do anything else?
aceqott said:
Add the smali DateView$SettingsObserver to smali/com/android/dialer/dialpad and change all the routes to which it belongs.
Changing the .class public.
Should I do anything else?
Click to expand...
Click to collapse
Its going to be pretty tough to add an observer to SecContacts, they chose to use letters for every single method so its going to be difficult to figure out where to place anything.
I'll look at it when I can but its probably not going to happen right away and like I said, I'm not having the dialpad color not changing instantly even without an observer so it is hard to tell if it will even work if I do find something.
tdunham said:
Its going to be pretty tough to add an observer to SecContacts, they chose to use letters for every single method so its going to be difficult to figure out where to place anything.
I'll look at it when I can but its probably not going to happen right away and like I said, I'm not having the dialpad color not changing instantly even without an observer so it is hard to tell if it will even work if I do find something.
Click to expand...
Click to collapse
Well, too bad, anyway I do not understand, I have seen now a video of other ROMs where if the digit is changed and letters SecContact real time.
While I catch a cold and am having a fever, honestly cannot convince myself to lay down and tell myself read this thread later. Thanks for amazing guide.:good:
kmokhtar79 said:
While I catch a cold and am having a fever, honestly cannot convince myself to lay down and tell myself read this thread later. Thanks for amazing guide.:good:
Click to expand...
Click to collapse
Get to bed and read on Tapatalk. ..
Sent from my awesome g920f powered by 6thGear
daxgirl said:
Get to bed and read on Tapatalk. ..
Sent from my awesome g920f powered by 6thGear
Click to expand...
Click to collapse
I need wide screen [emoji16]
OK for start, I am asking to see whether if in theory I am understanding it correctly or not.
I am trying adding a new observe for battery color as once shared by @remuntada78.
I added this in my settings observer
Code:
const-string v1, "battery_color"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
and
Code:
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/BatteryMeterView;
invoke-virtual {v0}, Lcom/android/systemui/BatteryMeterView;->setBatteryColor()V
and then in
BatteryMeterView.smali
Code:
.class public Lcom/android/systemui/BatteryMeterView;
.super Landroid/view/View;
.source "BatteryMeterView.java"
# interfaces
.implements Lcom/android/systemui/DemoMode;
.implements Lcom/android/systemui/statusbar/policy/BatteryController$BatteryStateChangeCallback;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
[COLOR="Red"] Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;,[/COLOR]
Lcom/android/systemui/BatteryMeterView$BatteryTracker;
}
.end annotation
in the same smali:
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals [COLOR="red"]2[/COLOR]
const/4 v0, 0x0
invoke-direct {p0, p1, p2, v0}, Lcom/android/systemui/BatteryMeterView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
[COLOR="red"] new-instance v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;
new-instance v2, Landroid/os/Handler;
invoke-direct {v2}, Landroid/os/Handler;-><init>()V
invoke-direct {v1, p0, v2}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;-><init>(Lcom/android/systemui/BatteryMeterView;Landroid/os/Handler;)V
invoke-virtual {v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->observe()V[/COLOR]
return-void
.end method
and as my smali does not support mcontext I added following method in red
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V [COLOR="SeaGreen"]#last public constructor[/COLOR]
.
.
.
.end method
.method static synthetic access$000(Lcom/android/systemui/BatteryMeterView;)Landroid/os/Handler;
.locals 1
iget-object v0, p0, Lcom/android/systemui/BatteryMeterView;->mPostInvalidateHandler:Landroid/os/Handler;
return-object v0
.end method
[COLOR="red"].method static synthetic access$001(Lcom/android/systemui/BatteryMeterView;)Landroid/content/Context;
.locals 1
invoke-virtual {p0}, Lcom/android/systemui/BatteryMeterView;->getContext()Landroid/content/Context;
move-result-object v0
return-object v0
.end method[/COLOR]
And lastly have done those samli modification described here I don't try it.
kmokhtar79 said:
OK for start, I am asking to see whether if in theory I am understanding it correctly or not.
I am trying adding a new observe for battery color as once shared by @remuntada78.
I added this in my settings observer
Code:
const-string v1, "battery_color"
invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V
and
Code:
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->this$0:Lcom/android/systemui/BatteryMeterView;
invoke-virtual {v0}, Lcom/android/systemui/BatteryMeterView;->setBatteryColor()V
and then in
BatteryMeterView.smali
Code:
.class public Lcom/android/systemui/BatteryMeterView;
.super Landroid/view/View;
.source "BatteryMeterView.java"
# interfaces
.implements Lcom/android/systemui/DemoMode;
.implements Lcom/android/systemui/statusbar/policy/BatteryController$BatteryStateChangeCallback;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
[COLOR="Red"] Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;,[/COLOR]
Lcom/android/systemui/BatteryMeterView$BatteryTracker;
}
.end annotation
in the same smali:
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
.locals [COLOR="red"]2[/COLOR]
const/4 v0, 0x0
invoke-direct {p0, p1, p2, v0}, Lcom/android/systemui/BatteryMeterView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
[COLOR="red"] new-instance v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;
new-instance v2, Landroid/os/Handler;
invoke-direct {v2}, Landroid/os/Handler;-><init>()V
invoke-direct {v1, p0, v2}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;-><init>(Lcom/android/systemui/BatteryMeterView;Landroid/os/Handler;)V
invoke-virtual {v1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$SettingsObserver;->observe()V[/COLOR]
return-void
.end method
and as my smali does not support mcontext I added following method in red
Code:
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V [COLOR="SeaGreen"]#last public constructor[/COLOR]
.
.
.
.end method
.method static synthetic access$000(Lcom/android/systemui/BatteryMeterView;)Landroid/os/Handler;
.locals 1
iget-object v0, p0, Lcom/android/systemui/BatteryMeterView;->mPostInvalidateHandler:Landroid/os/Handler;
return-object v0
.end method
[COLOR="red"].method static synthetic access$001(Lcom/android/systemui/BatteryMeterView;)Landroid/content/Context;
.locals 1
invoke-virtual {p0}, Lcom/android/systemui/BatteryMeterView;->getContext()Landroid/content/Context;
move-result-object v0
return-object v0
.end method[/COLOR]
And lastly have done those samli modification described here I don't try it.
Click to expand...
Click to collapse
Look at the red class declaration. You added observer class that belongs to a different class. You need an observer for this class. Not for PhoneStatusBar.smali
Sent from my awesome g920f powered by 6thGear
daxgirl said:
Look at the red class declaration. You added observer class that belongs to a different class. You need an observer for this class. Not for PhoneStatusBar.smali
Sent from my awesome g920f powered by 6thGear
Click to expand...
Click to collapse
You are saying I need another observer to create as BatteryMeterView$SettingsObserver.smali right?
kmokhtar79 said:
You are saying I need another observer to create as BatteryMeterView$SettingsObserver.smali right?
Click to expand...
Click to collapse
Exactly. Observer is in this case an inner class. BatteryMeterView class cannot have an inner class that's called PhoneStatusBar$SettingsObserver.
http://www.javaworld.com/article/2077411/core-java/inner-classes.html
Sent from my awesome g920f powered by 6thGear
daxgirl said:
Are you??? tomorrow we will add our observer then ???
Click to expand...
Click to collapse
@daxgirl
Looking for an alternate method to add an observer where one wouldn't normally work. No rush on this.
tdunham said:
@daxgirl
Looking for an alternate method to add an observer where one wouldn't normally work. No rush on this.
Click to expand...
Click to collapse
Lol... hi there. On this side "looking forward to finishing properly handling assets and scripts for the new custom settings app so I cac concentrate on other things"
Just to clarify the thing...
We have built a settings app a while ago for ourselves. Since we both work with java, we don't need it to be as automated as ficeto's app is. So now the biggest challenge is to make it available for all, by providing a code that wouldn't require an entire forum on xda to couch devs to use it and minimize your exposure to java where possible. Our goal is to provide as clean code is possible, so minimal changes to code would be required to operate the app. That is because we understand that most devs have minimal skills when it comes to original development. We dont want to force people to build special conditions and make huge changes to the java part of the app. So the automating part... It's taking time....
We have so far fully automated and integrative nav drawer, where items can be added easily with little guiding, theme change support, automated preference fragments, automated scripts execution from the app assets and automated preference handling from the get go, no matter how deep the preference tree goes (as many nesting preference screens as you want). Right now I am working on handling those things in separate classes, so the devs wouldn't need to copy huge chunks of code when they want to create another new preference fragment for their drawer.... and as much as it's fun, little time is left for anything else for now...
Sent from my awesome g920f powered by 6thGear

Categories

Resources