yashsingh1/xdaforums huggingface dataset:
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] swordsx48:
why not a flashable zip please? or an adb push file. im on sgh-t999. and what is dlk3? not too familiar with coding, as you can see.

EDIT: i got multi apk tool and i pulled the android policy jar but i just cant get to decompiling it. help me out please?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
Have you had a chance to look into this yet? Just wanted to post as a side note I just noticed that I have the same bug as upndwn4par where the volume seems to double when I hit the power button.

Thank you for your work and looking into this when time permits.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Sorry. I've got some issues with my rom that I'm trying to iron out. I'll try to set some time aside for this in the next day or two.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] upndwn4par:
Manually compile/decompile with smali/baksmali. It works best for jar files.

I fixed the problem by using loserskater's files he posted in the zip and replacing mine with them. Works perfect now.

For anyone trying the mod, I think it is probably better to rename the conditions (cond +2) than use cond_long.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Ok. The cond's in green were way off. Should be fine now. Sorry everybody! I also updated the zip because the modified one in there was even wrong. Everything updated and good to go now.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] N00BY0815:
Ok this is a very noobish question maybe, but is this code really device specific, or do you think it can be applied to all devices? Cause our precious Optimus Black also doesnt support it on stock ICS. Our CM does support it though. Do you think, you could push me to the right direction? Just need some links and references if possible ;)
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Only one way to find out. Try it! :D If you're having issues, let me know.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] alvin551:
hi mate im trying to get this working on the international galaxy s3 and just don't quite understand. I have compared it as much as possible to your diffs but still not working. Could you help me at all? Thanks in advance here is the log when trying to compile
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] Unknownforce:
As it says, you have cond_1 and cond_22 defined more than once, thus confusing the compiler, it won't know which one to go to when it comes up.

You need to figure out how you changed it, because it's important that they are setup properly, if you have the wrong cond set for the wrong action, you could mess some stuff up pretty bad, when you do certain functions it might try to do the wrong thing...

The best thing to do is to delete it all and start from scratch, cause trying to fix it at this point might just do more harm than good. But if you're content trying to fix it, you would run a search through it for both of those and find them all, the lines that say ":cond_1" and ":cond_22" ONLY, not "goto :cond_1" or any others. There's more than one of them for each one. Then figure out why there's two and where they came from, you only want to modify the code that you added/changed, not any of the stock stuff.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] alvin551:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Thanks mate will have a look at it. Im new to smali so its a bit confusing . But heh we all gotta start somewhere. Apreciate it
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Added an issues section with a fix for if you're having volume issues after applying this mod.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
On the GT-i9300 I changed all the :cond_23's to :cond_test (since it was a test lol) instead of :cond_21, since it was already defined and DIDN'T increment the rest of the method by +2... works ok!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Yeah, I meant to change that. Thanks for letting me know!

EDIT: Changed the OP so no longer need to increase cond's.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
No, thank you for this mod! :)
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] vladmir:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Please, someone can make a flashing zip whit this mod for stock odex 4.1.2 xxema1!

Continue with the great work!

Tanks in advance
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] widokeren:
Thanks dude,

it's working on 4.1.2 S3 Korean version.

im looking this for a long long time.

for one more time thank you so much :fingers-crossed::good::good:
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
When I press volume up with the screen off (to raise the volume, skipping works OK) it instead decreases the volume. Have I cocked up somewhere or does anyone else have that?

I'm siding with my error here but thought I'd check.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] Unknownforce:
If you can get me a copy of your android.policy.jar file from this rom, I can make a flashable zip for you.

It's likely something you've done wrong with the mod, I do not have this problem. Try starting over from scratch.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
It's this, but it makes no sense at all to me:

I don't understand what it's saying... look at the line and replace it with an identical line? If not, which other line do I replace it with?

EDIT:

What a tard I am. There's more to that code box that I didn't see, particularly the line you're supposed to get the value from. Oh dear. Ignore the above. I got it sorted now.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] pathaniya:
I have always wanted to learn and know, the volume key hack/mod. Could you tell me it's possible on any version of Android, (from Donut to JB) also would it work on OEM's. Like am on stock Galaxy Note 2 would it work? Or are there other formalities?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

It will work on a stock note 2

And it will probably work on ics+ for all devices, although it will probably involve more tweaking to get it working
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] upndwn4par:
FYI, I think some of the issues being reported here are device / ROM specific.

The original mod posted skips tracks and adjusts volume exactly as it should on my ROMs.

Anyway, thanks again for this mod. Love it.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] shoman94:
Ported to my SGS2-i777-ATT ROM with minor changes.

Thanks you!!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] Gandalf:
Hey man,

I'm trying to apply this to the AT&T LK3 update (4.1.1) and I'm not seeing pswitch_4 or any of the pswitch listed in your OP. Does it really matter what the pswitches are labeled as, so long as I've placed your additional code at the end?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] Unknownforce:
If you don't see ANY pswitch's you're not looking in the correct file...

But to answer the question... I don't believe the names of pswitch's need to increment or even have any pattern. They are only "labels" from my understanding, but they DO need to MATCH according to the function/code you're adding to the top portion, just make sure you're putting the code in the correct locations. (between the last goto 0 and the pswitch data part.

But I am 99% sure that as long as you name it the same in both places it will work just fine.

I think the SGS3 was incremental by 4 bytes each new pswitch... and even started with a number other than 0, so I think it was like:

pswitch_20

pswitch_24

pswitch_28

pswitch_2c

pswitch_30

So to keep it somewhat "normal" I just changed it to pswitch_34 (or whatever it was)

I can't remember for certain, but I'm pretty sure that's just about what I did for the SGS3...

Take a backup before you start... and just try it and see. If it goes south or doesn't boot, then it obviously didn't work, and then you can restore your backup.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] Gandalf:
Yea I do see pswitch labels, such as the ones you listed, just not the ones from the OP. Thanks for the clarification that it shouldn't matter, as long as it is in the same order as the label at the bottom of the file. I'll try it out and let everyone know. Thanks!

Edit:

Here is the list of pswitch at the bottom on android.policy:

:pswitch_6
:pswitch_c
:pswitch_12
:pswitch_1c
:pswitch_26
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Hmm, this guide no longer works...

When you replace the :cond_20 with the :cond_long it throws up errors... the old guide was better! :D

EDIT:

I kind of got it working, but now it's adjusting the volume as well as the track. It changes the track, AND the volume :(
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
Ultra-noob question: this requires a deodexed android.policy.jar, right? Because I'm editing the smali code?

~Ibrahim~
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] THADDIUS25:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Could someone make a zip for this to much stuff to do
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
Wha? It's copy and paste! :D See the apk editing guide in my signature to learn how to push/pull, decompile/recompile, etc. It's written in a very noob-friendly way. :D

I imagine the only difference is that it will require deodexing (but that's a very easy process, too) of the *.jar file. Maybe take a look at my guide, see what you have to do here, and if you can't figure it out, post a question in the Q&A section and we can work through it together.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Even as a copy and paste, this causes the volume to increase, now, and it needs working out.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
And I guess you already tried this, too?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Yeah, got that. I had that issue before previously, as it would skip up, then trying to skip down would decrease the volume.

Now it skips up and down, but also affects the volume with it.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

I've used the exact code as posted multiple times with no errors. If you want to post your android.policy I can take a look
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Sure :)

EDIT:

Hmm, my

PhoneWindowManager$SamsungVolumeControlThread.smali

file is much different in this release.

EDIT2:

I copied over the old files from the last version of android.policy.jar's "PhoneWindowManager$SamsungVolumeControlThread.smali" and it works as intended again.

Watch out for this on your later non-GT-i9300 releases!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
So it was an issue in PhoneWindowManager$SamsungVolumeControlThread.smali?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Yeah, I noticed it was much bigger and hard more code in there (using WinMerge, etc) so I just copied the old one in and BAM, it was working ok....It's a hack for now, but it seems fine :)

If you want a before and after (you have the after) so you can see how they've changed it on my files I'll upload the older one for you too?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Yeah, upload the unmodified one if you don't mind.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
It's not unmodified, it's just the previous version. The one I've just finished was XXEMR2, this one (uploaded to this post) is XXEMA2.

However, as I said, using the code for that file form the previous one in the new one fixed it.

Compare the first upload (which is the latest file from our line of firmware) to this one.

