[DEV][MODDING] CRT, Airview, 4-way reboot, ink effect, phone, sms..etc [9/Dec/2013]

Mr0lala

Senior Member
Aug 29, 2010
78
81
0
Ha Noi
Hi majdinj,

First, I want to say thank you for great guide :good:, I try to port for my phone Galaxy S2HD it work almost :victory:

Now i try to follow your guide: LockScreen Torch but in step mod PhoneWindowManager.smali i can't find exact line to mod :(, because I have many line same same like your guide =.=! and it make my phone bootloop all times :(. Can you check my PhoneWindowManager.smali or add more line?. It's will be easier for me to find exact line to mod this :cool:
 

Attachments

Last edited:

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
Hi majdinj,

First, I want to say thank you for great guide :good:, I try to port for my phone Galaxy S2HD it work almost :victory:

Now i try to follow your guide: LockScreen Torch but in step mod PhoneWindowManager.smali i can't find exact line to mod :(, because I have many line same same like your guide =.=! and it make my phone bootloop all times :(. Can you check my PhoneWindowManager.smali or add more line?. It's will be easier for me to find exact line to mod this :cool:
As you know, each ROM has its specific values; although the concept is the same, you will need to have sometimes several trials of failure then succeed..!!!
Anyhow, you seems to be stuck in const and cond values (I know it is tough mod), but here is your file after modification in the attachment..

N.B: I have deleted one line in your smali because I think it might interrupt with code, but if got bootloop, just return it back..
Here is where you should put the line that I deleted:
Code:
    .line 3356
    invoke-interface/range {v38 .. v38}, Lcom/android/internal/statusbar/IStatusBarService;->cancelPreloadRecentApps()V
    :try_end_38c
    .catch Landroid/os/RemoteException; {:try_start_383 .. :try_end_38c} :catch_3e6

    .line 3364
    .end local v38           #statusbar:Lcom/android/internal/statusbar/IStatusBarService;
    :cond_38c
    :goto_38c
    const/16 v46, 0x0

    move/from16 v0, v46

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z

    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->launchHomeFromHotKey()V

    [B][COLOR="Blue"]invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->goHome()Z[/COLOR][/B]

    .line 3365
Make sure that you edited the other smali in a correct way..!!!
 

Attachments

Mr0lala

Senior Member
Aug 29, 2010
78
81
0
Ha Noi
As you know, each ROM has its specific values; although the concept is the same, you will need to have sometimes several trials of failure then succeed..!!!
Anyhow, you seems to be stuck in const and cond values (I know it is tough mod), but here is your file after modification in the attachment..

N.B: I have deleted one line in your smali because I think it might interrupt with code, but if got bootloop, just return it back..
Here is where you should put the line that I deleted:
Code:
    .line 3356
    invoke-interface/range {v38 .. v38}, Lcom/android/internal/statusbar/IStatusBarService;->cancelPreloadRecentApps()V
    :try_end_38c
    .catch Landroid/os/RemoteException; {:try_start_383 .. :try_end_38c} :catch_3e6

    .line 3364
    .end local v38           #statusbar:Lcom/android/internal/statusbar/IStatusBarService;
    :cond_38c
    :goto_38c
    const/16 v46, 0x0

    move/from16 v0, v46

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomePressed:Z

    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->launchHomeFromHotKey()V

    [B][COLOR="Blue"]invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->goHome()Z[/COLOR][/B]

    .line 3365
