package io.gavinhungry.xposed.oneplus.noquickpulldown;

import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedHelpers;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;

import android.view.MotionEvent;

public class NoQuickPulldown implements IXposedHookLoadPackage {
  public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {

    XposedBridge.log("OP2 handleLoadPackage: " + lpparam.packageName);

    if (lpparam.packageName.equals("com.android.systemui")) {
      try {
        findAndHookMethod("com.android.systemui.statusbar.phone.NotificationPanelView", lpparam.classLoader,
          "onTouchEvent", MotionEvent.class, XC_MethodReplacement.DO_NOTHING);
      } catch (Throwable t) {
        XposedBridge.log("OP2 Error!");
      }
    }

  }
}

@@ -270,60 +270,8 @@
 ok;%0A
-import de.robv.android.xposed.XC_MethodReplacement;%0A
 impo
@@ -315,79 +315,34 @@
 rs;%0A
+%0A
 import 
-static de.robv.android.xposed.XposedHelpers.findAndHookMetho
+android.os.Buil
 d;%0A
-%0A
 impo
@@ -436,16 +436,143 @@
 ckage %7B%0A
+%0A  private static final String qsExpandFieldName = Build.VERSION.SDK_INT == 21 ? %22mTwoFingerQsExpand%22 : %22mQsExpandImmediate%22;%0A%0A
   public
@@ -650,81 +650,8 @@
 e %7B%0A
-%0A    XposedBridge.log(%22OP2 handleLoadPackage: %22 + lpparam.packageName);%0A%0A
     
@@ -704,24 +704,25 @@
 stemui%22)) %7B%0A
+%0A
       try %7B%0A
@@ -729,16 +729,30 @@
         
+XposedHelpers.
 findAndH
@@ -888,16 +888,20 @@
 t.class,
+ new
  XC_Meth
@@ -906,33 +906,236 @@
 thod
-Replacement.DO_NOTHING
+Hook() %7B%0A%0A          @Override%0A          protected void beforeHookedMethod(MethodHookParam param) throws Throwable %7B%0A            XposedHelpers.setBooleanField(param.thisObject, qsExpandFieldName, false);%0A          %7D%0A        %7D
 );%0A
+%0A
     
@@ -1189,20 +1189,9 @@
 log(
-%22OP2 Error!%22
+t
 );%0A 
@@ -1203,15 +1203,14 @@
 %7D%0A    %7D%0A
-%0A
   %7D%0A%7D%0A

setBooleanField false