[Samsung Epic 4G Touch] tdunham:
Music Skip Mod for JB

Credits to Mirko DDD in i9100 thread for the original guide for this.

Android.policy.jar changes

Add attached files to:

com/android/internal/policy/impl/

Smali edit:

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

Before:

.field private mIsVisibleSPenGestureView:Z

.field mKeyboardTapVibePattern:[J

After:

.field private mIsVisibleSPenGestureView:Z

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

.field mIsVolumeBlocking:Z
[/COLOR]
.field mKeyboardTapVibePattern:[J

Before:

.field private mVolumeDownKeyTriggered:Z

.field private final mVolumeKeyLongPressforOneTouchReport:Ljava/lang/Runnable;

After:

.field private mVolumeDownKeyTriggered:Z

[COLOR="Red"].field mVolumeDownLongPress:Ljava/lang/Runnable;[/COLOR]

.field private final mVolumeKeyLongPressforOneTouchReport:Ljava/lang/Runnable;

Before:

[CODE .line 7619

new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$35;

invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$35;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;

.line 8566

return-void

.end method][/CODE]

After:

.line 7619
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$35;

invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$35;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mScreenLockTimeout:Ljava/lang/Runnable;

[COLOR="Red"] .line 8130
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipNext;

invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipNext;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;

.line 8131
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipPrev;

invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$SkipPrev;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;
[/COLOR]
.line 8566
return-void
.end method

Before:

.method handleVolumeKey(II)V
.registers 8
.parameter "stream"
.parameter "keycode"

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

move-result-object v0

.line 5725
.local v0, audioService:Landroid/media/IAudioService;
if-nez v0, :cond_7

.line 5750
:goto_0
return-void

After:

.method handleVolumeKey(II)V
.registers 8
.parameter "stream"
.parameter "keycode"

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

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

if-nez v0, :cond_c[/COLOR]

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

move-result-object v0

.line 5725
.local v0, audioService:Landroid/media/IAudioService;
if-nez v0, :cond_7

.line 5750
[COLOR="Red"]:cond_c[/COLOR]
:goto_0
return-void

New method. Insert right above:

.method public hasNavigationBar()Z

[COLOR="Red"].method handleVolumeLongPress(I)V
.registers 6
.parameter "keycode"

.prologue
const/4 v1, 0x1

move-object/from16 v0, p0

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

const/4 v1, 0x0

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

const/16 v1, 0x18

if-ne p1, v1, :cond_19

iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;

.local v0, btnHandler:Ljava/lang/Runnable;
:goto_e
iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

invoke-static {}, Landroid/view/ViewConfiguration;->getTapTimeout()I

move-result v2

int-to-long v2, v2

invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

return-void

.end local v0 #btnHandler:Ljava/lang/Runnable;
:cond_19
iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;

.restart local v0 #btnHandler:Ljava/lang/Runnable;
goto :goto_e
.end method

.method handleVolumeLongPressAbort()V
.registers 3

.prologue
const/4 v1, 0x0

move-object/from16 v0, p0

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

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

iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeUpLongPress:Ljava/lang/Runnable;

invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

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

iget-object v1, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownLongPress:Ljava/lang/Runnable;

invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

return-void
.end method
[/COLOR]
.method public hasNavigationBar()Z

Before:

.line 6215
:cond_46b
:goto_46b
if-eqz v5, :cond_547

After:

.line 6215
:cond_46b
:goto_46b
[COLOR="Red"]if-eqz v5, :cond_55a[/COLOR]

Before:

.line 6297
.end local v6 #ex:Landroid/os/RemoteException;
:cond_514
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 v29, v0

if-nez v29, :cond_6a

After:

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

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

if-nez v0, :cond_new

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

move-result v26

if-eqz v26, :cond_new

move-object/from16 v0, p0

move/from16 v14, v18

invoke-virtual {v0, v14}, Lcom/android/internal/policy/impl/PhoneWindowManager;->handleVolumeLongPress(I)V

:cond_new
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 v29, v0

if-nez v29, :cond_6a

Before:

.line 6305
.end local v26 #telephonyService:Lcom/android/internal/telephony/ITelephony;
.end local v28 #voipInterfaceService:Landroid/os/IVoIPInterface;
:cond_547
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 v29, v0

if-eqz v29, :cond_6a

After:

.line 6305
.end local v26 #telephonyService:Lcom/android/internal/telephony/ITelephony;
.end local v28 #voipInterfaceService:Landroid/os/IVoIPInterface;
[COLOR="Red"]:cond_55a
[/COLOR] [COLOR="Red"]if-nez v5, :cond_ko

move-object/from16 v0, p0

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

if-eqz v0, :cond_ko

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_ko

move-object/from16 v0, p0

const/4 v3, 0x0

move/from16 v14, v18

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

:cond_ko[/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 v29, v0

if-eqz v29, :cond_6a

New method. Insert right above:

.method sendCloseSystemWindows(Ljava/lang/String;)V

[COLOR="Red"].method protected sendMediaButtonEvent(I)V
.registers 15
.parameter "code"

.prologue
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

move-result-wide v1

.local v1, eventtime:J
new-instance v11, Landroid/content/Intent;

const-string v4, "android.intent.action.MEDIA_BUTTON"

const/4 v5, 0x0

invoke-direct {v11, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

.local v11, downIntent:Landroid/content/Intent;
new-instance v0, Landroid/view/KeyEvent;

const/4 v5, 0x0

const/4 v7, 0x0

move-wide v3, v1

move v6, p1

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

.local v0, downEvent:Landroid/view/KeyEvent;
const-string v4, "android.intent.extra.KEY_EVENT"

invoke-virtual {v11, v4, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;

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

const/4 v5, 0x0

invoke-virtual {v4, v11, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V

new-instance v12, Landroid/content/Intent;

const-string v4, "android.intent.action.MEDIA_BUTTON"

const/4 v5, 0x0

invoke-direct {v12, v4, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

.local v12, upIntent:Landroid/content/Intent;
new-instance v3, Landroid/view/KeyEvent;

const/4 v8, 0x1

const/4 v10, 0x0

move-wide v4, v1

move-wide v6, v1

move v9, p1

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

.local v3, upEvent:Landroid/view/KeyEvent;
const-string v4, "android.intent.extra.KEY_EVENT"

invoke-virtual {v12, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;

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

const/4 v5, 0x0

invoke-virtual {v4, v12, v5}, Landroid/content/Context;->sendOrderedBroadcast(Landroid/content/Intent;Ljava/lang/String;)V

const/4 v8, 0x1

move-object/from16 v9, p0

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

return-void
.end method[/COLOR]

.method sendCloseSystemWindows(Ljava/lang/String;)V