Related
I found this:
http://forum.xda-developers.com/showthread.php?t=1483193
Can someone do this pls
???????
Sent from my Dell Streak using XDA App
DISCLAIMER:This is not my work,. i am just reposting
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
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"?>
<com.android.systemui.statusbar.LatestItemContainer androidrientation="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" androidaddingRight="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" />
</com.android.systemui.statusbar.LatestItemContainer>
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:
Add this code to the file like this before XML main body ends:
Code:
<resources>
.
.
.
<public type="anim" name="slide_out_left_basic" id="0x7f0c0000" />
<public type="anim" name="slide_out_right_basic" id="0x7f0c0001" />
</resources>
Please note that id should be unique for every line item so adjust the anim id accordingly. If you don't know how, just leave it, do a compile and decompile again and the id will be added automatically. Thanks to LeoMar for the tip!
Remember the Anim ID, save it for editing LatestItemContainer$1.smali
Save
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, 0x7f0c
and
Code:
.line 51
const v1, 0x7f0c0001
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
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/StatusBarNotificationV
move-object/from16 v0, v18
move-object v1, v4
invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setOnSwipeCallback(Ljava/lang/RunnableV
.line 735
:cond_swno
const v4, 0x7f0b0014
move-object/from16 v0, v18
move v1, v4
invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->findViewById(I)Landroid/view/View;
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
invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/LatestItemContainer;->setDrawingCacheEnabled(Z)V
.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
.field static final TRANSACTION_onNotificationClear:I = 0xc
.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
sparse-switch p1, :sswitch_data_13e
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:
.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/StringV
.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
.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
0xc -> :sswitch_124
0x5f4e5446 -> :sswitch_8
.end sparse-switch
it's important to note this
Code:
0xc -> :sswitch_124
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/StringV
.line 363
invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeString(Ljava/lang/StringV
.line 364
invoke-virtual {v0, p2}, Landroid/os/Parcel;->writeString(Ljava/lang/StringV
.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:
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
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
mother of god... one hell of a reply!
crashDebug said:
mother of god... one hell of a reply!
Click to expand...
Click to collapse
?
Sent from my Dell Streak using XDA App
I think it would be great if someone could do this for those of us who don't understand coding.
It's much better in sony Ericsson forum as Xperia mini pro is my second phone
devs There are willing to help but here nobody wills to help.
I already tried this but compiling back was error
Sent from my Dell Streak using XDA App
Mo one ???
Sent from my SK17i using XDA App
Here it is ....
As some people here asked for it I'll try to explain how I learned to add screenshot option in power menu.
First I'd like to thank some special members that helped me a lot for doing this :
Championswimmer, Barath_000, Achotjan
First you need to know it's not an easy thing to do and you may have bootloop, reboot etc ... that's why you need time and most of everything backup to restore the modded files.
You'll need tools to do this.
I used a "all in one tool": android utility (thanks to tommytomatoe)
http://forum.xda-developers.com/showthread.php?t=1167623
It can be used on linux / mac laptop
If you don't want to use it or using windows laptop you'll need apktool and dex2jar
Before beginning :
Make a backup of these 2 files in system/framework :
framework-res.apk
android.poilicy.jar
Why ? you'll work on these files so if it doesn't work you'll have a "safe working base" ...
Ready ?
1.Framework-res.apk
Decompile this file (with android utility or apktool)
In the "drawable-hpdi" folder place the png attached, and named it "whateveryouwant".
I advice you to keep the name it got as all my how to will name it like that
Then go in the values folder,
You'll find several xml files, with notepad ++ or other xml editor open*: strings.xml and public*.xml
In strings.xml:
Add this line at the end of the file just above </resources> add the line*:
<string name="global_action_screenshot_txt">Take screenshot</string>
It must look like that*:
<string name="add_region_in_locale_picker_dummy_string">+</string>
<string name="global_action_sleep">Sleep mode</string>
<string name="global_action_screenshot_txt">Take screenshot</string>
</resources>
Click to expand...
Click to collapse
Save and close strings.xml
Open public.xml
In the fitting section (drawable and strings) add these lines :
<public type="string" name="global_action_screenshot_txt" id="0x010403da" />
<public type="drawable" name="semc_ic_dialog_screenshot" id="0x0108057f" />
Little tip for "how to" choose the id's (0x010403da and 0x0108057f)
- Search for the last ID for the category (for drawable the last one was0x0108057e)
- write the next letter or number ... (last one was 0x0108057e so the next one is 0x0108057f)
Tip number 2 for the ID ...
the letter list begin to a and finish to f
the number list begins to 0 and finish to 9
Finding the fitting ID can take time so stay calm and relax
Once you've done that, save public.xml but don't close it you'll need it later ....
Now you can compile your framework-res.apk
If you did something wrong apktool will write it .. just read and repair what's wrong.
Now the framework is set, you need now to tell the device wich action you want to run when you tap the option on screen.
2. Andorid.policy.jar
Decompile this file.
Go to com/android/internal/policy/impl folder
Here you'll fond some smali files.
Find the smali named GlobalActions.smali and open it.
In the # annotations thread add this line
Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;,
in must look like this :
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;,
Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;,
Lcom/android/internal/policy/impl/GlobalActions$Action;,
Lcom/android/internal/policy/impl/GlobalActions$MyAdapter;
}
.end annotation
Click to expand...
Click to collapse
In the # instance fields thread add this line :
.field private mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
It must look like this :
# instance fields
.field private mAdapter:Lcom/android/internal/policy/impl/GlobalActions$MyAdapter;
.field private mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
.field private mAirplaneState:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction$State;
.field private final mAudioManager:Landroid/media/AudioManager;
.field private mBroadcastReceiver:Landroid/content/BroadcastReceiver;
.field private mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.field private final mContext:Landroid/content/Context;
.field private mDeviceProvisioned:Z
.field private mDialog:Landroid/app/AlertDialog;
.field private mHandler:Landroid/os/Handler;
.field private mIsWaitingForEcmExit:Z
.field private mItems:Ljava/util/ArrayList;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/ArrayList",
"<",
"Lcom/android/internal/policy/impl/GlobalActions$Action;",
">;"
}
.end annotation
.end field
Click to expand...
Click to collapse
Is that all ??? No !!!!!
Search the line 195
It must be like this in stock rom :
.line 195
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
const/4 v1, 0x0
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v2, v0, v1
Click to expand...
Click to collapse
If there's const/4 v0, 0x4 : this tell the system how many options you've got in the power menu (here 4)
Just under .line 195 add these lines :
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$8;
const v1, 0x108057f
const v2, 0x10403da
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
Click to expand...
Click to collapse
Now it must look like this
.line 195
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$8;
const v1, 0x108057f
const v2, 0x10403da
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
const/4 v0, 0x4
Click to expand...
Click to collapse
What that mean ????
const v1, 0x108057f
Click to expand...
Click to collapse
= the ID in public.xml for the Drawable ... ATTENTION : the ID must be written without the 0 (in public.xml = 0x0108057f ; in android policy 0x108057f )
const v2, 0x10403da
Click to expand...
Click to collapse
= the ID in public.xml for the string
respect this order
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$8
Click to expand...
Click to collapse
In the IMPL folder of the decompiled android.policy.jar you'll see several files named GlobalActions$1.smali ; GlobalActions$2.smali; etc ....
You'll need to create a smali file, it's name will follow the already existing name ... if the last one is GlobalActions$7.smali then you'll create GlobalActions$8.smali ...
What should I get in this file ?????
Calm down and take the GlobalActions$8.smali attached, rename it if you need, but don't forget to rename inside it all GlobalActions$8 entries in GlobalActions$thenumberyouchoose
Once you've done that get back to GlobalActions.smali ....
Find this line
invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/ObjectLjava/util/ArrayList;
Click to expand...
Click to collapse
just above add
const/4 v1, 0x3
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
aput-object v2, v0, v1
const/4 v1, 0x4
Click to expand...
Click to collapse
Added Globalactions.txt file so you can compare with yours
Here it is, work in android.policy is over ... save and close the GlobalActions file, and recompile android.policy.jar
Ready to flash ? .. so must build a zip file with good permissions and all the files ...
Find a flashing zip and decompress it
Create these folder
system/framework
system/app
system/bin
Inside framework folder get framework-res.apk and android.policy.jar you compiled
inside bin get the screenshot file (see attachement)
inside app get CMscreenshot.apk (see attachement)
edit your update-script to get these line : (translation for edify script can be done easily)
copy_dir PACKAGE:system SYSTEM:
set_perm 0 0 04755 SYSTEM:bin/screenshot
Click to expand...
Click to collapse
permissions are needed or else you'll get error (saved to null ...) will taking screenshot
save, compresss make your zip ...
MAKE A BACKUP
And flash ....
reboot .... and enjoy the screenshot option
Hope it helps ..
Once again take your time ... if you're novice in modding it'll take time ... it took me nearly one month to do it ...
FAQ :
Q: Can't find GlobalActions$8.smali in attachment
A: Download GlobalActions$8.zip and rename it GlobalActions$8.smali ....
Q: Can't find the screenshot file to place in bin folder
A : download bin.zip .... it's in
Q: Why can't I use the screencapture.apk from Arc, Neo, Xperia S etc ...
A: We still fighting to make it working ...
Thanks Tof, very useful
Just one question, in my decompiled framework-res, in "public.xml", drawable section are totally mixed order, is there an easier way to find the last id?
LzVebz said:
Thanks Tof, very useful
Just one question, in my decompiled framework-res, in "public.xml", drawable section are totally mixed order, is there an easier way to find the last id?
Click to expand...
Click to collapse
To be honest I don't know easier way than writing the ID you want to get and search if it already exist ..
If someone have a useful xml editor that can sort ID by section ...
I thought..ID's are reading automatically if they miss...only if you add them in strings and xmls…
Finaly here thanks Tof )
FeraVolt said:
I thought..ID's are reading automatically if they miss...only if you add them in strings and xmls…
Finaly here thanks Tof )
Click to expand...
Click to collapse
Finally took time to write it
Got me long long nights with my computer to get it working ... hope it wold help people to have more sleep time
For ID you're not wrong .. ID are getting automatically if you compile from sources (I may be wrong but it's what I understood )
First: THANK YOU!!!
Then...
I've... some issues...
My globalaction now is:
Code:
.line 232
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$11;
const v1, 0x1080452
const v2, 0x10404f5
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
const/4 v0, 0x6
const/4 v0, 0x5
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v1, v0, v10
It is wrong?
Now i'm trying with this, without success:
Code:
.line 232
const/4 v0, 0x5
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v1, v0, v10
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v1, v0, v9
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$3;
const v2, 0x1080418
const v3, 0x10403fc
const v4, 0x10403fd
invoke-direct {v1, p0, v2, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;III)V
aput-object v1, v0, v11
new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$4;
const v2, 0x1080030
invoke-direct {v1, p0, v2, v13}, Lcom/android/internal/policy/impl/GlobalActions$4;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v1, v0, v12
const/4 v1, 0x4
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$10;
const v3, 0x108044e
const v4, 0x1040508
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$10;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
invoke-static {v0}, Lcom/google/android/collect/Lists;->newArrayList([Ljava/lang/Object;)Ljava/util/ArrayList;
const/4 v1, 0x3
iget-object v2, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
aput-object v2, v0, v1
const/4 v1, 0x4
move-result-object v0
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;
const/4 v1, 0x5
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$11;
const v1, 0x1080452
const v2, 0x10404f5
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
Yes, I know there are a lot of things... But I'm sure that there is something in this file...
@dettofatto
Yes there are some errors in your file but can't correctly quote your post since I'm on phone... Recheck with op first until I get back home to show your errors
Sent from my X10s using XDA
dettofatto said:
First: THANK YOU!!!
Then...
I've... some issues...
My globalaction now is:
Code:
.line 232
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$11;
const v1, 0x1080452
const v2, 0x10404f5
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
const/4 v0, 0x6
const/4 v0, 0x5 [COLOR="Red"]----not needed cause line just above is enough[/COLOR]
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mSilentModeToggle:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;
aput-object v1, v0, v10
It is wrong?
Click to expand...
Click to collapse
See above in red
And so I'll have 0x4 and 0x6 without 0x5?
Or I must put all your new lines under 0x5?
Because my. 232 line starts with constant 0x5...
And so I thought that the new screenshot has 0x6...
Or new lines start before 0x5?
Tomorrow I'll try all these options and I'll see!
I'm wrong?
Thank you...
Sent from My Motosola....
No...
Rebooted.. I'll try again...
Ah! I'm on motorola device...
Code:
.line 232
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$11;
const v1, 0x1080452
const v2, 0x10404f5
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
const/4 v0, 0x5
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
dettofatto said:
No...
Rebooted.. I'll try again...
Ah! I'm on motorola device...
Code:
.line 232
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$11;
const v1, 0x1080452
const v2, 0x10404f5
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mCaptureScreenshot:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
const/4 v0, 0x5
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
Click to expand...
Click to collapse
Would you upload and attach your globalaction.smali please?
Sent from my X10s using XDA
Yes!!! I'll do tomorrow! The original file? Yes... I think so...
Thank you!
Sent from My Motosola....
dettofatto said:
Yes!!! I'll do tomorrow! The original file? Yes... I think so...
Thank you!
Sent from My Motosola....
Click to expand...
Click to collapse
The one you modded please
thanks
Tof37 said:
The one you modded please
thanks
Click to expand...
Click to collapse
This is my file!
dettofatto said:
This is my file!
Click to expand...
Click to collapse
Add a quick look at your file and there are some errors in it ...
that's why it doesn't work will attach your file later to show the errors
Thank you again!!!
Sent from My Motosola....
Have a look at the file
I attached mine as model in OP so you can compare
I don't suppose you know how to change the order of the power menu?
blueowl0708 said:
I don't suppose you know how to change the order of the power menu?
Click to expand...
Click to collapse
That can be done
Lines must placed in the order you want them...
Sent from my X10s using XDA
Firstly I am by no means an expert and am just trying to share what i have learnt about smali as its hard to find much info about general smali. Contributions to the thread are always welcome
For the last year or so I have been developing AllianceROM on the i9100. During this time I have learnt lots about smali through a combination of trial and error and guides I have found here on XDA. The guides are great but one thing that stands out is that they all follow the same pattern of “Find a certain line in a certain file and copy/paste" to replace methods or chunks of code for the desired outcome. Whilst this is a great means to an end it is only a means to that particular end. Most people wont actually understand what they are doing or how it works and will blindly do as instructed.
So I thought that I would try to write some general guides. The aim is to give you the means to dream up your own mods and know how to go about implementing them from scratch by yourself. I am by no means an expert but hopefully there should be enough here to set you on your way. These are the methods I used to create many of the mods in alliance, lots of which didn’t exist on Touchwiz devices before.
You will need certain tools to do this but I am not going into how to decompile etc. Before attempting this you should have a good knowledge of decompiling apks and modding in general and have the following tools available:
ADB
Notepad ++
A good image editor like Photoshop or GIMP
The guides are in 3 sections:
Coloring stuff with color pickers
Toggling stuff to show or hide
List choices for things like toggles in view etc
For the purposes of these guides I am using an apk from our legendary alliance developer ficeto. He has made this app to enable us to easily add color pickers, checkboxes and lists by adding a single line to an xml. Huge huge thanks to him as he made this a lot easier!! You can use this to test your mods but please dont rename everything from ficeto to "ubermodders" or something and try to pass it off as your own. If you do it will be reported It is to be used as is, not changed or renamed (this causes problems for people installing alliamceMOD) and dont forget to credit ficeto!!
Please feel free to ask general smali questions here too!
So lets get started!!
Coloring Stuff:
Text Colors
There is a ton of stuff in alliance that can be colored, from text to images or backgrounds. Text works by using the setTextColor method and images and backgrounds use setColorFilter to lay a color over the top of an image ot setBackgroundColor to fill the entire background. I will cover one of each in this section starting with text color. The 3 methods use similar code and text color is the easiest to start with.
So….you decide you want to change the color of some text using a picker. For this example I will use the dropdown date. Where do you start? As you probably know dropdown stuff is dealt with by SystemUI.apk. When you decompile that you are faced with a ton of smali files. The best way to start is to use a handy function in Notepad++ called “Find in Files” which will search for certain text within files. Funnily enough its under the Search menu at the top!!
In this case the first port of call would be to search for the obvious word “date”. This returns a ton of results and you should see an obvious file called DateView.smali. If your search doesn’t return much for your specific choice of text then you have a couple of options:
1) look in the layout xml and find the id for the view you want to change. Look the id up in public.xml and then search that using “Find in Files” again. If you are unsure of the text view id then use hierarchy viewer from the tools folder of the sdk which will show you all the views on your screen
2) look through the smali files manually for anything that sounds like it might contain your target
So you think you found the right smali. Open it and search for “setText(Ljava/lang/CharSequenceV”. This will hopefully return a line something like this:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
Scroll up until you see the name of the method. This should give you a good idea if you have the right text. In this case that line was in .method private final updateClock()V which sounds about right!
What this line is doing is calling settext with the parameter Ljava/lang/CharSequence which is the date string. Invoke virtual calls the method and the bit in the brackets {p0, v5} is the date view (p0 means “this file”) and the string (v5). The v is a register. Registers are used to store things. A few lines up in the method you will see something similar to this:
invoke-virtual {v0, v9, v5}, Landroid/content/Context;->getString(I[Ljava/lang/ObjectLjava/lang/String;
move-result-object v5
What that is doing is using getString to get the date and moving it into the register v5. This v5 is then used in our setText call.
So now we have identified our text view in the smali we can use setTextColor to change its color.
A bit of background is useful here. Color pickers do not act directly on any smali. Your phone has a database where it stores its settings. It is located in data/data/com.android.providers.settings/databases/settings.db. You can open it with Root Explorer and take a look. You will see a standard database with entries and values. What color picker code does is put an entry in this database with a “key” and a hex code. The smali then uses this key to look up the hex color it needs to set.
Now we need to add some code to look up that entry and return the color to the smali. There are 3 elements to this:
The ContentResolver
This is used to resolve the entry in the database. In order to use the content resolver we must put it into a register as we mentioned earlier. At the top of the method you will see .locals X where X is a number. This is the number of registers used in the method. So if it says .locals 5 there will be v0,v1,v2,v3 and v4. We need to add 3 to this value as we will be using 3 new registers. One for the resolver, one for the default color (in case there is no entry in the database it needs to have a color to set) and one for the key.
Now we need context in order to get the content resolver. There are a few ways to do this. A lot of files have a field called mContext. This can be used directly like this:
iget-object v5, p0, Lcom/android/systemui/statusbar/policy/BrightnessController;->mContext:Landroid/content/Context;
This is using iget-object to put mContext into v5. As mentioned earlier the p0 mean “this”.
The v5 should be the first of the new registers you added. So if previously .locals was 5 and you changed it to 8 then this would be v5 as v0 to v4 already exist. You can reuse registers but you can run into problems if it is needed further through the code so it is advisable to add new.
Alternatively, smali files whose .super is a view (look at the top of the smali for .super) like the date view we are working with here can use getcontext to get context like this:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v5
Now we have context we can use it to get the content resolver and put it into the register using this line:
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
The Key
Next we need the key that we want to look up in the database. This is as simple as :
const-string v6, "date_color"
This just puts the constant string “date_color” into v6. The text inside the “” can be anything you like but cannot have spaces and the key must match the picker key we will add later.
The Default Value
Next we need a default color for in case there is no entry in the database. For example on a fresh install or after a wipe. The value is hex but in reverse preceded with -0x so ICS blue 33b5e5 becomes -0xcc4a1a because 0 = F, 1 = E, 2 = D etc
0 = F
1 = E
2 = D
3 = C
4 = B
5 = A
6 = 9
7 = 8
8 = 7
9 = 6
A = 5
B = 4
C = 3
D = 2
E = 1
F = 0
We put that into our 3rd new register v7 using:
const v7, -0xcc4a1a
Now we have all the needed elements we can use them to return the color to the smali from the database using:
invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
This uses the getInt method with our parameters. I have colored them so you can see how the registers relate to the getInt method. V5 is the content resolver, v6 is the string and v7 is the integer of the color.
The resultant color from the database is then moved into v5. We can use v5 register again as we no longer need the content resolver.
The color from the database is now stored in v5. From the settext line we found earlier we can see that the text view is referred to as p0:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
The first item in the brackets is the text view. This wont be p0 in all cases. Its only p0 here because we are working with a smali that has a view as its super so the smali is effectively the text view. If working with something like ToggleSlider for example we may have something like:
invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequenceV
So in this case the text view is in v2.
We can now use setTextColor on our date which is p0 with the color which we put in v5:
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setTextColor(I)V
The full code looks like this:
invoke-virtual {p0, v3}, Lcom/android/systemui/statusbar/policy/DateView;->setText(Ljava/lang/CharSequenceV
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/DateView;->getContext()Landroid/content/Context;
move-result-object v5
invoke-virtual {v5}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v5
const-string v6, "date_color"
const v7, -0xcc4a1a
invoke-static {v5, v6, v7}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v5
invoke-virtual {p0, v5}, Lcom/android/systemui/statusbar/policy/DateView;->setTextColor(I)V
Oh and just so you know the big V at the end of lines like ;->setText(Ljava/lang/CharSequenceV and ;->setTextColor(I)V means the method returns void or nothing.
Hopefully the apk will now compile and you can test the result. In order for something to change immediately you need observers but I wont go into that here. This will only change when the updateClock method runs. A reboot will also trigger it to update the color.
I know I have written a lot to take in here. But hopefully this will give you a good basic understanding of how methods are called with parameters in smali.
Next stop…..choosing the color!
Thanks to ficeto this part is REALLY easy!
Decompile the attached apk. You will find a file called preferences.xml in the xml folder. Open it with Notepad++. Each instance of this line will add another picker…
<com.ficeto.colorpicker.ColorPickerPreference android:title="Dropdown Date Color" android:key="date_color" android:summary="Select Color" android:dialogTitle="Select Color" />
Change the android:title to what you want your picker to be called and change android:key=“date_color” to whatever the key you used earlier was. So if your smali was....
const-string v6, "clock_color"
Then the android:key would be “clock_color”.
That’s it. Compile and push the apk or install as a system app and it will show in your app drawer as custom settings. Now go test your new mod!!
Any questions or problems please ask (with logs and files if possible) as its impossible to cover all eventualities in a guide.
OK....time for part 2
COLORING IMAGES
This part will cover two things. Coloring images in a similar way to setting text colors from part 1 and also how to create a method and pass it context. Sometimes you wont be able to use mContext or getcontext but most smali files have context already in their init so you can use that and pass it to a new method. Using your own method is more efficient as you can run your code to get the color from the database just once and use it on multiple items and in multiple places.
There are three main ways to color an image. Using the method setColorFilter(I)V which is in android/widget/ImageView smali in framework2.jar, using method public final setColorFilter(ILandroid/graphics/PorterDuff$ModeV in the same file and using method public setColorFilter(ILandroid/graphics/PorterDuff$ModeV in android/graphics/drawable/Drawable smali in framework.jar. It depends what and where the image is as to which you use. All three methods overlay a color on an existing image and the two with porterduffmode have a means of choosing what effect the overlay has. There is more about this at the bottom of the post.
Lets start....
Things are stored in fields in a smali. At the top of the file you will see them like this:
Code:
.field protected mType:Ljava/lang/String;
.field protected mView:Landroid/view/View;
.field protected mIcon:I
These fields can be used to store things of their type. So in the ones shown above you would put a string, a view and an integer respectively. You can see the type a field should hold after the :
In order to use your own method to get the color from the database we need to add a new field to store the value in so we can use it in another method. For this example i am going to use the toggle icons in lidroids toggle mod but this can be done on pretty much any image you want.
At the top of the smali with the other instance fields add your new field. You can call it whatever you want and it is going to store an integer so you will need an I after the colon. Im calling this one mToggleColor for obvious reasons:
Code:
.field private mToggleColor:I
We now have somewhere to put our value so now we can write the new method. At this point you should refer to the text color guide for explanations about the content resolver, context and registers as I will assume you have an idea about these now.
You can call your method anything you want. It will need 3 registers to store the resolver, default value and integer. This method has no context parameter (in the brackets after the method name) so you would need to use getcontext or mContext....
Code:
.method color_toggles()V
.locals 3
If you are going to use existing context and pass it to your method it would look like this. As you can see the method is expecting context as its parameter when called...
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
Now we get the content resolver so we need context. If using the first method then you would need to call your view and invoke getcontext like this in stock toggles:
Code:
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
As metioned in the text color guide your contentresolver is now in v1.
If you are passing context to your method then the context is the parameter of the method. Each item in brackets after methods name is stored in a p. So in this case the context would be in p1. All you need to do is use it to get the resolver:
Code:
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
Again...resolver now in v1.
The next part is identical to the text color guide so i wont repeat it. But you should have now something that looks like this:
Code:
.method color_toggles()V
.locals 3
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
const-string v2, "theme_color"
const v3, -0x4d06ff
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
or if passing context:
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "theme_color"
const v3, -0xcc4a1a
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
Both of the above now have your color stored in v1. We can now put it into your new field that you created earlier using iput:
Code:
iput v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mToggleColor:I
This puts the integer in v1 into the field in p0 (this file) and stores it as mToggleColor
Your method is not expected to return anything meaning something doesnt call it and ask for a value in reply so after this we need:
Code:
return-void
....and then to finish the method....
Code:
.end method
The final methods look like this:
Code:
.method color_toggles()V
.locals 3
iget-object v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mBtnImage:Landroid/widget/ImageView;
invoke-virtual {v1}, Landroid/widget/ImageView;->getContext()Landroid/content/Context;
move-result-object v1
const-string v2, "theme_color"
const v3, -0x4d06ff
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
iput v1, p0, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->mToggleColor:I
return-void
.end method
Code:
.method color_toggles(Landroid/content/Context;)V
.locals 3
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "theme_color"
const v3, -0xcc4a1a
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v1
iput v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
return-void
.end method
Now your color can be put into your new field we need to invoke your new method. Otherwise it will just be an empty field. You can do this in a number of places. Either directly before you use it or in the methods init. We will come back to this.
In order to color an image you need to find it first. There are ways of calling the image by its id but looking for it this way will familiarise you more with smali. Images can be set using setImageResource and setImageDrawable. If you search firstly for the images id in the smalis to find the correct file and if that doesnt find anything then have a look at file names and see what you can find that looks like it might be right. In this case PowerButton smali has a method called :
Code:
.method private updateImageView(II)V
...which uses setImageResource(I)V. Sounds like a good place to start!
Code:
.method private updateImageView(II)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
return-void
.end method
We need to invoke your new method. If you are not passing context you can just do this:
Code:
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->color_toggles()V
...which will invoke your new method and put your color in your field.
Or to pass context you would do:
Code:
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/alliance/systemui/quickpanel/PowerButton;->color_toggles(Landroid/content/Context;)V
In the above code the method you are in has a Landroid/view/View; stored in v1. You can use getContext on this and then invoke your method. The invoke says to call your method color_toggles(Landroid/content/ContextV which is in this file (p0) with the parameter v1 (the context). Now your method has run we can use iget to get the color from the field:
Code:
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
You can see in the original updateImage method that the imageView is in v0. We can now apply the color (in v1) to the image (v0).
Code:
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
Final methods would look like this:
Code:
.method private updateImageView(II)V
.locals 2
invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/quicksetting/QuickSettingButton;->color_toggles()V
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
return-void
.end method
or
Code:
.method private updateImageView(II)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageResource(I)V
invoke-virtual {v1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v1
invoke-virtual {p0, v1}, Lcom/alliance/systemui/quickpanel/PowerButton;->color_toggles(Landroid/content/Context;)V
iget v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mColor:I
invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setColorFilter(I)V
return-void
.end method
Your source image should be white. You can make them semi transparent so the color is not as bright. For example the off toggles could be 50% transparent so they will only appear dim compared to the on ones.
You will notice in PowerButton smali there is another method....
Code:
.method private updateImageView(ILandroid/graphics/drawable/Drawable;)V
.locals 2
iget-object v1, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v1, p1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
move-result-object v0
check-cast v0, Landroid/widget/ImageView;
invoke-virtual {v0, p2}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
return-void
.end method
This is the same except it uses 2 parameters (in the brackets after the name) of and (I)nteger and Landroid/graphics/drawable/Drawable rather than two (I)ntegers.
You don't HAVE to use your own method. You could just use identical code to the textColor code straight after the setImageResource and invoke setColorFilter on the ImageView rather than setTextColor on a TextView. But I think it is good practice to use a new method
PorterDuffMode
Sometimes when you implement a color picker you will get an outcome you dont want like a battery that had a a white centre and the fill in a color wouldnt show the level as it would all have the same color overlay. Instead of using setColorFilter(I)V you can use setColorFilter(ILandroid/graphics/PorterDuff$ModeV.
If you are familiar with Photoshop you may be better than me at this but basically it changes the way the color is laid over. Using different modes will give different results. As Im not great with Photoshop for me its more trial and error!
There are lots of different modes:
PorterDuff.Mode ADD Saturate(S + D)
PorterDuff.Mode CLEAR [0, 0]
PorterDuff.Mode DARKEN [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)]
PorterDuff.Mode DST [Da, Dc]
PorterDuff.Mode DST_ATOP [Sa, Sa * Dc + Sc * (1 - Da)]
PorterDuff.Mode DST_IN [Sa * Da, Sa * Dc]
PorterDuff.Mode DST_OUT [Da * (1 - Sa), Dc * (1 - Sa)]
PorterDuff.Mode DST_OVER [Sa + (1 - Sa)*Da, Rc = Dc + (1 - Da)*Sc]
PorterDuff.Mode LIGHTEN [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)]
PorterDuff.Mode MULTIPLY [Sa * Da, Sc * Dc]
PorterDuff.Mode OVERLAY
PorterDuff.Mode SCREEN [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
PorterDuff.Mode SRC [Sa, Sc]
PorterDuff.Mode SRC_ATOP [Da, Sc * Da + (1 - Sa) * Dc]
PorterDuff.Mode SRC_IN [Sa * Da, Sc * Da]
PorterDuff.Mode SRC_OUT [Sa * (1 - Da), Sc * (1 - Da)]
PorterDuff.Mode SRC_OVER [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc]
PorterDuff.Mode XOR [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
The letters in CAPITALS are the what you put as the parameter.
I have found that MULTIPLY is the most useful. SRC_ATOP is used as default in setColorFilter(I)V
To use one you need to put the mode into a register. You do that using sget:
Code:
sget-object v1, Landroid/graphics/PorterDuff$Mode;->MULTIPLY:Landroid/graphics/PorterDuff$Mode;
Then you call the porterduff setcolorfilter method instead of the normal one. Like this:
invoke-virtual {v6, v12, v1}, Landroid/widget/ImageView;->setColorFilter(ILandroid/graphics/PorterDuff$ModeV
...instead of this:
invoke-virtual {v6, v12}, Landroid/widget/ImageView;->setColorFilter(I)V
There is a good article here
Please ask if anything is unclear.
Toggles
You have learnt how to get a value from the database creating a toggle is pretty straightforward. For this example I will use toggling the text on lidroid toggles but you can use this on anything from settings button in statusbar to things stopping auto scroll on toggles etc.
Again we start by finiding the method we need to mod. Look at the top of smali files for the field names. This may help you to find the item you wish to toggle. Method names will also help you find your place. In this example we can see in PowerButton smali there is a method called:
Code:
.method protected updateText()V
Obvious huh! It wont always be that easy to find so i will cover how to call something by it's ID later in this post.
In this method you can see that the text is set by calling the setText method. There are two ways to do this. The obvious thing to do is not to run this line so the text will not be set. This is the first way i will cover and it is the way that things are toggled such as ink effect or crt etc rather than showing/hiding things. I will get to that later.
TURNING THINGS ON/OFF
We need to read that value into our smali. This is done in exactly the same way as a color so if you are not sure please go back and read those posts.
This would be added the line before the setText call....
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
...dont forget to add to .locals if you are using a new register!! That gets us context so now we can...
Code:
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
...which gets the value from the database which will be 1 or 0 for on/off and puts it into v3.
To toggle something we then act on that value. The if-eqz checks if a value is zero. So the next line would be:
Code:
if-eqz v3, :cond_skip_text
....as you can see, if v3 is zero then it goes to the condition skip_text.
All we need to do now is make a new cond called skip_text after the setText line so it effectively does just that.....skips the setText. Right before return-void put:
Code:
:cond_skip_text
That's it. All you have to do with a toggle to turn something on or off is skip the chunk of text that does what you want to stop. So as long as your new cond comes after it then it should work
SHOWING/HIDING
This works in exactly the same way as above but instead of skipping code you are going to use setVisibility(I)V method.
We have got the value from the database as we did before:
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_show_text
To hide something we must set visibility of the item to "gone". The value for this is 0x8. Visible is 0x1. If the database value returns 0 then the item is unchecked and so should be hidden. If it returns 1 then the item should be visible.
If the value from the database was 1 and the checkbox was ticked then you can use the value in v3 as the value for setVisibility. If it was 0 then the value needs to be set to 0x8 for "gone". We can put 0x8 into v4 here because the line will be skipped if the checkbox was checked:
Code:
const v3, 0x8
....now we add the new cond:
Code:
:cond_show_text
and invoke the set visibility which now has either 0x1 or 0x8 in it.
Code:
invoke-virtual {v1, v3}, Landroid/widget/TextView;->setVisibility(I)V
This tells the code to find the place labelled :goto_new so we add that straight after the code that sets visibility to shown. The full code would look like this....
Code:
iget-object v3, p0, Lcom/alliance/systemui/quickpanel/PowerButton;->mView:Landroid/view/View;
invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v3
const-string v4, "toggle_text"
const v5, 0x1
invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_show_text
const v4, 0x8
:cond_show_text
invoke-virtual {v1, v4}, Landroid/widget/TextView;->setVisibility(I)V
Thats it!
CALLING THINGS BY ID
Say you wanted to make a show/hide for the recents button that can be added to dropdown header. You can call it by it's public ID and then use setvisibility. Create a new method like you did for coloring images (refer to that guide if unsure), get a value from the database, test for non-zero and skip to cond. You can use mCcontext here from in Phonestatusbar:
Code:
.method Update_recents()V
.locals 6
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "recents_button"
const/4 v3, 0x1
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_1
const v3, 0x8
Now to get the image we can use findViewById method. In order to use it we need the parent view that contains the image. In Phonestatusbar you can get to most stuff by using the field mStatusBarWindow.
Code:
iget-object v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
Now we get the id of the image from public.xml and put it into a register:
Code:
const v5, 0x7f0d0014
....and then findViewById. This method expects an integer as a parameter which we have in v5...
Code:
invoke-virtual {v4, v5}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
Now we have the item we can setVisibility with the value in v3:
Code:
:cond_1
invoke-virtual {v4, v3}, Landroid/widget/LinearLayout;->setVisibility(I)V
In this case I used LinearLayout but you can use imageView or whatever depending what you are doing. The full method would look like this:
Code:
.method Update_recents()V
.locals 6
iget-object v1, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "recents_button"
const/4 v3, 0x1
invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v3
if-nez v3, :cond_1
const/4 v3, 0x8
:cond_1
iget-object v5, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;
const v6, 0x7f0d0014
invoke-virtual {v5, v6}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;
move-result-object v4
invoke-virtual {v4, v3}, Landroid/widget/LinearLayout;->setVisibility(I)V
return-void
.end method
All we need to do now is to call the method. The best place for this is during makestatusbarview. I put it right after the settings button is set but you can put it in loads of places. It just invokes update_recents_button in p0 (this file):
Code:
iget-object v9, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButton:Landroid/widget/ImageView;
iget-object v10, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSettingsButtonListener:Landroid/view/View$OnClickListener;
invoke-virtual {v9, v10}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V
[COLOR="Red"] invoke-virtual {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->update_recents_button()V[/COLOR]
Thats all for now
USEFUL POSTS:
NOTEPAD++ SMALI HIGHLIGHTING - Thanks to @majdinj
LIST OF DALVIK OPCODES - Thanks to @majdinj
last one
one more actually
Goldie you are the best. Thanks. :victory:
finally, you're the grand master
thank you
Hope my ramblings make sense!
Very good. Thanks for all your hard work
What a fantastic guide. Top work Goldieking
Sent from my PurifieD S4
Finally !!
Was thinking you had abandoned the project
Now the challenge is on for who can make the first one thats not dropdown date
Sent from my GT-I9305 using Tapatalk
Sorry buddy for no feedback on your fantastic guide, I got busy with ither stuffs.
But I must say hey you reveal the secreat of samsuck and your hard work with us.
trying to work with smali
Hi Goldieking I'm trying to modify my SecSettings.apk trying to make a mod for toggle
In Settings/display i'm trying to add a ListPreference to show something like 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"
}
In my DisplaySetting.smali i've add this in red:
Code:
.field private mSmartRotationAnimationImage:[I
.field private mSmartStayAnimationImage:[I
.field mStatusbarColor:Lcom/loser/colorpicker/ColorPickerPreference;
.field mSupportFolderType:Z
[COLOR="Red"].field private mTogglesStyle:Landroid/preference/ListPreference;[/COLOR]
.field private mTouchKeyLight:Landroid/preference/ListPreference;
In the .method public onCreate(Landroid/os/Bundle)V i've add this
Code:
const-string v12, "battery_icon_list"
invoke-virtual {p0, v12}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v12
check-cast v12, Landroid/preference/ListPreference;
iput-object v12, p0, Lcom/android/settings/DisplaySettings;->mBatteryStyle:Landroid/preference/ListPreference;
const-string v12, "battery_icon_list"
const/4 v13, 0x0
invoke-static {v8, v12, v13}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v12
iget-object v13, p0, Lcom/android/settings/DisplaySettings;->mBatteryStyle:Landroid/preference/ListPreference;
invoke-static {v12}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v12
invoke-virtual {v13, v12}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
iget-object v13, p0, Lcom/android/settings/DisplaySettings;->mBatteryStyle:Landroid/preference/ListPreference;
invoke-virtual {v13, p0}, Landroid/preference/SwitchPreferenceScreen;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
[COLOR="Red"] const-string v12, "toggles_icon_list"
invoke-virtual {p0, v12}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;
move-result-object v12
check-cast v12, Landroid/preference/ListPreference;
iput-object v12, p0, Lcom/android/settings/DisplaySettings;->mTogglesStyle:Landroid/preference/ListPreference;
const-string v12, "toggles_icon_list"
const/4 v13, 0x0
invoke-static {v8, v12, v13}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v12
iget-object v13, p0, Lcom/android/settings/DisplaySettings;->mTogglesStyle:Landroid/preference/ListPreference;
invoke-static {v12}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v12
invoke-virtual {v13, v12}, Landroid/preference/ListPreference;->setValue(Ljava/lang/String;)V
iget-object v13, p0, Lcom/android/settings/DisplaySettings;->mTogglesStyle:Landroid/preference/ListPreference;
invoke-virtual {v13, p0}, Landroid/preference/SwitchPreferenceScreen;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V[/COLOR]
And in the .method public onPreferenceChange i' ve add this:
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
[COLOR="Red"] if-eqz v0, :cond_13 [/COLOR]
.line 1089
check-cast p2, Ljava/lang/Boolean;
invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z
move-result v0
if-eqz v0, :cond_e
move v0, v6
.line 1090
:goto_6
Code:
:cond_11
move-wide v0, v4
goto/16 :goto_3
:cond_12
iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mBatteryStyle:Landroid/preference/ListPreference;
if-ne p1, v1, :cond_2
check-cast p2, Ljava/lang/String;
invoke-static {p2}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I
move-result v0
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "battery_icon_list"
invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_4
[COLOR="Red"][/COLOR] :cond_13
iget-object v1, p0, Lcom/android/settings/DisplaySettings;->mTogglesStyle:Landroid/preference/ListPreference;
if-ne p1, v1, :cond_1
check-cast p2, Ljava/lang/String;
invoke-static {p2}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I
move-result v0
invoke-virtual {p0}, Lcom/android/settings/DisplaySettings;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
const-string v2, "toggles_icon_list"
invoke-static {v1, v2, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z
goto/16 :goto_4 [/COLOR]
.end method
The logcat show this:
Code:
W/dalvikvm( 3982): VFY: register1 v0 type 5, wanted ref
W/dalvikvm( 3982): VFY: bad arg 1 (into Ljava/lang/Object;)
W/dalvikvm( 3982): VFY: rejecting call to Ljava/lang/String;.equals (Ljava/lang/Object;)Z
W/dalvikvm( 3982): VFY: rejecting opcode 0x6e at 0x0215
W/dalvikvm( 3982): VFY: rejected Lcom/android/settings/DisplaySettings;.onPreferenceChange (Landroid/preference/Preference;Ljava/lang/Object;)Z
W/dalvikvm( 3982): Verifier rejected class Lcom/android/settings/DisplaySettings;
W/dalvikvm( 3982): Class init failed in newInstance call (Lcom/android/settings/DisplaySettings;)
D/AndroidRuntime( 3982): Shutting down VM
W/dalvikvm( 3982): threadid=1: thread exiting with uncaught exception (group=0x41af32a0)
E/AndroidRuntime( 3982): FATAL EXCEPTION: main
E/AndroidRuntime( 3982): java.lang.VerifyError: com/android/settings/DisplaySettings
E/AndroidRuntime( 3982): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 3982): at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime( 3982): at android.app.Fragment.instantiate(Fragment.java:577)
E/AndroidRuntime( 3982): at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1229)
E/AndroidRuntime( 3982): at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1245)
E/AndroidRuntime( 3982): at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:618)
E/AndroidRuntime( 3982): at com.android.settings.Settings.onCreate(Settings.java:191)
E/AndroidRuntime( 3982): at android.app.Activity.performCreate(Activity.java:5206)
E/AndroidRuntime( 3982): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
E/AndroidRuntime( 3982): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
E/AndroidRuntime( 3982): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
E/AndroidRuntime( 3982): at android.app.ActivityThread.access$700(ActivityThread.java:140)
E/AndroidRuntime( 3982): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
E/AndroidRuntime( 3982): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3982): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 3982): at android.app.ActivityThread.main(ActivityThread.java:4921)
E/AndroidRuntime( 3982): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3982): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 3982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
E/AndroidRuntime( 3982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
E/AndroidRuntime( 3982): at dalvik.system.NativeStart.main(Native Method)
So i know i make errors in the .method public onPreferenceChange (Landroid/preference/Preference;Ljava/lang/ObjectZ
can you teach me how to add new lines to make it work?
Ummm.....I always use custom settings for a list which means I only gotta add a single line but in cond_d you have the same lines twice for contextualpage_settings where you move boolean result into v0 then use it as an object in the next lines. Are you sure you didnt change something there? Those four lines were already repeated?
Without looking at the file its difficult to tell but something looks wrong here...
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
[COLOR="Red"] if-eqz v0, :cond_13[/COLOR]
Sent from my GT-I9305 using Tapatalk
Goldieking said:
Ummm.....I always use custom settings for a list which means I only gotta add a single line but in cond_d you have the same lines twice for contextualpage_settings where you move boolean result into v0 then use it as an object in the next lines. Are you sure you didnt change something there? Those four lines were already repeated?
Without looking at the file its difficult to tell but something looks wrong here...
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
[COLOR="Red"] if-eqz v0, :cond_13[/COLOR]
Sent from my GT-I9305 using Tapatalk
Click to expand...
Click to collapse
I'm sorry you're right i've add this:
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
[COLOR="Red"] const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_13[/COLOR]
so i've to delete this lines?
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/ObjectZ
move-result v0
edit:I tried to change the lines above whit those:
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
[COLOR="Red"] invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_13[/COLOR]
but it doesn't work again ,you try to look in my file
View attachment DisplaySettings.zip
This is a great guide.
Thanks very much, Goldie...
remuntada78 said:
I'm sorry you're right i've add this:
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
[COLOR="Red"] const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_13[/COLOR]
so i've to delete this lines?
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/ObjectZ
move-result v0
edit:I tried to change the lines above whit those:
Code:
:cond_d
const-string v2, "contextualpage_settings"
invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_12
[COLOR="Red"] invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_13[/COLOR]
but it doesn't work again ,you try to look in my file
View attachment 2340166
Click to expand...
Click to collapse
Hard on phone but try this...
https://db.tt/ocnydt7E
Sent from my GT-I9305 using Tapatalk
kahvitahra said:
Samsung JB roms
What you need to do is:
-Decompile android.policy.jar of your rom
-Copy attached JB folder to yours (POST 1)
-In file "GlobalActions$99.smali" there is id 0x1110008, you might want to check that this id is same in you roms puplic.xml ( config_sf_slowBlur ).
( check also that ids 0x104000a = "ok" -string and 0x104 = "cancel" -string matches in your framework. )
-Open GlobalActions.smali
-Search line "new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;" ( some roms might have different number on reboot button. You find right one by for example tracking mRestart. See example below. )
-Change number 5 to 99 ( two of them )
Before
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$5;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
After
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
-Open GlobalActions$SinglePressAction.smali
-Before line "# instance fields"
paste following code
Code:
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
-Then after line "# direct methods"
paste following code
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, "Reboot"
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, "Download"
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
-So your file should look something like this after those changes
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# 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
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
# instance fields
.field private final mIconResId:I
.field private final mMessageResId:I
# direct methods
.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, "Reboot"
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, "Download"
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
.method protected constructor <init>(II)V
.registers 3
.parameter "iconResId"
.........
.........
-Compile .jar and your done.
{
"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"
}
Click to expand...
Click to collapse
Note : This is not my work..I'm just sharing the work of the XDA Member kahvitahra :
Original Thread - http://forum.xda-developers.com/showpost.php?p=38379872&postcount=184
Batt. %
ImBJ said:
original thread - http://forum.xda-developers.com/show...&postcount=184 Samsung JB roms
What you need to do is:
-Decompile android.policy.jar of your rom
-Copy attached JB folder to yours (POST 1)
-In file "GlobalActions$99.smali" there is id 0x1110008, you might want to check that this id is same in you roms puplic.xml ( config_sf_slowBlur ).
( check also that ids 0x104000a = "ok" -string and 0x104 = "cancel" -string matches in your framework. )
-Open GlobalActions.smali
-Search line "new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;" ( some roms might have different number on reboot button. You find right one by for example tracking mRestart. See example below. )
-Change number 5 to 99 ( two of them )
Before
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$5;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$5;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
After
Code:
new-instance v0, Lcom/android/internal/policy/impl/GlobalActions$99;
const v1, 0x1080640
const v2, 0x1040165
invoke-direct {v0, p0, v1, v2}, Lcom/android/internal/policy/impl/GlobalActions$99;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
iput-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
-Open GlobalActions$SinglePressAction.smali
-Before line "# instance fields"
paste following code
Code:
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
-Then after line "# direct methods"
paste following code
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, "Reboot"
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, "Download"
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
-So your file should look something like this after those changes
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# 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
# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;
# instance fields
.field private final mIconResId:I
.field private final mMessageResId:I
# direct methods
.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, "Reboot"
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, "Download"
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
.method protected constructor <init>(II)V
.registers 3
.parameter "iconResId"
.........
.........
-Compile .jar and your done.
Click to expand...
Click to collapse
[/QUOTE]
Are the screen shots of sg star??? If yes how did u enabled battery percentage????
deleted
Are the screen shots of sg star??? If yes how did u enabled battery percentage????[/QUOTE]
its galaxy young !! i'll post the tutorial for battery percentage later..
U can also do this using xposed module xblast tools
Sent from my GT-S5282 using Tapatalk
T3snake said:
U can also do this using xposed module xblast tools
Sent from my GT-S5282 using Tapatalk
Click to expand...
Click to collapse
i agree !! but this is for custom roms !! so people can have it without xblast tool !!
nice tut thank bro for this mod
Are the screen shots of sg star??? If yes how did u enabled battery percentage????[/QUOTE]
charging lol
Howdy I have been compiling a list mods for the Verizon Note 4, but most should work across all variants!!
{
"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"
}
This thread is posted in the Samsung Galaxy Note 4 Unified Development Thread and can be viewed across all Note 4 Variants.
This is and will always be a work in progress, so feel free to contribute and please do!!!!
This thread assumes you know how to decompile and compile using APKTOOL.
Enjoy!!!
[Guide How-to] Verizon Note 4 Remove CD Installer & ASEC Note 4
This removes the annoying CD installer that pops up when you plug into your computer and your phone will go straight to MTP.
Enjoy!!
Remove CD Installer Download: http://d-h.st/Wm7
Just flash with TWRP
[Guide How-to] Verizon Note 4 Enable Native Call Recording Note 4
Smali edit for InCallUI.apk:
com/android/services/telephony/common/PhoneFeature.smali
Add the lines that are highlighted in RED
Code:
const-string v3, "CscFeature_VoiceCall_ConfigRecording"
invoke-virtual {v0, v3}, Lcom/sec/android/app/CscFeature;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
[COLOR="Red"]const-string v0, "RecordingAllowed"[/COLOR]
.line 1693
sget-object v3, Lcom/android/services/telephony/common/PhoneFeature;->mFeatureList:Ljava/util/HashMap;
const-string v6, "voice_call_recording"
const-string v7, "RecordingAllowed"
const-string v3, "CscFeature_VoiceCall_ConfigRecording"
invoke-virtual {v0, v3}, Lcom/sec/android/app/CscFeature;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
const-string v0, "RecordingAllowed"
.line 1693
sget-object v3, Lcom/android/services/telephony/common/PhoneFeature;->mFeatureList:Ljava/util/HashMap;
const-string v6, "voice_call_recording"
const-string v7, "RecordingAllowed"
For those not capable of doing smali edits just flash this via TWRP. Enable Call Recording
[Guide How-to] Remove Lockscreen Carrier Note 4
This removes the lockscreen carrier text.
Keyguard.apk smali edit:
smali/com/android/keyguard/CarrierText.smali:
Change if-nez to if-eqz in the indicated edit in BLUE:
Code:
.method private static concatenate(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
.locals 5
.param p0, "plmn" # Ljava/lang/CharSequence;
.param p1, "spn" # Ljava/lang/CharSequence;
.prologue
const/4 v2, 0x1
const/4 v3, 0x0
.line 310
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v4
[COLOR="Blue"]if-eqz[/COLOR] v4, :cond_1
move v0, v2
For those of you not capable of smali edit's, just flash this via TWRP Remove Lock Screen Carrier Text
[Guide How-to] Remove Safe Volume Warning Note 4
This removes the safe volume warning that pops up when you turn up the volume beyond a certain point
This mod requires modifying framework.jar
Edit smali/android/media/AudioService.smali:
Changes are in .method private checkSafeMediaVolume(III)Z
, new lines are in BLUE:
Code:
iget-object v6, p0, Landroid/media/AudioService;->mSafeMediaVolumeState:Ljava/lang/Integer;
invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I
move-result v6
[COLOR="Blue"]goto :goto_td[/COLOR]
if-ne v6, v7, :cond_4
Code:
goto :goto_1
.line 6873
.end local v0 # "e":Ljava/lang/Exception;
.end local v1 # "pm":Landroid/os/PowerManager;
.end local v3 # "wl":Landroid/os/PowerManager$WakeLock;
[COLOR="Blue"]:goto_td[/COLOR]
:cond_4
monitor-exit v5
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
goto :goto_0
.end method
For those not capable of smali edit's just flash this in TWRP Remove Safe Volume Warning
[Guide How-To] Enable Call & MSG Blocking Note 4
This enables call and msg blocking natively.
Simple CSC edit.
system/csc/feature.xml edit
Must be inserted BEFORE
</FeatureSet>
</SamsungMobileFeature>
(** please note that feature.xml can be overwritten so this may not stick if using a third party software like Xposed)
Code:
<CscFeature_Setting_EnableMenuBlockCallMsg>TRUE</CscFeature_Setting_EnableMenuBlockCallMsg>
For those of you not capable of this edit, just flash this with TWRP Native Call & Message Block
[Guide How-to] Replace Recents with Menu Note 4
Keylayout edits:
system/usr/keylayout/Generic.kl
Change key 254 from APP_SWITCH to MENU
key 254 MENU
Download: Generic.kl
Now Recent Apps capacitive key is Menu (single-press) and Search (long-press).
However, we have now lost access to recent apps via a hardware key.
[Guide How-to] VZW Note 4 4 Way Reboot Power Menu EPM Note 4
This will work with Odex or Deodexed Rom. To see the 4 way Menu you must hit restart on the Primary Menu!!!
First grab your Deodexed android.policy.jar from system/framework
Decompile it with APKTOOL. Look in smali\com\android\internal\policy\impl\
Find GlobalActions$SinglePressAction.smali and open with NotePad++
Look for this:
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# 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
# instance fields
.field public customAction:I
.field public isKnoxCustom:Z
.field private final mIcon:Landroid/graphics/drawable/Drawable;
.field private final mIconResId:I
.field mLayoutId:I
.field private final mMessage:Ljava/lang/CharSequence;
.field private final mMessageResId:I
# direct methods
.method protected constructor <init>(II)V
.locals 2
.param p1, "iconResId" # I
.param p2, "messageResId" # I
Add in the Red Text to look like this:
Code:
.class abstract Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.super Ljava/lang/Object;
.source "GlobalActions.java"
# interfaces
.implements Lcom/android/internal/policy/impl/GlobalActions$Action;
# 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="Red"]# static fields
.field protected static rebootMode:I
.field protected static final rebootOptions:[Ljava/lang/String;[/COLOR]
# instance fields
.field public customAction:I
.field public isKnoxCustom:Z
.field private final mIcon:Landroid/graphics/drawable/Drawable;
.field private final mIconResId:I
.field mLayoutId:I
.field private final mMessage:Ljava/lang/CharSequence;
.field private final mMessageResId:I
# direct methods
[COLOR="Red"].method static constructor <clinit>()V
.locals 3
const/4 v0, 0x4
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "Reboot"
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, "Download"
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[/COLOR]
.method protected constructor <init>(II)V
.locals 2
.param p1, "iconResId" # I
.param p2, "messageResId" # I
Save file and look for GlobalActions.smali in the same folder.
Find this:
Code:
invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.line 1126
new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$8;
const-string v2, "VZW"
sget-object v4, Lcom/android/internal/policy/impl/GlobalActions;->mSalesCode:Ljava/lang/String;
invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_3
const v2, 0x1080b2d
:goto_2
const v4, 0x10401cf
move-object/from16 v0, p0
invoke-direct {v3, v0, v2, v4}, Lcom/android/internal/policy/impl/GlobalActions$8;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.line 1164
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$9;
Change the red text to look like this:
Code:
invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v2, v0, Lcom/android/internal/policy/impl/GlobalActions;->mPowerOff:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.line 1126
new-instance v3, Lcom/android/internal/policy/impl/GlobalActions$[COLOR="Red"]99[/COLOR];
const-string v2, "VZW"
sget-object v4, Lcom/android/internal/policy/impl/GlobalActions;->mSalesCode:Ljava/lang/String;
invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-eqz v2, :cond_3
const v2, 0x1080b2d
:goto_2
const v4, 0x10401cf
move-object/from16 v0, p0
invoke-direct {v3, v0, v2, v4}, Lcom/android/internal/policy/impl/GlobalActions$[COLOR="Red"]99[/COLOR];-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
move-object/from16 v0, p0
iput-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
.line 1164
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$9;
Save file.
Add the 3 smali files in this zip to the same folder: Smali-Files-Zip
Now recompile. That's it.
For those of you not able to edit smali. Here is a zip flashable with TWRP. VZW Note 4 4 Way EPM Menu
To see the 4 way Menu you must hit restart on the Primary Menu!!!
Enjoy!!!
Framework Mods- Note 4 Native WiFi Tether, All Rotations, Safe Media Volume Disabled, Dreams enabled, Battery Critical Warnings lowered to 1%.
Here is the download: Framework Mods
Here is the download to return to stock: Stock Framework
Enjoy!!!
[Guide How-to] Remove NFC notification icon in status bar Note 4
First grab your Features.xml from /system/csc/
Open with Notepad++ and look for following text:
Code:
<!-- NFC -->
<CscFeature_NFC_SetSecureEventType>ISIS</CscFeature_NFC_SetSecureEventType>
<CscFeature_NFC_StatusBarIconType>Vzw</CscFeature_NFC_StatusBarIconType>
<CscFeature_SmartcardSvc_SetAccessControlType>GPAC, MODE1</CscFeature_SmartcardSvc_SetAccessControlType>
<CscFeature_SmartcardSvc_HideTerminalCapability>eSE</CscFeature_SmartcardSvc_HideTerminalCapability>
<CscFeature_NFC_CardModeRoutingTypeForUicc>ROUTE_ON_WHEN_SCREEN_UNLOCK</CscFeature_NFC_CardModeRoutingTypeForUicc>
<CscFeature_NFC_EnableSecurityPromptPopup>all</CscFeature_NFC_EnableSecurityPromptPopup>
<CscFeature_NFC_EnableInvalidTagPopup>true</CscFeature_NFC_EnableInvalidTagPopup>
<CscFeature_NFC_ConfigAdvancedSettings>Disable</CscFeature_NFC_ConfigAdvancedSettings>
<CscFeature_NFC_DefaultCardModeConfig>DH:UICC</CscFeature_NFC_DefaultCardModeConfig>
Change the red text to look like this:
Code:
<!-- NFC -->
<CscFeature_NFC_SetSecureEventType>ISIS</CscFeature_NFC_SetSecureEventType>
<CscFeature_NFC_StatusBarIconType>[COLOR="Red"]none[/COLOR]</CscFeature_NFC_StatusBarIconType>
<CscFeature_SmartcardSvc_SetAccessControlType>GPAC, MODE1</CscFeature_SmartcardSvc_SetAccessControlType>
<CscFeature_SmartcardSvc_HideTerminalCapability>eSE</CscFeature_SmartcardSvc_HideTerminalCapability>
<CscFeature_NFC_CardModeRoutingTypeForUicc>ROUTE_ON_WHEN_SCREEN_UNLOCK</CscFeature_NFC_CardModeRoutingTypeForUicc>
<CscFeature_NFC_EnableSecurityPromptPopup>all</CscFeature_NFC_EnableSecurityPromptPopup>
<CscFeature_NFC_EnableInvalidTagPopup>true</CscFeature_NFC_EnableInvalidTagPopup>
<CscFeature_NFC_ConfigAdvancedSettings>Disable</CscFeature_NFC_ConfigAdvancedSettings>
<CscFeature_NFC_DefaultCardModeConfig>DH:UICC</CscFeature_NFC_DefaultCardModeConfig>
Save file and copy back to /system/csc, reboot and boom its gone!!!
Enjoy!!
[Guide How-to] Enable Private Mode with a deodexed Rom and SecureStorage=false Note 4
First thing you need to do is grab PersonalPageService.apk from system/priv-app
Decompile with APKTOOL
Find PersonalPageService\smali\com\samsung\android\personalpage\service\util\SecureProperties.smali open with Notepad++
Find the follow code:
Code:
.method public constructor <init>(Landroid/content/Context;)V
.locals 2
.param p1, "context" # Landroid/content/Context;
.prologue
const/4 v1, 0x1
.line 61
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 54
const/4 v0, 0x0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 63
invoke-static {}, Landroid/os/Debug;->isProductShip()I
move-result v0
if-nez v0, :cond_3
.line 64
invoke-static {}, Lcom/sec/android/securestorage/SecureStorage;->isSupported()Z
move-result v0
if-nez v0, :cond_2
.line 65
const/4 v0, 0x0
sput-boolean v0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->SUPPORT_SECURE_STORAGE_FEATURE:Z
.line 72
:goto_0
sget-boolean v0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->SUPPORT_SECURE_STORAGE_FEATURE:Z
if-eqz v0, :cond_0
Replace the items in Red like this:
Code:
.method public constructor <init>(Landroid/content/Context;)V
.locals 2
.param p1, "context" # Landroid/content/Context;
.prologue
const/4 v1, 0x1
.line 61
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 54
const/4 v0, 0x0
iput-object v0, p0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->mImpl:Lcom/samsung/android/personalpage/service/util/SecureProperties$PropertiesImpl;
.line 63
invoke-static {}, Landroid/os/Debug;->isProductShip()I
move-result v0
[COLOR="Red"]if-nez v0, :cond_0[/COLOR]
.line 64
invoke-static {}, Lcom/sec/android/securestorage/SecureStorage;->isSupported()Z
move-result v0
[COLOR="Red"]if-nez v0, :cond_0[/COLOR]
.line 65
const/4 v0, 0x0
sput-boolean v0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->SUPPORT_SECURE_STORAGE_FEATURE:Z
.line 72
:goto_0
sget-boolean v0, Lcom/samsung/android/personalpage/service/util/SecureProperties;->SUPPORT_SECURE_STORAGE_FEATURE:Z
if-eqz v0, :cond_0
Save file and compile apk. Push to system/priv-app
For those not capable of changing smali files here is a flashable zip: PersonalPageService.apk
Enjoy!!!
[Guide How-To] Enable Lockscreen Rotation Note 4
First grab Keyguard.apk from system/priv-app
Decompile with APKTOOL.
Open smali file smali/com/android/keyguard/KeyguardViewManager.smali
Look for the following:
Code:
.method private shouldEnableScreenRotation()Z
.locals 3
.prologue
const/4 v1, 0x0
.line 249
iget-object v2, p0, Lcom/android/keyguard/KeyguardViewManager;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
.line 250
.local v0, "res":Landroid/content/res/Resources;
const-string v2, "lockscreen.rot_override"
invoke-static {v2, v1}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z
move-result v2
Replace the Red text to look like this:
Code:
Code:
.method private shouldEnableScreenRotation()Z
.locals 3
.prologue
[COLOR="Red"]const/4 v1, 0x1[/COLOR]
.line 249
iget-object v2, p0, Lcom/android/keyguard/KeyguardViewManager;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
.line 250
.local v0, "res":Landroid/content/res/Resources;
const-string v2, "lockscreen.rot_override"
invoke-static {v2, v1}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z
move-result v2
Compile and push to system/priv-app
For those that are unable to edit smali here is a flashable zip: LockSceen Rotation
Enjoy!!
[Guide How-to] Disable Screen Wake Plugged/Unplugged Note 4
First grab your services.jar from system/framework and decompile with APKTOOL
Find smali\com\android\server\power\PowerManagerService .smali and open PowerManagerService with Notepad++
Look for the following:
Code:
.method private shouldWakeUpWhenPluggedOrUnpluggedLocked(ZIZ)Z
.locals 4
.param p1, "wasPowered" # Z
.param p2, "oldPlugType" # I
.param p3, "dockedOnWirelessCharger" # Z
.prologue
const/4 v1, 0x1
const/4 v0, 0x0
.line 2216
iget-boolean v2, p0, Lcom/android/server/power/PowerManagerService;->mWakeUpWhenPluggedOrUnpluggedConfig:Z
if-nez v2, :cond_1
Change to Red text to look like this:
Code:
.method private shouldWakeUpWhenPluggedOrUnpluggedLocked(ZIZ)Z
.locals 4
.param p1, "wasPowered" # Z
.param p2, "oldPlugType" # I
.param p3, "dockedOnWirelessCharger" # Z
.prologue
[COLOR="Red"]const/4 v1, 0x0[/COLOR]
const/4 v0, 0x0
.line 2216
iget-boolean v2, p0, Lcom/android/server/power/PowerManagerService;->mWakeUpWhenPluggedOrUnpluggedConfig:Z
if-nez v2, :cond_1
That's it. Compile and push to system/framework
For those of you not capable of editing smali files here is a flashable zip: Disable Screen Wake Plug/unpluged
Enjoy!!!
[Guide How-to] Bluetooth Scan Dialog Removal
First grab your SecSettings.apk from system/priv-app and decompile with APKTOOL
Find smali/com/android/settings/Bluetooth/BluetoothScanDialog.smali
Look for the follow in .method private initialize()V method:
Code:
.line 79
new-instance v4, Lcom/android/settings/bluetooth/BluetoothScanDialog$3;
invoke-direct {v4, p0, v0}, Lcom/android/settings/bluetooth/BluetoothScanDialog$3;-><init>(Lcom/android/settings/bluetooth/BluetoothScanDialog;Landroid/app/AlertDialog;)V
invoke-virtual {v0, v4}, Landroid/app/Dialog;->setOnCancelListener(Landroid/content/DialogInterface$OnCancelListener;)V
.line 86
[COLOR="Red"]invoke-virtual {v0}, Landroid/app/Dialog;->show()V[/COLOR]
.line 87
return-void
.end method
Delete the text in Red, save file and compile. That's it. push to system/priv-app
Enjoy!!!
Flashlight Toggle & Battery Stats Toggle Mod Flashable-Settings-About Phone-Status-OFFICIAL Zip Updated 12-3-2014
Here is the flashable Flashlight Toggle Mod: VZW Flash Light Battery Stats Toggle Mod-Official Status
YOU MUST WAIT AT LEAST 5-10 MINS AFTER FLASHING FOR THE MOD TO WORK.
Some of you might also have to add "Flashlight" to your settings DB via SQLite. To see the toggle.
1) Download sqlite editor app. I got it from here.
2) Open the app and give it root permissions. It should populate a list.
3) Scroll and Tap the "Settings Storage"
4) Tap "Settings.db"
5) Tap "System"
6) Scroll down until you find "notification_panel_active_app_list", tap to highlight it. I noticed its a little hard to get it highlighted because it seems to want to highlight the one under it. So you might have to tap the one right above it to get it highlighted. Make sure its the notification_panel_active_app_list, and I also updated my notification_panel_active_app_list_reset NOT the notification_panel_default_active_app_list. I picked the wrong one the first time and it didnt work.
7) Once it is highlighted tap the phones menu button.
8) Tap "Edit Record"
9) You'll see a list of all the toggles that are currently enabled to show in notification area.
10) At the bottom of the list or anywhere else in the list add ; and the words Flashlight and Battery then another ;. So it will look like this at the end. ;TouchSensitivity;Flashlight;Battery; Then press Save.
11) Reboot and you should have a Flashlight and a Battery Stats toggle now. You can now use the edit feature and move it anywhere you want in the list of toggles.
This might also have a positive side effect of the following:
When you go to Settings-About Phone-Status it might say OFFICIAL!!!
Enjoy!!!
Enable Tab view in Settings
First grab your SecSettings.apk from system/priv-app
Decompile with APKTOOL and open res.values/bools with Notepad++
look for the following 2 lines:
Code:
<bool name="settings_list">false</bool>
<bool name="settings_grid">true</bool>
Change them to look like this:
Code:
<bool name="settings_list">[COLOR="Red"]true[/COLOR]</bool>
<bool name="settings_grid">[COLOR="Red"]false[/COLOR]</bool>
That's it. Compile and push to System/priv-app
Enjoy!!
How to enable Flashlight operation with Volume
First grab your SecSettings.apk from system/priv-app and decompile with APKTOOL.
Look in res/xml for display_settings_2014.xml and open with Notepad++
Add the following line in Red. When you are done look in settings-Display and you will see Torch Light options menu
Code:
<CheckBoxPreference android:title="@string/led_indicator_settings" android:key="key_simple_led_indicator_settings" android:summary="@string/led_indicator_settings_summary" android:widgetLayout="@touchwiz:layout/preference_widget_twcheckbox" />
[COLOR="Red"]<PreferenceScreen android:title="@string/torchlight_settings" android:key="torchlight" android:fragment="com.android.settings.torchlight.TorchlightSettings" />[/COLOR]
<ListPreference android:persistent="false" android:entries="@array/touch_key_light_entries" android:title="@string/touch_key_light" android:key="touch_key_light" android:summary="@string/touch_key_light_summary" android:widgetLayout="@layout/round_more_icon" android:entryValues="@array/touch_key_light_values" />
Compile and push to system/priv-app
That's it.
Enjoy!!!!
How to Enable add Apps Ops to Settings.
First grab SecSettings.apk from system/priv-app and decompile with APKTOOL
Get gridlist_settings_headers.xml from res/xml and edit with Notepad++
Look for:
Code:
<header android:icon="@drawable/ic_setting_grid_powersaving" android:id="@id/power_saving" android:title="@string/power_saving_mode_title_k" android:fragment="com.android.settings.powersavingmode.MenuPowerSavingModeSettings" />
and add right below it the following:
Code:
<header android:icon="@drawable/ic_settings_applicationpermissions" android:title="@string/app_ops_settings" android:fragment="com.android.settings.applications.AppOpsSummary" />
Save file and compile. That's it.
Push to system/priv-app
Enjoy!!!
Great post...
Will the Wi-Fi tether mod work with the ATT Variant?
thesilentnight said:
Great post...
Will the Wi-Fi tether mod work with the ATT Variant?
Click to expand...
Click to collapse
I have not seen the AT&T firmware. You must be rooted. If you are rooted and want to send me your framework-res.apk I can take a look for you.
Sadly as far as i know, root isnt yet available yet for the ATT variant....
thesilentnight said:
Sadly as far as i know, root isnt yet available yet for the ATT variant....
Click to expand...
Click to collapse
OMG, I'm sooo glad I could write what's written in my signature.
EMSpilot said:
...Here is the flashable Flashlight Toggle Mod...
Click to expand...
Click to collapse
You sir, ROCK!!! Very good work
the "Verizon Note 4 Enable Native Call Recording Note 4"
Will this work on N910G snapdragon variant ? also, does this enable automatic call recording ?
pratik_193 said:
the "Verizon Note 4 Enable Native Call Recording Note 4"
Will this work on N910G snapdragon variant ? also, does this enable automatic call recording ?
Click to expand...
Click to collapse
If you can send me your InCallUI.apk I can take a look. No automatic call recording. When you get a call or make a call you simply tap the call recording button once on the screen.
EMSpilot said:
If you can send me your InCallUI.apk I can take a look. No automatic call recording. When you get a call or make a call you simply tap the call recording button once on the screen.
Click to expand...
Click to collapse
Here it is..
Can you make a modded secphone something we had for note 3 ? link below
http://forum.xda-developers.com/showthread.php?t=2498449
CZ Eddie said:
OMG, I'm sooo glad I could write what's written in my signature.
Click to expand...
Click to collapse
Why is that?
thesilentnight said:
Sadly as far as i know, root isnt yet available yet for the ATT variant....
Click to expand...
Click to collapse
CZ Eddie said:
OMG, I'm sooo glad I could write what's written in my signature.
Click to expand...
Click to collapse
thesilentnight said:
Why is that?
Click to expand...
Click to collapse
My sig is pretty self explanatory in regards to your earlier statement.
I ditched my grandfathered unlimited data plan with AT&T in November 2014 because AT&T won't let anyone root their Galaxy phones.
Hello, T-Mobile!
Click to expand...
Click to collapse
pratik_193 said:
Here it is..
Can you make a modded secphone something we had for note 3 ? link below
http://forum.xda-developers.com/showthread.php?t=2498449
Click to expand...
Click to collapse
Hey @EMSpilot any luck ?
pratik_193 said:
Hey @EMSpilot any luck ?
Click to expand...
Click to collapse
Where did this InCallUI.apk come from? It won't build.
EMSpilot said:
Where did this InCallUI.apk come from? It won't build.
Click to expand...
Click to collapse
i got it from the current ROM i have a N910G snapdragon... you need anything else ?
Hmm, get a whole bunch of errors when trying to decompile SecSettings.apk. I can decompile other apks fine so don't think it's something with my setup.
Code:
W: Skipping "android" package group
W: Could not decode attr value, using undecoded value instead: ns=android, name=widgetLayout, value=0x02030015
Can't find framework resources for package of id: 2. You must install proper framework files, see project website for more info
Great post op!!
Did by any chance someone tried this in an international N4?
Awesome thread!
Subscribed!
Thanks contributors!
@EMSpilot
when i try to add the torchlight mod it makes all the checkboxes in the settings menu disappear.
any idea what the problem could be? the mod itself works perfect, but the checkboxes are pretty usefull as well.
thanks in advance :good:
Psycho_666 said:
@EMSpilot
when i try to add the torchlight mod it makes all the checkboxes in the settings menu disappear.
any idea what the problem could be? the mod itself works perfect, but the checkboxes are pretty usefull as well.
thanks in advance :good:
Click to expand...
Click to collapse
What Rom are you running? NJ5? or? The mods are based on NI2. If you are running NJ5 you have to decompile do the mod compile and push back to the phone.
I'm running an ANK5 rom.
but I don't understand how it has anything to do with the checkboxes.
it's pretty frustrating
Sent from my Note 4