yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy S 5 Unified Development] tdunham:
Very good. I am doing this mod from the guide for a stock rom and that was the only thing I think that was missing from the guide.

I made one very minor edit to SecSettings strings (second line) so instead of Timeout it says 'Button Delay'. This made more sense to me.

Well, no force closes but the skip function isn't working for me. I will let you know if additional changes are required as I look through this.
[Samsung Galaxy S 5 Unified Development] Kamy:
Great, that was actually my laziness or what I didn't use logcat to figure out those IDs are mismatched. Just one thing maybe some noobs like me would face is that, after copying volbtn_settings.xml in xml folder, SecSettings.apk needs to be recompiled in order to create new IDs and then decompile again and do those change in smali.

Edit: compiled successfully and functioning well. :good:
[Samsung Galaxy S 5 Unified Development] tdunham:
My apologies, one more smali edit I left out completely for PhoneWindowManag er$SettingsObserver.smali. This addition was added to the very end of android.policy.jar edits. Now music skip mod works. :)
[Samsung Galaxy S 5 Unified Development] Kamy:
Huh! But without this change it also works at my side! I can skip music while phone is locked. Unless you are pointing something else which I am not aware of.
[Samsung Galaxy S 5 Unified Development] tdunham:
It may already be in that smali if you ported yours over. That is why I missed it to add to the guide. No matter, if yours is working, great job. :)

This mod is a little difficult to do.
[Samsung Galaxy S 5 Unified Development] metalfan78:
Thanks for this tdunham, this was one of the quickest mods I've accomplished. Works great!
[Samsung Galaxy S 5 Unified Development] Silassi1:
Thanks for this mod...followed instructions everything works fine except play/pause does not work for me...it will pause the song when pressed but won't restart play on second press...any ideas or anyone else experience this?
[Samsung Galaxy S 5 Unified Development] tdunham:
This is a known issue. We're waiting for a fix. No idea for an eta, sorry.
[Samsung Galaxy S 5 Unified Development] Silassi1:
Ok...thanks for quick reply...
[Samsung Galaxy S 5 Unified Development] sleshepic:
Thanks again [MENTION=1042140]tdunham[/MENTION] for another awesome guide, added to my NE5 Rom, thanks from all of us for taking the time to lay all this out
[Samsung Galaxy S 5 Unified Development] qwerty123258:
4.4.4 kk is work

but...vol up function don't work

vol up button press then volume decrease when screen off

turn off music control then no error
[Samsung Galaxy S 5 Unified Development] tdunham:
This guide is for android 4.4.2. Maybe some additional changes for 4.4.4.
[Samsung Galaxy S 5 Unified Development] giew13:
nice work sir, btw how to remove album art image that replacing the wallpaper in lockscreen while playing a music in TW 4.2.2?
[Samsung Galaxy S 5 Unified Development] metalfan78:
Well, just for fun, I tried to do this mod on 5.0, only got one error when recompiling, a duplicate label.
[Samsung Galaxy S 5 Unified Development] Kamy:
Thanks for update I have been trying to see whether I can make it run on my Note 3 with previous guide though couldn't. I would go for updated codes.
[Samsung Galaxy S 5 Unified Development] intxeon:
In secsettings Soundsetting.smali doesn't exist on lollipop
[Samsung Galaxy S 5 Unified Development] Kamy:
Need some help. I have done framework.jar and android.policy.jar parts and using ROM control, Enabling and disabling works and toggles the volume behavior, but Volume up/down actions don't work here. Any hint would be highly appreciated.
[Samsung Galaxy S 5 Unified Development] tdunham:
For Android L and which phone?

And this only works with screen off you know?
[Samsung Galaxy S 5 Unified Development] Kamy:
Tw lollipop on Note 3. Yes I tried screen off.
[Samsung Galaxy S 5 Unified Development] tdunham:
Can you send me your android.policy before and after modification so that I can compare? There is one area that may need extra notes in the guide to find the correct register.
[Samsung Galaxy S 5 Unified Development] Kamy:
Sure.
[Samsung Galaxy S 5 Unified Development] tdunham:
Ok, I missed a method in the guide I think.

In PhoneWindowManager.smali

Add new method above .method public isNavigationBarVisible()Z

