[Android General] Albe96:
Wake Up Screen Using Volume Buttons

Wake Up Screen Using Volume Buttons

​

- Decompile services.jar

- Open services.jar/smali/com/android/server/policy/PhoneWindowManager.smali

- Find This Method --> .method public interceptKeyBeforeQueueing(Landroid/view/KeyEvent;I)I

- Add The Blue Highligted Code And Match The Bold Locals.

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

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/server/policy/PhoneWindowManager;->mSystemBooted:Z

move/from16 v22, v0

if-nez v22, :cond_2

sget-boolean v22, Lcom/android/server/policy/PhoneWindowManager;->DEBUG_INPUT:Z

if-nez v22, :cond_0

sget-boolean v22, Lcom/android/server/wm/WindowManagerDebugConfig;->SAFE_DEBUG:Z

if-eqz v22, :cond_1

:cond_0
const-string/jumbo v22, "WindowManager"

new-instance v23, Ljava/lang/StringBuilder;

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

const-string/jumbo v24, "interceptKeyTq mSystemBooted = "

invoke-virtual/range {v23 .. v24}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

move-result-object v23

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/server/policy/PhoneWindowManager;->mSystemBooted:Z

move/from16 v24, v0

invoke-virtual/range {v23 .. v24}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

move-result-object v23

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

move-result-object v23

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

:cond_1
const/16 v22, 0x0

return v22

:cond_2
const/high16 v22, 0x20000000

and-int v22, v22, p2

if-eqz v22, :cond_8

const/4 v10, 0x1

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

move-result v22

if-nez v22, :cond_9

const/4 v7, 0x1

:goto_1
invoke-virtual/range {p1 .. p1}, Landroid/view/KeyEvent;->isCanceled()Z

move-result v6

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

move-result [B]v14[/B]

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

invoke-direct {v0, [B]v14 [/B]}, Lcom/android/server/policy/PhoneWindowManager;->volumeWake(I)V

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

move-result v8

const/high16 v22, 0x1000000

and-int v22, v22, p2

if-eqz v22, :cond_a

const/4 v12, 0x1

:goto_2
move-object/from16 v0, p0

2. Add The Following Method At The End Of The Smali -->

.method private volumeWake(I)V
.registers 7

const/4 v3, 0x0

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

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

move-result-object v0

const-string/jumbo v1, "volume_wake_screen"

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

move-result v0

if-eqz v0, :cond_1

move v0, p1

const/16 v1, 0x18

const/16 v2, 0x19

if-eq v1, v0, :cond_2

if-eq v2, v0, :cond_2

:cond_1
:goto_1
return-void

: cond_2
iget-object v0, p0, Lcom/android/server/policy/PhoneWindowManager;->mPowerManager:Landroid/os/PowerManager;

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

move-result-wide v3

invoke-virtual {v0, v3, v4}, Landroid/os/PowerManager;->wakeUp(J)V

goto/16 :goto_1
.end method

3.ROM Control V2

<com.wubydax.romcontrol.v2.prefs.MySwitchPreference android:title="Wake up the volume button" android:key="volume_wake_screen" android:defaultValue="0" android:summaryOn="Enabled" android:summaryOff="Disconnected"/>