[Samsung Galaxy S 5 Unified Development] tdunham:
[Guide How-to] KitKat 4.4.2/Android L Music Control - Volume Music Skip

UPDATED FOR ANDROID L

This guide requires knowledge of decompiling and compiling apk and smali files.

It is only a guide.

I do not take requests. If you want this mod for your rom, get with a dev with the knowledge to get it done.

I have attached android.policy files for diffing in case you get stuck on a section.

SecSettings.apk

In SecSettings.apk we setup the Music Control menu items & toggles.

(This edit does not work on Android L)

*** Add the two new files from the SecSettings_new_files.zip attached at the bottom of this post.

res/values/strings.xml edit:

Add new lines

<string name="volbtn_toggle_title">Music Control</string>
<string name="volbtn_timeout_title">Button Delay</string>
<string name="volbtn_timeout_summary">%s</string>
<string name="volbtn_vol_up_title">Volume Up Action</string>
<string name="volbtn_vol_up_summary">%s</string>
<string name="volbtn_vol_down_title">Volume Down Action</string>
<string name="volbtn_vol_down_summary">%s</string>

res/values/arrays.xml edit:

Add new lines

<string-array name="volbtn_action_entries">
<item>Next</item>
<item>Pause</item>
<item>Play</item>
<item>Play/Pause</item>
<item>Previous</item>
<item>Stop</item>
</string-array>
<string-array name="volbtn_action_values">
<item>87</item>
<item>127</item>
<item>126</item>
<item>85</item>
<item>88</item>
<item>86</item>
</string-array>
<string-array name="volbtn_timeout_entries">
<item>100ms</item>
<item>150ms</item>
<item>200ms</item>
<item>250ms</item>
<item>300ms</item>
<item>350ms</item>
<item>400ms</item>
<item>450ms</item>
<item>500ms</item>
</string-array>
<string-array name="volbtn_timeout_values">
<item>100</item>
<item>150</item>
<item>200</item>
<item>250</item>
<item>300</item>
<item>350</item>
<item>400</item>
<item>450</item>
<item>500</item>
</string-array>

res/xml/sound_settings.xml edit:

Add new line where you want the menu item to appear in the Sound settings menu.

<SwitchPreferenceScreen android:title="@string/volbtn_toggle_title" android:key="volbtn_music_controls" android:fragment="com.android.settings.VolBtnSettings" />

Smali Edit:

smali/com/android/settings/SoundSettings.smali

Add new line in BLUE

.field private mVibrateWhenRinging:Landroid/preference/CheckBoxPreference;

[COLOR="Blue"].field private mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;
[/COLOR]
.field private mVolume:Lcom/android/settings/RingerVolumePreference;

Increase locals value by 1 indicated in GREEN

Note:

When the change to .locals is increased by one, both of the V7 values in the new lines should be one LESS than the .locals value.

(New .locals value in our example is 8. 8-1=7, so we use V7)

Add new lines indicated in BLUE

.method private updateState(Z)V
[COLOR="Green"].locals 8
[/COLOR]
const/4 v2, 0x1

const/4 v4, 0x0

invoke-virtual {p0}, Landroid/app/Fragment;->getActivity()Landroid/app/Activity;

move-result-object v0

if-nez v0, :cond_1

:cond_0
:goto_0
return-void

:cond_1
iget-object v0, p0, Lcom/android/settings/SoundSettings;->mAudioManager:Landroid/media/AudioManager;

invoke-virtual {v0}, Landroid/media/AudioManager;->getRingerMode()I

move-result v6

[COLOR="Blue"] iget-object v1, p0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;

if-eqz v1, :cond_td

iget-object v3, p0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;

invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v7, "volbtn_music_controls"

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

move-result v1

if-eqz v1, :cond_vol

move v1, v2

:goto_vol
invoke-virtual {v3, v1}, Landroid/preference/SwitchPreferenceScreen;->setChecked(Z)V

:cond_td
[/COLOR] const-string v0, "CTC"