.method isMusicActive()Z
.locals 3

iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;

const-string v2, "audio"

invoke-virtual {v1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

move-result-object v0

check-cast v0, Landroid/media/AudioManager;

if-nez v0, :cond_0

const-string v1, "WindowManager"

const-string v2, "isMusicActive: couldn\'t get AudioManager reference"

invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

const/4 v1, 0x0

:goto_0
return v1

:cond_0
invoke-virtual {v0}, Landroid/media/AudioManager;->isLocalOrRemoteMusicActive()Z

move-result v1

goto :goto_0
.end method
[Samsung Galaxy S 5 Unified Development] Kamy:
Yup, now working amazingly. Thank you very much for support and help. :good:
[Samsung Galaxy S 5 Unified Development] tdunham:
Perfect, thank you for helping find my mistake also. :)

OP has been updated with additional method.

Also, added modified CustomSettings.apk and guide to modify existing apk for Android L for toggles since SecSettings modification no longer applies.
[Samsung Galaxy S 5 Unified Development] intxeon:
Hi tdunham

Could you have a look to my android.policy files?

I got bootloop when I put modified andorid.policy.jar and I don't know why.

I attached Stock and modded file from S5 with lollipop
[Samsung Galaxy S 5 Unified Development] intxeon:
Ok I solved the bootloop problem.But I still have a problem.

Play function doesn't work.I mean If I set Play to Volume Up and Stop to volume down ..the volume up doesn't play the song..
[Samsung Galaxy S 5 Unified Development] tdunham:
I think you mean the other choices. It's a known issue I think. The only dependable ones that work are the music skip right now.
[Samsung Galaxy S 5 Unified Development] Kamy:
[MENTION=1042140]tdunham[/MENTION]

Hey mate, is there any way to enable single tap to volume up and down while music control is enable?
[Samsung Galaxy S 5 Unified Development] tdunham:
I'm not sure what you mean. Single tap would interfere with the regular volume control I think.
[Samsung Galaxy S 5 Unified Development] Kamy:
But seems when music control is enabled seems I cannot volume up or down
[Samsung Galaxy S 5 Unified Development] tdunham:
Ok, I understand. It should work for normal volume when single press. Does volume work normally when screen is on and music mod is enabled? Maybe I will have to take another look at your android.policy files again.
[Samsung Galaxy S 5 Unified Development] Kamy:
Yes, while screen is on, volume up and down are functioning well, only when screen is off and music control is enabled they don't increase/decrease the volume scale.

Appreciate your help again.
[Samsung Galaxy S 5 Unified Development] metalfan78:
[MENTION=1042140]tdunham[/MENTION], when I had this issue you told me some framework edits needed to be done.
[Samsung Galaxy S 5 Unified Development] tdunham:
Is that what your problem was too? Yeah, the framework.jar edits are quite a few but its only copy and paste a ton of the missing methods for audio services.
[Samsung Galaxy S 5 Unified Development] tdunham:
[MENTION=4819130]kmokhtar79[/MENTION]

You saw the framework.jar edits for lollipop? There are a bunch so go through and doublecheck everything is in there. I may have to go through and verify I didn't miss another method too I suppose as well when I get a chance. :rolleyes:
[Samsung Galaxy S 5 Unified Development] Kamy:
Yes I modified framework.jar already. OK would recheck. Thanks.
[Samsung Galaxy S 5 Unified Development] tdunham:
Your android.policy looks fine so far but I will look again later. Time to head out for the day here.
[Samsung Galaxy S 5 Unified Development] metalfan78:
Yea, the music control worked, but regular volume controls didn't until I went through framework. Then everything worked as intended
[Samsung Galaxy S 5 Unified Development] Kamy:
[MENTION=1042140]tdunham[/MENTION] mate, I went through again and remodify framework.jar, still no luck with volume adjustment while screen is off and music control is ON.

Edit: I cannot find entire following smali in my android.policy seems they removed it(!!!?), do you have it in yours?

.method handleVolumeKey(II)V

So after adding it, volume adjustment is now working. :fingers-crossed:
[Samsung Galaxy S 5 Unified Development] tdunham:
Nice catch. I was just logging in to see if I could help.

