Android Open Source - XposedWifiDeepSleep Singleton Method Hook






From Project

Back to project page XposedWifiDeepSleep.

License

The source code is released under:

MIT License

If you think the Android project XposedWifiDeepSleep listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ru.abusalimov.xposed.util;
/*from   ww  w .ja va  2s .c o m*/
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XCallback;

/**
 * Singleton-like: all instances are the same to avoid unnecessary
 * repeated hook invocations.
 */
public abstract class SingletonMethodHook extends XC_MethodHook {

  @Override
  public int compareTo(XCallback other) {
    if (this.equals(other)) {
      return 0;
    }
    return super.compareTo(other);
  }

  @Override
  public boolean equals(Object o) {
    if (getClass().isInstance(o)) {
      return true;
    }
    return super.equals(o);
  }

  @Override
  public int hashCode() {
    return ~getClass().hashCode() ^ 0xdeadbeef;
  }

}




Java Source Code List

ru.abusalimov.xposed.util.SingletonMethodHook.java
ru.abusalimov.xposed.wifideepsleep.WifiControllerDeviceInactiveStateProcessMessageMethodHook.java
ru.abusalimov.xposed.wifideepsleep.XposedMod.java