[Android General] ShaDisNX255:
Volume Skip Mod for Oreo?

Hi guys.

If I could do a request, could someone make a guide to implement the volume skip mod for Oreo?

I was trying to implement the one from the guide here by [MENTION=4985020]Grouxho[/MENTION] which is very nice: https://xdaforums.com/showpost.php?p=70092477&postcount=29

For the most part, most methods are exactly the same. But I am having problems with PhoneWindowManager.smali, specifically in method

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

As the logcat points out that it rejects this class

And this is where I notice that there is a small, but I think important difference as to the guide methods

I do not fully understand smali yet, so if anyone would be kind enough to take a look at it, I would be very grateful

First edit the guide asks for this method is this:

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

move-object/from16 v0, p0

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

move/from16 v20, v0

if-nez v20, :cond_b

const/16 v20, 0x0

[COLOR="Red"]	#Pay attention!. Add this goto tag just before return v20

:goto_aaaabbbb

#[/COLOR]

return v20

However, my method starts a bit differently in Oreo

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

move-object/from16 v0, p0

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

move/from16 v26, v0

if-nez v26, :cond_2f

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

if-eqz v26, :cond_2c

const-string/jumbo v26, "WindowManager"

new-instance v27, Ljava/lang/StringBuilder;

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

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

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

move-result-object v27

move-object/from16 v0, p0

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

move/from16 v28, v0

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

move-result-object v27

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

move-result-object v27

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

:cond_2c
const/16 v26, 0x0

return v26

As you see, my first return is waaaaaay down and I think already that is a problem, I don't know where I should add it :s

Then, it asks me to look for:

#sswitch for 0x18, 0x19 keycodes

Mine is

0x18 -> :sswitch_2b3

So it asks me to add in red:

:sswitch_216 #sswitch for 0x18, 0x19 keycodes

invoke-static {}, Lcom/android/server/SamsungCoreServices;->getEdgeWindowPolicy()Lcom/android/server/policy/EdgeWindowPolicy;

move-result-object v20

invoke-interface/range {v20 .. v20}, Lcom/android/server/policy/EdgeWindowPolicy;->isEdgeWakeupPending()Z

move-result v20

if-eqz v20, :cond_222

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

:cond_222

[COLOR="red"]#add this block of code. Just before .. >getTelecommService()Landroid/telecom/TelecomManager instruction

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/server/policy/PhoneWindowManager;->mGrxSkipTracks:Z #si no está activado el mod saltamos bloque

if-eqz v0, :cond_250aaaa

move-object/from16 v0, p0

iget-boolean v0, v0, Lcom/android/server/policy/PhoneWindowManager;->mScreenOnFully:Z #si no está apagada la pantalla

if-nez v0, :cond_250aaaa

if-eqz v7, :cond_23cabab

move-object/from16 v0, p0

const/4 v1, 0x0

iput-boolean v1, v0, Lcom/android/server/policy/PhoneWindowManager;->mGrxEsLongVol:Z

move/from16 v1, v12

iput v1, v0, Lcom/android/server/policy/PhoneWindowManager;->mGrxTeclaVol:I

invoke-virtual {v0}, Lcom/android/server/policy/PhoneWindowManager;->grx_tecla_vol()V

goto/16 :goto_aaaabbbb #PAY ATTENTION!!. (Same goto tag name than before!).

:cond_23cabab
move-object/from16 v0, p0

invoke-virtual {v0}, Lcom/android/server/policy/PhoneWindowManager;->grx_callbacks_long_vol()V

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

if-nez v1, :cond_24dabab

const/4 v1, 0x0

iput-boolean v1, v0, Lcom/android/server/policy/PhoneWindowManager;->mGrxEsLongVol:Z

iget v1, v0, Lcom/android/server/policy/PhoneWindowManager;->mGrxTeclaVol:I

invoke-virtual {v0, v1}, Lcom/android/server/policy/PhoneWindowManager;->grx_click_volumen(I)V

:cond_24dabab
const/4 v1, 0x0

iput-boolean v1, v0, Lcom/android/server/policy/PhoneWindowManager;->mGrxEsLongVol:Z

:cond_250aaaa
#[/COLOR]

invoke-virtual/range {p0 .. p0}, Lcom/android/server/policy/PhoneWindowManager;->getTelecommService()Landroid/telecom/TelecomManager;

move-result-object v18

But mine is missing a few things

:sswitch_2b3
invoke-virtual/range {p0 .. p0}, Lcom/android/server/policy/PhoneWindowManager;->getTelecommService()Landroid/telecom/TelecomManager;

move-result-object v24

if-eqz v24, :cond_32a

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

move-result v26

It doesn't have Edge Window policy stuff, so idk if I should add it or not

Thank you for anyone who read this, I am attaching the full method to see if anybody wants to take a look. The rest of the guide seems to be fine, everything is present in Oreo

Thanks again :)