Howto enable Gmail notifications for all new mail with smali/baksmali - Hero, G2 Touch Q&A, Help & Troubleshooting

The Gmail app on my Hero (possibly on all Android devices?) has one big annoyance: I only get audio and vibration notifications for the first mail received after clearing notifications. If I missed the first notification for some reason, the phone will sit quiet for all subsequent incoming mail until I attend to the existing notification (the notification text will be updated on subsequent mail but no vibration/sound).
This is reported here
http://code.google.com/p/android/issues/detail?id=4190
Since Google seems to ignore this issue I decided to fix it my self. Here is a summary of how I did it, in case someone is interested in doing something similar.
Required knowledge is basic understanding of the Android SDK and some basic knowledge of the concepts of assembler. The latter is required since this involves modifying Dalvik assembly. Don't worry too much, it's MUCH easier than assembly for real CPUs.
Download smali/baksmali from http://code.google.com/p/smali/ (Thank you JesusFreke, you ROCK!).
Get hold of Gmail.apk either by pulling from your device or extracting it from your current ROM update.zip. Disassemble it with
Code:
java -jar baksmali.jar Gmail.apk
Now you have the Gmail source code in a subfolder called out. Use a descent search tool to search for a relevant section in the resulting files. I searched for "NotificationManager" since that handles Android notifications (using UltraEdit's Find in files).
There is one line found
Code:
invoke-virtual {v4, p0, v5}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V
Register v5 contains the notification to be set (check SDK docs, it's the last argument of the method call). Scroll up to see what's being done to the Notification prior to showing it.
Code:
iget p0, v5, Landroid/app/Notification;->flags:I
or-int/lit8 p0, p0, 0x1
iput p0, v5, Landroid/app/Notification;->flags:I
This is the manipulation of the flags controlling notification properties. Here I cleared the FLAG_ONLY_ALERT_ONCE (check SDK docs) flag by adding a line:
Code:
iget p0, v5, Landroid/app/Notification;->flags:I
or-int/lit8 p0, p0, 0x1
[B]and-int/lit8 p0, p0, 0xf7[/B]
iput p0, v5, Landroid/app/Notification;->flags:I
When new mail arrived I noted this with logcat:
Code:
New email for [email protected] unreadCount:5 [B]getAttention:true[/B]
...
New email for [email protected] unreadCount:5 [B]getAttention:false[/B]
The first case gave me notifications, the other didn't. Let's make getAttention always true! Search for "getAttention". It's slightly above the previous edited section.
Code:
invoke-virtual {p2, v1, v2}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v2
.line 287
.local v2, getAttention:Z
A local variable called getAttention is in register v2. Check some lines later to see that it's used to output the logs above. The right place! Now make the variable always true by loading 0x1 in register v2:
Code:
invoke-virtual {p2, v1, v2}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v2
[B]const/4 v2, 0x1[/B]
.line 287
.local v2, getAttention:Z
Done! Save the file (Utils.smali) and assemble it back into a classes.dex file. Back at the console:
Code:
java -jar smali.jar -o classes.dex out
You end up with a shiny new classes.dex. Replace the original one in Gmail.apk with the new file using your favorite zip manager. Also, remove the folder "META-INF" found in the apk. Now follow some guide on the net for signing the apk. This process adds a new "META-INF" folder.
Now push it to the phone, and reboot (make a nandroid backup first!).
Code:
adb remount
adb push Gmail.apk /system/app/Gmail.apk
adb shell rm /data/dalvik-cache/*Gmail*
adb shell reboot
Now my phone beeps and vibrates for every incoming mail. This process is not for everyone, but works for me. The adventurous can download my modified apk (based on MCR 3.0, which is based on 2.73.405.66)
http://www.mediafire.com/?uuzwhkc5nzy
http://www.filefactory.com/file/a1h98eh/n/Gmail.apk
http://www.filedropper.com/gmail
Obviously root required and nandroid recomended. No warranties.
Anyone have suggestions for other modifications or want to collaborate on some Dalvik hacking? This turned out to be quite fun
Dalvik info can be found here:
http://www.netmite.com/android/mydroid/dalvik/docs/dalvik-bytecode.html
http://www.netmite.com/android/mydroid/dalvik/docs/instruction-formats.html

this is a really cool hack, and dalvik hacking sounds quite interesting, but too high for me...
good job!

Great hack.... however having tried to do this myself ...... I'll leave it for you experts lol

This is an old thread - but super work!
"Gmail Notifier" in Android store now replaces this (I think that is also from you?) but your detective skills are an inspiration!
Thanks

Related

[Q] Modifying of system StartupWizard.apk, need your help!

I need to add some steps in standard StartupWizard.apk
Device is Archos 101 IT with installed SDE and UrukDroid1.5.
I've got /system/app/StartupWizard.apk by usb, unpack it by "apktool d StartupWizard.apk" (apktool1.4.1), and added 2 lines just for test:
in StartupWizard\smali\com\archos\startupwizard\Welcome.smali at end of onCreate:
Code:
iget-object v1, p0, Lcom/archos/startupwizard/Welcome;->mManager:Lcom/archos/startupwizard/WizardManager;
invoke-virtual {v1, p0}, Lcom/archos/startupwizard/WizardManager;->goNextStep(Landroid/app/Activity;)V
so end of onCreate method is:
Code:
.line 44
:cond_0
const-string v0, "Welcome"
const-string v0, "onCreate: no wizardPreTreatment"
invoke-static {v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
iget-object v1, p0, Lcom/archos/startupwizard/Welcome;->mManager:Lcom/archos/startupwizard/WizardManager;
invoke-virtual {v1, p0}, Lcom/archos/startupwizard/WizardManager;->goNextStep(Landroid/app/Activity;)V
goto :goto_0
.end method
i.e. I've added goNextStep() call and wizard should pass to Disclaimer view at start.
I've packed it back by "apktool b StartupWizard", got no errors in output.
Then copy this StartupWizard\dist\StartupWizard.apk to device by usb and then RootExplorer to /system/app/StartupWizard.apk
Now after device reboot StartupWizard should run automatically (I've not completed it after uruk install).
But reboot is looping - after boot-animation screen turns black for couple of seconds, then boot-animation is showed again, and again, and again...
Questions:
- what I'm doing wrong?
- how to lauch StartupWizard without reboot?
- in which logs can I see reason of looping?
- is it possible to replace files /system/app/ in such way? or how should I install new StartupWizard.apk?
- should StartupWizard.apk be processed with signjar и zipalign?
- is there error in added 2 lines of code? I copy-pasted it from previous onClick method, where goNextStep() called in normal program flow.
Please use the Q&A Forum for questions Thanks
Moving to Q&A

ref: Add Reboot Mod

EDIT: post #3 now includes the steps so a guide to add it to your own files this information is from http://forum.xda-developers.com/showthread.php?t=811532 only modified to work with photon
ok guys i got it working im on skinny rev unlocked with dark fire theme so that is the framework apk i used but its easy to modify for the developers wanting to add this to there theme or rom.. just use my files android.policy.jar and framework.jar
to do this decompile and edit this xml in your framework.apk
Code:
"framework-res.apk\res\values\strings.xml"
add
Reboot
Recovery
next add png icons here
"framework-res.apk\res\drawable-hdpi"
make sure they are named
"ic_lock_reboot.png
"ic_lock_recovery.png
then recompile/build etc.. after you have build apk decompile it again
go here
frameworkres.apk\res\values\public.xml
you will see this with different id #s
and
these are what you need to change in the android.policy.jar
com\android\internal\policy\impl\GlobalActions.sma li"
at line 661
const v3, 0x1080501 (reboot icon)
const v4, 0x10404ed (reboot string)
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$10;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x5
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;
const v3, 0x1080502 (recovery icon)
const v4, 0x10404ee (recovery string)
the first set of icon ids are for reboot
first # is drawable icon second is string #
second set is recovery as in the ( ) 's
so now change these numbers to those in the public.xml as i described above
next recompile your android.policy.jar and its ready to add
thanks!
screenie here http://dl.dropbox.com/u/46879286/20120214113758.jpeg
colors are off sorry
chrystal0925 said:
ok guys i got it working im on skinny rev unlocked with dark fire theme so that is the framework apk i used but its easy to modify for the developers wanting to add this to there theme or rom.. just use my files android.policy.jar and framework.jar
download here http://dl.dropbox.com/u/46879286/photon.power.mod.zip
to do this decompile and edit this xml in your framework.apk
"framework-res.apk\res\values\strings.xml"
add
Reboot
Recovery
next add png icons here
"framework-res.apk\res\drawable-hdpi"
make sure they are named
"ic_lock_reboot.png
"ic_lock_recovery.png
then recompile/build etc.. after you have build apk decompile it again
go here
frameworkres.apk\res\values\public.xml
you will see this with different id #s
and
these are what you need to change in the android.policy.jar
com\android\internal\policy\impl\GlobalActions.sma li"
at line 661
const v3, 0x1080501 (reboot icon)
const v4, 0x10404ed (reboot string)
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$10;->(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x5
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;
const v3, 0x1080502 (recovery icon)
const v4, 0x10404ee (recovery string)
the first set of icon ids are for reboot
first # is drawable icon second is string #
second set is recovery as in the ( ) 's
so now change these numbers to those in the public.xml as i described above
next recompile your android.policy.jar and its ready to add
thanks!
screenie here http://dl.dropbox.com/u/46879286/20120214113758.jpeg
colors are off sorry
Click to expand...
Click to collapse
This is great I was working on it last night did you have to make changes to build prop?
Sent from my MB855 using xda premium
No I didn't and it works fine
edit: above may not work on other roms with my files so heres a guide need to be deodex odex is not working:
use apk_manager to decompile framework-res
open "values\strings.xml add this to it
Code:
<string name="reboot_recovery">Recovery</string>
<string name="reboot">Reboot</string>
next add png icons here (i attached some to use )
"framework-res.apk\res\drawable-hdpi"
make sure they are named
"ic_lock_reboot.png
"ic_lock_recovery.png
recompile then decompile to get it to auto generate the public id's
now to add the option to the shutdown
so decompile framework.jar and open "com\android\internal\app\ShutdownThread.smali
add to line 40 keep the lines spaced(skipping a line between )
Code:
.field public static mReboot:I
then at line 542 before "invoke-static {}, Landroid/os/Power;->shutdown()V" add this
Code:
sget v1, Lcom/android/internal/app/ShutdownThread;->mReboot:I
const/4 v2, 0x1
if-eq v1, v2, :reboot
const/4 v2, 0x2
if-eq v1, v2, :rebootRecovery
then at line 557 or about line 554 after this
.line 512
return-void
add this
Code:
:reboot
const-string v4, "now"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
:rebootRecovery
const-string v4, "recovery"
invoke-static {v4}, Landroid/os/Power;->reboot(Ljava/lang/String;)V
return-void
next save and recompile
now decompile androidpolicy.jar
open com\android\internal\policy\impl\GlobalActions.smali
look for .method private createDialog()Landroid/app/AlertDialog;
and at line 624 edit to add two more methods
Code:
.line 232
const/4 v0, 0x4
(change the 0x4 to 0x6)
and at line 657 edit out the ids from your public.xml (]do not add this reference here )
add this
Code:
const/4 v1, 0x4
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$10;
const v3, 0x1080501 ([COLOR="Red"]change this to drawable reboot id[/COLOR])
const v4, 0x10404ed [COLOR="red"](reboot string id[/COLOR])
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$10;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
const/4 v1, 0x5
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;
const v3, 0x1080502( [COLOR="red"]drawable recovery id[/COLOR])
const v4, 0x10404ee ([COLOR="red"]recovery string id[/COLOR])
invoke-direct {v2, p0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V
aput-object v2, v0, v1
so you need to go back to your framework.apk
open res/values/public to get the id's to change the above..
save and go to
GlobalActions$5.smali and copy it and name it GlobalActions$10.smali
open GlobalActions$10 and replace all instances ( so any where you see) of GlobalActions$5
with GlobalActions$10 then add this code
Code:
sput v2, Lcom/android/internal/app/ShutdownThread;->mReboot:I
to line 52 before
invoke-static {v0, v1}, Lcom/android/internal/app/ShutdownThread;->shutdown(Landroid/content/Context;Z)V
now copy GlobalActions$10.smali and name it GlobalActions$11.smali
replace all instances of GlobalActions$10 with GlobalActions$11
then save recompile and everything is now added to run this mod!
chrystal0925 said:
No I didn't and it works fine
Sent from my MB855 using XDA App
Click to expand...
Click to collapse
Sounds good,and Thanks
Sent from my MB855 using xda premium
Welcome hope it helps!
Sent from my MB855 using XDA App
If anyone needs send me your framework apk and I can mod it for you to use
Sent from my MB855 using XDA App
how to change android.policy.jar. when i open it, its only contain manifest.mf. there is also android.policy.odex.
zeguym said:
how to change android.policy.jar. when i open it, its only contain manifest.mf. there is also android.policy.odex.
Click to expand...
Click to collapse
you need baksmali to decompile it. which rom are you on? if you cant get it send me the policy and framework.. once you decompile the policy it turns it into a classes.dex then you zip the policy using 7zip or winrar and you replace the new classes.dex with the one in the zip..
chrystal0925 said:
you need baksmali to decompile it. which rom are you on? if you cant get it send me the policy and framework.. once you decompile the policy it turns it into a classes.dex then you zip the policy using 7zip or winrar and you replace the new classes.dex with the one in the zip..
Click to expand...
Click to collapse
I use stock rom.
Can you kindly give step by step how to decompile and compile it again.
I already have baksmali, but when trying to decompile it, it always failed.
is this because stock rom is odex ? not deodex ?
zeguym said:
I use stock rom.
Can you kindly give step by step how to decompile and compile it again.
I already have baksmali, but when trying to decompile it, it always failed.
is this because stock rom is odex ? not deodex ?
Click to expand...
Click to collapse
That could be why I'm using deodex files.. I'm not to sure on directions I use a tool like a script its simple it was 2 commands one to decompile other to recompile.. as far as I know deodex is for theming Modding etc..
I was trying to see if you can use my files but your framework I've had people use my reboot mod on the echo on stock but the framework apk was a deodex version and the rest odex I could deodex it n try if you can post the apk I dont think I have a stock file but if so then you would just decompile my files and edit what I listed after adding to the frameworkapk. You can try this way as well
Sent from my MB855 using XDA App
ive tried flashing on top of an odex version with a completely stock version just deodex it dont work it has to many looping issues so recommend that your rom is deodex..
wrong post. deleted.

[REQUEST] Disable increasing ringtone

I want to disable increasing ringtone. Is there any MOD available for "S Advance" that can be used?
I dont wanna use any app for this.
There are mods for s3 and s2 but i'm not sure whether they will run on s advance.
Plz help
XXLQB+Cocore 5.0+NOS Turbo
I'm going to add this feature to my ROM... anyways this is more of a Do-It-Yourself thingy.. so here are the steps, follow them and tell me whether they work or not...
1. Decompile SecPhone.apk using APKTOOL
2. Go to Smali\com\android\phone\Ringer$1.smali (note: open it with NotePad++)
3. Search for setStreamVolume. There should be two results. Delete the first one (the whole line in RED, like this):
Code:
.line 394
iget-object v1, p0, Lcom/android/phone/Ringer$1;->this$0:Lcom/android/phone/Ringer;
iget-object v1, v1, Lcom/android/phone/Ringer;->mAudioManager:Landroid/media/AudioManager;
[COLOR="Red"]invoke-virtual {v1, v3, v5, v4}, Landroid/media/AudioManager;->setStreamVolume(III)V[/COLOR]
4. Now search for nop (usually at the end of the file), copy it and hit enter twice and paste again (see code bellow, the blue one). "leave one line space in between each line":
Code:
goto/16 :goto_b
.line 717
nop
[COLOR="Blue"] nop[/COLOR]
:pswitch_data_1ca
.packed-switch 0x1
5. Save the changes
6. Recompile your SecPhone.apk.
7. With 7-Zip or WinRAR, open the the original (stock) SecPhone.apk. Then drag and drop the classes.dex and resources.arsc you just compiled into the (stock) SecPhone.apk.
8. Push the SecPhone.apk to your phone.
(Note that some Line numbers or numbers in the codes may differ)

Can't disable signature check for system app

Hi, I need to disable signature check for system app (to develop an anti-theft app), so I've try this solution, by decompiling Services.jar with this tutorial.
And after replacing the file and restarting, my phone "forgot" all my apps (only rom application was still here) and I cannot install other application (via usb debugging). So I try by editing the file directly in a new rom (zip) file, and the same problem appear.
Do you know where the problem can be ? Or maybe another way to install app with system signed app rights ?
Do we know the private key of cm ? So maybe I can sign my app with the key ? (but I we know this key, it is a security problem, so I don't think we can)
Thanks
phone:I9100 (intl) ; rom:cm 10.1 nightly
I've check the logcat when the installation problem occur, and i have this error
Code:
"Cannot install platform packages to user storage"
I look into the cm github and i found this part of code
Code:
Signature[] s1 = null;
if (obj instanceof SharedUserSetting) {
s1 = ((SharedUserSetting)obj).signatures.mSignatures;
}
if ((compareSignatures(pkg.mSignatures, s1) == PackageManager.SIGNATURE_MATCH)) {
Slog.w(TAG, "Cannot install platform packages to user storage");
mLastScanError = PackageManager.INSTALL_FAILED_INVALID_INSTALL_LOCATION;
return null;
}
Previously, with the tutorial I've edit the `compareSignatures()` function to make it return `SIGNATURE_MATCH`. But in this code, the error occurs when the function return this value.
It's seem this code is a security added, to be sure a system app will not be installed in the "user storage". The only way to fix my problem was to make the error never append (and I don't think this is a big vulnerability, but maybe i'm wrong, and if you have a better solution tell me)
So in addition to the first tutorial, I've replace
Code:
invoke-static {v3, v0}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
move-result v3
if-nez v3, :cond_1d1
.line 3715
const-string v3, "PackageManager"
const-string v4, "Cannot install platform packages to user storage"
invoke-static {v3, v4}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
by
Code:
invoke-static {v3, v0}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
const/4 v3, -0x3
if-nez v3, :cond_1d1
.line 3715
const-string v3, "PackageManager"
const-string v4, "Cannot install platform packages to user storage"
invoke-static {v3, v4}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I
And it work I've never work in decompiled Java bytecode before so if I've made some mistakes, tell me.
Hope it will help !

[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.

Categories

Resources