[MOD][DEV][4.3][Deodexed]Volume Rocker Wake - Nexus 4 Original Android Development

Please note the procedure works for both JWR66V and JSS15J, Deodexed Only!
pull android.policy.jar from /system/framework
apktool d android.policy.jar
Navigate to android.policy.jar.out\smali\com\android\internal\policy\impl\PhoneWindowManager.smali
Search for .method private isWakeKeyWhenScreenOff(I)Z
A few lines down will be 0x18 -> :sswitch_0 and 0x19 -> :sswitch_0
Delete both these lines. It should look like this towards the bottom near .end method:
PHP:
.sparse-switch
0x1b -> :sswitch_1
0x4f -> :sswitch_1
0x55 -> :sswitch_1
0x56 -> :sswitch_1
0x57 -> :sswitch_1
0x58 -> :sswitch_1
0x59 -> :sswitch_1
0x5a -> :sswitch_1
0x5b -> :sswitch_1
0x7e -> :sswitch_1
0x7f -> :sswitch_1
0x82 -> :sswitch_1
0xa4 -> :sswitch_0
.end sparse-switch
.end method
Save, and close out of PhoneWindowManager.smali
apktool b android.policy.jar.out android.mod.policy.jar
Rename android.mod.policy.jar to android.policy.jar
Push to /system/framework
chmod 644 or set permissions to rw-r-r
Reboot to recovery
Wipe cache
Wipe dalvik
Fix permissions
Reboot to system

Nice
Sent from my Nexus 4 using xda app-developers app

Thanks OP, really does work!

Hi,
I'm trying to do this but i'm getting error, i guess..
C:\Users\okanb3\Desktop\apktool>apktool b android.policy.jar.out android.mod.pol
icy.jar
I: Checking whether sources has changed...
I: Smaling...
[0,0] No enum constant org.jf.dexlib.AnnotationVisibility.RUNT¦ME
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: C:\Users\okanb3\Desktop\apktool\android.policy.jar.out\smali\com\android\inter
nal\policy\impl\keyguard\KeyguardSecurityViewFlipper$LayoutParams.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:66)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:50)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:257)
at brut.androlib.Androlib.buildSources(Androlib.java:214)
at brut.androlib.Androlib.build(Androlib.java:205)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Click to expand...
Click to collapse
Any help?
Also, any chance to do this mod on Ubuntu, with source codes? I can't any commit about this.

Related

How to add Reboot to power menu for Xperia's phones

