[Android General] Hyper.Alvi:
Double tap gestures on home screen (13 actions) (for 8.0, launcher3)

Info : The guide is originally made by ikrom for 6.0. You can find it here.​

Credits:

ikrom - for the marshmallow guide

Kamy - for some smalis

1. Decompile TouchWizHome_2017.apk

2. Put the smalis from download link in their folders

3. Open com.android.launcher3.home.Workspace.smali

in # instance fields add

.field private mDetector:Landroid/view/GestureDetector;

.field swipeAction:[I

in .method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V add

[COLOR="Red"]invoke-direct {p0, p1}, Lcom/android/launcher3/home/Workspace;->HyperLauncherGestures(Landroid/content/Context;)V[/COLOR]

return-void
.end method

before .method private initWorkspace()V add this method

.method private HyperLauncherGestures(Landroid/content/Context;)V
.locals 7

const/4 v6, 0x2

const/4 v5, 0x1

const/4 v4, 0x0

const/16 v3, 0x3e7

const/4 v1, 0x3

new-array v1, v1, [I

iput-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

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

move-result-object v0

iget-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

const-string v2, ""

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

move-result v2

aput v2, v1, v4

iget-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

const-string v2, ""

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

move-result v2

aput v2, v1, v5

iget-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

const-string v2, "hyper_launcher_doubletap"

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

move-result v2

aput v2, v1, v6

iget-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

aget v1, v1, v4

if-ne v1, v3, :cond_0

iget-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

aget v1, v1, v5

if-ne v1, v3, :cond_0

iget-object v1, p0, Lcom/android/launcher3/home/Workspace;->swipeAction:[I

aget v1, v1, v6

if-eq v1, v3, :cond_1

:cond_0
new-instance v1, Landroid/view/GestureDetector;

new-instance v2, Lcom/android/launcher3/home/Workspace$SwipeListener;

const/4 v3, 0x0

invoke-direct {v2, p0, v3}, Lcom/android/launcher3/home/Workspace$SwipeListener;-><init>(Lcom/android/launcher3/home/Workspace;Lcom/android/launcher3/home/Workspace$SwipeListener;)V

invoke-direct {v1, p1, v2}, Landroid/view/GestureDetector;-><init>(Landroid/content/Context;Landroid/view/GestureDetector$OnGestureListener;)V

iput-object v1, p0, Lcom/android/launcher3/home/Workspace;->mDetector:Landroid/view/GestureDetector;

:cond_1
return-void
.end method

in .method public onInterceptTouchEvent(Landroid/view/MotionEvent;)Z add

packed-switch v6, :pswitch_data_0

:cond_2
:goto_1
[COLOR="red"] iget-object v0, p0, Lcom/android/launcher3/home/Workspace;->mDetector:Landroid/view/GestureDetector;

if-eqz v0, :cond_ik

iget-object v0, p0, Lcom/android/launcher3/home/Workspace;->mDetector:Landroid/view/GestureDetector;

invoke-virtual {v0, p1}, Landroid/view/GestureDetector;->onTouchEvent(Landroid/view/MotionEvent;)Z

:cond_ik[/COLOR]
:pswitch_0
invoke-super {p0, p1}, Lcom/android/launcher3/common/base/view/PagedView;->onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

move-result v4

goto :goto_0

:pswitch_1

5. Decompile services.jar

6. Put the smalis from download link in their folders. In smali_classes2.

7. Open com.android.server.policy.PhoneWindowManager.smali

in # instance fields add

.field mAbsPhoneWindownManager:Lcom/android/server/policy/PhoneWindowManagers$KeyPolicy;
.field mScreenshotReceiver:Landroid/content/BroadcastReceiver;

in .method public constructor <init>()V add

invoke-direct/range {v0 .. v7}, Lcom/android/server/policy/BarController;-><init>(Ljava/lang/String;IIIIII)V

iput-object v0, p0, Lcom/android/server/policy/PhoneWindowManager;->mNavigationBarController:Lcom/android/server/policy/BarController;

[COLOR="Red"] new-instance v0, Lcom/android/server/policy/PhoneWindowManager$Torch;

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

iput-object v0, p0, Lcom/android/server/policy/PhoneWindowManager;->mScreenshotReceiver:Landroid/content/BroadcastReceiver;
[/COLOR]
new-instance v0, Lcom/android/server/policy/PhoneWindowManager$5;

in .method public init(Landroid/content/Context;Landroid/view/IWindowManager;Landroid/view/WindowManagerPolicy$WindowManagerFuncs;)V add

.locals 23

[COLOR="Red"] new-instance v2, Lcom/android/server/policy/PhoneWindowManagers$KeyPolicy;

move-object/from16 v0, p1

invoke-direct {v2, v0}, Lcom/android/server/policy/PhoneWindowManagers$KeyPolicy;-><init>(Landroid/content/Context;)V

move-object/from16 v1, p0

iput-object v2, v1, Lcom/android/server/policy/PhoneWindowManager;->mAbsPhoneWindownManager:Lcom/android/server/policy/PhoneWindowManagers$KeyPolicy;[/COLOR]

move-object/from16 v0, p1

move-object/from16 v1, p0

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

.
.
.
invoke-virtual {v0, v2, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

[COLOR="Red"] const-string v2, "android.intent.action.ScreenShot"

move-object/from16 v0, v19

invoke-virtual {v0, v2}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

move-object/from16 v0, p0

iget-object v2, v0, Lcom/android/server/policy/PhoneWindowManager;->mScreenshotReceiver:Landroid/content/BroadcastReceiver;

move-object/from16 v0, p1

move-object/from16 v1, v19

invoke-virtual {v0, v2, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;[/COLOR]

new-instance v19, Landroid/content/IntentFilter;

const-string/jumbo v2, "android.intent.action.USER_SWITCHED"

8. In rom control xml add

<com.wubydax.romcontrol.v2.prefs.MyListPreference android:entries="@array/launcher_gesture_entries" android:title="Double tap on homescreen" android:key="hyper_launcher_doubletap" app:packageNameToKill="com.sec.android.app.launcher" app:isSilent="true" android:summary="999" android:entryValues="@array/launcher_gesture_values" />

9. In rom control arrays add

<string-array name="launcher_gesture_entries">
<item>Turn off the screen</item>
<item>Power menu</item>
<item>Recent apps</item>
<item>Volume up</item>
<item>Volume down</item>
<item>Dialer</item>
<item>Google search</item>
<item>Sound mode</item>
<item>Reboot</item>
<item>Notifications panel</item>
<item>Switch wi-fi</item>
<item>Switch bluetooth</item>
<item>Clear memory</item>
<item>Disable</item>
</string-array>
<string-array name="launcher_gesture_values">
<item>0</item>
<item>1</item>
<item>4</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>17</item>
<item>23</item>
<item>999</item>
</string-array>

10.Done