[AT&T, Rogers, Bell, Telus Samsung Galaxy S III] loserskater:
android.policy.jar

4.3

See here: http://xdaforums.com/showpost.php?p=49617297&postcount=49

<4.3

Navigate to /smali/com/android/internal/policy/impl/PhoneWindowManager$PolicyHandler.smali

:pswitch_4
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;

#calls: Lcom/android/internal/policy/impl/PhoneWindowManager;->enableSPenGesture()V
invoke-static {v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->access$300(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

goto :goto_0

[COLOR="red"]:pswitch_5
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;

iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;

check-cast v0, Landroid/view/KeyEvent;

invoke-virtual {v1, v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->dispatchMediaKeyWithWakeLockToAudioService(Landroid/view/KeyEvent;)V

iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;

iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;

check-cast v0, Landroid/view/KeyEvent;

const/16 p1, 0x1

invoke-static {v0, p1}, Landroid/view/KeyEvent;->changeAction(Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;

move-result-object v0

invoke-virtual {v1, v0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->dispatchMediaKeyWithWakeLockToAudioService(Landroid/view/KeyEvent;)V

iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$PolicyHandler;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;

const/4 p0, 0x1

iput-boolean p0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z

goto :goto_0[/COLOR]

.line 828
:pswitch_data_0
.packed-switch 0x1
:pswitch_0
:pswitch_1
:pswitch_2
:pswitch_3
:pswitch_4
[COLOR="Red"]:pswitch_5[/COLOR]
.end packed-switch
.end method

Navigate to /smali/com/android/internal/policy/impl/PhoneWindowManager$SettingsObserver.smali

.method observe()V

const-string v1, "incall_power_button_behavior"

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

move-result-object v1

invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

[COLOR="red"]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 {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)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 {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)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 {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)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 {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V[/COLOR]

.line 878
const-string v1, "accelerometer_rotation"

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

move-result-object v1

invoke-virtual {v0, v1, v2, p0}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V

Navigate to /smali/com/android/internal/policy/impl/PhoneWindowManager.smali

.field private mIsSensorhubEnabled:Z

.field private mIsVisibleSPenGestureView:Z

[COLOR="red"].field mIsVolumeAction:Z

.field mIsVolumeBlocking:Z[/COLOR]

.field mKeyboardTapVibePattern:[J

.field mKeyguard:Landroid/view/WindowManagerPolicy$WindowState;

.field mVoiceTalkDefaultLaunch:Z

.field mVoiceTalkIntent:Landroid/content/Intent;

[COLOR="red"].field mVolBtnMusicControls:I

.field mVolBtnTimeout:I

.field mVolBtnVolDown:I

.field mVolBtnVolUp:I[/COLOR]

.field private mVolumeDownKeyConsumedByScreenshotChord:Z

.field private mVolumeDownKeyTime:J

.method handleVolumeKey(II)V

.method handleVolumeKey(II)V
.locals 5
.parameter "stream"
.parameter "keycode"

.prologue
.line 4866
[COLOR="red"]move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z

if-nez v0, :cond_vol[/COLOR]

invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getAudioService()Landroid/media/IAudioService;

move-result-object v0

.line 4867
.local v0, audioService:Landroid/media/IAudioService;
if-nez v0, :cond_0

.line 4898
[COLOR="red"]:cond_vol[/COLOR]
:goto_0
return-void

.line 4875
:cond_0
:try_start_0

Add the following methods after handleVolumeKey

.method handleVolumeLongPress(Landroid/view/KeyEvent;)V
.locals 11
.parameter "event"

.prologue
const/4 v7, 0x0

.line 26
const/4 v0, 0x1

iput-boolean v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z

.line 27
iput-boolean v7, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z

.line 28
invoke-virtual {p1}, Landroid/view/KeyEvent;->getKeyCode()I

move-result v0

const/16 v1, 0x18

if-ne v0, v1, :cond_0

.line 29
iget v6, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolUp:I

.line 30
.local v6, newKeyCode:I
:goto_0
iget-object v9, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

const/4 v10, 0x6

.line 31
new-instance v0, Landroid/view/KeyEvent;

invoke-virtual {p1}, Landroid/view/KeyEvent;->getDownTime()J

move-result-wide v1

invoke-virtual {p1}, Landroid/view/KeyEvent;->getEventTime()J

move-result-wide v3

invoke-virtual {p1}, Landroid/view/KeyEvent;->getAction()I

move-result v5

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

.line 30
invoke-virtual {v9, v10, v0}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

move-result-object v8

.line 32
.local v8, msg:Landroid/os/Message;
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

iget v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnTimeout:I

int-to-long v1, v1

invoke-virtual {v0, v8, v1, v2}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z

.line 33
return-void

.line 29
.end local v6 #newKeyCode:I
.end local v8 #msg:Landroid/os/Message;
:cond_0
iget v6, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolDown:I

goto :goto_0
.end method

.method handleVolumeLongPressAbort()V
.locals 2

.prologue
.line 36
const/4 v0, 0x0

iput-boolean v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z

.line 37
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

const/4 v1, 0x6

invoke-virtual {v0, v1}, Landroid/os/Handler;->removeMessages(I)V

.line 38
return-void
.end method

.method public interceptKeyBeforeQueueing(Landroid/view/KeyEvent;IZ)I

const/16 v23, 0x1

move/from16 v0, v23

move-object/from16 v1, p0

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyTriggered:Z

.line 5200
invoke-virtual/range {p1 .. p1}, Landroid/view/KeyEvent;->getDownTime()J

move-result-wide v23

move-wide/from16 v0, v23

move-object/from16 v2, p0

iput-wide v0, v2, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyTime:J

.line 5201
const/16 v23, 0x0

move/from16 v0, v23

move-object/from16 v1, p0

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyConsumedByScreenshotChord:Z

.line 5202
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->cancelPendingPowerKeyAction()V

.line 5203
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->cancelPendingScreenrecordChordAction()V

.line 5204
invoke-direct/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->interceptScreenshotChord()V

.line 5246
:cond_1a
:goto_8
[COLOR="red"]if-eqz v5, :cond_long[/COLOR]

.line 5247
invoke-static {}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getTelephonyService()Lcom/android/internal/telephony/ITelephony;

move-result-object v22

.line 5248
.local v22, telephonyService:Lcom/android/internal/telephony/ITelephony;
if-eqz v22, :cond_20

.line 5250
:try_start_0
invoke-interface/range {v22 .. v22}, Lcom/android/internal/telephony/ITelephony;->isRinging()Z

move-result v23

if-eqz v23, :cond_20

:catch_0
move-exception v6

.line 5283
.local v6, ex:Landroid/os/RemoteException;
const-string v23, "WindowManager"

const-string v24, "ITelephony threw RemoteException"

move-object/from16 v0, v23

move-object/from16 v1, v24

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

.line 5333
.end local v6 #ex:Landroid/os/RemoteException;
:cond_20
move-object/from16 v0, p0

[COLOR="red"]iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenOnEarly:Z

if-nez v0, :cond_next

const/16 v1, 0x1

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I

if-ne v0, v1, :cond_next

invoke-virtual/range {p1 .. p1}, Landroid/view/KeyEvent;->getKeyCode()I

move-result v0

const/16 v1, 0x18

if-ne v0, v1, :cond_temp1

const/16 v1, 0x55

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolUp:I

if-eq v0, v1, :cond_temp

:cond_temp1
invoke-virtual/range {p1 .. p1}, Landroid/view/KeyEvent;->getKeyCode()I

move-result v0

const/16 v1, 0x18

if-ne v0, v1, :cond_temp2

const/16 v1, 0x7E

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolUp:I

if-eq v0, v1, :cond_temp

:cond_temp2
invoke-virtual/range {p1 .. p1}, Landroid/view/KeyEvent;->getKeyCode()I

move-result v0

const/16 v1, 0x19

if-ne v0, v1, :cond_temp3

const/16 v1, 0x55

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolDown:I

if-eq v0, v1, :cond_temp

:cond_temp3
invoke-virtual/range {p1 .. p1}, Landroid/view/KeyEvent;->getKeyCode()I

move-result v0

const/16 v1, 0x19

if-ne v0, v1, :cond_temp4

const/16 v1, 0x7E

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnVolDown:I

if-eq v0, v1, :cond_temp

:cond_temp4
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->isMusicActive()Z

move-result v21

if-eqz v21, :cond_next

:cond_temp
move-object/from16 v0, p0

move-object/from16 v1, p1

invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(Landroid/view/KeyEvent;)V

:cond_next
move-object/from16 v0, p0[/COLOR]

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;

move-object/from16 v23, v0

if-nez v23, :cond_1

.line 5334
new-instance v23, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;

move-object/from16 v23, v0

invoke-virtual/range {v23 .. v23}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->start()V

goto/16 :goto_2

.line 5341
.end local v22 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Red"]:cond_long
if-nez v5, :cond_next1

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z

if-eqz v0, :cond_next1

const/16 v1, 0x1

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I

if-ne v0, v1, :cond_next1

invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z

if-nez v0, :cond_next1

move-object/from16 v0, p0

const/4 v3, 0x0

invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V

:cond_next1[/COLOR]
move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;

move-object/from16 v23, v0

if-eqz v23, :cond_1

.method public updateSettings()V

const-string v19, "incall_power_button_behavior"

const/16 v20, 0x1

move-object/from16 v0, v19

move/from16 v1, v20

invoke-static {v13, v0, v1}, Landroid/provider/Settings$Secure;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v9

[COLOR="red"]const-string v19, "volbtn_music_controls"

const/16 v20, 0x0

move-object/from16 v0, v19

move/from16 v1, v20

invoke-static {v13, v0, v1}, 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

const-string v19, "volbtn_timeout"

const/16 v20, 0x190

move-object/from16 v0, v19

move/from16 v1, v20

invoke-static {v13, v0, v1}, 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;->mVolBtnTimeout:I

const-string v19, "volbtn_vol_up"

const/16 v20, 0x57

move-object/from16 v0, v19

move/from16 v1, v20

invoke-static {v13, v0, v1}, 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;->mVolBtnVolUp:I

const-string v19, "volbtn_vol_down"

const/16 v20, 0x58

move-object/from16 v0, v19

move/from16 v1, v20

invoke-static {v13, v0, v1}, 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;->mVolBtnVolDown:I[/COLOR]

.line 2006
.local v9, incallPowerBehavior:I
const-string v19, "user_rotation"

const/16 v20, 0x0

move-object/from16 v0, v19

move/from16 v1, v20

invoke-static {v13, v0, v1}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v17

That's it. Compile and test!

Newer Firmwares:(Sprint 4.1.2 MR2, etc.)

com\android\internal\policy\impl\PhoneWindowManager.smali

We need to edit one of the sections in method interceptKeyBeforeQueueing.

Remove the code in purple and add the code in green.

move-object/from16 v23, v0

invoke-virtual/range {v23 .. v23}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->start()V

goto/16 :goto_2

.line 5341
.end local v22 #telephonyService:Lcom/android/internal/telephony/ITelephony;
[COLOR="Red"]:cond_long
if-nez v5, :cond_next1

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z

if-eqz v0, :cond_next1

const/16 v1, 0x1

move-object/from16 v0, p0

iget v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolBtnMusicControls:I

if-ne v0, v1, :cond_next1

invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPressAbort()V

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeAction:Z

if-nez v0, :cond_next1

move-object/from16 v0, p0

const/4 v3, 0x0

[COLOR="Purple"]invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeKey(II)V[/COLOR]

[COLOR="Green"]iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;

move-object/from16 v23, v0

move-object/from16 v0, v23

invoke-virtual {v0, v3, v15}, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->handleVolume(II)V[/COLOR]

:cond_vc[/COLOR]
move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSamsungVolumeControlThread:Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;

move-object/from16 v23, v0

if-eqz v23, :cond_1

com\android\internal\policy\impl\PhoneWindowManager$SamsungVolumeControlThread.smali

method handleVolume:

.method handleVolume(II)V
.locals 6

[COLOR="Red"]iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;

iget-boolean v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mIsVolumeBlocking:Z

if-nez v0, :cond_vc[/COLOR]

iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager$SamsungVolumeControlThread;->this$0:Lcom/android/internal/policy/impl/PhoneWindowManager;

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

const-string v4, "audio"

invoke-virtual {v3, v4}, 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

[COLOR="red"]:cond_vc[/COLOR]
:goto_0
return-void

:cond_0
:try_start_0
invoke-virtual {v0}, Landroid/media/AudioManager;->dismissVolumePanel()V

sparse-switch p2, :sswitch_data_0

goto :goto_0