This file: PhoneWindowManager$SamsungVolumeControlThread.smal i is affected.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
UPDATE(2-18):Samsung apparently likes to duplicate things, so I added the necessary changes for newer firmwares like XXEMR2.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Hmm, I just realised that you can't change the volume when the screen is off, is this normal?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] IganKuhz:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Yeah that's a problem... for a moment I think I did something wrong

Enviado desde mi GT-I9300 usando Tapatalk 2
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
It's no major biggie, I'd rather it work with more players and be compatible than that, but if there's a fix I'm open to that too.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

I'll look into it
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] upndwn4par:
Works fine for me.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

With the new 4.1.2 sprint build, Samsung decided to move some things around. I had somebody test a fix and they can confirm the issue is resolved. I'll update the op when I get to my computer.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
UPDATE(2-20):Samsung not only duplicated the handleVolumeKey method, but left the unused method in there... New changes should now work for newer firmwares
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Great job :) Working great!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] xxScoobxx:
Thanks works like a charm!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] Idyar:
Used in our ROM (LL1) works incredibly well much better then our old implementation. Thanks!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] svfreddy:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Can someone please make a flashable file? I'm doing this for my girlfriends phone but not familiar with coding or the at&t gs3. I have flashable file for my Sprint gs3 but not sure if they're compatible? Anyone?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
Not sure if the flashable you have is this method or the old one. Either way I am sure the registers are different. If I am understanding you right you have the Sprint GS3 and your girlfriend has the ATT GS3?

This MOD was made from ATT GS3 and the Dev has a ATT GS3 ROM. Why not just flash his ROM on her device? It has the look of a Stock ROM looks like you will just be gaining a lot of features for her including this one. This thread is more for developers who want to implement this inside a ROM.

Here is the link to his ROM: http://xdaforums.com/showthread.php?t=2033093
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] svfreddy:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Your right. Was just curious if i could flash a simple mod and keep her same setup since she isn't familiar with custom roms or flashing. Thanks for the response
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

The problem with a flashable zip is that there's a lot of different features that go into the android.policy file. So you'd need multiple zips to accommodate people's wants, which you can fulfill with flashing roms.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] svfreddy:
Re: [MOD][HOW-TO]Long press volume to skip tracks (The right way!)

Now i understand, thanks,, looking at custom roms now :)
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
See the link in my sig for APK editing; the tool I use, VTS, also has great smali editing, too! :) You'll need to be de-odexed for it to work, though (I'm still working on that for my stock ROM...will have a guide up when I figure it out, haha).

But this way, you can add/remove this to any ROM you want (more or less)! :D
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
Where does this go again? You mean here, right?

Or inside that collapsed .method handleVolumeKey(II)V?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
You got it :) Add them where you have the arrow in the screenshot. As stated in the OP "add after" these are two separate methods you are adding in they should not go in an existing method.

:good:
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
They're completely new methods, so outside of the .method handleVolumeKey

bahh... got me by one minute
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
You guys are great; I appreciate your help wholeheartedly! :D But, I'm an uber-noob and I have unfortunately taken the red pill.

I'm on stock LK3 (with two mods that don't edit android.policy.jar). For the 2nd to last edit (not including the special Sprint 4.1.2 edits), my cond_xx are different from those in your OP and in the nearby lines I have an iget-boolean instead of an iget-object, or an invoke-static instead of an invoke-virtual. I checked out the diffs, but those diffs have the same differences compared to my smalis as the OP does (it also had extra edits not noted in the OP, most of it increasing some of the v_xx by 2--relevant?).

I went ahead and guessed, but the mod didn't work. :/

Am I gong to have to learn smali to figure this out (not even close to knowing any sort of programming language; XML layouts are still a bit tricky for me, haha) or is there a system to the edits here that I'm missing? Don't be afraid to tell me, "You're basically going to need to climb Mt. Everest to figure this out" because I get a feeling that's where I am now, haha. :D

But, if I'm really close, let me know that, too, haha. :D
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Alright. Got the setting working so now you can enable and disable it just like in CM.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] enewman17:
Seems that some of the code is not showing correctly in the code boxes for the xml changes you posted for the volume mod 2.0 at least I can't see it. lol Thanks again this is great. I can't wait to get to some coding.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Weird. Seems that the xda app didn't like the xml when I changed the title last night. Fixed!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
Fantastic! This means it's one less mod I have to create as an option!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
Working Perfectly. Thank you again for your continued development and support of this MOD.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
I'm getting a :

java.lang.VerifyError: com/android/settings/SoundSettings

Error in the SoundSettings.smali.

I also had the same in the android.policy.jar and the solution was to decrement one of these sorts of things:

move-object/from16 v1, v17

However I'm trying all sorts with the SoundSetting.smali and getting no where. I hate assembly language, it makes no sense at all!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
It looks like maybe in the method onCreate you added the method but did not change the virtual range to match your registers.

CODE FROM THE OP: in the above stated method(onCreate).

invoke-virtual/range {v18 .. v19}, Landroid/preference/CheckBoxPreference;->setPersistent(Z)V

CODE FROM Your device:

invoke-virtual/range {v17 .. v18},

I see you changed the other part of that method to match your registers:

:cond_long
const/16 v17, 0x0

goto/16 :goto_long

My register range matches the OP so I did not have any problems but it looks as if your is different looking over the entire file.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
I can fix it for you if you would like. I can not get to it until I get to it until I get off work unless loserskater can get it done earlier. Would you like me to use the file you posted yesterday?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
If you could do that, that'd be fantastic :)

Yeah that file I posted yesterday is the one ill be needing :D

Thanks!
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] ikjadoon:
I have this exact same issue: no idea what smali is happening and my v_xx are mostly different from the OP. I just found a great smali crash course in Virtuous Ten Studio (an IDE, incidentally that I was already using to modify apks, jars, etc.). Google it, install, and Help -> Smali help. Here's a screenie of the help file I'm looking at: http://prntscr.com/vjf0z

Or...evolutioncsr can do it, too. If you were curious to learn more about smal! VTS is a great tool anyways, :D
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
Try this
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] evolutioncsr:
Can you try this? I only had a few minutes.

EDIT: You got me by 4 minutes :) That's what I get for going AFK. now to diff and see how far off I was.

EDIT2: No diff :)

For Kryten2k35 there were several registers that needed to be changed v17, v18, v19 = v18. v19, v20 in the tutorial

Also in the tutorial onCreate method: This needed to be changed to what is in red in "Your Code" below.

invoke-static {v[COLOR="red"]15[/COLOR], v0, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

Your Code:

invoke-static {v[COLOR="Red"]14[/COLOR], v0, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

I am sure you will notice from the diff just wanted to point them out.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] MattBooth:
That did the trick. Now it's not working at all (i.e. changing the track - Settings no longer FC's though), but I will try to fix that myself :)

EDIT:

All fixed, thanks to you both :)
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] shoman94:
@loserskater

I've been meaning to tell you....

In this method:

.method handleVolumeLongPress(Landroid/view/KeyEvent;)V

this line:

invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;->(JJIII)V

I get a compile error. I need to make it like this:

invoke-direct/range {v0 .. v7}, Landroid/view/KeyEvent;-><init>(JJIII)V

Not sure if that will help some people but I thought I would mention it.
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] purpstar:
Is it possible to make this a flashable zip or a simplified version.. sorry for sounding noobish..
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] AskinSavascisi:
cheers m8 , it did help me :D

EDIT: recompiled succesfully -> when restarting getting bootloops :/ any idea why?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] metalfan78:
I'm having trouble getting this to work on MD4. Anyone have any luck?
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] metalfan78:
Im getting this, Sprint version, 4.1.2. Any help would be appreciated.

C:\apktool>apktool b android.policy.jar.out

I: Checking whether sources has changed...

I: Smaling...

[9481,1] missing END_METHOD_DIRECTIVE at '.method'

[9530,61] no viable alternative at input '('

[9579,4] missing EOF at '.line'

Exception in thread "main" brut.androlib.AndrolibException: Could not smali file

: java.io.FileInputStream@4570415f

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:256)

at brut.androlib.Androlib.buildSources(Androlib.java:213)

at brut.androlib.Androlib.build(Androlib.java:204)

at brut.androlib.Androlib.build(Androlib.java:176)

at brut.apktool.Main.cmdBuild(Main.java:218)

at brut.apktool.Main.main(Main.java:74)

C:\apktool>
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] CNexus:
The error is indicating that it can't find the end of the method

It finds the .method but no matching .end method
[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] metalfan78:
Thanks, I'm not sure where to look for it though.