Its missing in ours too so I added that to the amended part of the guide for android L since post #1 is already too long to add any additional code.
[Samsung Galaxy S 5 Unified Development] slimshouki:
Very enlightening

Dear [MENTION=1042140]tdunham[/MENTION]

I did everything and triple checked all smali in android. Policy & framework but always get a bootloop and Its clear problem is from android.policy. I could find where the problem was. In \com\android\internal\policy\impl\PhoneWindowManag er$SettingsObserver.smali you need to be sure that code in green matches together, otherwise it will cause a bootloop.

const-string v1, "default_input_method"

invoke-static {v1}, Landroid/provider/Settings$Secure;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

invoke-virtual [COLOR="Lime"]{v0, v1, v4, p0, v5}[/COLOR], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

[COLOR="Blue"] const-string v1, "volbtn_music_controls"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

invoke-virtual[/COLOR] [COLOR="Lime"]{v0, v1, v4, p0, v5}[/COLOR][COLOR="Blue"], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

const-string v1, "volbtn_timeout"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

invoke-virtual [/COLOR][COLOR="Lime"]{v0, v1, v4, p0, v5}[/COLOR][COLOR="Blue"], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

const-string v1, "volbtn_vol_up"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

invoke-virtual [/COLOR][COLOR="Lime"]{v0, v1, v4, p0, v5}[/COLOR][COLOR="Blue"], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V

const-string v1, "volbtn_vol_down"

invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

move-result-object v1

invoke-virtual [/COLOR][COLOR="Lime"]{v0, v1, v4, p0, v5}[/COLOR][COLOR="Blue"], Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V[/COLOR]

const-string v1, "immersive_mode_confirmations"

I tried everything to force volume buttons during screen on to invoke interface of media volume and not ringtone volume but couldn't succeed.I am desperate to find the code

Thanks [MENTION=1042140]tdunham[/MENTION] & [MENTION=892580]kmokhtar[/MENTION] for your mod and support
[Samsung Galaxy S 5 Unified Development] talkingmonkeys:
Just wanted to note [MENTION=1042140]tdunham[/MENTION] that in the amended lollipop guide the extra android.policy.jar method you tell us to search for a non existent line. I know how to read through threads though and found the correct one already posted by you in another post. ".method public isNavigationBarVisible()Z" :good:

Working well. Great guide as always, thanks brother
[Samsung Galaxy S 5 Unified Development] tdunham:
[MENTION=5266065]talkingmonkeys[/MENTION]

Which line is that man?
[Samsung Galaxy S 5 Unified Development] tdunham:
[MENTION=4991063]slimshouki[/MENTION]

Thanks. Added a note to make sure values match in that section.

You're still having an issue finding something or did you get this to work?
[Samsung Galaxy S 5 Unified Development] talkingmonkeys:
I got it to work. It was just what you have listed to search for for the framework.jar edit that is not there. It's actually the line in my post in quotations which you had posted in another post
[Samsung Galaxy S 5 Unified Development] slimshouki:
I need to force volume buttons to media volume instead of Ringtone volume when screen on
[Samsung Galaxy S 5 Unified Development] tdunham:
So how do you plan on adjusting ringtone volume? Easiest to link them like I showed in the guide thread for linking notification and ringtone volume in framework.jar. I don't know how to completely remap volume buttons otherwise.
[Samsung Galaxy S 5 Unified Development] slimshouki:
I always use media volume instead of Ringtone volume. However if i would like to adjust Ringtone volume, i can just click on the gear beside seek bar then adjust Ringtone volume. Its not a method of remapping key, it involves replacing invoke-interface of Ringtone volume with interface of media volume
[Samsung Galaxy S 5 Unified Development] tdunham:
I'm not sure I understand why you want to do this. If I open a multimedia application, like music player, the media volume already gets controlled by the volume keys by default doesn't it?
[Samsung Galaxy S 5 Unified Development] slimshouki:
You are right but the people around you will hear your video or song until you lower the volume. Sometimes, its totally unconvenient or you want to have your space. Some apps do so like rocket locker
[Samsung Galaxy S 5 Unified Development] kushal.arora16:
Hi Sir.. I want this volume button track skipping mod for my note 3 N900, stock lollipop.. Can u plzz help me to get it.?

