Init resources hook when call hookSystemWideLayout (#2210)

Fix #2209
This commit is contained in:
LoveSy 2022-11-03 17:32:46 +08:00 committed by GitHub
parent 7a544a4aaa
commit 2ba0d5a714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -1771,6 +1771,14 @@ public class XResources extends XResourcesSuperClass {
if (id == 0) if (id == 0)
throw new IllegalArgumentException("id 0 is not an allowed resource identifier"); throw new IllegalArgumentException("id 0 is not an allowed resource identifier");
if (resDir == null) {
try {
XposedInit.hookResources();
} catch (Throwable throwable) {
throw new IllegalStateException("Failed to initialize resources hook", throwable);
}
}
HashMap<String, CopyOnWriteSortedSet<XC_LayoutInflated>> inner; HashMap<String, CopyOnWriteSortedSet<XC_LayoutInflated>> inner;
synchronized (sLayoutCallbacks) { synchronized (sLayoutCallbacks) {
inner = sLayoutCallbacks.get(id); inner = sLayoutCallbacks.get(id);