New lines at the end of the same method.

Add lines indicated in BLUE

.method private updateState(Z)V
.
.
.
goto/16 :goto_1

[COLOR="Blue"] :cond_vol
move v1, v4

goto/16 :goto_vol
[/COLOR].end method

Search for the string "phone_vibration" in SoundSettings.smali and add the new lines indicated in BLUE right above it.

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

move-object/from16 v0, p0

move-object/from16 v1, v32

invoke-virtual {v0, v1}, Lcom/android/settings/SoundSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v32

check-cast v32, Landroid/preference/SwitchPreferenceScreen;

move-object/from16 v0, v32

move-object/from16 v1, p0

iput-object v0, v1, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;

move-object/from16 v0, p0

iget-object v0, v0, Lcom/android/settings/SoundSettings;->mVolBtnMusicCtrl:Landroid/preference/SwitchPreferenceScreen;

move-object/from16 v32, v0

move-object/from16 v0, v32

move-object/from16 v1, p0

invoke-virtual {v0, v1}, Landroid/preference/Preference;->setOnPreferenceChangeListener(Landroid/preference/Preference$OnPreferenceChangeListener;)V
[/COLOR]
const-string v32, "phone_vibration"

Add new lines indicated in BLUE

Make sure values v2, v3 & v4 values match surrounding code.

.method public onPreferenceChange(Landroid/preference/Preference;Ljava/lang/Object;)Z
.locals 6

const/4 v0, 0x0

const/4 v1, 0x1

invoke-virtual {p1}, Landroid/preference/Preference;->getKey()Ljava/lang/String;

move-result-object v2

const-string v3, "SoundSettings"

new-instance v4, Ljava/lang/StringBuilder;

invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

const-string v5, "onPreferenceChange : "

invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v4

invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v4

invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object v4

invoke-static {v3, v4}, Landroid/util/secutil/Log;->secV(Ljava/lang/String;Ljava/lang/String;)I

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

invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

move-result v3

if-eqz v3, :cond_td3

check-cast p2, Ljava/lang/Boolean;

invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z

move-result v3

if-eqz v3, :cond_td4

const/4 v0, 0x1

:goto_td5
invoke-virtual {p0}, Lcom/android/settings/SoundSettings;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v4

const-string v3, "volbtn_music_controls"