I learn it from this thread:http://forum.xda-developers.com/showthread.php?t=811532
this is the final method for Xperia phones that will add reboot options to the power menu
updated 2011/08/07
================================================== ==========
Step 1.
the first thing we need to do is add string and image resources to framwork-res
for this example I am using a MT15i_4.0.A.368_HK.ftf ROM
your resource id's will be different if on another ROM
use apk_manager to decompile framework-res
open "values\strings.xml" and add our string resources
Code:
<string name="reboot">Reboot</string>
save and close
open "values-zh-rCN\strings.xml" and add our string resources
Code:
<string name="reboot">重启手机</string>
save and close
open "values\public.xml" and assign our strings resource id's
scroll until you get to the end of the "<public type="string"" id list
note the id of the last string, in this example it is "0x010403e0" sometimes
the id's are out of order so search for "0x010403e0 + 1" or "0x010403e1"
if the next id is unused then we can start assigning id's to the strings
we added.
Code:
<public type="string" name="reboot" id="0x010403e1" />
now is a good time to add the image resources(reboot.png) so add your icons to
"res\drawable-hdpi"
and assign id's to them the same way we did for the strings(using the sorted funtion of microsoft-office-excel may be much more easier)
in this example, using the example icons in the zip file I had
Code:
<public type="drawable" name="reboot" id="0x01080526" />
save and close
now framework-res has the resources needed for this mod use
apk_manager to compile.
================================================== ==========
Step 2.
next we need to modify Xperia's shutdown method to accept 3 more options
so decompile framework and open "com\android\internal\app\ShutdownThread.smali "
since we are going to pass an integer to ShutdownThread and then evaluate
that integer when the code runs we have to have a spot for the integer so
change this
Code:
.field private static mReboot:Z
to
Code:
.field public static mReboot:I
.field private static mReboot:Z
then in method(add the red color code)
Code:
.line 409
:goto_1f
const-string v2, "ShutdownThread"
const-string v2, "Performing low-level shutdown..."
invoke-static {v4, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
Code:
sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I
const/4 v2, 0x1
if-eq v1, v2, :cond_2f
Code:
.line 410
invoke-static {}, Landroid/os/Power;->shutdown()V
.line 411
return-void
Code:
:cond_2f
const-string v4, "reboot"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
Code:
.line 388
:catch_2a
move-exception v0
save and close
compile framework
================================================== ==========
Step 3.
now we are going to add the extra options to the power menu
decompile android.policy
open "com\android\internal\policy\impl\GlobalActions.sm ali"
the first thing that we need to do is increase the array length by 3
so in method createDialog change this
Code:
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
to this
Code:
const/4 v0, 0x4
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
now add the new menu items this is where the resource id's that we added
to framework-res com into play so after
Code:
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$3;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
add this code
Code:
aput-object v2, v0, v1
const/4 v1, 0x3
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$7;
const v3, 0x1080526 # reboot icon resource id
const v4, 0x10403e1 # reboot string resource id
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$7;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
make sure to change the resource id's to match what you added to to framework-res
save and close
next add the code that runs when the menu item is pressed
copy GlobalActions$3.smali and name it GlobalActions$7.smali
open GlobalActions$7 and replace all instances of GlobalActions$3(ctrl+h)
with GlobalActions$7 then change
Code:
const/4 v1, 0x1
to
Code:
const/4 v1, 0x1
const/4 p0, 0x1
sput p0, Lcom/android/internal/app/ShutdownThread;->mReboot:I
save and close
compile android.policy
done test on the phone.
flash the attached update.zip with the stock updater.enjoy~
Click to expand...
Click to collapse
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Thank u EQ,Let me have a try
Any one can help me add new options reboot directly to CWM
quangnhut123 said:
Any one can help me add new options reboot directly to CWM
Click to expand...
Click to collapse
?
Sent Via LT15i - FXP46-CM7
quangnhut123 said:
Any one can help me add new options reboot directly to CWM
Click to expand...
Click to collapse
He wants boot to recovery
Sent from my MT15i using xda premium
blade buddy solves this problem
copy GlobalActions$3.smali and name it GlobalActions$7.smali
open GlobalActions$7 and "replace all instances of GlobalActions$3(ctrl+h)
with GlobalActions$7 then change"
can you tell me ho to do that with qoute?
copy "GlobalActions$3.smali" and name it "GlobalActions$7.smali"
open "GlobalActions$7.smali" and replace all instances of "GlobalActions$3" (ctrl+h)
with GlobalActions$7
example in first column:
.class Lcom/android/internal/policy/impl/GlobalActions$3;
change to
.class Lcom/android/internal/policy/impl/GlobalActions$7;
correct if am wrong
----------------------------------------------------------------------
indonesia:
copy "GlobalActions$3.smali" ganti nama jadi "GlobalActions$7.smali"
buka "GlobalActions$7.smali" dan ganti semua tulisan "GlobalActions$3" (ctrl+h)
dengan "GlobalActions$7"
contoh pada baris pertama:
.class Lcom/android/internal/policy/impl/GlobalActions$3;
menjadi
.class Lcom/android/internal/policy/impl/GlobalActions$7;
adoet_t said:
copy "GlobalActions$3.smali" and name it "GlobalActions$7.smali"
open "GlobalActions$7.smali" and replace all instances of "GlobalActions$3" (ctrl+h)
with GlobalActions$7
example in first column:
.class Lcom/android/internal/policy/impl/GlobalActions$3;
change to
.class Lcom/android/internal/policy/impl/GlobalActions$7;
correct if am wrong
----------------------------------------------------------------------
indonesia:
copy "GlobalActions$3.smali" ganti nama jadi "GlobalActions$7.smali"
buka "GlobalActions$7.smali" dan ganti semua tulisan "GlobalActions$3" (ctrl+h)
dengan "GlobalActions$7"
contoh pada baris pertama:
.class Lcom/android/internal/policy/impl/GlobalActions$3;
menjadi
.class Lcom/android/internal/policy/impl/GlobalActions$7;
Click to expand...
Click to collapse
You can use my mod from Ray here It is 99%(if not 100%) compatible with Arc..
Thank you MM!!!:D:D
error while recompiling
I apologize if this question is in wrong section but i ran into a small problem with my sony xperia ray ics 4.0.4 ...587,
I read the given tutorial on adding reboot, . But after i edit public xml i try to compile and it gives me an error
error: Public symbol drawable/reboot declared here is not defined.
i have followed the tutorial properly (i think)..plz help me where m i going wrong?
mandar_ez said:
I apologize if this question is in wrong section but i ran into a small problem with my sony xperia ray ics 4.0.4 ...587,
I read the given tutorial on adding reboot, . But after i edit public xml i try to compile and it gives me an error
error: Public symbol drawable/reboot declared here is not defined.
i have followed the tutorial properly (i think)..plz help me where m i going wrong?
Click to expand...
Click to collapse
did you add the drawable to the working folder?
PVy.
@ How to add Reboot to power menu for Xperia's phones
or install this theme..
http://forum.xda-developers.com/showthread.php?t=1952567
pvyParts said:
did you add the drawable to the working folder?
PVy.
Click to expand...
Click to collapse
thank you for replying..
yes i pasted the reboot.png in drawable-hdpi folder..on recompile there is that error..
thanks again
also i extracted the framework-res.apk from /system/framework/framework-res.apk from my xperia using the file manager..is it necessary to extract from the stock rom?
log:
C:\apktool>java -jar apktool.jar b frame NEWframework-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
C:\apktool\frame\res\values\public.xml:6621: error: Public entry identifier 0x10
808bc entry index is larger than available symbols (index 2236, total symbols 20
38).
C:\apktool\frame\res\values\public.xml:6621: error: Public symbol drawable/ic_lo
ck_reboot declared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, --min-sdk-version, 15, --target-sdk-ver
sion, 15, -F, C:\Users\Kate\AppData\Local\Temp\APKTOOL3008729626159014937.tmp, -
x, -S, C:\apktool\frame\res, -M, C:\apktool\frame\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)
at brut.androlib.Androlib.buildResources(Androlib.java:269)
at brut.androlib.Androlib.build(Androlib.java:192)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sd
k-version, 15, --target-sdk-version, 15, -F, C:\Users\Kate\AppData\Local\Temp\AP
KTOOL3008729626159014937.tmp, -x, -S, C:\apktool\frame\res, -M, C:\apktool\frame
\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:253)
... 6 more
Hi
what about ics?
i need it plz help...
in ics the following line :
Code:
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
doesn't exist in android.policy.jar\com\android\internal\policy\impl\GlobalActions.smali
poria1999 said:
Hi
what about ics?
i need it plz help...
in ics the following line :
Code:
const/4 v0, 0x3
new-array v0, v0, [Lcom/android/internal/policy/impl/GlobalActions$Action;
doesn't exist in android.policy.jar\com\android\internal\policy\impl\GlobalActions.smali
Click to expand...
Click to collapse
Can anyone help me?
poria1999 said:
Can anyone help me?
Click to expand...
Click to collapse
do you use stock ics????
s.bluedreams said:
do you use stock ics????
Click to expand...
Click to collapse
Yep...
Is it work for u?
poria1999 said:
Yep...
Is it work for u?
Click to expand...
Click to collapse
doesnt work at stock i think !
use one mod like Ultimate HD MOD by eagle boy and then try...
i didnt test it
هموطن
Does work at stock for sure.
Recoded it, mine works, this one maybe not.

[guide]taking care of lidroid in statusbar expanded

how to taking care of lidroid in statusbar expanded.xml
i found the tuts by aory utamie on galaxy Y fb group
how to make the toggles lay on the bottom of notification bar...and its gave
me some idea...why not we take it full control
of lidroid from xml instead of play around with smali which is really such as pain in the ass....
so...long story short...lets dig in.
1. dec.. systemui
2. open statusbarservice.smali
paste these code below #instance fields
.field l1:Landroid/widget/LinearLayout;
3.next go to public.xml... find the last id and add one more... in my case the last id is
0x7f090028 ....and then i add one id with name="awesomelidroid" id="0x7f090029"
then open ids.xml and add new id name awesomelidroid and give it values...false
4.on the statusbarservice.smali ...go to .line 336 and paste this below thoose group's line
.line 337
const v2, 0x7f090029 //these id must define in public.xml and ids.xml also
invoke-virtual {v1, v2}, Lcom/android/systemui/statusbar/ExpandedView;->findViewById(I)Landroid/view/View;
move-result-object v2
check-cast v2, Landroid/widget/LinearLayout;
iput-object v2, p0, Lcom/android/systemui/statusbar/StatusBarService;->l1:Landroid/widget/LinearLayout;
5. and finally... the important part...we move the lidroid inflater into our own view
find .line 344 and modified it...
.line 344
.local v3, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
const/4 v8, 0x0
invoke-virtual {v3}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V
iget-object v2, p0, Lcom/android/systemui/statusbar/StatusBarService;->l1:Landroid/widget/LinearLayout;
invoke-virtual {v2, v3, v8}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;I)V
6.then on statusbar-expanded.xml.. create some linearlayout and give it id="@id/awesomelidroid"
put it everywhere u want
...build n push...
NB:
-OUT OF TOPIC question...will be ignored (ask ur question in the proper thread)
-i dont take any responsibility of ur failure...
-think b4 u reply this thread
-think again
thanx to :
Allah SWT
Lidroid
Aoury Utamie
and U
enjoy...
if this post help ya.... u know what to do
{
"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"
}
Sent from my GT-S5360 using Tapatalk 2
nice guide i was looking for it
b/w share your systemui for referance
hey sir, i stuck on point 6. i'm added linear layout on expanded <LinearLayout androidrientation="horizontal" android:id="@id/awesomelidroid" android:layout_width="fill_parent" android:layout_height="wrap_content" but when decompile i have error
Awesome man!!.Now we can put the toggles anywhere you want.
ocoot said:
hey sir, i stuck on point 6. i'm added linear layout on expanded <LinearLayout androidrientation="horizontal" android:id="@id/awesomelidroid" android:layout_width="fill_parent" android:layout_height="wrap_content" but when decompile i have error
Click to expand...
Click to collapse
Please read point 3
Sent from my GT-S5360 using Tapatalk 2
yes sir, I've added that in the point 3 in ids. but when it gets to point 6, I added
<LinearLayout androidrientation = "horizontal" android: id = "@ id / awesomelidroid" android: layout_width = "fill_parent" android: layout_height = "wrap_content"
then I add this again
</ linearlayout>
be like this
<LinearLayout androidrientation = "horizontal" android: id = "@ id / awesomelidroid" android: layout_width = "fill_parent" android: layout_height = "wrap_content"
</ linearlayout>
and when recompiled, in case of error
kill3d said:
how to taking care of lidroid in statusbar expanded.xml
i found the tuts by aory utamie on galaxy Y fb group
how to make the toggles lay on the bottom of notification bar...and its gave
me some idea...why not we take it full control
of lidroid from xml instead of play around with smali which is really such as pain in the ass....
so...long story short...lets dig in.
1. dec.. systemui
2. open statusbarservice.smali
paste these code below #instance fields
.field l1:Landroid/widget/LinearLayout;
3.next go to public.xml... find the last id and add one more... in my case the last id is
0x7f090028 ....and then i add one id with name="awesomelidroid" id="0x7f090029"
then open ids.xml and add new id name awesomelidroid and give it values...false
4.on the statusbarservice.smali ...go to .line 336 and paste this below thoose group's line
.line 337
const v2, 0x7f090029 //these id must define in public.xml and ids.xml also
invoke-virtual {v1, v2}, Lcom/android/systemui/statusbar/ExpandedView;->findViewById(I)Landroid/view/View;
move-result-object v2
check-cast v2, Landroid/widget/LinearLayout;
iput-object v2, p0, Lcom/android/systemui/statusbar/StatusBarService;->l1:Landroid/widget/LinearLayout;
5. and finally... the important part...we move the lidroid inflater into our own view
find .line 344 and modified it...
.line 344
.local v3, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
const/4 v8, 0x0
invoke-virtual {v3}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V
iget-object v2, p0, Lcom/android/systemui/statusbar/StatusBarService;->l1:Landroid/widget/LinearLayout;
invoke-virtual {v2, v3, v8}, Landroid/widget/LinearLayout;->addView(Landroid/view/View;I)V
6.then on statusbar-expanded.xml.. create some linearlayout and give it id="@id/awesomelidroid"
put it everywhere u want
...build n push...
NB:
-OUT OF TOPIC question...will be ignored (ask ur question in the proper thread)
-i dont take any responsibility of ur failure...
-think b4 u reply this thread
-think again
thanx to :
Allah SWT
Lidroid
Aoury Utamie
and U
enjoy...
if this post help ya.... u know what to do
View attachment 1426824
Sent from my GT-S5360 using Tapatalk 2
Click to expand...
Click to collapse
Man how u added weather in statusbar??
Sent from my GT-S6102 using xda premium
samsoul16 said:
Man how u added weather in statusbar??
Sent from my GT-S6102 using xda premium
Click to expand...
Click to collapse
Nothing is imposible when kill3d plays in statusbar :banghead::banghead::banghead:
Sent from my Android System using Busybox Commands.
ocoot said:
yes sir, I've added that in the point 3 in ids. but when it gets to point 6, I added
<LinearLayout androidrientation = "horizontal" android: id = "@ id / awesomelidroid" android: layout_width = "fill_parent" android: layout_height = "wrap_content"
then I add this again
</ linearlayout>
be like this
<LinearLayout androidrientation = "horizontal" android: id = "@ id / awesomelidroid" android: layout_width = "fill_parent" android: layout_height = "wrap_content"
</ linearlayout>
and when recompiled, in case of error
Click to expand...
Click to collapse
What exactly error u got??
Id not define???
Have set those awesomelidroid to false in ids.xml...???
Sent from my GT-S5360 using Tapatalk 2
kill3d said:
What exactly error u got??
Id not define???
Have set those awesomelidroid to false in ids.xml...???
Sent from my GT-S5360 using Tapatalk 2
Click to expand...
Click to collapse
yes sir, I have complied with all the steps you give, but I stopped in that section. when compile error always occur
this is the logcat
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode, sharing)
Could Not Find D:\file\APKmanager\place-apk-here-for-modding\../place-apk-here-for-modding/signedSettings.apk
Could Not Find D:\file\APKmanager\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedSettings.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\octo\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Loading resource table from file: C:\Users\octo\apktool\framework\2.apk
I: Loaded.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
Could Not Find D:\file\APKmanager\place-apk-here-for-modding\../place-apk-here-for-modding/signedSystemUI.apk
Could Not Find D:\file\APKmanager\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedSystemUI.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\octo\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569)
at org.jf.smali.smaliFlexLexer.getErrorHeader(smaliFlexLexer.java:2661)
at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:2530)
at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java:119)
at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238)
at org.jf.smali.smaliParser.smali_file(smaliParser.java:430)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
at brut.androlib.Androlib.buildSources(Androlib.java:179)
at brut.androlib.Androlib.build(Androlib.java:170)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569)
at org.jf.smali.smaliFlexLexer.getErrorHeader(smaliFlexLexer.java:2661)
at org.jf.smali.smaliFlexLexer.nextToken(smaliFlexLexer.java:2530)
at org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java:119)
at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238)
at org.jf.smali.smaliParser.smali_file(smaliParser.java:430)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:71)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
at brut.androlib.Androlib.buildSources(Androlib.java:179)
at brut.androlib.Androlib.build(Androlib.java:170)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
Benchmark.apk==None was unexpected at this time.
Click to expand...
Click to collapse
I think this is smali matter...
Please compare it with mine
http://db.tt/JJZ0xshE
Sent from my GT-S5360 using Tapatalk 2
kill3d said:
I think this is smali matter...
Please compare it with mine
http://db.tt/JJZ0xshE
Sent from my GT-S5360 using Tapatalk 2
Click to expand...
Click to collapse
oke thanks. i'll try
kill3d said:
I think this is smali matter...
Please compare it with mine
http://db.tt/JJZ0xshE
Sent from my GT-S5360 using Tapatalk 2
Click to expand...
Click to collapse
I don't wanna spam the thread. So plz check Ur inbox. Anyways nice work love it. Will try today. As my xams are over today...
And can u plz make a tutorial if u have a little time on how to make 2 different tabs for notifications and toggles...
Sent from my GT-S6102 using xda premium
ah, i get the problem from the last error. on your tuts, your last id is 0x7f090028. but on me, my last id is
<public type="id" name="dcsmscarrier" id="0x7f090028" />
<public type="id" name="tombolnotif" id="0x7f090029" />
why i fix that?
ocoot said:
ah, i get the problem from the last error. on your tuts, your last id is 0x7f090028. but on me, my last id is
<public type="id" name="dcsmscarrier" id="0x7f090028" />
<public type="id" name="tombolnotif" id="0x7f090029" />
why i fix that?
Click to expand...
Click to collapse
+1 those id =>> 0x7f09002a
Sent from my GT-S5360 using Tapatalk 2
i will try this sir..thanks for the tut!!:good:
Killed cab u share systemui for comparison
"T}{@ÑK$" ÑøT TÕ $Ä¥ Jû§T Pr€ë$ ÎT...!!!
Sent From MY ¥ Dûø$ Üs!nG ËvÕ X RoM V¡Å XpArEnT TaPtAlK 2
Dcsms plz SHARE ur systemui. I need to do some comparison...
"T}{@ÑK$" ÑøT TÕ $Ä¥ Jû§T Pr€ë$ ÎT...!!!
Sent From MY ¥ Dûø$ Üs!nG ËvÕ X RoM V¡Å XpArEnT TaPtAlK 2
Sir i tried your guide and no error when compile it but now my statusbar not the same as yours.
How can i fix that?
Note: i compare your statusbarservice.smali has :
.field l1:Landroid/widget/LinearLayout
.field l2:Landroid/widget/LinearLayout
But in your guide you only put .fieldl1 ?
d3cka said:
Sir i tried your guide and no error when compile it but now my statusbar not the same as yours.
View attachment 1631022
How can i fix that?
Note: i compare your statusbarservice.smali has :
.field l1:Landroid/widget/LinearLayout
.field l2:Landroid/widget/LinearLayout
But in your guide you only put .fieldl1 ?
Click to expand...
Click to collapse
Hey dude It depends on where have u created the linear layout with that id. Create it before ongoing titles layout...
"T}{@ÑK$" ÑøT TÕ $Ä¥ Jû§T Pr€ë$ ÎT...!!!
Sent From MY ¥ Dûø$ Üs!nG ËvÕ X RoM V¡Å XpArEnT TaPtAlK 2

