Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Sep 11, 2024
1 parent e1cf358 commit a827cf0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/main/java/de/robv/android/xposed/XposedBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ public static <S, T extends S> boolean invokeConstructor(T instance, Constructor
}

/**
* Simplified version of {@link java.util.concurrent.CopyOnWriteArrayList}
* Simplified version of {@link java.util.concurrent.CopyOnWriteArrayList} with sorting
* @hide
*/
public static final class CopyOnWriteArrayList<E> {
public static final class CopyOnWriteSortedList<E> {
private volatile Object[] elements = EMPTY_ARRAY;

public Object[] getSnapshot() {
Expand All @@ -320,6 +320,8 @@ public synchronized void add(E e) {
Object[] newElements = new Object[snapshot.length + 1];
System.arraycopy(snapshot, 0, newElements, 0, snapshot.length);
newElements[snapshot.length] = e;
if (newElements.length >= 2)
Arrays.sort(newElements);
elements = newElements;
}

Expand Down Expand Up @@ -348,7 +350,7 @@ private static int indexOf(Object[] arr, Object o) {
// Aliucord changed: public, so that it can be passed as lsplant context object
public static class HookInfo {
Member backup;
final CopyOnWriteArrayList<XC_MethodHook> callbacks = new CopyOnWriteArrayList<>();
final CopyOnWriteSortedList<XC_MethodHook> callbacks = new CopyOnWriteSortedList<>();
private final Member method;
private final boolean isStatic;
private final Class<?> returnType;
Expand Down

0 comments on commit a827cf0

Please sign in to comment.