invoke-static {v4, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto :goto_0

:cond_td4
const/4 v0, 0x0

goto :goto_td5

:cond_td3[/COLOR]
const-string v3, "emergency_tone"

We need to change three public value so compile the changed SecSettings.apk, then decompile it. Open res/values/public.xml and search for the string these strings and write down the public values:

"action_bar_switch_padding"

"volbtn_toggle_title"

"volbtn_settings"

Now in the original SecSettings, open the smali file we added

smali/com/android/settings/VolBtnSettings.smali, search for each of the strings and change your public value to match as indicated in BLUE.

const v4, 0x[COLOR="Blue"]7f0f0045[/COLOR] # type="dimen" name="action_bar_switch_padding"

const v4, 0x[COLOR="Blue"]7f091a29[/COLOR] # type="string" name="volbtn_toggle_title"

const v0, 0x[COLOR="Blue"]7f0700fe[/COLOR] # type="xml" name="volbtn_settings"

That should be it for SecSettings.apk. Compile after making these last value changes and make sure the Music Control menu functions before continuing with android.policy.jar.

android.policy.jar

(also see additional changes for Android L linked at the bottom of this post)

*** Add the two new files from the android.policy.new_files.zip attached at the bottom of this post.

Smali Edits

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

Add new line in BLUE

.field private mKeyEventInjectionThread:Ljava/lang/Thread;

[COLOR="Blue"].field mIsVolLongPressed:Z
[/COLOR]
.field mKeyboardTapVibePattern:[J

Add new lines in BLUE

.field mVirtualKeyVibePattern:[J

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

.field mVolBtnTimeout:I

.field mVolBtnVolDown:I

.field mVolBtnVolUp:I

[/COLOR].field private mVolumeDownKeyConsumedByScreenshotChord:Z

.field private mVolumeDownKeyTime:J

.field private mVolumeDownKeyTriggered:Z

[COLOR="Blue"].field final mVolumeDownLongPress:Ljava/lang/Runnable;
[/COLOR]
.field private mVolumeUpKeyConsumedByScreenshotChord:Z

.field private mVolumeUpKeyTime:J

.field private mVolumeUpKeyTriggered:Z

[COLOR="Blue"].field final mVolumeUpLongPress:Ljava/lang/Runnable;
[/COLOR]
.field mWifiDisplayConnected:Z

Add new lines in BLUE near end of method BEFORE the return-void.

.method public constructor <init>()V
.
.
.
[COLOR="Blue"] new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$MusicNext;

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

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

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

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

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

.method static synthetic access$000(Lcom/android/internal/policy/impl/PhoneWindowManager;)V

Add new methods ABOVE

.method public hasNavigationBar()Z

.method handleVolumeLongPress(I)V
.locals 4

const/16 v1, 0x18

if-ne p1, v1, :cond_0

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

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

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

int-to-long v2, v2

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

return-void

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

goto :goto_0
.end method

.method handleVolumeLongPressAbort()V
.locals 2

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

The next section may be a little difficult to find.

Search for the string: "interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!", scroll up a few lines and place the new lines indicated in BLUE, right below the :sswitch_1 statement.

Important Note:

(AFTER adding the new section below, come back here)

The v12 value may need to be changed to match surrounding code. The next occurrence in our code is this statement:

invoke-virtual {v0, v12, v6, v5}, Lcom/android/internal/policy/impl/sec/SamsungPhoneWindowManager;->handleSamsungVolumeControl(IZZ)V

Search for the next occurrence of handleSamsungVolumeControl(IZZ)V and if your second values of v12 & v6 match, then you are good to go. If it is NOT, then the v12 & v6 in the new code below needs to be changed to match that value.

:sswitch_1
[COLOR="Blue"] move-object/from16 v0, p0

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

if-eqz v0, :cond_td

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

move-result v0

if-eqz v0, :cond_td

move-object/from16 v0, p0

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

if-nez v0, :cond_td

if-eqz v6, :cond_td2

move-object/from16 v0, p0

move/from16 v1, v12

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

const/4 v15, 0x0

goto/16 :goto_0

:cond_td2
move-object/from16 v0, p0

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

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

if-nez v1, :cond_td3

move/from16 v1, v12

const/4 v3, 0x3

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

:cond_td3
const/4 v1, 0x0

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

:cond_td
[/COLOR]
if-eqz v6, :cond_19

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

move-result-object v17

if-eqz v17, :cond_19

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

move-result v21

if-eqz v21, :cond_19

const-string v21, "WindowManager"

const-string v22, "interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!"

invoke-static/range {v21 .. v22}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

invoke-interface/range {v17 .. v17}, Lcom/android/internal/telephony/ITelephony;->silenceRinger()V
:try_end_0
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

and-int/lit8 v15, v15, -0x2

Android L version of previous section:

New code is BLUE, make sure the code in GREEN match original

:sswitch_0
[COLOR="Blue"] move-object/from16 v0, p0

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

if-eqz v0, :cond_td

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

move-result v0

if-eqz v0, :cond_td

move-object/from16 v0, p0

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

if-nez v0, :cond_td

if-eqz v5, :cond_td2

move-object/from16 v0, p0

move/from16 v1, v11

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

const/16 v16, 0x0

goto/16[/COLOR] [COLOR="Green"]:goto_8[/COLOR]
[COLOR="Blue"]:cond_td2
move-object/from16 v0, p0

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

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

if-nez v1, :cond_td3

move/from16 v1, v11

const/4 v3, 0x3

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

:cond_td3
const/4 v1, 0x0

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

:cond_td[/COLOR]
invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/PhoneWindowManager;->getTelecommService()Landroid/telecom/TelecomManager;

move-result-object v17

if-eqz v17, :cond_19

if-eqz v5, :cond_18

invoke-virtual/range {v17 .. v17}, Landroid/telecom/TelecomManager;->isRinging()Z

move-result v21

if-eqz v21, :cond_18

const-string v21, "WindowManager"

const-string v22, "interceptKeyBeforeQueueing: VOLUME key-down while ringing: Silence ringer!"

invoke-static/range {v21 .. v22}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

invoke-virtual/range {v17 .. v17}, Landroid/telecom/TelecomManager;->silenceRinger()V

and-int/lit8 v16, v16, -0x2

goto/16 [COLOR="Green"]:goto_8[/COLOR]

Add new method indicated in BLUE:

.method public isMetaKeyEventRequested(Landroid/content/ComponentName;)Z
.locals 1

iget-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mSystemKeyManager:Lcom/android/internal/policy/impl/sec/SystemKeyManager;

invoke-virtual {v0, p1}, Lcom/android/internal/policy/impl/sec/SystemKeyManager;->isMetaKeyEventRequested(Landroid/content/ComponentName;)Z

move-result v0

return v0
.end method

[COLOR="Blue"].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[/COLOR]

Add new method indicated in BLUE:

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

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

invoke-static {v0, p1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->sendCloseSystemWindows(Landroid/content/Context;Ljava/lang/String;)V

return-void
.end method

[COLOR="Blue"].method protected sendMediaButtonEvent(I)V
.locals 13

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

move-result-wide v1

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

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

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

const/16 v2, 0x1

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

move-result-object v0

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

return-void

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

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

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

return-void
.end method[/COLOR]

Add new lines indicated in BLUE

NOTE:

Make note of the value of the line in GREEN.

If your value is different, the 4 occurrences of v13 in our new code must also be changed to match.

Example:

If your line before the new code is:

move-result-object v8

You would change the 4 values of v13 to v8.

.method public updateSettings()V
.locals 23

move-object/from16 v0, p0

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

move-object/from16 v18, v0

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

[COLOR="Green"]move-result-object v13
[/COLOR]
[COLOR="Blue"]const-string v7, "volbtn_music_controls"

const/4 v9, 0x0

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

const-string v7, "volbtn_timeout"

const/16 v9, 0x190

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

const-string v7, "volbtn_vol_up"

const/16 v9, 0x57

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

const-string v7, "volbtn_vol_down"

const/16 v9, 0x58

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

Android L Version of previous section:

New code is in BLUE

.method public updateSettings()V
.locals 19

move-object/from16 v0, p0

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

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

move-result-object v9

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

const/4 v10, 0x0

invoke-static {v9, v7, v10}, 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 v7, "volbtn_timeout"

const/16 v10, 0x190

invoke-static {v9, v7, v10}, 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 v7, "volbtn_vol_up"

const/16 v10, 0x57

invoke-static {v9, v7, v10}, 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 v7, "volbtn_vol_down"

const/16 v10, 0x58

invoke-static {v9, v7, v10}, 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]

Smali edit

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

Search for string "immersive_mode_confirmations" and add new section in BLUE right above that line.

Make sure the values above in GREEN match the new code.

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="Green"]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 {v0, v1, v4, p0, v5}, 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 {v0, v1, v4, p0, v5}, 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 {v0, v1, v4, p0, v5}, 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 {v0, v1, v4, p0, v5}, Landroid/content/ContentResolver;->registerContentObserver(Landroid/net/Uri;ZLandroid/database/ContentObserver;I)V
[/COLOR]
const-string v1, "immersive_mode_confirmations"

Android L UPDATE

:

Additional Android L Changes

Additional changes for Android L are here --->> Android L amended guide

Credits: [MENTION=1016795]loserskater[/MENTION] for the orginal mod HERE ; [MENTION=2471504]jeboo[/MENTION] for his GitHub HERE [MENTION=2744265]sac23[/MENTION] for the tremendous help getting framework.jar changes