[Q] [Dev][Smali]All register args must fit in 4 bits error![SOLVED!]

Hi , I'm trying to port miui V5
here's my problem when trying to recompile patched android.policy.jar
Code:
apktool b out/android.policy out/android.policy.jar
I: Checking whether sources has changed...
I: Smaling...[10610,4] All register args must fit in 4 bits
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: /home/sijav/Desktop/patchrom/nypone/out/android.policy/smali/com/android/internal/policy/impl/PhoneWindowManager.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:66)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:50)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:257)
at brut.androlib.Androlib.buildSources(Androlib.java:214)
at brut.androlib.Androlib.build(Androlib.java:205)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Why me?
here is the code:
Code:
.....
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpKeyTriggered:Z
if-eqz v1, :cond_1f
:cond_1d
const/4 v1, 0x1
:goto_b
move-object/from16 v0, p0
invoke-direct {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->interceptPowerKeyDown(Z)V
invoke-static {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Injector;->sendPowerUpBroadcast(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
[CODE]#Line 10610 is below(goto/16)!
goto/16 :goto_3
.line 3478
:cond_1e
:try_start_5
move-object/from16 v0, p0
iget v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIncallPowerBehavior:I
and-int/lit8 v1, v1, 0x2
if-eqz v1, :cond_1c
invoke-interface/range {v18 .. v18}, Lcom/android/internal/telephony/ITelephony;->isOffhook()Z
move-result v1
if-eqz v1, :cond_1c
.line 3483
invoke-interface/range {v18 .. v18}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_5
.catch Landroid/os/RemoteException; {:try_start_5 .. :try_end_5} :catch_2
move-result v11
....[/CODE]
Any Idea? Please share it
SOLVED:
By making this line =>
Code:
invoke-static {[COLOR="red"]p[/COLOR]0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Injector;->sendPowerUpBroadcast(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
Into this =>
Code:
invoke-static {[COLOR="Red"]v[/COLOR]0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Injector;->sendPowerUpBroadcast(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
same problem ! tks!
sijav said:
Hi , I'm trying to port miui V5
here's my problem when trying to recompile patched android.policy.jar
Code:
apktool b out/android.policy out/android.policy.jar
I: Checking whether sources has changed...
I: Smaling...[10610,4] All register args must fit in 4 bits
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: /home/sijav/Desktop/patchrom/nypone/out/android.policy/smali/com/android/internal/policy/impl/PhoneWindowManager.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:66)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:50)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:257)
at brut.androlib.Androlib.buildSources(Androlib.java:214)
at brut.androlib.Androlib.build(Androlib.java:205)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Why me?
here is the code:
Code:
.....
iget-boolean v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpKeyTriggered:Z
if-eqz v1, :cond_1f
:cond_1d
const/4 v1, 0x1
:goto_b
move-object/from16 v0, p0
invoke-direct {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->interceptPowerKeyDown(Z)V
invoke-static {p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Injector;->sendPowerUpBroadcast(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
[CODE]#Line 10610 is below(goto/16)!
goto/16 :goto_3
.line 3478
:cond_1e
:try_start_5
move-object/from16 v0, p0
iget v1, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIncallPowerBehavior:I
and-int/lit8 v1, v1, 0x2
if-eqz v1, :cond_1c
invoke-interface/range {v18 .. v18}, Lcom/android/internal/telephony/ITelephony;->isOffhook()Z
move-result v1
if-eqz v1, :cond_1c
.line 3483
invoke-interface/range {v18 .. v18}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_5
.catch Landroid/os/RemoteException; {:try_start_5 .. :try_end_5} :catch_2
move-result v11
....[/CODE]
Any Idea? Please share it
SOLVED:
By making this line =>
Code:
invoke-static {[COLOR="red"]p[/COLOR]0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Injector;->sendPowerUpBroadcast(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
Into this =>
Code:
invoke-static {[COLOR="Red"]v[/COLOR]0}, Lcom/android/internal/policy/impl/PhoneWindowManager$Injector;->sendPowerUpBroadcast(Lcom/android/internal/policy/impl/PhoneWindowManager;)V
Click to expand...
Click to collapse
Great!I have come up with the same problem! Can I have some advice from you if possible!
iwantnobody19 said:
Great!I have come up with the same problem! Can I have some advice from you if possible!
Click to expand...
Click to collapse
Yes, LEAVE IT TO Professionals! ) that's what I did! ... however I could manage many things working by changing smalis and with a great help of great developer "munjeni" which helped me a lot ... but couldn't get network working (the only remaining bug :crying: ) you can always look at my git and get ideas https://github.com/sijav/patchrom_nypon
Hope you get more successful than I

[GUIDE] Mod Skype 4.x to call invisible contacts

GUIDE IS ON POST #2
Hi folks!
In Skype 4.x it is impossible to call invisible contacts, and I was hoping you would lend me a hand to change things around!
Here's what I got so far:
I assume that the app is checking if the contact is available, if not it returns an error message
The displayed error message is "No answer"
In \res\values\strings.xml the string "No answer" has 2 matches:
Code:
<string name="message_call_duration_no_answer">no answer</string>
and
<string name="message_call_failed_no_answer">No answer</string>
I assume we're looking for the latter
Apart from public.xml and many localized string.xml the string "message_call_failed_no_answer" can only be found in two R$string.smali (in \smali\com\skype\raider and \smali\com\skype\android\app) wich I assume being identical for our purposes
Code:
.class public final Lcom/skype/android/app/R$string;
.super Ljava/lang/Object;
.source "R.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/skype/android/app/R;
.end annotation
Code:
.class public final Lcom/skype/raider/R$string;
.super Ljava/lang/Object;
.source "R.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/skype/raider/R;
.end annotation
From this line on the files are identical
In both the files the string "message_call_failed_no_answer" has only 1 match:
Code:
.field public static final message_call_failed_no_answer:I = 0x7f070261
If we look for the string "0x7f070261", we find it in 4 files: public.xml, the two almost identical R$string.smali, and smali\com\skype\android\app\calling\PreCallActivity.smali
In PreCallActivity.smali the string "0x7f070261" has only 1 match:
Code:
.method private endCallWithReason(Lcom/skype/SkyLib$LEAVE_REASON;)V
[blablabla]
.line 642
:pswitch_6
const v0, 0x7f070261
invoke-virtual {p0, v0}, Lcom/skype/android/app/calling/PreCallActivity;->getString(I)Ljava/lang/String;
move-result-object v0
invoke-direct {p0, v0}, Lcom/skype/android/app/calling/PreCallActivity;->endCallWithMessage(Ljava/lang/String;)V
goto :goto_0
...but... my coding skills are equal to ZERO, so I have no clue how to proceed from here
I tried to look into Skype 3.2 but PreCallActivity.smali doesn't exist: nor in smali\com\skype\android\app (infact in smali\com\skype\android\ there is no app subdir to be found at all...), nor anywhere else.
A little help please?
Thank you for your time
f:fingers-crossed:
Edit: Now that I think of it, I will try to just delete from .line 642 to goto_0 and recompile... I'm not so hopeful but hey! :fingers-crossed:
Edit: I Recompiled the apk deleting only
Code:
invoke-virtual {p0, v0}, Lcom/skype/android/app/calling/PreCallActivity;->getString(I)Ljava/lang/String;
move-result-object v0
invoke-direct {p0, v0}, Lcom/skype/android/app/calling/PreCallActivity;->endCallWithMessage(Ljava/lang/String;)V
, copied META-INF folder and AndroidManifest.xml over from the original apk to the newly compiled one, checked zipalignment zipaligned it, signed it and... GREAT SUCCESS! I've managed to insall and use the app... now I'll wait for my invisible friends to "show up"
GUIDE
Alrighty Folks!
Well... IT WORKS
So, to sum it up, if you want to do it yourself:
Decompile the Skype apk
Open \smali\com\skype\android\app\PreCallActivity.smali in Notepad++ (or your editor of choice)
Find 0x7f070261
Edit the file to look something like this
HTML:
const v0, 0x7f070261
#
# invoke-virtual {p0, v0}, Lcom/skype/android/app/calling/PreCallActivity;->getString(I)Ljava/lang/String;
#
# move-result-object v0
#
# invoke-direct {p0, v0}, Lcom/skype/android/app/calling/PreCallActivity;->endCallWithMessage(Ljava/lang/String;)V
#
goto :goto_0
(I commented the pesky lines but I guess deleting them would be ok too)
Recompile
Open your new apk and copy META-INF folder and manifest.xml from the original apk
Sign the new apk
Zipalign the signed apk
Install as a regular apk
CREDITS:
KUDOS TO @ibanez7 FOR HIS EXCELLENT GUIDE ABOUT DECOMPILING/RECOMPILING APKs :good::good::good: (Recommended if you have doubts about any of the above steps)
KUDOS TO @Flextrick FOR HIS AWESOME ANDROID MULTITOOL :good::good::good:
Make sure you thank them if you found this guide useful
Enjoy
f

[GUIDE][MIUI] PatchROM Rejects Fixing Tutorial

Hello everyone!
MIUI (which stands for Mi User Interface and pronounced "Me You I", a play on the common abbreviation of the words user interface as UI), developed by Xiaomi Tech, is a stock and aftermarket firmware for smartphones and tablet computers based on the free software Android operating system. MIUI includes various features such as theming support.
Click to expand...
Click to collapse
Patchrom is a open-source project initiated and maintained by MIUI team. It mainly utilizes the assembler/disassembler technology to craft a MIUI ROM for an existing ROM. Although this project is for MIUI ROM, but the technology and tools is general for crafting any android ROM.
Click to expand...
Click to collapse
{
"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"
}
Today I present you a guide for PatchROM rejects fixing. I'm not an expert at all, so maybe I'll miss things. Don't expect that I'll explain solution to every issue, however, I try my best to do this tutorial. I'm very happy due to I haven't found a specific thread about this.
This guide is applicable to all devices and Miui versions (using PatchROM)
Click to expand...
Click to collapse
This guide is continue updating. I'm getting more knowledge everyday, and I'll explain the most kinds of rejects as posible.
Click to expand...
Click to collapse
Having said that, let's start!
1. Understanding Rejects
First of all, is needed to know why we get a reject. We know that we've got a reject when executing in Terminal "make firstpatch" appears something like this:
Code:
Hunk #1 FAILED at 111.
1 out of 1 hunks FAILED -- saving rejects to file android.services.jar.out/PhoneWindowManager.smali.rej
This tells me that the patch couldn't apply it at line 111. Also we know that the half-patched file is located in android.services.jar.out and it's called "PhoneWindowManager.smali".
Realise that PatchROM decompiles framework files at smali code to add MIUI lines. What's smali?:
Smali/Baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation. The names "Smali" and "Baksmali" are the Icelandic equivalents of "assembler" and "disassembler" respectively.
Click to expand...
Click to collapse
Now that we've seen the failed hunks, it's time to find the related reject. Reject files are located at temp/reject folder.
Following my example, the half-patched file is located at android.services.jar.out. So I have to open that sub-folder at reject directory, and look for "PhoneWindowManager.smali.rej"; that's the reject file.
Having done that, we have to find the base file. In this case, I'll be located in device root folder (patchrom/device) at
android.services.jar.out. We have to look for "PhoneWindowManager.smali"; I'll be at the same path that reject one.
For example, if reject file is located at "patchrom/device/temp/reject/android.policy.jar.out/smali/com/android/internal/policy/impl" original file will be located at "patchrom/device/android.policy.jar.out/smali/com/android/internal/policy/impl".
Click to expand...
Click to collapse
Once we have found the right file to edit, it's time to patch it manually.
2. Getting Patch Knowledge
Now we have to open both files (reject and base). In the reject, we'll see something like this:
Code:
*** PhoneWindowManager.smali 2015-09-09 11:46:13.541852561 -0300
--- PhoneWindowManager.smali 2015-09-09 11:47:07.349851413 -0300
***************
*** 393,404 ****
.field private mPowerKeyTriggered:Z
! .field private final mPowerLongPress:Ljava/lang/Runnable;
.field mPowerManager:Landroid/os/PowerManager;
.field mPreloadedRecentApps:Z
.field mRecentAppsDialog:Lcom/android/internal/policy/impl/RecentApplicationsDialog;
.field mRecentAppsDialogHeldModifiers:I
--- 395,408 ----
.field private mPowerKeyTriggered:Z
! .field private mPowerLongPress:Ljava/lang/Runnable;
.field mPowerManager:Landroid/os/PowerManager;
.field mPreloadedRecentApps:Z
+ .field private final mQuickBootLock:Ljava/lang/Object;
+
.field mRecentAppsDialog:Lcom/android/internal/policy/impl/RecentApplicationsDialog;
.field mRecentAppsDialogHeldModifiers:I
The next step will be patching. Before that, we have to get some knowledge about symbology and terminology:
***XX,XX***: this tells me that the patch is expecting source input (below codes) between the specified lines. In this case, it expected them between line 393 and 404.
---XX,XX---: this tells me how the lines should look after patching, and where they should be. In this case, between line 395 and 408.
However, the expecting lines doesn't matter a lot. The important part is that we realise that:
Lines below asterisks (***) are how they look in base file before patching.
Lines below hyphens (---) are how they look in base file after patching.
We get a reject, because the patch couldn't find the expected source input at the given line numbers and that's why the actual patching fails.
Click to expand...
Click to collapse
So our work will be patching them manually, due to human brain is more intelligent than an automatic patch (not always, jajajaja :silly: )
To do that, we have to understand the symbols:
+ means that the line is added by the patch
- means that the line is removed by the patch
! means that the line is changed/edited by the patch
Having this knowledge, it's time to fix that reject...
3. Applying Patches Manually
I'm going to follow my example and fix it. Then you'll apply the same procedure with your reject.
Firstly, we have to pay attention to source input (asterisks):
Code:
*** 393,404 ****
.field private mPowerKeyTriggered:Z
! .field private final mPowerLongPress:Ljava/lang/Runnable;
.field mPowerManager:Landroid/os/PowerManager;
.field mPreloadedRecentApps:Z
.field mRecentAppsDialog:Lcom/android/internal/policy/impl/RecentApplicationsDialog;
.field mRecentAppsDialogHeldModifiers:I
Now it's time to look for that lines in the base file. They will be located 200 lines after or before the expecting input. Besides, they could be lightly different, almost in values. In my case, this will be the right place to work:
Code:
.field private mPowerKeyTriggered:Z
.field private final mPowerLongPress:Ljava/lang/Runnable;
.field mPowerManager:Landroid/os/PowerManager;
.field mPreloadedRecentApps:Z
.field private mPressOnAppSwitchBehavior:I
.field private mPressOnAssistBehavior:I
.field private mPressOnMenuBehavior:I
.field private final mQuickBootLock:Ljava/lang/Object;
.field private final mQuickBootPowerLongPress:Ljava/lang/Runnable;
As you can see, they're in different order, and others doesn't appear. Now we've located the source input, pay attention to the "after patch" (hyphens):
Code:
--- 395,408 ----
.field private mPowerKeyTriggered:Z
! .field private mPowerLongPress:Ljava/lang/Runnable;
.field mPowerManager:Landroid/os/PowerManager;
.field mPreloadedRecentApps:Z
+ .field private final mQuickBootLock:Ljava/lang/Object;
+
.field mRecentAppsDialog:Lcom/android/internal/policy/impl/RecentApplicationsDialog;
.field mRecentAppsDialogHeldModifiers:I
This tells me that I'll have to edit:
Code:
.field private final mPowerLongPress:Ljava/lang/Runnable;
And change it to:
Code:
.field private mPowerLongPress:Ljava/lang/Runnable;
Besides, I'll have to add this:
Code:
.field private final mQuickBootLock:Ljava/lang/Object;
Realise that files are partially patched. In this case, it's not needed to add it due to it's already in the original file, but in a distinct location. If you want, you can put it under:
Code:
.field mPreloadedRecentApps:Z
To leave it as the reject says, although it's an insignificant change.
So after patching it manually, it look in this way:
Code:
.field private mPowerKeyTriggered:Z
.field private mPowerLongPress:Ljava/lang/Runnable;
.field mPowerManager:Landroid/os/PowerManager;
.field mPreloadedRecentApps:Z
.field private mPressOnAppSwitchBehavior:I
.field private mPressOnAssistBehavior:I
.field private mPressOnMenuBehavior:I
.field private final mQuickBootLock:Ljava/lang/Object;
.field private final mQuickBootPowerLongPress:Ljava/lang/Runnable;
Finally, save your changes and exit. Go to another reject! :laugh: :laugh: :laugh:​
Thanks list:
@Tquetski from MIUI forums
@JavierAlonso (Me)
*Donate to those guys if you can*
Click to expand...
Click to collapse
Code:
Press thanks if I help you ;)
Code:
Don't copy my work without my permission
PD: I'm busy right now. I'll be adding more explanations and examples to this tutorial, due to this first example it's quite easy. Be patient please
Click to expand...
Click to collapse
Multiple Line Change
Here I'm going to explain you another kind of reject, that could be confusing sometimes. I like to call it: Multiple Line Change.
For example, we can find this reject:
Code:
*** 40,52 ****
# virtual methods
.method public run()V
.locals 5
.prologue
:try_start_0
iget-object v1, p0, Lcom/android/server/MasterClearReceiver$1;->val$context:Landroid/content/Context;
! invoke-static {v1}, Landroid/os/RecoverySystem;->rebootWipeUserData(Landroid/content/Context;)V
const-string v1, "MasterClear"
--- 44,66 ----
# virtual methods
.method public run()V
.locals 5
.prologue
:try_start_0
iget-object v1, p0, Lcom/android/server/MasterClearReceiver$1;->val$context:Landroid/content/Context;
! iget-object v2, p0, Lcom/android/server/MasterClearReceiver$1;->val$intent:Landroid/content/Intent;
!
! const-string v3, "format_sdcard"
!
! const/4 v4, 0x0
!
! invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
!
! move-result v2
!
! invoke-static {v1, v2}, Landroid/os/RecoverySystem;->rebootFactoryReset(Landroid/content/Context;Z)V
const-string v1, "MasterClear"
As you can see, there's not addition (+) or delete (-) symbols, only edit (!). This type of reject is special due to in "source input" there's a single line with !, and in "after patch" appear 11 changes.
How? What's the reason? Very simple.
Do not look at lines of code as individual things. They can be considered "one object" and should be looked at in an abstract way like this.
Click to expand...
Click to collapse
For example, I have this line in source input:
Code:
! invoke-static {v1}, Landroid/os/RecoverySystem;->rebootWipeUserData(Landroid/content/Context;)V
And in "after patch" appears this:
Code:
! iget-object v2, p0, Lcom/android/server/MasterClearReceiver$1;->val$intent:Landroid/content/Intent;
!
! const-string v3, "format_sdcard"
!
! const/4 v4, 0x0
!
! invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
!
! move-result v2
!
! invoke-static {v1, v2}, Landroid/os/RecoverySystem;->rebootFactoryReset(Landroid/content/Context;Z)V
So what to do? You have to know that:
If "!" lines appear close together, it means this "Block of code" is one object. So replace the single "!" before line with that entire block.
Applying this knowledge, with this the reject I'll do this:
I have to change this:
Code:
invoke-static {v1}, Landroid/os/RecoverySystem;->rebootWipeUserData(Landroid/content/Context;)V
To this:
Code:
iget-object v2, p0, Lcom/android/server/MasterClearReceiver$1;->val$intent:Landroid/content/Intent;
const-string v3, "format_sdcard"
const/4 v4, 0x0
invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v2
invoke-static {v1, v2}, Landroid/os/RecoverySystem;->rebootFactoryReset(Landroid/content/Context;Z)V
So after patching it manually, the base file looks in this way:
Code:
# virtual methods
.method public run()V
.locals 5
.prologue
:try_start_0
iget-object v1, p0, Lcom/android/server/MasterClearReceiver$1;->val$context:Landroid/content/Context;
iget-object v2, p0, Lcom/android/server/MasterClearReceiver$1;->val$intent:Landroid/content/Intent;
const-string v3, "format_sdcard"
const/4 v4, 0x0
invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v2
invoke-static {v1, v2}, Landroid/os/RecoverySystem;->rebootFactoryReset(Landroid/content/Context;Z)V
const-string v1, "MasterClear"
And that's it. I think it's very easy to understand. This kind of reject is nearly and addition, with the difference that we change one line with an entire block. So DON'T leave the ! line of source input; you must delete it and replace it with that block.
There is already a label with that name.
Hi! I'm here again to go to the next level about smali and rejects. :highfive:
Today I'm not going to explain you a reject at all; I'm going to explain how to fix a very common issue when making fullota.
In Terminal, you'll get something like this:
Code:
out/framework2/smali/com/android/internal/app/IAppOpsService$Stub.smali[695,4] There is already a label with that name.
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/internal/app/IAppOpsService$Stub.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:71)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:55)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:354)
at brut.androlib.Androlib.buildSources(Androlib.java:294)
at brut.androlib.Androlib.build(Androlib.java:280)
at brut.androlib.Androlib.build(Androlib.java:255)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
Why we're getting this error? Very simple: sometimes MiPatcher (or just you when patching manually) gets confused due to it found the same line twice in a smali, so it applies a duplicate diff, or something like that, so it results in "There is already a label with that name."
And the question is...How can we fix it? Quite simple too. Firstly, locate which file is corrupted. In my case is:
Code:
out/framework2/smali/com/android/internal/app/IAppOpsService$Stub.smali[695,4] There is already a label with that name.
So I'll open "IAppOpsService$Stub.smali", which should be located at: patchrom/device/framework2/smali/com/android/internal/app/. After that, it's time to find out the line that's wrong.
Terminal output tells it. In my case:
Code:
IAppOpsService$Stub.smali[695,4]
I'll have to go to line 695 (use Ctrl+I). When I'm looking at there, I found this:
Attention: Don't look only at line 695. You've to look around it to figure out what we've to edit.
Click to expand...
Click to collapse
Code:
:sswitch_d
const-string v7, "com.android.internal.app.IAppOpsService"
invoke-virtual {p2, v7}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v7
invoke-static {v7}, Lcom/android/internal/app/IOpsCallback$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IOpsCallback;
Now you've to be focused in which label could be repeated. Applying logic, the line that's causing the issue is:
Code:
:sswitch_d
Why? Coz the other lines uses values that are used all over the file. To check that ":sswitch_d" is the label which is repeated, just look for the same code in that file (use Ctrl+f).
I found this code some lines up:
Code:
[B][COLOR="Blue"]:sswitch_d[/COLOR][/B]
const-string v6, "com.android.internal.app.IAppOpsService"
invoke-virtual {p2, v6}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
.line 197
invoke-virtual {p0}, Lcom/android/internal/app/IAppOpsService$Stub;->resetCounters()V
.line 198
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
goto/16 :goto_0
Realise that both codes are too similar. That's why I think that MiPatcher fails. So what to do?
To fix this issue, you have to mix both codes. Look for what lines coincide, and then mix the ones that doesn't match.
Be careful, a different value (v7, p2) doesn't mean that the line doesn't coincide.
In my case, I deleted the first code (that was around line 695, which was failing) and I mixed it content into the second code. After editing, it looked in this way:
Code:
:sswitch_d
const-string v6, "com.android.internal.app.IAppOpsService"
invoke-virtual {p2, v6}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v7
invoke-static {v7}, Lcom/android/internal/app/IOpsCallback$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IOpsCallback;
.line 197
invoke-virtual {p0}, Lcom/android/internal/app/IAppOpsService$Stub;->resetCounters()V
.line 198
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
goto/16 :goto_0
Finally, save your changes and try to make fullota again. I'll work :laugh:
Sorry for my bad english. I'll try to improve the syntax and vocabulary. Hope you understand it.
Click to expand...
Click to collapse
Invalid register: vX. Must be between vX and vX, inclusive
Hello again! I'll be explaining how to fix that kind of error soon; I'm busy right now
ValueError: need more than X values to unpack
Hi! Now I'm gonna go into another common issue while making fullota. :silly:
In Terminal, you'll get something like this:
Code:
using prebuilt boot.img...
Traceback (most recent call last):
File "/home/develop/patchrom/tools/releasetools/ota_from_target_files", line 884, in <module>
main(sys.argv[1:])
File "/home/develop/patchrom/tools/releasetools/ota_from_target_files", line 852, in main
WriteFullOTAPackage(input_zip, output_zip)
File "/home/develop/patchrom/tools/releasetools/ota_from_target_files", line 432, in WriteFullOTAPackage
Item.GetMetadata(input_zip)
File "/home/develop/patchrom/tools/releasetools/ota_from_target_files", line 163, in GetMetadata
name, uid, gid, mode = columns[:4]
ValueError: need more than 2 values to unpack
make: *** [fullota] Error 1
It seems that we'll need to make a lot of changes and too much stuff, but don't worry about it, it's very easy to solve.
What you've to do is look for a file called "filesystem_config.txt", which is located at: patchrom/device/metadata. Once you open it, it will look as follows:
Code:
Segmentation fault
system 0 0 755
system/bin/app_process_vendor 0 2000 755
system/bin/dexopt_vendor 0 2000 755
system/etc 0 0 755
system/etc/apns-conf.xml 0 0 644
system/etc/audio_effects.conf 0 0 644
system/etc/audio_policy.conf 0 0 644
system/etc/bash 0 0 755
system/etc/bash/bash_logout 0 0 644
system/etc/bash/bashrc 0 0 644
system/etc/bluetooth 0 0 755
system/etc/bluetooth/auto_pair_devlist.conf 0 0 644
system/etc/bluetooth/bt_did.conf 0 0 644
system/etc/bluetooth/bt_stack.conf 0 0 644
system/etc/calib.dat 0 0 644
system/etc/CHANGELOG-CM.txt 0 0 644
system/etc/clatd.conf 0 0 644
system/etc/dhcpcd 0 0 755
system/etc/dhcpcd/dhcpcd.conf 0 0 644
system/etc/dhcpcd/dhcpcd-hooks 0 0 755
system/etc/dhcpcd/dhcpcd-hooks/10-mtu 0 0 644
system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf 0 0 644
system/etc/dhcpcd/dhcpcd-hooks/95-configured 0 0 644
system/etc/dhcpcd/dhcpcd-run-hooks 1014 2000 550
system/etc/ethertypes 0 0 644
system/etc/event-log-tags 0 0 644
system/etc/fallback_fonts.xml 0 0 644
system/etc/firmware 0 0 755
system/etc/firmware/a300_pfp.fw 0 0 644
system/etc/firmware/a300_pm4.fw 0 0 644
system/etc/firmware/modem_fw.* 0 0 755
system/etc/firmware/vidc_1080p.fw 0 0 644
system/etc/firmware/wcd9310 0 0 755
system/etc/firmware/wcd9310/wcd9310_anc.bin 1013 1005 700
system/etc/firmware/wcd9310/wcd9310_mbhc.bin 1013 1005 700
system/etc/firmware/wlan 0 0 755
system/etc/firmware/wlan/prima 0 0 755
system/etc/firmware/wlan/prima/WCNSS_cfg.dat 0 0 644
system/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini 1000 1010 600
system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin 0 0 644
system/etc/.has_su_daemon 0 0 644
system/etc/install-cm-recovery.sh 0 0 544
system/etc/NOTICE.html.gz 0 0 644
system/lib/liblbesec.so 0 0 744
system/lost+found 0 0 755
system/xbin/busybox 0 0 6755
system/xbin/insecure 0 2000 6755
system/xbin/oemfix 0 2000 6755
system/xbin/shelld 0 1000 6750
Now you've to delete some things:
Delete "Segmentation fault" line
Click to expand...
Click to collapse
Delete empty lines at the top of the file
Click to expand...
Click to collapse
After that, the file should look like this:
Code:
system 0 0 755
system/bin/app_process_vendor 0 2000 755
system/bin/dexopt_vendor 0 2000 755
system/etc 0 0 755
system/etc/apns-conf.xml 0 0 644
system/etc/audio_effects.conf 0 0 644
system/etc/audio_policy.conf 0 0 644
system/etc/bash 0 0 755
system/etc/bash/bash_logout 0 0 644
system/etc/bash/bashrc 0 0 644
system/etc/bluetooth 0 0 755
system/etc/bluetooth/auto_pair_devlist.conf 0 0 644
system/etc/bluetooth/bt_did.conf 0 0 644
system/etc/bluetooth/bt_stack.conf 0 0 644
system/etc/calib.dat 0 0 644
system/etc/CHANGELOG-CM.txt 0 0 644
system/etc/clatd.conf 0 0 644
system/etc/dhcpcd 0 0 755
system/etc/dhcpcd/dhcpcd.conf 0 0 644
system/etc/dhcpcd/dhcpcd-hooks 0 0 755
system/etc/dhcpcd/dhcpcd-hooks/10-mtu 0 0 644
system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf 0 0 644
system/etc/dhcpcd/dhcpcd-hooks/95-configured 0 0 644
system/etc/dhcpcd/dhcpcd-run-hooks 1014 2000 550
system/etc/ethertypes 0 0 644
system/etc/event-log-tags 0 0 644
system/etc/fallback_fonts.xml 0 0 644
system/etc/firmware 0 0 755
system/etc/firmware/a300_pfp.fw 0 0 644
system/etc/firmware/a300_pm4.fw 0 0 644
system/etc/firmware/modem_fw.* 0 0 755
system/etc/firmware/vidc_1080p.fw 0 0 644
system/etc/firmware/wcd9310 0 0 755
system/etc/firmware/wcd9310/wcd9310_anc.bin 1013 1005 700
system/etc/firmware/wcd9310/wcd9310_mbhc.bin 1013 1005 700
system/etc/firmware/wlan 0 0 755
system/etc/firmware/wlan/prima 0 0 755
system/etc/firmware/wlan/prima/WCNSS_cfg.dat 0 0 644
system/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini 1000 1010 600
system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin 0 0 644
system/etc/.has_su_daemon 0 0 644
system/etc/install-cm-recovery.sh 0 0 544
system/etc/NOTICE.html.gz 0 0 644
system/lib/liblbesec.so 0 0 744
system/lost+found 0 0 755
system/xbin/busybox 0 0 6755
system/xbin/insecure 0 2000 6755
system/xbin/oemfix 0 2000 6755
system/xbin/shelld 0 1000 6750
Realise that there aren't empty lines, which were causing the issue.
Finally, save your changes and try to make fullota again. I'll work
I'll try tomorrow..Understood a bit of it, even if I'm reading through my smartphone
P.s. Sent u a PM, check it
Inviato dal mio LG-D405n utilizzando Tapatalk
@javieraonso very thanks for your tuto
Envoyé de mon SM-G7102 en utilisant Tapatalk
buggaty said:
@javieraonso very thanks for your tuto
Envoyé de mon SM-G7102 en utilisant Tapatalk
Click to expand...
Click to collapse
I'll be updating it with more details and examples.
JavierAlonso said:
I'll be updating it with more details and examples.
Click to expand...
Click to collapse
i have some problem
i see in reject file
and some line on smali code i cant found on original smali
example on reject have line for edited but when search this line on original i can't find it
buggaty said:
i have some problem
i see in reject file
and some line on smali code i cant found on original smali
example on reject have line for edited but when search this line on original i can't find it
Click to expand...
Click to collapse
They appear with different values. Don't look for the full line. Send me your reject and Base file, and tell me in which box are you working.
Enviado desde mi GT-S7275R mediante Tapatalk
JavierAlonso said:
They appear with different values. Don't look for the full line. Send me your reject and Base file, and tell me in which box are you working.
Enviado desde mi GT-S7275R mediante Tapatalk
Click to expand...
Click to collapse
Thanks a lot javier
Mi device galaxy grand 2 g7102
Here the framework and reject
http://www.mediafire.com/?4qi9xmvil1kv6vm
Envoyé de mon SM-G7102 en utilisant Tapatalk
Thanks a lot javier
Mi device galaxy grand 2 g7102
Here the framework and reject
http://www.mediafire.com/?4qi9xmvil1kv6vm
Envoyé de mon SM-G7102 en utilisant Tapatalk
Click to expand...
Click to collapse
You've send me every smali and reject...Tell me which file are you trying to patch.
JavierAlonso said:
You've send me every smali and reject...Tell me which file are you trying to patch.
Click to expand...
Click to collapse
pls can you patch them
i d'ont have experience on smali
im traying but not success
im try patching all these framework manually
these i have send you
buggaty said:
pls can you patch them
i d'ont have experience on smali
im traying but not success
im try patching all these framework manually
these i have send you
Click to expand...
Click to collapse
I'm not here to patch files from everyone. [emoji16] I'm not going to do your work.
I'm here to teach and explain the procedure. Sometimes if you find any difficult reject, I could help you, so we learn together.
Enviado desde mi GT-S7275R mediante Tapatalk
@JavierAlonso
hey
i found this line on temp/reject/android.policy.jar.out/smali/com/android/internal/policy/phonewindowmanajer.smali.rej
this line for editing but on original smali is not found this line wath can do?
and i found mani other line for rditing in reject and when i serach on original is not found
*** 11952,11957 ****
if-eqz v12, :cond_19
invoke-interface {v11}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_5
.catch Landroid/os/RemoteException; {:try_start_5 .. :try_end_5} :catch_2
Click to expand...
Click to collapse
buggaty said:
@JavierAlonso
hey
i found this line on temp/reject/android.policy.jar.out/smali/com/android/internal/policy/phonewindowmanajer.smali.rej
this line for editing but on original smali is not found this line wath can do?
and i found mani other line for rditing in reject and when i serach on original is not found
Click to expand...
Click to collapse
Don't look for these lines exactly. For example, look for the last part of the second line.
However, send me the Base file and reject one.
Enviado desde mi GT-S7275R mediante Tapatalk
JavierAlonso said:
Don't look for these lines exactly. For example, look for the last part of the second line.
However, send me the Base file and reject one.
Enviado desde mi GT-S7275R mediante Tapatalk
Click to expand...
Click to collapse
the smali
buggaty said:
the smali
Click to expand...
Click to collapse
I think this is the right place to edit:
Code:
if-eqz v19, :cond_11
.line 4715
:try_start_1
invoke-interface/range {v19 .. v19}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_1
.catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_1
Realise that "if-eqz" is calling "cond_11", so the addition must be:
if-eqz p3, :cond_11
Click to expand...
Click to collapse
In instead of:
if-eqz p3, :cond_19
Click to expand...
Click to collapse
Pay a lot attention to that types of additions; look for what's the smali calling. After editing, it should look in this way:
Code:
.line 4713
.local v9, "hungUp":Z
if-eqz v19, :cond_11
if-eqz p3, :cond_11
.line 4715
:try_start_1
invoke-interface/range {v19 .. v19}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_1
.catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_1
Also realise that there's the same source input some lines below:
Code:
if-eqz v20, :cond_29
if-eqz p3, :cond_29
.line 4924
invoke-interface/range {v19 .. v19}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_6
.catch Landroid/os/RemoteException; {:try_start_6 .. :try_end_6} :catch_3
Look that it's already patched with " if-eqz p3, :cond_29" with "cond_29" in both "if-eqz" lines.
Hope you've understood me :victory:
Press thanks if I help you
Click to expand...
Click to collapse
JavierAlonso said:
I think this is the right place to edit:
Code:
if-eqz v19, :cond_11
.line 4715
:try_start_1
invoke-interface/range {v19 .. v19}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_1
.catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_1
Realise that "if-eqz" is calling "cond_11", so the addition must be:
In instead of:
Pay a lot attention to that types of additions; look for what's the smali calling. After editing, it should look in this way:
Code:
.line 4713
.local v9, "hungUp":Z
if-eqz v19, :cond_11
if-eqz p3, :cond_11
.line 4715
:try_start_1
invoke-interface/range {v19 .. v19}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_1
.catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_1
Also realise that there's the same source input some lines below:
Code:
if-eqz v20, :cond_29
if-eqz p3, :cond_29
.line 4924
invoke-interface/range {v19 .. v19}, Lcom/android/internal/telephony/ITelephony;->endCall()Z
:try_end_6
.catch Landroid/os/RemoteException; {:try_start_6 .. :try_end_6} :catch_3
Look that it's already patched with " if-eqz p3, :cond_29" with "cond_29" in both "if-eqz" lines.
Hope you've understood me :victory:
Click to expand...
Click to collapse
thanks a lot
I begin to understand a can
I begin to understand a can
@JavierAlonso hello bro
i have prob now
sim card not detected i think the prob on telephonny-commen.jar
wath smali caused this issue?

Categories

Resources