@@ -271,6 +271,37 @@ interface MethodUnhooker<T> {
271271 @ NonNull
272272 MethodUnhooker <Method > hook (@ NonNull Method origin , @ NonNull Class <? extends Hooker > hooker );
273273
274+ /**
275+ * Hook the static initializer of a class with default priority.
276+ * <p>
277+ * Note: If the class is initialized, the hook will never be called.
278+ * </p>
279+ *
280+ * @param origin The class to be hooked
281+ * @param hooker The hooker class
282+ * @return Unhooker for canceling the hook
283+ * @throws IllegalArgumentException if class has no static initializer or hooker is invalid
284+ * @throws HookFailedError if hook fails due to framework internal error
285+ */
286+ @ NonNull
287+ <T > MethodUnhooker <Constructor <T >> hookClassInitializer (@ NonNull Class <T > origin , @ NonNull Class <? extends Hooker > hooker );
288+
289+ /**
290+ * Hook the static initializer of a class with specified priority.
291+ * <p>
292+ * Note: If the class is initialized, the hook will never be called.
293+ * </p>
294+ *
295+ * @param origin The class to be hooked
296+ * @param priority The hook priority
297+ * @param hooker The hooker class
298+ * @return Unhooker for canceling the hook
299+ * @throws IllegalArgumentException if class has no static initializer or hooker is invalid
300+ * @throws HookFailedError if hook fails due to framework internal error
301+ */
302+ @ NonNull
303+ <T > MethodUnhooker <Constructor <T >> hookClassInitializer (@ NonNull Class <T > origin , int priority , @ NonNull Class <? extends Hooker > hooker );
304+
274305 /**
275306 * Hook a method with specified priority.
276307 *
@@ -358,6 +389,7 @@ interface MethodUnhooker<T> {
358389 /**
359390 * Basically the same as {@link Constructor#newInstance(Object...)}, but calls the original constructor
360391 * as it was before the interception by Xposed.
392+ *
361393 * @param constructor The constructor to create and initialize a new instance
362394 * @param thisObject The instance to be constructed
363395 * @param args The arguments used for the construction
0 commit comments