Make sure that you edited the other smali in a correct way..!!!
Thanks for your help but unfortunately my phone still bootloop :crying::crying: even I add the blue code or not :(
 

Mr0lala

Senior Member
Aug 29, 2010
78
81
0
Ha Noi
Are the other 2 smali edited correctly?
Use logcat to locate problem
Sure, I think I edited KeyguardViewMediator$4.smali and KeyguardViewMediator.smali. Here is my android.policy.jar I edited, can you check it?

Logcat will be not work if phone bootloop , is this true? Because when I use logcat it say waitting for devices...., Logcat only work when phone go to main menu, right? (sorry my bad English :( )
 

Attachments

ezaechiel

Senior Member
Mar 19, 2013
1,017
1,032
0
Issou
team.5n0w.fr
Extended Power Menu Addons (ScreenShot, Recovery & Download modes)

In this tutorial, we will modify 2 files; the framework-res.apk file and android.policy.jar file...
Here for the sake of tutorial, I will refer to ScreenShot resources by blue color lines, Recovery resources by green lines and download resources by orange lines.. Please download these resources first.

A) framework-res.apk
1. Decompile framework-res.apk by APK-Multi Tool
2. Add your desired resources image to res\drawable-xhdpi folder, here they are [tw_ic_lock_screenshot.png], [tw_ic_lock_recovery.png] and [tw_ic_lock_download.png]
3. Go to res\values folder and open strings.xml file and add the following lines at the end before </resources>:
Code:
[COLOR="Blue"]    <string name="global_action_screenshot_txt">Take screenshot</string>[/COLOR]
[COLOR="Green"]    <string name="global_action_recovery_txt">Recovery Mode</string>[/COLOR]
[COLOR="DarkOrange"]    <string name="global_action_download_txt">Download mode</string>[/COLOR]
4. Now recompile your framework-res.apk THEN decompile it again; so we can have new generated ids in public.xml file in res\values folder.
5. In your new decompiled framework-res.apk, go to res\values folder and open public.xml file and locate the following lines for the added new image resources:
Code:
    [COLOR="Blue"]<public type="drawable" name="tw_ic_lock_screenshot" id="0x01080a98" />[/COLOR]
    [COLOR="Green"]<public type="drawable" name="tw_ic_lock_recovery" id="0x01080a9a" />[/COLOR]
    [COLOR="DarkOrange"]<public type="drawable" name="tw_ic_lock_download" id="0x01080a99" />[/COLOR]
and the following lines for the added new strings resources:
Code:
    [COLOR="Blue"]<public type="string" name="global_action_screenshot_txt" id="0x01040784" />[/COLOR]
    [COLOR="Green"]<public type="string" name="global_action_recovery_txt" id="0x01040785" />[/COLOR]
    [COLOR="DarkOrange"]<public type="string" name="global_action_download_txt" id="0x01040786" />[/COLOR]
6. Leave public.xml file opened and go to the next step..

B) android.policy.jar
1. Backsmali android.policy.jar
2. Navigate to classout\com\android\internal\policy\impl folder and open GlobalActions.smali.
3. Search for ".field private mDialog:Landroid/app/AlertDialog;" and add these new lines bellow it:
Code:
.field private mDialog:Landroid/app/AlertDialog;

[COLOR="Blue"].field private mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[/COLOR]
[COLOR="Green"].field private mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

[COLOR="DarkOrange"].field private mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

.field private mHandler:Landroid/os/Handler;
4. Search for "[Lcom/android/internal/policy/impl/GlobalActions$Action;" for power menu arrays and increase the number of arrays (the line above it) to accommodate the total number of new arrays..
Code:
    .line 418
    const/4 v1, 0x[B][COLOR="Purple"]5     <!--- You need to increase the arrays number here[/COLOR][/B]

    new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
So the line will be:
Code:
    .line 418
    const/4 v1, 0x[B][COLOR="Purple"]8[/COLOR][/B]

    new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;
5. Now we will put listener actions for these added arrays.. so above the newly modified "const/4 v1, 0x8" add these action lines:
Code:
    .line 416
    invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/GlobalActions;->onAirplaneModeChanged()V

    [COLOR="Blue"]new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$ScreenCap;

    const v2, 0x1080a98

    const v3, 0x1040784

    move-object/from16 v0, p0

    invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$ScreenCap;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    move-object/from16 v0, p0

    iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]
	
[COLOR="Green"]    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Recovery;

    const v2, 0x1080a9a

    const v3, 0x1040785

    move-object/from16 v0, p0

    invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$Recovery;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    move-object/from16 v0, p0

    iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;
[/COLOR]
[COLOR="DarkOrange"]    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$Download;

    const v2, 0x1080a99

    const v3, 0x1040786

    move-object/from16 v0, p0

    invoke-direct {v1, v0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$Download;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    move-object/from16 v0, p0

    iput-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;[/COLOR]

    .line 418
    const/4 v1, 0x8
As you can see here, the ids for each action are obtained from public.xml file from framework-res.apk. The first id in each action will represent the image resource and the second id will represent the string resource... See public.xml lines above and you will figure it out ;)..
6. Now we need to add new arrays to show in Power Menu.. So bellow modified "const/4 v1, 0x8" add new arrays to show after the last array:
Code:
    .line 418
    const/4 v1, 0x8

    new-array v1, v1, [Lcom/android/internal/policy/impl/GlobalActions$Action;

    const/4 v2, 0x0

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mAccessiblityShortcut:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    aput-object v3, v1, v2
...
...
...
    const/4 v2, 0x4

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRestart:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    aput-object v3, v1, v2

[COLOR="Blue"]    const/4 v2, 0x5
	
    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mScreenCapture:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    aput-object v3, v1, v2[/COLOR]

[COLOR="Green"]    const/4 v2, 0x6
	
    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mRecovery:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    aput-object v3, v1, v2[/COLOR]

[COLOR="DarkOrange"]    const/4 v2, 0x7
	
    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/android/internal/policy/impl/GlobalActions;->mDownload:Lcom/android/internal/policy/impl/GlobalActions$SinglePressAction;

    aput-object v3, v1, v2[/COLOR]
7. Now save changes and exit.
8. Copy smali resources for ScreenShot, Recovery and Download modes into classout\com\android\internal\policy\impl folder
9. Smali (recompile) the finished android.policy.jar

Now push the modified framework-res.apk and android.policy.jar to your phone.. This will be enough for new Power Menu recovery and download modes addons but not for ScreenShot!! You need to push extra file to bin folder in your phone which is screenshot and fix permissions to rwsr-xr-x that is 04755 in updater-script language.

Results example:


Framed Recent app windows

For this mod, we will modify 2 files; SystemUI.apk and framework-res.apk
First download the resources from here.

A) SystemUI.apk
1. Decompile SystemUI.apk by APK-Multi Tool.
2. Inside Recent_Mod.zip there is three files; status_bar_recent_item.xml and status_bar_recent_panel.xml, copy them to res\layout-port folder for android 4.1 or to res\layout for android 4.2; and nyandroid11.png move it to res\drawable-nodpi folder
3. Go to res\values\bools.xml and change:
Code:
    <bool name="config_recents_thumbnail_image_fits_to_xy">[B][COLOR="Red"]false[/COLOR][/B]</bool>