I do not know how to edit all these files. Can u plzz provide me files to copy replace and get the work done..?

please... thanks a lot...
[Samsung Galaxy S 5 Unified Development] kushal.arora16:
Help please..

Sir I want SKIPPING TRACKS with VOLUME KEYS while screen off feature for my stock rooted Note 3 N900 running Lollipop.. I do not know editing files as described here..

Please provided me edited files to copy replace & get the mod work please..

I can provide any file if you need..

Thanks...waiting for you reply sir..
[Samsung Galaxy S 5 Unified Development] tdunham:
You will need to find a developer using the same exact phone and build to do this. We won't do it for you and there is a lot of work involved and no way to test it.
[Samsung Galaxy S 5 Unified Development] kushal.arora16:
Thanks.
[Samsung Galaxy S 5 Unified Development] tdunham:
Gotcha, added thanks.

Technically, the new method can be added in just about anywhere and I just put stuff like that in my guides to keep things in order. It's just to keep the methods in alphabetical order.

I believe once the smali is recompiled, apktool resorts them that way anyway.
[Samsung Galaxy S 5 Unified Development] dedichthui:
"res /xml/preferences.xml" not have any files in secsetings.apk. Only radiobuttons_preferences and my_clock_preferences. Help me. Thankyou.
[Samsung Galaxy S 5 Unified Development] tdunham:
There are no SecSettings edits for Android L.
[Samsung Galaxy S 5 Unified Development] evilvoice:
I don't think I am ever going to get this to work. This is now my 10th attempt after starting over every single time. While it does not error or anything, nothing happens when I turn it on in Custom Settings. It just turns volume up or down quickly. I've tried in Music and Google Play Music.
[Samsung Galaxy S 5 Unified Development] metalfan78:
You're following post #56 and adding the new files, correct? Post 64 has some other edits too
[Samsung Galaxy S 5 Unified Development] evilvoice:
I followed Post #1 (I found out after trying about 2 or 3 times, that you have to follow the android.policy edits here as well and can not just look at post #56). I paid close attention to when a method in Post #1 had been updated to a lollipop edit (I think there are 2 or 3). I then followed Post #56. Post #64 is included in Post #1 so I did not do that one again. There is also information about making sure values in green match posted sometime after Post #56 (Post #83)

I added in the android.policy new files linked in the 1st post. Those were the only ones added by me. I had Custom Settings from the first time of trying this mod.

The Only issue I really have, is here:

My version of the part in green is

goto :goto_8

I left his as posted by him since he said to only check in the green and mine does say the same thing. Don't know if the /16 makes a difference
[Samsung Galaxy S 5 Unified Development] Surghikov:
Big thanks guru! You are the best!

It's work on my i9500 SGS4: http://4pda.ru/forum/index.php?showtopic=540887&view=findpost&p=41087283
[Samsung Galaxy S 5 Unified Development] metalfan78:
Have you tried using winmerge to diff the files? Maybe there is a mistake somewhere, something small. I do that all the time after I mod something and it doesn't work. It's a good way to check.
[Samsung Galaxy S 5 Unified Development] evilvoice:
Delete. Need to pay more attention to which file I am working on
[Samsung Galaxy S 5 Unified Development] est_yasser:
Bootloop

I ended up with a bootloop on 5.0.1 lollipop

logcat is in attachments < but i took the logcat for a short period of time, i hope the problem is presented.

thanks for helping:good:
[Samsung Galaxy S 5 Unified Development] Hani K.:
Worked perfectly on 5.0.1, but doesn't work on 5.1.1.

Encountered many double/repeated methods/values, a lot have changed.

Tried changing the code, removed the repeated methods and changed the variable registers used according to the resources of 5.0.1.

Got it to finally boot, but doesn't work.

No FCs or anything, it just doesn't work.

Hope some one can find the trigger to it and get the missing part.
[Samsung Galaxy S 5 Unified Development] tdunham:
I'll update the guide for 5.1.1 when I have time.
[Samsung Galaxy S 5 Unified Development] renzetti.s:
Just to say thanks

After long study I let that work on lg g2...

Thanks again.

Question for people that actually use this mod:

Are you able to change volume pushing volume during screen off?
[Samsung Galaxy S 5 Unified Development] thereassaad:
Wrong thread [emoji16][emoji16][emoji16]
[Samsung Galaxy S 5 Unified Development] renzetti.s:
Please can someone answer to me?

