Beispiel #1
0
  @Override
  public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {

    switch (lpparam.packageName) {
      case PACKAGE_SETTINGS:
        SettingsHooks.hook(lpparam.classLoader);
        break;
      case PACKAGE_SYSTEMUI:
        SystemUIHooks.hookSystemUI(lpparam.classLoader);
        StatusBarHeaderHooks.hook(lpparam.classLoader);
        NotificationPanelHooks.hook(lpparam.classLoader);
        StackScrollAlgorithmHooks.hook(lpparam.classLoader);
        NotificationHooks.hookSystemUI(lpparam.classLoader);
        RecentsStackHooks.hookSystemUI(lpparam.classLoader);
        RecentsNavigation.hookSystemUI(lpparam.classLoader);
        DoubleTapSwKeys.hook(lpparam.classLoader);
        break;
      case PACKAGE_ANDROID:
        DoubleTapHwKeys.hook(lpparam.classLoader);
        LiveDisplayObserver.hook(lpparam.classLoader);
        PermissionGranter.initAndroid(lpparam.classLoader);
        break;
      case PACKAGE_PHONE:
        EmergencyHooks.hook(lpparam.classLoader);
        break;
      case PACKAGE_OWN:
        XposedHelpers.findAndHookMethod(
            SETTINGS_OWN,
            lpparam.classLoader,
            "isActivated",
            XC_MethodReplacement.returnConstant(true));
        if (!sPrefs.getBoolean("can_read_prefs", false))
          XposedHelpers.findAndHookMethod(
              SETTINGS_OWN,
              lpparam.classLoader,
              "isPrefsFileReadable",
              XC_MethodReplacement.returnConstant(false));
        break;
    }

    // Has to be hooked in every app as every app creates own instances of the Notification.Builder
    NotificationHooks.hook(lpparam.classLoader);

    // This actually is only used in the system process, but every app has access, so just to be
    // sure hook everything
    if (ConfigUtils.qs().enable_qs_editor) {
      try {
        Class<?> classCMStatusBarManager =
            XposedHelpers.findClass("cyanogenmod.app.CMStatusBarManager", lpparam.classLoader);
        XposedBridge.hookAllMethods(
            classCMStatusBarManager, "publishTile", XC_MethodReplacement.DO_NOTHING);
        XposedBridge.hookAllMethods(
            classCMStatusBarManager, "publishTileAsUser", XC_MethodReplacement.DO_NOTHING);
      } catch (Throwable ignore) {
      }
    }
  }
Beispiel #2
0
  @Override
  public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam)
      throws Throwable {

    switch (resparam.packageName) {
      case PACKAGE_SYSTEMUI:
        NotificationHooks.hookResSystemui(resparam, sModulePath);
        StatusBarHeaderHooks.hookResSystemui(resparam, sModulePath);
        RecentsStackHooks.hookResSystemui(resparam, sModulePath);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
          RecentsNavigation.hookResSystemui(resparam);
        }
        break;
    }

    // Has to be hooked in every app because every hook only applies to the current process
    ConfigUtils.notifications().loadBlacklistedApps();
    if (!ConfigUtils.notifications().blacklistedApps.contains(resparam.packageName)) {
      NotificationHooks.hookResAndroid(resparam);
    }
  }