to:
Code:
    <bool name="config_recents_thumbnail_image_fits_to_xy">[B][COLOR="Blue"]true[/COLOR][/B]</bool>
4. Go to res\values\colors.xml and change:
Code:
    <color name="status_bar_recents_app_label_color">[B][COLOR="Red"]#ffffffff[/COLOR][/B]</color>
to:
Code:
    <color name="status_bar_recents_app_label_color">[B][COLOR="Blue"]#ff555555[/COLOR][/B]</color>
5. Go to res\values\drawables.xml and change:
Code:
    <item type="drawable" name="status_bar_recents_app_thumbnail_background">[B][COLOR="Red"]#88000000[/COLOR][/B]</item>
to:
Code:
    <item type="drawable" name="status_bar_recents_app_thumbnail_background">[B][COLOR="Blue"]#ffe0e0e0[/COLOR][/B]</item>
6. Go to res\values\ids.xml and add these lines if they are not there:
Code:
    <item type="id" name="recents_transition_background">false</item>
    <item type="id" name="recents_transition_placeholder_icon">false</item>
7. Recompile your finished SystemUI.apk

B) framework-res.apk
1. Decompile framework-res.apk by APK-Multi Tool
2. Go to res\values\dimens.xml and change thumbnail height and width size to:
Code:
    <dimen name="thumbnail_height">160.0dip</dimen>
Code:
    <dimen name="thumbnail_width">240.0dip</dimen>
3. Recompile your finished framework-res.apk



Results example:
I have a question, does we have to set compression level to 0 for framework-res.apk in the screenshot guide?
 

ezaechiel

Senior Member
Mar 19, 2013
1,017
1,032
0
Issou
team.5n0w.fr
Noob question:How to link ids to public.xml?

Just have to deompile framework-res.apk and find id for permlab_forceback and change the one in PhoneWindowManager$KillConcept.smali by the one you found in public.xml ^^.


EDIT :

Look up the id for permlab_forceback in public then change the 0x10xxxxx id in the smali so the last five digits match the id you found

Sent from my GT-I9100 using Tapatalk 2
Oups too late, you already answered ^^.
 
  • Like
Reactions: #Henkate and Kamy

ezaechiel

Senior Member
Mar 19, 2013
1,017
1,032
0
Issou
team.5n0w.fr
I didn´t as I implemented in xxlt4 Pristine
nothing changed at the compression

hope it helps
In fact when I flash the mods separately it works great without changing compression, but it doesn't work when I put the file directly in the install zip of the rom ^^. I'll test it tonight with a compression of 0 to see it something change ;).

Thanks for your answer.
 

majdinj

Senior Member
Nov 25, 2006
980
3,437
0
AlAhsa
In fact when I flash the mods separately it works great without changing compression, but it doesn't work when I put the file directly in the install zip of the rom ^^. I'll test it tonight with a compression of 0 to see it something change ;).

Thanks for your answer.
for some reason, APK-Multi tool manager will ruin framework-res.apk signature (even if you compile as system to preserve signature!!!:confused:)

what I do usually, I just open the original framework-res.apk and extract assets, META-INF, and AndroidManifest.xml, then I open the new modded framework-res.apk and just darg and drop those file and folders inside it and that's all...

By doing this method, you will not worry about compression level even if it is set to 9 :)
 
  • Like
Reactions: Kamy and hara74

ezaechiel

Senior Member
Mar 19, 2013
1,017
1,032
0
Issou
team.5n0w.fr
for some reason, APK-Multi tool manager will ruin framework-res.apk signature (even if you compile as system to preserve signature!!!:confused:)

what I do usually, I just open the original framework-res.apk and extract assets, META-INF, and AndroidManifest.xml, then I open the new modded framework-res.apk and just darg and drop those file and folders inside it and that's all...

By doing this method, you will not worry about compression level even if it is set to 9 :)
Ok thanks because after ten tries, I always have this problem. So I'll try your method, Hope it solve my problem ^^. Will let you know if I succeed.

EDIT : It works great, you're my hero :D
 
Last edited:

ashok9949

Senior Member
Oct 5, 2010
82
7
0
Lodz
CRT TV off effect

Quote:
Some custom kernels, works when wifi is on!!
1. We need Backsmali/smali program for this method.
2. Put the service.jar in baksmali folder.
3. Follow its procedure to baksmali service.jar, if done you will have classout folder.
4. Open classout folder and go to \com\android\server folder and open PowerManagerService$ScreenBrightnessAnimator.smali file.
5. Search for "Landroid/os/Handler;->removeMessages(I)VI" and add the following code lines (the blue ones only):
Code:
.line 3064
.end local v0 #delta:I
:cond_60
:goto_60
iget-object v7, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;

#getter for: Lcom/android/server/PowerManagerService;->mScreenBrightnessHandler:Landroid/os/Handler;
invoke-static {v7}, Lcom/android/server/PowerManagerService;->access$7200(Lcom/android/server/PowerManagerService;)Landroid/os/Handler;

move-result-object v7

if-eqz p2, :cond_maj

const/16 v9, 0xb

const/4 v10, 0x0

const v2, 0x10

invoke-virtual {v7, v9, v2, v10}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;

move-result-object v9

invoke-virtual {v9}, Landroid/os/Message;->sendToTarget()V

:cond_maj
const/16 v9, 0xa

invoke-virtual {v7, v9}, Landroid/os/Handler;->removeMessages(I)V
6. Save changes.
Quote:
To disable glitch turning off, please see this post by joosh3 here
7. Recompile (smali) your jar. You will get "classes.dex" and with 7zip, open the archive of the original service.jar. Then drag and drop the classes.dex you just compiled into the jar. Push the jar to your phone.


this methos is not working in GT-I9082 4.1.2 stock rom
 

klurosu

Senior Member
Apr 1, 2011
640
658
0
Phú Tho
klurosu.net
CRT TV off effect

Quote:
Some custom kernels, works when wifi is on!!
1. We need Backsmali/smali program for this method.
2. Put the service.jar in baksmali folder.
3. Follow its procedure to baksmali service.jar, if done you will have classout folder.
4. Open classout folder and go to \com\android\server folder and open PowerManagerService$ScreenBrightnessAnimator.smali file.
5. Search for "Landroid/os/Handler;->removeMessages(I)VI" and add the following code lines (the blue ones only):
Code:
.line 3064
.end local v0 #delta:I
:cond_60
:goto_60
iget-object v7, p0, Lcom/android/server/PowerManagerService$ScreenBrightnessAnimator;->this$0:Lcom/android/server/PowerManagerService;

#getter for: Lcom/android/server/PowerManagerService;->mScreenBrightnessHandler:Landroid/os/Handler;
invoke-static {v7}, Lcom/android/server/PowerManagerService;->access$7200(Lcom/android/server/PowerManagerService;)Landroid/os/Handler;

move-result-object v7

if-eqz p2, :cond_maj

const/16 v9, 0xb

const/4 v10, 0x0

const v2, 0x10

invoke-virtual {v7, v9, v2, v10}, Landroid/os/Handler;->obtainMessage(III)Landroid/os/Message;

move-result-object v9

invoke-virtual {v9}, Landroid/os/Message;->sendToTarget()V

:cond_maj
const/16 v9, 0xa

invoke-virtual {v7, v9}, Landroid/os/Handler;->removeMessages(I)V
6. Save changes.
Quote:
To disable glitch turning off, please see this post by joosh3 here
7. Recompile (smali) your jar. You will get "classes.dex" and with 7zip, open the archive of the original service.jar. Then drag and drop the classes.dex you just compiled into the jar. Push the jar to your phone.


this methos is not working in GT-I9082 4.1.2 stock rom
Method works on many roms but if it doesn't you must customize the mod.
Usually is the same lines to edit...but ot depends of rom. Search well and you'll sucess


sent from an I9105P hipervitaminated :)
 

danivancouver

Senior Member
Nov 10, 2010
611
617
0
Hi, I wanted to comment on what happens with the animation of the battery.

I am creating my rom, edited the animation, the Compilation decopilacion and without failure, without making wiper flaseo and it works, the problem biene when I integrate it in the rom, to make the wiper and flasear, the setting ui fails ...

Let an be?

Greetings.
 
Last edited: