Related
my phone in the tricolor states
MAPL100
SPL-1.17.hard
MicroP-Maple (LED) v6
ENGID 0x2
PCBID 0x80
PanelInfo 15-0x2
does that mean its stock tmobile? shouldn't it be 1.17.0000
SPL-1.17 means that its bootloader is HardSPL'd. Doesn't mean the OS itself is not stock though.
Hi there, I want to share this tutorial for implementing Swipe-to-Remove Notification feature found in CyanogenMod to stock ROM (Gingerbread or earlier ROM). Sure it will be available on ICS but for those who like to add one to their custom ROM here's how Currently i don't know to whom should i give credit to, if anybody knows please post below and i'll add the link for the original modder. Thanks to:
1. like-p for help showing me what files to be edited
2. LeoMar75 for some info on how to control Stub switch case
This mod is based on Sony Ericsson Xperia Ray, so take care when adding to another device, some code might be different though so no direct copy paste, please learn some of the line first.
PS: For Froyo mod, please follow Jason-EX here
Requirement:
1. decompiled Framework.jar with Baksmali manager
2. decompiled SystemUI.apk with APK Multi Tool
3. Some Basic understanding about editing xml file and smali code.
4. WinMerge or other comparison tool (to better editing and comparing with my sample file)
5. Backup the framework.jar and SystemUI.apk first!
Files to be edited:
in SystemUI.apk
res/anim/
res/layout/status_bar_latest_event.xml
res/values/public.xml
smali/com/android/systemui/statusbar/LatestItemContainer$1.smali
smali/com/android/systemui/statusbar/LatestItemContainer.smali
smali/com/android/systemui/statusbar/StatusBarService$7.smali (or depends on your numbering, could be $8 or larger)
smali/com/android/systemui/statusbar/StatusBarService.smali
in framework.jar:
smali/com/android/internal/statusbar/IStatusBarService$Stub$Proxy.smali
smali/com/android/internal/statusbar/IStatusBarService$Stub.smali
smali/com/android/internal/statusbar/IStatusBarService.smali
UPDATE: This is the additional guide for other device when editing StatusBarService.smali. See here:
1. HTC based
2. Samsung based
Alright, let's mod one by one
1. Editing SystemUI.apk
1.1 Editing res/anim
We are registering anim object here, so swipe animation can be done.
Create folder anim (if not exists yet) inside /res folder
Create 2 file named slide_out_left_basic.xml and slide_out_right_basic.xml inside res/anim folder
for slide_out_left_basic.xml, edit the file and fill with this
Code:
<?xml version="1.0" encoding="utf-8"?>
<translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0.0" android:toXDelta="-100.0%p"
xmlns:android="http://schemas.android.com/apk/res/android" />
for slide_out_right_basic.xml, edit the file and fill with this
Code:
<?xml version="1.0" encoding="utf-8"?>
<translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0.0" android:toXDelta="100.0%p"
xmlns:android="http://schemas.android.com/apk/res/android" />
Save both
Update: Mirko ddd (&shoman94 have pointed that out before but i have no idea where to change, sorry mate) have given me the tip to improve the gesture. read his post here Thanks mate, both of you!
1.2 Editing res/layout/status_bar_latest_event.xml
We are replacing LinearLayout object used in StatusBar with LatestItemContainer here, so notification can be removed. We handle the Styling first by editing this .xml first. Here are the steps:
Change the code from Original code to this (change the bold one)
Code:
<?xml version="1.0" encoding="utf-8"?>
<[B]com.android.systemui.statusbar.LatestItemContainer [/B]android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="65.0sp"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.systemui.statusbar.LatestItemView android:id="@id/content" android:background="@android:drawable/status_bar_item_background" android:paddingRight="6.0sp" android:focusable="true" android:clickable="true" android:layout_width="fill_parent" android:layout_height="64.0sp" android:shadowColor="#ff000000" android:shadowDx="0.0" android:shadowDy="1.0" android:shadowRadius="2.0" />
<View android:background="@drawable/divider_horizontal_light_opaque" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<[B]/com.android.systemui.statusbar.LatestItemContainer[/B]>
Save
1.3 Editing res/values/public.xml
This one is for registering anim file that we made on step 1.1 to be available publicly and to be recognized in .smali program. Here are the steps:
Recompile your apk after putting anim file into /res folder
Decompile again the resulting apk
Inside /res/values/public.xml, you'll found something like this:
Code:
<resources>
.
.
.
[B]
<public type="anim" name="slide_out_left_basic" id="0x7f0c0000" />
<public type="anim" name="slide_out_right_basic" id="0x7f0c0001" />
[/B]
</resources>
[*]Remember the ID for both anim lines. This will be applied again on the step 1.4
1.4 Adding smali/com/android/systemui/statusbar/LatestItemContainer$1.smali and smali/com/android/systemui/statusbar/LatestItemContainer.smali
This is the class of LatestItemContainer that will be used to handle the notification list instead of LatestItemView. Here are the steps:
Please download from the attachment
insert the files inside to mentioned folder above
Inside LatestItemContainer$1.smali, there's an id that references the anim from step1.2. please edit it if you have different id for anim left or anim from previous step.
Code:
.line 53
:cond_0
const/high16 v1, [B]0x7f0c[/B]
and
Code:
.line 51
const v1, [B]0x7f0c0001[/B]
1.5 Add smali/com/android/systemui/statusbar/StatusBarService$7.smali (or depends on your existing framework numbering, could be $8 or larger)
This is additional function for StatusBarService to handle onClearNotification function. Here are the steps:
Extract the StatusBarService$7.smali from attachment
If StatusBarService$7.smali does not exist before, just place it inside, if not, skip this step.
If StatusBarService$7.smali exists, Please rename the file to StatusBarService$8.smali (or whatever higher number that is unused) and rename all the line inside the file from
Code:
StatusBarService$7
to
Code:
StatusBarService$8
1.6 Edit smali/com/android/systemui/statusbar/StatusBarService.smali
UPDATE: This is the additional guide for other device when editing StatusBarService.smali. See here:
1. Generic java readout
2. HTC based
3. Samsung based
This is the file that generate NotificationView. Please take care of the changes here more carefully because there might be some differences between vendors in this file. Here are the steps:
Open StatusBarService.smali and find this function
Code:
.method makeNotificationView(Lcom/android/internal/statusbar/StatusBarNotification;Landroid/view/ViewGroup;)[Landroid/view/View;
Find this code in the makeNotificationView function body:
Code:
invoke-virtual {v0, v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object v18
const v4, 0x7f0b0014
move-object/from16 v0, v18
move v1, v4
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v10
Insert the bold code below between the existing code:
Code:
invoke-virtual {v0, v1, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
move-result-object v18
[B] check-cast v18, Lcom/android/systemui/statusbar/LatestItemContainer;
.line 516
.local v18, row:Lcom/android/systemui/statusbar/LatestItemContainer;
move-object/from16 v0, v16
iget v0, v0, Landroid/app/Notification;->flags:I
move v4, v0
and-int/lit8 v4, v4, 0x2
if-nez v4, :cond_swno
move-object/from16 v0, v16
iget v0, v0, Landroid/app/Notification;->flags:I
move v4, v0
and-int/lit8 v4, v4, 0x20
if-nez v4, :cond_swno
new-instance v4, Lcom/android/systemui/statusbar/StatusBarService$7;
move-object v0, v4
move-object/from16 v1, p0
move-object/from16 v2, p1
invoke-direct {v0, v1, v2}, Lcom/android/systemui/statusbar/StatusBarService$7;-><init>(Lcom/android/systemui/statusbar/StatusBarService;Lcom/android/internal/statusbar/StatusBarNotification;)V
move-object/from16 v0, v18
move-object v1, v4
invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setOnSwipeCallback(Ljava/lang/Runnable;)V
.line 735
:cond_swno[/B]
const v4, 0x7f0b0014
move-object/from16 v0, v18
move v1, v4
[B] invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->findViewById(I)Landroid/view/View;[/B]
move-result-object v10
Once again, change
Code:
StatusBarService$7
to
Code:
StatusBarService$8
line if you happened to have StatusBarService$8.smali as the result of renaming on the previous step.
IMPORTANT LOGIC TO BE UNDERSTOOD: This step tells the function to:
1. cast the already made View Object to LatestItemContainer instead of using LatestView class.
2. Filter if the Notification is removable or not
3. the LatestItemContainer object (v18) is assigned with onSwipeCallback(new StatusBarService$7)
Change the following (still on the same function body):
Code:
move v1, v4
invoke-virtual {v0, v1}, Landroid/view/View;->setDrawingCacheEnabled(Z)V
.line 542
const/4 v4, 0x3
to
Code:
move v1, v4
[B] invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setDrawingCacheEnabled(Z)V
[/B]
.line 542
const/4 v4, 0x3
Please note:
StatusBarService.smali might be different between vendor, so please adapt with your .smali to implement the above coding.
2. Editing framework.jar
2.1 editing smali/com/android/internal/statusbar/IStatusBarService$Stub.smali
Here are the steps:
Add this code on variable declaration part inside the file
Code:
.field static final TRANSACTION_onClearAllNotifications:I = 0xb
[B].field static final TRANSACTION_onNotificationClear:I = 0xc[/B]
.field static final TRANSACTION_onNotificationClick:I = 0x9
.field static final TRANSACTION_onNotificationError:I = 0xa
If the 0xc is already used on another static value, you must change it so it remains unique.
Find this code:
Code:
.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.registers 14
.parameter "code"
.parameter "data"
.parameter "reply"
.parameter "flags"
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.prologue
.line 39
sparse-switch p1, :sswitch_data_124
change to
Code:
.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.registers 14
.parameter "code"
.parameter "data"
.parameter "reply"
.parameter "flags"
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.prologue
.line 39
[B]sparse-switch p1, :sswitch_data_13e[/B]
Insert/replace this code (it is at the end of the file):
Code:
.line 176
const/4 v0, 0x1
goto/16 :goto_7
.line 39
:sswitch_data_124
.sparse-switch
0x1 -> :sswitch_f
0x2 -> :sswitch_1c
0x3 -> :sswitch_29
0x4 -> :sswitch_42
0x5 -> :sswitch_5f
0x6 -> :sswitch_7b
0x7 -> :sswitch_8d
0x8 -> :sswitch_c7
0x9 -> :sswitch_d5
0xa -> :sswitch_ef
0xb -> :sswitch_116
0x5f4e5446 -> :sswitch_8
.end sparse-switch
to
Code:
[B]
.line 176
const/4 v0, 0x1
goto/16 :goto_7
.end local v1 #_arg0:Ljava/lang/String;
.end local v2 #_arg1:Ljava/lang/String;
.end local v3 #_arg2:I
:sswitch_124
const-string v0, "com.android.internal.statusbar.IStatusBarService"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
.line 177
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v1
.line 178
.restart local v1 #_arg0:Ljava/lang/String;
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v2
.line 179
.restart local v2 #_arg1:Ljava/lang/String;
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v3
.line 180
.restart local v3 #_arg2:I
invoke-virtual {p0, v1, v2, v3}, Lcom/android/internal/statusbar/IStatusBarService$Stub;->onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.line 181
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
.line 182
const/4 v0, 0x1
goto/16 :goto_7[/B]
.line 39
:sswitch_data_13e
.sparse-switch
0x1 -> :sswitch_f
0x2 -> :sswitch_1c
0x3 -> :sswitch_29
0x4 -> :sswitch_42
0x5 -> :sswitch_5f
0x6 -> :sswitch_7b
0x7 -> :sswitch_8d
0x8 -> :sswitch_c7
0x9 -> :sswitch_d5
0xa -> :sswitch_ef
0xb -> :sswitch_116
[B]0xc -> :sswitch_124[/B]
0x5f4e5446 -> :sswitch_8
.end sparse-switch
it's important to note this
Code:
[B]0xc -> :sswitch_124[/B]
If you rename the static at the previous steps, please change the 0xc accordingly.
2.2 Editing smali/com/android/internal/statusbar/IStatusBarService$Stub$Proxy.smali
Here are the steps:
Insert these function code to the file:
Code:
.method public onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.registers 9
.parameter "pkg"
.parameter "tag"
.parameter "id"
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.prologue
.line 359
invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;
move-result-object v0
.line 360
.local v0, _data:Landroid/os/Parcel;
invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;
move-result-object v1
.line 362
.local v1, _reply:Landroid/os/Parcel;
:try_start_8
const-string v2, "com.android.internal.statusbar.IStatusBarService"
invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V
.line 363
invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 364
invoke-virtual {v0, p2}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
.line 365
invoke-virtual {v0, p3}, Landroid/os/Parcel;->writeInt(I)V
.line 366
iget-object v2, p0, Lcom/android/internal/statusbar/IStatusBarService$Stub$Proxy;->mRemote:Landroid/os/IBinder;
const/16 v3, 0xa
const/4 v4, 0x0
invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.line 367
invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
:try_end_21
.catchall {:try_start_8 .. :try_end_21} :catchall_28
.line 370
invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V
.line 371
invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V
.line 373
return-void
.line 370
:catchall_28
move-exception v2
invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V
.line 371
invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V
throw v2
.end method
Please inspect the code for this part:
Code:
[B]const/16 v3, 0xa[/B]
const/4 v4, 0x0
invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
The bold one must match on one of the switch case value at the end of IStatusBarService$Stub.smali,
in my phone actually the valid one is the TRANSACTION_onNotificationError (0xa) so if your NotificationError is not 0xa but 0xb for example, please change the bold one to 0xb
Save
2.3 editing smali/com/android/internal/statusbar/IStatusBarService.smali
Insert this function code to the file. Here are the steps:
Insert these function code to the file:
Code:
.method public abstract onNotificationClear(Ljava/lang/String;Ljava/lang/String;I)V
.annotation system Ldalvik/annotation/Throws;
value = {
Landroid/os/RemoteException;
}
.end annotation
.end method
Save
There you have it AFAIK, the files that you need to take care more than others are:
1. smali/com/android/systemui/statusbar/StatusBarService.smali
2. res/values/public.xml
The rest can be applied from the attachment below directly. Ok that's all, after you are done, compile both SystemUI.apk and Framework.jar.
How to Compile the right way?
1. SystemUI.apk ->
Compile with APK Multi Tool, press y and y twice with all the requested input,
delete modified file from keep folder, and after that continue compiling.
Copy from original APK the META-INF and AndroidManifest.xml to the unsignedSystemUI.apk
rename unsignedSystemUI.apk to signedSystemUI.apk
select Zipalign from APK Multi Tool to optimize apk.
Rename to SystemUI.apk (move the original one just in case)
2. framework.jar ->
Smali inside Baksmali Manager
Replace classes.dex inside framework.jar with the generated one.
and apply on your phone.
Hope this helps you (programmer ofc, not end user ) to implement on your device.
G'day!
Mate, thank you so much for this - I have been trying to figure it out for our ROM for weeks LOL I'm going to give it a try this evening and I'll let you know if I get it! Thanks again
Dunc001 said:
Mate, thank you so much for this - I have been trying to figure it out for our ROM for weeks LOL I'm going to give it a try this evening and I'll let you know if I get it! Thanks again
Click to expand...
Click to collapse
Ok let me know mate
ill try it on my SGY
Looks fun! great post
tommytomatoe said:
Looks fun! great post
Click to expand...
Click to collapse
Updated step, to give you some warning about StatusBarService$7 naming convention
definitely gonna give this a try!!
great akaka.try it soon.
did u know how to port ICS layout to stock rom? can u write a tut?
this will be great!!
nvt992 said:
great akaka.try it soon.
did u know how to port have ICS layout to stock rom? can u write a tut?
this will be great!!
Click to expand...
Click to collapse
What layout? Do you mean ICS launcher layout or..?
no.see my attach
nvt992 said:
no.see my attach
Click to expand...
Click to collapse
Well do you have the original link? First, i know nothing about that, so i should learn first. and secondly, it's more about theme editing, so i think it's more about editing XML inside SystemUI.apk rather than coding a .smali like above. Thirdly, the shortcut for setting in ICS IMHO is not as efficient as Power Widget Status Bar.
hansip87 said:
Well do you have the original link? First, i know nothing about that, so i should learn first. and secondly, it's more about theme editing, so i think it's more about editing XML inside SystemUI.apk rather than coding a .smali like above. Thirdly, the shortcut for setting in ICS IMHO is not as efficient as Power Widget Status Bar.
Click to expand...
Click to collapse
this is for cm7
patch http://forum.xda-developers.com/showthread.php?t=1324924
or original theme
http://forum.xda-developers.com/showthread.php?t=1334922
hope u can do it
nvt992 said:
this is for cm7
patch http://forum.xda-developers.com/showthread.php?t=1324924
or original theme
http://forum.xda-developers.com/showthread.php?t=1334922
hope u can do it
Click to expand...
Click to collapse
Well ok thanks but don't count on me ok because i am currently researching for 2G/3G toggle button for PowerWidget, this one is not that high on my list, but you never know..
ok thank you
where can i get Baksmali manager?
lasmaty07 said:
where can i get Baksmali manager?
Click to expand...
Click to collapse
Check back later mate, just uploading right now because of on the original link, it's dead. I'll upload it for us all to share
EDIT: Uploaded. Click Baksmali Manager link on the first page to download. APK Multi Tool can be found on the same parent thread (Hacking General)
Done, but get this error when recompiling .apk
Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\me\Desktop\folder>apktool.bat b -f -d out
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: [email protected]
at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)
at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)
at brut.androlib.src.SmaliBuilder.buildFile(Unknown Source)
at brut.androlib.src.SmaliBuilder.build(Unknown Source)
at brut.androlib.src.SmaliBuilder.build(Unknown Source)
at brut.androlib.Androlib.buildSourcesSmali(Unknown Source)
at brut.androlib.Androlib.buildSources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Tried to do it manually like this and using apk multitool, but same error in log.
even tried to compile just after decompiling but that's no help.. same error
Any help?
jaggyjags said:
Done, but get this error when recompiling .apk
Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\me\Desktop\folder>apktool.bat b -f -d out
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: [email protected]
at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)
at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)
at brut.androlib.src.SmaliBuilder.buildFile(Unknown Source)
at brut.androlib.src.SmaliBuilder.build(Unknown Source)
at brut.androlib.src.SmaliBuilder.build(Unknown Source)
at brut.androlib.Androlib.buildSourcesSmali(Unknown Source)
at brut.androlib.Androlib.buildSources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Tried to do it manually like this and using apk multitool, but same error in log.
even tried to compile just after decompiling but that's no help.. same error
Any help?
Click to expand...
Click to collapse
APKTools is a bit outdated and i'm afraid some incompatibilites with Google SDK might be the source of the problem. search APK Multi Tools and use that one instead with SDK release 16 and up.
Hello, and thanks for the how-to!
Sadly I couldn't get it to work on my phone (Motorola Atrix 2). Some of the smali files were pretty different... I tried my best but there were definitely moments when I wasn't sure if I was doing the correct thing... SystemUI won't compile.
Hi, all. Seems the statusbarservice.smali is very different from each other. So to help you all, this is the java code that should give you a better understanding. Please read here https://github.com/nadlabak/android...m/android/server/status/StatusBarService.java
Sent from my ST18i using XDA App
If you like it then dont forget THANKS Button
Things You Need
-smabakv1(attached)- its easier for n00bs
-notepad++
-7-zip
-android.policy.jar(MIUI ROM)
-modded smali's(Attached)
Lets Start
1)Download smabakv1 its attached in post, extract it some where you can easily access it.
2)Copy your android.policy.jar to the directory where you extracted smabakv1.
3)Now run "Run Me.bat" and press 1 to decompile. you will get a classout folder.
4)navigate to "classout\com\android\internal\policy\impl\"
5)open "MiuiGlobalActions$SinglePressAction.smali" in notepad++
6)you need to add the highlighted code exactly where it is shown
Code:
.end annotation
[COLOR="RoyalBlue"][B]# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;[/B][/COLOR]
# instance fields
.field private mIconResId:I
Code:
.field private mTextview:Landroid/widget/TextView;
# direct methods
[COLOR="RoyalBlue"][B].method static constructor <clinit>()V
.registers 3
const/4 v0, 0x3
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Normal"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Recovery"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Bootloader"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/MiuiGlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
return-void
.end method[/B][/COLOR]
.method protected constructor <init>(II)V
.registers 3
.parameter "iconResId"
.parameter "messageResId"
7)now open "MiuiGlobalActions.smali" with notepad++ located in the same place.
8)search for "MiuiGlobalActions$3" and replace it with "MiuiGlobalActions$222"
99% of time you need to replace MiuiGlobalActions$3,.... but for some devices MiuiGlobalActions$x where x is a number, is diffrent
to find out which is yours
Code:
findstr /n /i /c:"rebootSafeMode" *
you should get something similar to this
Code:
invoke-interface {v0}, Landroid/view/WindowManagerPolicy$WindowManagerFuncs;->rebootSafeMode()V
now that is your MiuiGlobalActions$x
just replace your MiuiGlobalActions$x with MiuiGlobalActions$222 in MiuiGlobalActions.smali
Click to expand...
Click to collapse
these two places you should change in MiuiGlobalActions.smali
Code:
new-instance v1, Lcom/android/internal/policy/impl/[B]MiuiGlobalActions$3[/B];
Code:
invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/[B]MiuiGlobalActions$3[/B];-><init>(Lcom/android/internal/policy/impl/MiuiGlobalActions;II)V
Note: you need to replace it only in two places
this is for fun,... open "MiuiGlobalActions$222" in notepad++
look for "Reboot phone" and change it to what ever you want
Click to expand...
Click to collapse
Code:
invoke-direct {v1, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
const-string v2, "Reboot phone" [B][COLOR="Blue"]<------ Change it to what ever you want[/COLOR][/B]
invoke-virtual {v1, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v1
9)download modded smali's and place them in the same directory
"classout\com\android\internal\policy\impl\"
10)again run "run me.bat" and select 2 to recompile, you will get "classes.dex"
11)open your "android.policy.jar" in 7-zip and add the "classes.dex" to it,... yes replace it,...
12)push it to your phone, make a rom or do what ever you want from here,...
13)hit THANKS if you like it and feel it was useful
--------------------------------------------------------------------------------------------------------------------------------------
thanks to
Code:
kong, miui, android, kahvitahra, snq- and any1 whom ive forgotten please remind me
thank you sir!!
can you make something like this but to change the autobrightness ? like to default or to other values ?
thanks!!
ruizit0 said:
thank you sir!!
can you make something like this but to change the autobrightness ? like to default or to other values ?
thanks!!
Click to expand...
Click to collapse
maybe tmrw!!! or when i have free time,...
have u tried it on ur own? is it working?
also i have tried the same method from a diff source which was for ICS builds but it didnt work.
more to it, i dont have ShutdownThread;->reboot string in any smali present in IMPL!
Ozadroid said:
have u tried it on ur own? is it working?
also i have tried the same method from a diff source which was for ICS builds but it didnt work.
more to it, i dont have ShutdownThread;->reboot string in any smali present in IMPL!
Click to expand...
Click to collapse
sorry my mistake,... there is no more,... ShutdownThread;->reboot in jb
The smalis are modded for jb...
Which device ur in??? Or porting from where??
did you try replacing "MiuiGlobalActions$3" with "MiuiGlobalActions$222" ????
chiragkrishna said:
sorry my mistake,... there is no more,... ShutdownThread;->reboot in jb
The smalis are modded for jb...
Which device ur in??? Or porting from where??
did you try replacing "MiuiGlobalActions$3" with "MiuiGlobalActions$222" ????
Click to expand...
Click to collapse
nope i dint try urs.. will do it after i finish my work with Miui4 as Miui4.1 is not to the mark for my device!
Ozadroid said:
nope i dint try urs.. will do it after i finish my work with Miui4 as Miui4.1 is not to the mark for my device!
Click to expand...
Click to collapse
updated the guide,... it should be easier now,...
chiragkrishna said:
updated the guide,... it should be easier now,...
Click to expand...
Click to collapse
have you tried it by yourself?? or just posted ??
Thanks for the guide!
Is it possible to include Hot Boot Option? I really miss it
v1r0x said:
Thanks for the guide!
Is it possible to include Hot Boot Option? I really miss it
Click to expand...
Click to collapse
yes it is possible.. i'll just have to unpack my policy
Ozadroid said:
have you tried it by yourself?? or just posted ??
Click to expand...
Click to collapse
i had done that thing only,... but in the guide i screwed up,...
v1r0x said:
Thanks for the guide!
Is it possible to include Hot Boot Option? I really miss it
Click to expand...
Click to collapse
send me the android.policy.jar with HOT BOOT Option
v1r0x said:
Thanks for the guide!
Is it possible to include Hot Boot Option? I really miss it
Click to expand...
Click to collapse
chiragkrishna said:
i had done that thing only,... but in the guide i screwed up,...
send me the android.policy.jar with HOT BOOT Option
Click to expand...
Click to collapse
replace the below .method static constructor <clinit> in your guide and you'll get the 4-way Reboot !
Code:
.method static constructor <clinit>()V
.registers 4
const-string v2, "Droid"
sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;
invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-nez v2, :cond_3b
const-string v2, "GT-I9000"
sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;
invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-nez v2, :cond_3b
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Normal"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "GT-I9100"
sget-object v3, Landroid/os/Build;->MODEL:Ljava/lang/String;
invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-nez v2, :cond_2f
const-string v2, "Bootloader"
goto :goto_31
:cond_2f
const-string v2, "Download"
:goto_31
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/MiuiGlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
goto :goto_4f
:cond_3b
const/4 v0, 0x3
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Normal"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "Hot Boot"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "Recovery"
aput-object v2, v0, v1
sput-object v0, Lcom/android/internal/policy/impl/MiuiGlobalActions$SinglePressAction;->rebootOptions:[Ljava/lang/String;
:goto_4f
return-void
.end method
Thanks Ozadroid, but I think Hot Boot doesn't work :/
After hit "Ok" the phone reboots including the htc splash screen. So I think it's a regular reboot?
@OP:
another question^^'
Any idea if it is possible to store the "reboot phone" line in a variable in framework-res or somethink like that?
Think this would be good for a multi lang rom
v1r0x said:
Thanks Ozadroid, but I think Hot Boot doesn't work :/
After hit "Ok" the phone reboots including the htc splash screen. So I think it's a regular reboot?
Click to expand...
Click to collapse
yeah i think so!
but try like this! make a call and try hot boot while the call goes on! if the call gets cut its a normal reboot, if not congrats
I have chinesse tablet
will the same script works on this jellybean tablet
too bad I am getting the following errors trying to recompile android.policy.jar
classout/com/android/internal/policy/impl/MiuiGlobalActions$222$1.smali[27,4] Error for input '.parameter': Invalid directive
classout/com/android/internal/policy/impl/MiuiGlobalActions$222$1.smali[42,4] Error for input '.parameter': Invalid directive
classout/com/android/internal/policy/impl/MiuiGlobalActions$222$1.smali[43,4] Error for input '.parameter': Invalid directive
classout/com/android/internal/policy/impl/MiuiGlobalActions$222$1.smali[42,15] mismatched input '"dialog"' expecting END_METHOD_DIRECTIVE
any help
How to auto-hide mobile signal icons for empty SIM slots on MTK6589 devices
Introduction
Many users using only one SIM card tend to get fed up with the mobile signal
icon that's always displayed for empty SIM slot in the status bar. This how-to will show you
how to smali hack the SystemUI to make these icons auto-hide - according to presence
of a SIM card in a SIM slots. This is a clean solution - since it will dynamically reflect
which sim slot is in use and which is not. If both SIM slots are used, both icons will be visible.
For devs: It took me several hours to figure out how this could be achieved,
so please, if you decide to use this how-to to include the mod in your custom roms,
I expect you to give proper credits. Thanks in advance.
The guide does not cover things like deodexing/decompiling/compiling/odexing jars and apks.
It expects you already are familiar with these processes.
There are already many guides for those out there.
Solution
1) Decompile SystemUI.apk
2) Open smali/com/android/systemui/statusbar/SignalClusterViewGemini.smali
3) search for "apply" method
Code:
# virtual methods
.method public apply()V
4) Make note of constants defined at the beginning of the method.
We will need 0x0, 0x1, and 0x8 later.
v5 = 0x0 - ID for SIM Slot 1
v9 = 0x1 - ID for SIM Slot 2
v6 = 0x8 - constant used to set visibility of a view (0x8 == View.GONE)
Code:
.prologue
const/4 v11, 0x4
const/4 v10, 0x0
const/4 v9, 0x1
const/16 v6, 0x8
const/4 v5, 0x0
5) Search for first occurence of isSimInserted method call in "apply" method
Code:
.line 421
.local v3, state:I
invoke-direct {p0, v5}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v5 == 0x0 which is SIM Slot #1
move-result v4
if-eqz v4, :cond_1f
v5 constant which value ix 0x0 is used - this means it checks for SIM presense in Slot 1
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_1f
(label name might be different in your case)
6) Search for label name we found in the previous step to locate the start
of the code section for this label cond_1f in my case) Should look similat to this
Code:
.line 452
.end local v0 #id:I
.end local v1 #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2 #simColorId:I
:cond_1f
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkType:Landroid/widget/ImageView;
7) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_1f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroup:Landroid/view/ViewGroup;
invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 1 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)
8) Now search for next occurrence of isSimInserted call in "apply" method - this time for SIM Slot 2
Code:
.line 546
.restart local v3 #state:I
invoke-direct {p0, v9}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v9 == 0x1 which is SIM Slot #2
move-result v4
if-eqz v4, :cond_2f
v9 constant which value ix 0x1 is used - this means it checks for SIM presense in Slot 2
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_2f
(label name might be different in your case)
9) Search for label name we found in the previous step to locate the start
of the code section for this label cond_2f in my case) Should look similar to this
Code:
.line 578
.end local v0 #id:I
.end local v1 #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2 #simColorId:I
:cond_2f
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkTypeGemini:Landroid/widget/ImageView;
10) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_2f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroupGemini:Landroid/view/ViewGroup;
invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 2 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)
11) Recompile SystemUI and push it to phone. Done.
EDITED:............
Hi i changed the smali but it didn`t work...I got the same names and files in smali as you on your screenshots.
When I`m pasting the lines from your post should I delete the old ones?
Thank u very very much.. This was what I needed.. Really thanku...
Oops.. Got one problem.. After doing every thing as u said.. Zipaligned... And flashed.. And then SystemUI is FCing....
Can u plz plz reply A.S.A.P.
Plz..
Sent from my Micromax A116i using XDA Premium 4 mobile app
If there are FCs you probably did something wrong. Logcat would tell you exactly where and why it FCs so it'll help you to pinpoint where your issue is.
C3C076 said:
If there are FCs you probably did something wrong. Logcat would tell you exactly where and why it FCs so it'll help you to pinpoint where your issue is.
Click to expand...
Click to collapse
It worked.. Thank you very much..
Gravity Box was causing problems.. I disabled it. And all done...:thumbup:
Sent from my Micromax A116i using XDA Premium 4 mobile app
---------- Post added at 04:59 PM ---------- Previous post was at 04:57 PM ----------
sebcio2804 said:
Hi i changed the smali but it didn`t work...I got the same names and files in smali as you on your screenshots.
When I`m pasting the lines from your post should I delete the old ones?
Click to expand...
Click to collapse
No.. Just do as mentioned.. It worked for me..
Sent from my Micromax A116i using XDA Premium 4 mobile app
C3C076 said:
How to auto-hide mobile signal icons for empty SIM slots on MTK6589 devices
Introduction
Many users using only one SIM card tend to get fed up with the mobile signal
icon that's always displayed for empty SIM slot in the status bar. This how-to will show you
how to smali hack the SystemUI to make these icons auto-hide - according to presence
of a SIM card in a SIM slots. This is a clean solution - since it will dynamically reflect
which sim slot is in use and which is not. If both SIM slots are used, both icons will be visible.
For devs: It took me several hours to figure out how this could be achieved,
so please, if you decide to use this how-to to include the mod in your custom roms,
I expect you to give proper credits. Thanks in advance.
The guide does not cover things like deodexing/decompiling/compiling/odexing jars and apks.
It expects you already are familiar with these processes.
There are already many guides for those out there.
Solution
1) Decompile SystemUI.apk
2) Open smali/com/android/systemui/statusbar/SignalClusterViewGemini.smali
3) search for "apply" method
Code:
# virtual methods
.method public apply()V
4) Make note of constants defined at the beginning of the method.
We will need 0x0, 0x1, and 0x8 later.
v5 = 0x0 - ID for SIM Slot 1
v9 = 0x1 - ID for SIM Slot 2
v6 = 0x8 - constant used to set visibility of a view (0x8 == View.GONE)
Code:
.prologue
const/4 v11, 0x4
const/4 v10, 0x0
const/4 v9, 0x1
const/16 v6, 0x8
const/4 v5, 0x0
5) Search for first occurence of isSimInserted method call in "apply" method
Code:
.line 421
.local v3, state:I
invoke-direct {p0, v5}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v5 == 0x0 which is SIM Slot #1
move-result v4
if-eqz v4, :cond_1f
v5 constant which value ix 0x0 is used - this means it checks for SIM presense in Slot 1
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_1f
(label name might be different in your case)
6) Search for label name we found in the previous step to locate the start
of the code section for this label cond_1f in my case) Should look similat to this
Code:
.line 452
.end local v0 #id:I
.end local v1 #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2 #simColorId:I
:cond_1f
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkType:Landroid/widget/ImageView;
7) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_1f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroup:Landroid/view/ViewGroup;
invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 1 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)
8) Now search for next occurrence of isSimInserted call in "apply" method - this time for SIM Slot 2
Code:
.line 546
.restart local v3 #state:I
invoke-direct {p0, v9}, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->isSimInserted(I)Z // v9 == 0x1 which is SIM Slot #2
move-result v4
if-eqz v4, :cond_2f
v9 constant which value ix 0x1 is used - this means it checks for SIM presense in Slot 2
As you can see, if a return value of isSimInserted method is equal to zero (if-eqz v4...)
this means that the SIM for tested Slot is not inserted and code execution jumps to label :cond_2f
(label name might be different in your case)
9) Search for label name we found in the previous step to locate the start
of the code section for this label cond_2f in my case) Should look similar to this
Code:
.line 578
.end local v0 #id:I
.end local v1 #resId:Lcom/mediatek/systemui/ext/IconIdWrapper;
.end local v2 #simColorId:I
:cond_2f
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mSignalNetworkTypeGemini:Landroid/widget/ImageView;
10) Now add these lines before iget-object v4, p0 (start on new line, right after :cond_2f)
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/SignalClusterViewGemini;->mMobileGroupGemini:Landroid/view/ViewGroup;
invoke-virtual {v4, v6}, Landroid/view/ViewGroup;->setVisibility(I)V
This will reference the ViewGroup containing the signal icon for SIM Slot 2 and set it's visibility to 0x8 (View.GONE)
Make sure you use the correct parameter in setVisibility Call. In my case it's v6 (its value is 0x8)
11) Recompile SystemUI and push it to phone. Done.
Click to expand...
Click to collapse
Hello ,
I'm using AOSP Lollipop ROM on my redmi note 3 pro (dual sim) , using both sim. but the problem is there is only 1 signal bar icon for sim , doesn't matter if you use 1 SIM ,2 sim or no sim at all . Signal bar icon on status bar remains only 1. ROM developer who modified it is not helping at all to remove it.
Can you please help in how to unhide and show both sim card signal strength icon ?
Have posted same ques in this thread please see - http://forum.xda-developers.com/general/general/how-to-2-signal-bars-dual-sim-status-t3366574
hi,
im using samsung galaxy premier gt-i9260
the problem is
my friend call me , it doesn't show the contact info which i had save in google account ex: 8765 4321
but if i call him ex: +65 8765 4321, only will show his info.
i have try to merge the google account reboot
clear the contact n contact storage in application manager and reboot
resyn google contact n reboot
the problem still there
i failed to get the classes.dex in framework.jar (may be because jelly bean had change to others location?)
i falied to Edit file PhoneNumberUtils.smali under classes\android\telephony and set MIN_MATCH variable from:
.local v7, minMatchLen:I
const/4 v7, 0xb
.local v0, minMatchLen:I
const/4 v0, 0xb
Change to:
.local v7, minMatchLen:I
const/4 v7, 0x7
.local v0, minMatchLen:I
const/4 v0, 0x7
so i hope i can get helps from expert here