Advertisement
stirante

blocker

Mar 27th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.99 KB | None | 0 0
  1.         if (packageParam.packageName.equalsIgnoreCase("com.android.vending.billing.InAppBillingService.LACK")) {
  2.             //XposedBridge.log("In Lucky patcher!");
  3.            
  4.             //if there is no app database
  5.             XposedHelpers.findAndHookMethod("com.android.vending.billing.InAppBillingService.LACK.listAppsFragment", packageParam.classLoader, "getPackages", new XC_MethodHook() {
  6.                 @Override
  7.                 protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  8.                     String[] old = (String[]) param.getResult();
  9.                     String[] newOne = new String[old.length - 1];//probably there is better way to just subtract one element from this array
  10.                     boolean notFound = true;
  11.                     for (int i = 0; i < old.length; i++) {
  12.                         String p = old[i];
  13.                         if (p.equalsIgnoreCase("com.marz.snapprefs")) notFound = false;
  14.                         else {
  15.                             if (notFound) newOne[i] = p;
  16.                             else newOne[i - 1] = p;
  17.                         }
  18.                     }
  19.                     if (!notFound) param.setResult(newOne);
  20.                 }
  21.             });
  22.             //if there is database
  23.             XposedHelpers.findAndHookMethod("com.android.vending.billing.InAppBillingService.LACK.DatabaseHelper", packageParam.classLoader, "getPackage", boolean.class, boolean.class, new XC_MethodHook() {
  24.                 @Override
  25.                 protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  26.                     ArrayList list = (ArrayList) param.getResult();
  27.                     Iterator it = list.iterator();
  28.                     while (it.hasNext()) {
  29.                         Object o = it.next();
  30.                         if (((String) XposedHelpers.getObjectField(o, "pkgName")).equalsIgnoreCase("com.marz.snapprefs")) it.remove();
  31.                     }
  32.                 }
  33.             });
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement