[Dev]Enabling CRT-off Animation on Neo Stock ICS roms - Sony Ericsson Xperia Neo, Pro

We all know that there is no CRT-off mod for the Neo /V. This is because only changing the value of config_animateScreenLights from true to false in framework-res.apk is not working anymore!
The problem is that are some missing commands in the /system/framework/services.jar
After comparing files from GB and ICS, i might have come up with a Method.
This will require some devs to continue on my work, as i don't have the proper tools to work on.
Hands-on:
This is what have to be done:
First of all decompile classes of services.jar (I won't provide any information to this, there are many tutorials out there how to use the smali tools!)
Then in com/android/server/PowerManagerService.smali we have to make the method nativeStartSurfaceFlingerAnimation(I)V callable from inner classes. To do that, we have to add the following after the last access$XXXX method:
Code:
.method static synthetic access$9000(Lcom/android/server/PowerManagerService;I)V
.registers 2
.parameter "x0"
.parameter "x1"
.prologue
.line 110
invoke-direct {p0, p1}, Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)V
return-void
.end method
Than we have to add some commands to the file com/android/server/PowerManagerService$BrightnessState.smali to trigger the CRT-off-effect. For that add the red part between :cond_38 and iget-object v4, p0, Lcom/a.... like this (its around line 400 in code):
Code:
.line 2679
.restart local v3 #turningOff:Z
:cond_38
[COLOR="red"]iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
const/16 v3, 0x11 # CRT-On and CRT-Off
#calls: Lcom/android/server/PowerManagerService;->nativeStartSurfaceFlingerAnimation(I)
invoke-static {v4, v3}, Lcom/android/server/PowerManagerService;->access$9000(Lcom/android/server/PowerManagerService;I)V[/COLOR]
iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;
#getter for: Lcom/android/server/PowerManagerService;->mScreenBrightness:Lcom/android/server/PowerManagerService$BrightnessState;
invoke-static {v4}, Lcom/android/server/PowerManagerService;->access$6000(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$BrightnessState;
move-result-object v4
Lastly, recompile the file, put it on your phone CRT-off effect will be magically displayed.
Lastly, i really seek the devs help to work on this and bring success to this work

Wow that will be great when we have this on ICS
Write in my mobile

TheF3nix said:
Lastly, recompile the file, put it on your phone CRT-off effect will be magically displayed.
Click to expand...
Click to collapse
what do u mean by magically displayed? u made it to work or its still a work in progress?

jjdoctor said:
what do u mean by magically displayed? u made it to work or its still a work in progress?
Click to expand...
Click to collapse
Work in Progress? Just follow my steps. I haven't try it out yet. Not sure whether it will work
Sent from my MT11i using Tapatalk 2

TheF3nix said:
Work in Progress? Just follow my steps. I haven't try it out yet. Not sure whether it will work
Sent from my MT11i using Tapatalk 2
Click to expand...
Click to collapse
we need modified surfaceflinger.so and sufaceflingerclient.so to get it to work...

jjdoctor said:
we need modified surfaceflinger.so and sufaceflingerclient.so to get it to work...
Click to expand...
Click to collapse
Is anyone working on this anymore?
This would be a great mod to have again

Really waiting to have that on my Ray... CM Based ROM have this effect... So nice.... As I decompile CM ROM, animatescreenlights is set to TRUE. What I saw new is the config_screenOffAnimations, that line on bool.xml and not present on Stock ROMS I think (some?).

What if you compare the surfaceflinger and surfaceflingerclient from cm9 and stock roms, they can't be that different right?, maybe thats the way to go, to get this to work.

The latest cm 9.1 stable has CRT enabled....
Surely someone can now port this to stock ICS!!!!!!!!!!!!!!!!!

Related

[FIX] Updated: How to fix deodexed System Framework (slow Browser)

Update 14th Aug 2011: JesusFreke has released a new version of baksmali (v1.2.7) which seems to have fixed the bug above
You may download it from here http://blog.jesusfreke.com/2011/08/smalibaksmali-127.html - Thank you JesusFreke for a great tool and support
Please feel free to report any bugs or issues with this tool here or on his blog.
-------------
Good news to all modders out there - I finally found the bug for real this time - unfortunately, it's in baksmali.jar" .. The fault occurs when it attempts to build deodex framework.jarodex from into smali files
specifically this file "android/view/SurfaceView.smali"
I believe baksmali (v1.2.6) just fails to realize that the class variable it wants to access belongs to the super (parent) class .. instead it simply accesses the local class variable.
But I have a work-around fix to the bug (guranteed to work as long as the order of class fields mLeft and mTop are the same in android/view/SurfaceView.smali as android/webkit/WebViewCore$ShowRectData.smali)
The solution:
1. replace
Code:
.method private super_mLeft()I
.registers 2
.prologue
.line 911
iget v0, p0, Landroid/view/SurfaceView;->mLeft:I
return v0
.end method
with
Code:
.method private super_mLeft()I
.registers 2
.prologue
.line 911
iget v0, p0, [strike]Landroid/webkit/WebView;[/strike][COLOR="Red"]Landroid/view/View;[/COLOR]->mLeft:I
return v0
.end method
2. and this
Code:
.method private super_mTop()I
.registers 2
.prologue
.line 914
iget v0, p0, Landroid/view/SurfaceView;->mTop:I
return v0
.end method
with
Code:
.method private super_mTop()I
.registers 2
.prologue
.line 914
iget v0, p0, [strike]Landroid/webkit/WebView;[/strike][COLOR="Red"]Landroid/view/View;[/COLOR]->mTop:I
return v0
.end method
3. and
Code:
iget-object v0, v0, Landroid/view/SurfaceView;->mLocation:[I
move-object v5, v0
const/4 v6, 0x0
move-object/from16 v0, p0
iget v0, v0, Landroid/view/SurfaceView;->mLeft:I
move v7, v0
add-int v7, v7, p4
aput v7, v5, v6
with
Code:
iget-object v0, v0, Landroid/view/SurfaceView;->mLocation:[I
move-object v5, v0
const/4 v6, 0x0
move-object/from16 v0, p0
iget v0, v0, [strike]Landroid/webkit/WebView;[/strike][COLOR="Red"]Landroid/view/View;[/COLOR]->mLeft:I
move v7, v0
add-int v7, v7, p4
aput v7, v5, v6
4. and last peice
Code:
iget-object v0, v0, Landroid/view/SurfaceView;->mLocation:[I
move-object v5, v0
const/4 v6, 0x1
move-object/from16 v0, p0
iget v0, v0, Landroid/view/SurfaceView;->mTop:I
move v7, v0
add-int v7, v7, p5
aput v7, v5, v6
.line 439
with
Code:
iget-object v0, v0, Landroid/view/SurfaceView;->mLocation:[I
move-object v5, v0
const/4 v6, 0x1
move-object/from16 v0, p0
iget v0, v0, [strike]Landroid/webkit/WebView;[/strike][COLOR="Red"]Landroid/view/View;[/COLOR]->mTop:I
move v7, v0
add-int v7, v7, p5
aput v7, v5, v6
.line 439
*NOTE* please keep my nickname in references for this solution.
Happy Modding,
- Brightidea
Thanks
But how we change the code
Assuming you have a deodex'd rom, baksmali browser.apk make the listed change and re-smali the code.
If you asking how to bakssmali etc, thats more drawn out..
I cant wait to try this, later this evening
I m just wondering how, just this one line can fix the laggy browser?
But anyway if this realy works, i m happy.
Thank you for sharing your work.
I think these misguided
the problem is in the framework.jar
example:
if you use a rom with the folder system / framework ODEX
and system / app deodex
The browser deodex not lose acceleration
but if you, deodex framework.jar, lose acceleration
criskelo said:
I think these misguided
the problem is in the framework.jar
example:
if you use a rom with the folder system / framework ODEX
and system / app deodex
The browser deodex not lose acceleration
but if you, deodex framework.jar, lose acceleration
Click to expand...
Click to collapse
So if i understand u right, this mod makes no sense with deodexed ROM?
He's saying that the fix wont work. It isn't an issue in the smali code of the Browser but rather an issue in the deodexed framework.
Also, the OP edited the original post:
I have found out that this approach is not the "real" solution to the bug. So, I am back in the lab trying to figure it out. Meanwhile, you may still use it as to my knowledge it doesn't do any harm.
Click to expand...
Click to collapse
OMG
You are the MAN
It works ....works .....works
Thank you
Edit: it worked for 5 min's and now keep FC
criskelo said:
I think these misguided
the problem is in the framework.jar
example:
if you use a rom with the folder system / framework ODEX
and system / app deodex
The browser deodex not lose acceleration
but if you, deodex framework.jar, lose acceleration
Click to expand...
Click to collapse
You're partly right - I found problems in the deodexed Browser that I am going to share after I fix the bugs in framework.
I am currently digging it up - hope to find the glitch soon.
GanGs_KiD said:
OMG
You are the MAN
It works ....works .....works
Thank you
Edit: it worked for 5 min's and now keep FC
Click to expand...
Click to collapse
Sorry to disappoint - but I am still working on the fix.
- Brightidea.
brightidea said:
You're partly right - I found problems in the deodexed Browser that I am going to share after I fix the bugs in framework.
I am currently digging it up - hope to find the glitch soon.
Click to expand...
Click to collapse
Do not know if it was understood
I say look in framework.jar
The problem is framework.jar
criskelo said:
Do not know if it was understood
I say look in framework.jar
The problem is framework.jar
Click to expand...
Click to collapse
I found the bug for real this time - unfortunately, it's in smali.jar ..
and you were right. The fault occurs when it attempts to build framework.jar from smali files
specifically this file "android/view/SurfaceView.smali"
But I have a work-around (guranteed to work as long as the order of class fields mLeft and mTop are the same in android/view/SurfaceView.smali as android/webkit/WebViewCore$ShowRectData.smali)
Go to the first post in the thread to get the solution.
- Brightidea
HAHA you did it!!
Works like a charm!
Maybe would be interesting to report this issue to jesusfreeke
very good job.
why isn't thist threat in "Original Android development" subforum????
Wow ..
U R the man ;D
brightidea said:
I found the bug for real this time - unfortunately, it's in smali.jar ..
and you were right. The fault occurs when it attempts to build framework.jar from smali files
specifically this file "android/view/SurfaceView.smali"
But I have a work-around (guranteed to work as long as the order of class fields mLeft and mTop are the same in android/view/SurfaceView.smali as android/webkit/WebViewCore$ShowRectData.smali)
Go to the first post in the thread to get the solution.
- Brightidea
Click to expand...
Click to collapse
Well actually works
Perfect!
great job brightidea!
Wohoo! You're the man! Waiting for this to be incorporated in all the ROMs
Well done.
Hacre said:
Well done.
Click to expand...
Click to collapse
Hacre being nice...whoa. epic post.
Epic fix as well!
Sent from my 119.2 linpack SGS2
brightidea.. you're a genius ! thank you sir

Remvove GPS icon in status bar

Using scotts clean rom 1.2 and was wondering of there was anything I could flash to remove that icon.
Sent from my Rezound using xda premium
nfrederick said:
Using scotts clean rom 1.2 and was wondering of there was anything I could flash to remove that icon.
Sent from my Rezound using xda premium
Click to expand...
Click to collapse
PM me.
do u know how to use apktool?
pm sent
never used apktool
EDIT
just downloaded and installed, looks like it runs using correctly when I type apktool in a command prompt.
thats as far as I got haha
I have a SystemUI.apk that has it removed, as well as all of the advanced settings...you'd have to adb push it or use root explorer/ES File Explorer to stick it in system/app.
Ironically, I'm trying to do the opposite and don't know how to re-enable it with this particular SysUI
Would you mind posting it?
awenthol said:
I have a SystemUI.apk that has it removed, as well as all of the advanced settings...you'd have to adb push it or use root explorer/ES File Explorer to stick it in system/app.
Ironically, I'm trying to do the opposite and don't know how to re-enable it with this particular SysUI
Click to expand...
Click to collapse
nfrederick said:
Would you mind posting it?
Click to expand...
Click to collapse
Hahah... I can help you both...
I was just about to post a mod that removed location.
awenthol you need to change two lines under gpsone
in HtcCdmaStatusBar.smali...
Look For:
Code:
.line 279
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/HtcCdmaStatusBar;->mService:Landroid/app/StatusBarManager;
const-string v1, "gpsone"
const/4 v2, 0x0
Change to
Code:
.line 279
iget-object v0, p0, Lcom/android/systemui/statusbar/policy/HtcCdmaStatusBar;->mService:Landroid/app/StatusBarManager;
const-string v1, "gpsone"
[COLOR="Red"] const/4 v2, 0x1[/COLOR]
Then the second spot a few lines down is....
Code:
.method private updateMtGpsIcon()V
.locals 6
.prologue
const/4 v3, 0x3
const/4 v2, 0x0
Code:
.method private updateMtGpsIcon()V
.locals 6
.prologue
const/4 v3, 0x3
[COLOR="red"] const/4 v2, 0x1[/COLOR]
Oh and my next ROM will have the icon removed... And I will post a sep zip for it...
Ok, here is my mod: http://forum.xda-developers.com/showthread.php?p=21119197#post21119197
Thanks Scott, perfect timing! Haha.
I can't view the .xml files. I get some stuff at the top, but all I get for the rest of the document is yyyyy and random characters..
maximus20895 said:
I can't view the .xml files. I get some stuff at the top, but all I get for the rest of the document is yyyyy and random characters..
Click to expand...
Click to collapse
You need to decode them with apktool

[FIX][HOW TO] Camcorder Force Close After Deodexing

Alright well it looks like after we deodex the stock rom there's a problem that comes up with the camcorder force closing. After doing some research I came across a rom in the One X section that had the same issue and it was fixed making some changes to the framework.jar. After hours and hours of getting logcats and trying to cross comparing the two framework.jar files I finally fixed it. All credit goes to lyapota for the fix, I just applied it to our framework.
Instructions:
Step 1: Download
Step 2: Flash in Recovery
Step 3: Reboot (all files will update)
Step 4: Enjoy!
How To:
Decompile framework.jar \smali\android\media\MediaRecorder$1.smali
--------------------------------------------------------------------
replace
invoke-virtual {v1, v2}, Landroid/app/ContextImpl;->sendBroadcast(Landroid/content/IntentV
with
invoke-virtual {v1, v2}, Landroid/content/Context;->sendBroadcast(Landroid/content/IntentV
Thanks to dsb9938 for his flashable zip!
Thanks to lyapota for the fix!
First. Thanks so much! This was the only thing holding me back from flashing the rom.
x3demond3x said:
Alright well it looks like after we deodex the stock rom there's a problem that comes up with the camcorder force closing. After doing some research I came across a rom in the One X section that had the same issue and it was fixed making some changes to the framework.jar. After hours and hours of getting logcats and trying to cross comparing the two framework.jar files I finally fixed it. All credit goes to lyapota for the fix, I just applied it to our framework.
Instructions:
Step 1: Download
Step 2: Flash in Recovery
Step 3: Reboot (all files will update)
Step 4: Enjoy!
Thanks to dsb9938 for his flashable zip!
Thanks to lyapota for the fix!
Click to expand...
Click to collapse
Just did this and still force closes. I am sure it is because I have the One X camera mod. Anyone have a stock DNA cam zip that I can flash on my deodexed DNA?
CISGS said:
Just did this and still force closes. I am sure it is because I have the One X camera mod. Anyone have a stock DNA cam zip that I can flash on my deodexed DNA?
Click to expand...
Click to collapse
My bad, had the wrong file linked -_-. Try it again.
x3demond3x said:
My bad, had the wrong file linked -_-. Try it again.
Click to expand...
Click to collapse
Haha thanks bro. Works great. Good job.
Niiiiice work
Sent from my HTC6435LVW using xda premium
It worked great for me. Thanks for the fix.
Sent from my HTC6435LVW using Tapatalk 2
This also improved my battery life. Before gallery was highest usage after I deodexed.
Thanks for the fix!
Sent from my HTC6435LVW using xda premium
Now is this the fix for the camera app in this post?
http://forum.xda-developers.com/showthread.php?t=2022633
afipanic said:
Now is this the fix for the camera app in this post?
http://forum.xda-developers.com/showthread.php?t=2022633
Click to expand...
Click to collapse
Yes, this is a fix for basically all deodexed roms.
Re: [FIX] Camcorder Force Close After Deodexing
x3demond3x said:
Alright well it looks like after we deodex the stock rom there's a problem that comes up with the camcorder force closing. After doing some research I came across a rom in the One X section that had the same issue and it was fixed making some changes to the framework.jar. After hours and hours of getting logcats and trying to cross comparing the two framework.jar files I finally fixed it. All credit goes to lyapota for the fix, I just applied it to our framework.
Click to expand...
Click to collapse
Nice. I have this problem on my j butterfly and probably going to need to do what you did. I'll try this fix when I get home, but I don't think it will work.
If it doesn't work, what would I be looking for to change in my device's framework.jar?
Any help or consideration is appreciated. :thumbup:
Sent from my Nexus 7 using xda premium
SharpIS03 said:
Nice. I have this problem on my j butterfly and probably going to need to do what you did. I'll try this fix when I get home, but I don't think it will work.
If it doesn't work, what would I be looking for to change in my device's framework.jar?
Any help or consideration is appreciated. :thumbup:
Sent from my Nexus 7 using xda premium
Click to expand...
Click to collapse
If you can't get it to work. Just PM me and I'll help you out.
Re: [FIX] Camcorder Force Close After Deodexing
What files were edited for this fix? Need info to fix new ota build. Thanks
Sent from my HTC6435LVW using xda app-developers app
MicroMod777 said:
What files were edited for this fix? Need info to fix new ota build. Thanks
Sent from my HTC6435LVW using xda app-developers app
Click to expand...
Click to collapse
will this not work on the OTA then?
No, it does not work.
Please fix this file. Thanks.
Looking at the .smali it looks like it has the correct code already based on the OP.
Sent from my Droid DNA running ZoneDNA ROM..
Code:
.class Landroid/media/MediaRecorder$1;
.super Landroid/os/Handler;
.source "MediaRecorder.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Landroid/media/MediaRecorder;->start_stop_notify(I)V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x0
name = null
.end annotation
# instance fields
.field final synthetic this$0:Landroid/media/MediaRecorder;
.field final synthetic val$act:I
# direct methods
.method constructor <init>(Landroid/media/MediaRecorder;Landroid/os/Looper;I)V
.registers 4
.parameter
.parameter "x0"
.parameter
.prologue
.line 1097
iput-object p1, p0, Landroid/media/MediaRecorder$1;->this$0:Landroid/media/MediaRecorder;
iput p3, p0, Landroid/media/MediaRecorder$1;->val$act:I
invoke-direct {p0, p2}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V
return-void
.end method
# virtual methods
.method public handleMessage(Landroid/os/Message;)V
.registers 7
.parameter "msg"
.prologue
.line 1099
invoke-static {}, Landroid/app/ActivityThread;->currentActivityThread()Landroid/app/ActivityThread;
move-result-object v0
.line 1101
.local v0, actThread:Landroid/app/ActivityThread;
if-nez v0, :cond_e
.line 1102
const-string v3, "HtcDeviceInfoManager"
const-string v4, "MediaRecorder.start_stop_notify, no activity thread!"
invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 1118
:goto_d
return-void
.line 1105
:cond_e
invoke-virtual {v0}, Landroid/app/ActivityThread;->getSystemContext()Landroid/app/ContextImpl;
move-result-object v1
.line 1106
.local v1, context:Landroid/content/Context;
if-nez v1, :cond_1c
.line 1107
const-string v3, "HtcDeviceInfoManager"
const-string v4, "MediaRecorder.start_stop_notify, no context!"
invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_d
.line 1112
:cond_1c
new-instance v2, Landroid/content/Intent;
invoke-direct {v2}, Landroid/content/Intent;-><init>()V
.line 1113
.local v2, intent:Landroid/content/Intent;
const-string v3, "com.htc.HtcDeviceInfoManager.MediaReceiver"
invoke-virtual {v2, v3}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
.line 1114
const-string/jumbo v3, "type"
const/4 v4, 0x2
invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
.line 1115
const-string v3, "act"
iget v4, p0, Landroid/media/MediaRecorder$1;->val$act:I
invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
.line 1116
const-string/jumbo v3, "pid"
invoke-static {}, Landroid/os/Process;->myPid()I
move-result v4
invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
.line 1117
invoke-virtual {v1, v2}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
goto :goto_d
.end method
Here's the fix for the new OTA thanks to OP info....
MicroMod777 said:
Here's the fix for the new OTA thanks to OP info....
Click to expand...
Click to collapse
Did he happen to tell you how he fixed it this time?
zone23 said:
Did he happen to tell you how he fixed it this time?
Click to expand...
Click to collapse
Yes, the code is on the 1st post.
Sent from my HTC6435LVW using Tapatalk 2
MicroMod777 said:
Yes, the code is on the 1st post.
Sent from my HTC6435LVW using Tapatalk 2
Click to expand...
Click to collapse
OK well I looked at and post the code and it looked ok to me thats why i asked. Thanks

[MOD] Custom Volume Step Count for Everything

So I've always been annoyed with how the HiFi volume only has 15 steps. For me, 5 is too low and 10 is too loud (cheap earbuds). With the release of the V30, I've learned that it has 75 steps for the HiFi volume, which prompted me to modify our system to get 75 steps as well.
Well, I didn't do that exactly, but I think this is better. I didn't manage to get the 75 steps on just the HiFi volume: I changed every slider, and it's customizable. By default, it's 1 step on the HiFi slider. This is about 1/2 of a step on the ringer volume I think. But if you don't like that, you can change what it uses.
The property is
Code:
volume_step_size
in Settings.Global.
You can set that using ADB. For instance, if you want to go back to the default step size for HiFi mode, you could use
Code:
adb shell settings put global volume_step_size 10
The default step size if 5, but for whatever reason, the system uses double the number you want. It's some weird scaling thing I think.
Attached is the modified services.jar. It goes in /system/framework/ with 0644 permissions.
Enjoy!
Do it Manually
This guide assumes you know how to decompile and recompile APKs/JARs or DEX files. I'm just going to tell you what code you need to edit to add this mod yourself.
- Decompile your services.jar. If you're on an odexed system, you'll either have to deodex the JAR or edit the DEX. That's beyond the scope of this though.
- Find these two files:
Code:
- /com/android/server/audio/AudioService.smali
- /com/android/server/audio/AudioService$VolumeStreamState.smali
- In AudioService, you need to add two new methods.
Code:
.method static synthetic -get49(Lcom/android/server/audio/AudioService;)Z
.locals 1
iget-boolean v0, p0, Lcom/android/server/audio/AudioService;->mHifiDacMode:Z
return v0
.end method
You'll want to make sure that -get49 isn't already used as a method name. My latest method was -get48, so the one I added I renamed to -get49.
Code:
.method private getCustomVolumeStepValue()I
.locals 3
const-string/jumbo v0, "volume_step_size"
const v1, 0x2
iget-object v2, p0, Lcom/android/server/audio/AudioService;->mContext:Landroid/content/Context;
invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2
invoke-static {v2, v0, v1}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2
return v2
.end method
This is the method that grabs the current volume step set in Settings.Global. If there's no value found, it will use "2" by default.
- Now, go into AudioService$VolumeStreamState and find this method: "rescaleDeltaIndex(IIII)I." Comment the entire method out and paste this instead:
Code:
.method private rescaleDeltaIndex(IIII)I
.locals 3
.param p1, "deltaIndex" # I
.param p2, "flags" # I
.param p3, "streamType" # I
.param p4, "device" # I
.prologue
.line 4948
invoke-static {}, Lcom/android/server/audio/AudioService;->-get26()Z
move-result v2
if-eqz v2, :cond_4
const/high16 v2, 0x20000
and-int/2addr v2, p2
if-nez v2, :cond_4
const/4 v2, 0x3
if-ne p3, v2, :cond_4
.line 4950
iget-object v2, p0, Lcom/android/server/audio/AudioService$VolumeStreamState;->this$0:Lcom/android/server/audio/AudioService;
invoke-static {v2}, Lcom/android/server/audio/AudioService;->-get49(Lcom/android/server/audio/AudioService;)Z
move-result v2
if-eqz v2, :cond_0
and-int/lit16 v2, p2, 0x1000
if-nez v2, :cond_1
.line 4951
:cond_0
invoke-static {}, Lcom/android/server/audio/AudioService;->-get0()I
move-result v2
mul-int/2addr p1, v2
.line 4953
:cond_1
const/4 v1, 0x0
.line 4954
.local v1, "rescaledeltaIndex":I
invoke-virtual {p0, p4}, Lcom/android/server/audio/AudioService$VolumeStreamState;->getIndex(I)I
move-result v0
.line 4955
.local v0, "currentIndex":I
rem-int v2, v0, p1
if-eqz v2, :cond_3
.line 4956
if-gtz p1, :cond_2
.line 4957
rem-int v2, v0, p1
neg-int v1, v2
.line 4964
:goto_0
return v1
.line 4959
:cond_2
rem-int v2, v0, p1
sub-int v1, p1, v2
goto :goto_0
.line 4962
:cond_3
move v1, p1
goto :goto_0
.line 4966
.end local v0 # "currentIndex":I
.end local v1 # "rescaledeltaIndex":I
:cond_4
return p1
.end method
-get49 is the method you pasted earlier.
-get0 is the method that returns HIFI_MEDIA_VOLUME_OFFSET. Just make sure your -get0 is the same one as mine.
- Now, you need to actually get the custom method you pasted to be called. Find "adjustStreamVolume(IIILjava/lang/String;Ljava/lang/String;I)V" in AudioService and find the call to "rescaleIndex(III)I" inside it.
My call looks like this:
Code:
invoke-direct {v0, v6, v1, v13}, Lcom/android/server/audio/AudioService;->rescaleIndex(III)I
Change whatever you have to look like this:
Code:
invoke-direct {v0}, Lcom/android/server/audio/AudioService;->getCustomVolumeStepValue()I
- Rebuild and install!
Do I remove an old file first or just set this one in there
THANKS!!
The big step sizes have bothered me a lot!
If I want to use the adb command to set step sizes of 1, should I use 2?
Edit: File works for me!
Cheers
Emil
I've been looking for something like this. Thank you! ?
---------- Post added at 02:23 PM ---------- Previous post was at 02:22 PM ----------
shadavis08 said:
Do I remove an old file first or just set this one in there
Click to expand...
Click to collapse
I added .bak to the end of the original file so its still there in case I need it.
I changed the file and softrebooted. Not working.
Am I doing something wrong?
Salvaparalyzer said:
I changed the file and softrebooted. Not working.
Am I doing something wrong?
Click to expand...
Click to collapse
Did you change the permissions?
I would do a full reboot. A soft boot may not be enough.
Sent from my LG-H918 using Tapatalk
Salvaparalyzer said:
I changed the file and softrebooted. Not working.
Am I doing something wrong?
Click to expand...
Click to collapse
Are you sure it isn't working? Did you put it in the right place?
A little off-topic, but do you have any idea if something similar can be done for the brightness slider? Basically I would like to be able to set it to stick to increments of 5% or 10% when adjusting. Is there a similar setting I can change using ADB?
RichBordoni said:
A little off-topic, but do you have any idea if something similar can be done for the brightness slider? Basically I would like to be able to set it to stick to increments of 5% or 10% when adjusting. Is there a similar setting I can change using ADB?
Click to expand...
Click to collapse
Every time I fiddle with brightness something bootloops.
Zacharee1 said:
Are you sure it isn't working? Did you put it in the right place?
Click to expand...
Click to collapse
Permission are also correct I think
Update: Hmm, my phone soft restarts with incoming or out coming calls with this mod, fixed it by restoring my original file.
Just a heads up! Backup your old file.
H990DS V11i-GLOBAL-COM(flashed V10j Indonesia from V10g SEA)
3mL said:
Update: Hmm, my phone soft restarts with incoming or out coming calls with this mod, fixed it by restoring my original file.
Just a heads up! Backup your old file.
H990DS V11i-GLOBAL-COM(flashed V10j Indonesia from V10g SEA)
Click to expand...
Click to collapse
Weird, it doesn't happen here. The 990DS seems to always have problems with universal mods though.
Zacharee1 said:
Weird, it doesn't happen here. The 990DS seems to always have problems with universal mods though.
Click to expand...
Click to collapse
Yea, it's unfortunate.
Would you mind telling me what file you edited in the .dex file?
Perhaps it would work by editing my original file.
3mL said:
Yea, it's unfortunate.
Would you mind telling me what file you edited in the .dex file?
Perhaps it would work by editing my original file.
Click to expand...
Click to collapse
I'll write up a guide in a few hours. It involves editing Smali and all that.
Not only that. Phone reboots when trying to make a call with your file.
Restored the old file and the problem was gone.
H990ds here
3mL said:
Yea, it's unfortunate.
Would you mind telling me what file you edited in the .dex file?
Perhaps it would work by editing my original file.
Click to expand...
Click to collapse
Guide up.
Zacharee1 said:
Guide up.
Click to expand...
Click to collapse
Cheers! I'll have a look at it tomorrow.
Thanks Zach for the nice work.
I'm on OvrDrive's rom, h918, 10j. I believe it is odexed because the OP doesn't say anything about deodex.
I renamed the current services.jar, put yours in and set permissions. Rebooted and couldn't get past the LG logo.
Should your file work on this setup, or do I have to do it manually as you outlined?
androiddiego said:
Thanks Zach for the nice work.
I'm on OvrDrive's rom, h918, 10j. I believe it is odexed because the OP doesn't say anything about deodex.
I renamed the current services.jar, put yours in and set permissions. Rebooted and couldn't get past the LG logo.
Should your file work on this setup, or do I have to do it manually as you outlined?
Click to expand...
Click to collapse
I'm pretty sure this JAR is from OvrDriVE's 10J ROM so it should work fine.
Zacharee1 said:
I'm pretty sure this JAR is from OvrDriVE's 10J ROM so it should work fine.
Click to expand...
Click to collapse
Thanks! I'll try it again.

[MOD] Enable Double Press Power for Camera on stock ROM

This will enable the double press power for camera gesture on the stock ROM. On MiFavor 5.0 this will only work when the screen is on due to some zte service preventing it from working when screen is off (not surprised).
Decompile Settings_ZTE and open res/xml/display_settings.xml
Change
Code:
<SwitchPreference android:title="@string/camera_gesture_title" android:key="camera_gesture" android:summary="@string/camera_gesture_desc" />
to
Code:
<SwitchPreference android:title="@string/camera_double_tap_power_gesture_title" android:key="camera_double_tap_power_gesture" android:summary="@string/camera_double_tap_power_gesture_desc" />
Open smali/com/android/settings/DisplaySettings.smali
Go to
Code:
.method private updateState()V
Everywhere you see
Code:
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mCameraGesturePreference:Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
Change to
Code:
iget-object v3, p0, Lcom/android/settings/DisplaySettings;->mCameraDoubleTapPowerGesturePreference:Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
Change
Code:
const-string/jumbo v6, "camera_gesture_disabled"
to
Code:
const-string/jumbo v6, "camera_double_tap_power_gesture_disabled"
Go to
Code:
.method public onCreate(Landroid/os/Bundle;)V
Change
Code:
const-string/jumbo v6, "camera_double_tap_power_gesture"
invoke-virtual {p0, v6}, Lcom/android/settings/DisplaySettings;->removePreference(Ljava/lang/String;)V
to
Code:
const-string/jumbo v6, "camera_double_tap_power_gesture"
invoke-virtual {p0, v6}, Lcom/android/settings/DisplaySettings;->findPreference(Ljava/lang/CharSequence;)Lcom/zte/mifavor/support/v7/preference/Preference;
move-result-object v6
check-cast v6, Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
iput-object v6, p0, Lcom/android/settings/DisplaySettings;->mCameraDoubleTapPowerGesturePreference:Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
iget-object v6, p0, Lcom/android/settings/DisplaySettings;->mCameraDoubleTapPowerGesturePreference:Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
invoke-virtual {v6, p0}, Lcom/zte/mifavor/support/v7/preference/SwitchPreference;->setOnPreferenceChangeListener(Lcom/zte/mifavor/support/v7/preference/Preference$OnPreferenceChangeListener;)V
For MiFavor 5.0 use v0 instead of p0.
Go to
Code:
.method public onPreferenceChange(Lcom/zte/mifavor/support/v7/preference/Preference;Ljava/lang/Object;)Z
Change
Code:
iget-object v8, p0, Lcom/android/settings/DisplaySettings;->mCameraGesturePreference:Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
to
Code:
iget-object v8, p0, Lcom/android/settings/DisplaySettings;->mCameraDoubleTapPowerGesturePreference:Lcom/zte/mifavor/support/v7/preference/SwitchPreference;
Change
Code:
const-string/jumbo v11, "camera_gesture_disabled"
to
Code:
const-string/jumbo v11, "camera_double_tap_power_gesture_disabled"
You may need to change the register numbers (v#) based on the surrounding code.
Recompile Settings_ZTE.
Huge thanks to @raystef66 for testing for me.
Can you make this steps for B32?
WesTD said:
Can you make this steps for B32?
Click to expand...
Click to collapse
This should work for any variant and any build
bkores said:
This should work for any variant and any build
Click to expand...
Click to collapse
I've couldn't get 3rd step. what should be new line?
WesTD said:
I've couldn't get 3rd step. what should be new line?
Click to expand...
Click to collapse
Code:
<item type="integer" name="zte_config_screenBrightnessDoze">17</item>
Doesn't work. No ambient display
WesTD said:
Doesn't work. No ambient display
Click to expand...
Click to collapse
Does it show up in settings or it just doesn't work?
Check to the OP and make sure you changed all the values. I added one that I forgot.
bkores said:
Does it show up in settings or it just doesn't work?
Check to the OP and make sure you changed all the values. I added one that I forgot.
Click to expand...
Click to collapse
No in settings
WesTD said:
No in settings
Click to expand...
Click to collapse
Did you make sure you modified all the values in the OP? Like I said I added one I forgot.
If you did try removing the following from Settings_ZTE/smali/com/android/settings/DisplaySettings.smali
Code:
.line 594
invoke-static {v2}, Lcom/android/settings/zte/MFVSysResource;->getResId(I)I
move-result v2
bkores said:
Did you make sure you modified all the values in the OP? Like I said I added one I forgot.
If you did try removing the following from Settings_ZTE/smali/com/android/settings/DisplaySettings.smali
Click to expand...
Click to collapse
Did you try and worked on b32?
BTW, I've make all steps
WesTD said:
Did you try and worked on b32?
BTW, I've make all steps
Click to expand...
Click to collapse
No I didn't try it because I just assumed it would work since those modifications have worked on every ROM I've used them on. But of course ZTE messed something up, as usual.
@WesTD I updated the OP with a new method that should work.
So this requires a root?
could you send us the modificated apk?
so we could replace it manually without decompiling and compiling the apk since i dont know how to do it.
Better yet, maybe teach a man to fish.. I wouldn't mind learning this
JackTheBest said:
could you send us the modificated apk?
so we could replace it manually without decompiling and compiling the apk since i dont know how to do it.
Click to expand...
Click to collapse
I'm sorry but I will not as the point is to do it yourself.
bkores said:
I'm sorry but I will not as the point is to do it yourself.
Click to expand...
Click to collapse
Could you at least tell us what tools we should use?
And what compiler you used since there's more than just one.
JackTheBest said:
Could you at least tell us what tools we should use?
And what compiler you used since there's more than just one.
Click to expand...
Click to collapse
I used APKTool and oat2dex. I'll write a guide on using these tools in general to modify apks on the Axon 7.
@JackTheBest I made a guide here: https://forum.xda-developers.com/axon-7/how-to/guide-modifying-apk-jar-files-axon-7-t3697945
Sorry guys I updated the OP with an extra step that I forgot. ZTE really went to extreme lengths to disable this function. Instead of just removing the one line in the display_settings.xml file they chose to disable it in the code itself. ZTE really needs better engineers because this is pissing me off.
My rant of the day

Categories

Resources