Of course listen music...

Please
[Samsung Galaxy S 5 Unified Development] sleshepic:
When the mod is done right yes, short clicks affect volume while set duration of long press performs selected function
[Samsung Galaxy S 5 Unified Development] renzetti.s:
Thanks. Is it possible to have framework diff files too? Believe that my problem is there...

Ricevere un like è cosa gradita...

Receive thanks make me HAPPY
[Samsung Galaxy S 5 Unified Development] tdunham:
Framework is the easiest part and posting diff files isn't going to help.

This mod is based on Samsung Touchwiz smali so I do not know how difficult it would be to apply on other devices.
[Samsung Galaxy S 5 Unified Development] renzetti.s:
Thanks for your answer

First of all congratulation for your work is wonderful...

In the policy I had to change a lot.

The frame already check and is much different so if you are so nice to post diff files for frame too will help me.

For example cannot give the sense on this part:

move-object/from16 v0, p0

invoke-virtual {p0, v1, v2, v3}, Landroid/media/IAudioService$Stub;->adjustLocalOrRemoteStreamVolume(IILjava/lang/String;)V

Consider that actually I can change track next and prev (changing time just change the time to act the skip trace) but cannot change volume, can put pause but cannot put in play after that, so if you that are the Master of the mod have suggest for me....

Thanks again for your time.
[Samsung Galaxy S 5 Unified Development] tdunham:
Framwork.jar decompiled smali added to the OP for diff.
[Samsung Galaxy S 5 Unified Development] tdunham:
Yes, the only option that really works properly for this is skip track.

The other options are not working fully, it has been a known issue for a while and still no fix but the main feature to skip track should work fine.
[Samsung Galaxy S 5 Unified Development] renzetti.s:
Thanks Master.

So the best now is understand what do you want really means with other options.

You can confirm that cannot change volume with screen off listening music?

Ricevere un like è cosa gradita...

Receive thanks make me HAPPY
[Samsung Galaxy S 5 Unified Development] tdunham:
No, regular volume should work with screen off.

- short press for volume

- long press for skip track
[Samsung Galaxy S 5 Unified Development] renzetti.s:
About the frame the biggest difference I found are in the $stub part in the switch. I will try to add your 4 new switch instead relocate replace others.

Can you suggest which is the most important for regular volume

Ricevere un like è cosa gradita...

Receive thanks make me HAPPY
[Samsung Galaxy S 5 Unified Development] renzetti.s:
Finally I solved it. Thanks to everybody!
[Samsung Galaxy S 5 Unified Development] legolaas:
My IAudioService$Stub is here. What can I do?
[Samsung Galaxy S 5 Unified Development] TheKucho:
Thanks for this guide! I'm trying to get this working on my note 4 and have made all necessary edits to the jar files, but am currently clueless on enabling them since I do not know how to add them to settings. I just want to use it to skip tracks while the screen is off and don't need any additional settings, so I was wondering if there was another way to enable it without adding it to settings. I'm running 5.0.1 on the note 4. Thanks for the guide!
[Samsung Galaxy S 5 Unified Development] tdunham:
I cant say exactly but try this edit, changing 0x0 to 0x1 where I show in red for android.policy

.method public updateSettings()V
.locals 24

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;

move-object/from16 v19, v0

invoke-virtual/range {v19 .. v19}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v12

const-string v7, "volbtn_music_controls"

const/4 v9, [COLOR="Red"]0x1
[/COLOR]
invoke-static {v12, v7, v9}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v3

move-object/from16 v0, p0

iput v3, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I
[Samsung Galaxy S 5 Unified Development] TheKucho:
Would you happen to know which smali file that is located in? Thank you!
[Samsung Galaxy S 5 Unified Development] tdunham:
PhoneWindowManager.smali
[Samsung Galaxy S 5 Unified Development] apung:
hi [MENTION=1042140]tdunham[/MENTION]

help me.. i confuse port Android L Music Control to my note 4 N9100 L 5.1.1 latest stock rom

check my code before and after (compare) in file android.policy and framework-classes2

please give me solution in file PhoneWindowManager.smali

thanks