Skip to content

Commit

Permalink
Fix QS theme crash on android 14 QPR2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Apr 5, 2024
1 parent 1156ba3 commit 98933d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Class<?> StateFlowImplClass = findClass("kotlinx.coroutines.flow.StateFlowImpl", loadPackageParam.classLoader);
Class<?> ReadonlyStateFlowClass = findClass("kotlinx.coroutines.flow.ReadonlyStateFlow", loadPackageParam.classLoader);

Object zeroAlphaFlow = StateFlowImplClass.getConstructor(Object.class).newInstance(0f);
setObjectField(param.thisObject, "backgroundAlpha", ReadonlyStateFlowClass.getConstructors()[0].newInstance(zeroAlphaFlow));
try {
Object zeroAlphaFlow = StateFlowImplClass.getConstructor(Object.class).newInstance(0f);
setObjectField(param.thisObject, "backgroundAlpha", ReadonlyStateFlowClass.getConstructors()[0].newInstance(zeroAlphaFlow));
} catch (Throwable throwable) {
log(TAG + throwable);
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,22 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
// Power button
Object power = getObjectField(param.thisObject, "power");
setObjectField(power, "iconTint", colorActive[0]);
setObjectField(power, "backgroundColor", colorActiveAlpha[0]);
// setObjectField(power, "backgroundColor", colorActiveAlpha[0]);

// Settings button
Object settings = getObjectField(param.thisObject, "settings");
setObjectField(settings, "backgroundColor", colorInactiveAlpha[0]);
// setObjectField(settings, "backgroundColor", colorInactiveAlpha[0]);

// We must use the classes defined in the apk. Using our own will fail.
Class<?> StateFlowImplClass = findClass("kotlinx.coroutines.flow.StateFlowImpl", loadPackageParam.classLoader);
Class<?> ReadonlyStateFlowClass = findClass("kotlinx.coroutines.flow.ReadonlyStateFlow", loadPackageParam.classLoader);

Object zeroAlphaFlow = StateFlowImplClass.getConstructor(Object.class).newInstance(0f);
setObjectField(param.thisObject, "backgroundAlpha", ReadonlyStateFlowClass.getConstructors()[0].newInstance(zeroAlphaFlow));
try {
Object zeroAlphaFlow = StateFlowImplClass.getConstructor(Object.class).newInstance(0f);
setObjectField(param.thisObject, "backgroundAlpha", ReadonlyStateFlowClass.getConstructors()[0].newInstance(zeroAlphaFlow));
} catch (Throwable throwable) {
log(TAG + throwable);
}
}
});
} catch (Throwable ignored) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,18 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
// Settings button
Object settings = getObjectField(param.thisObject, "settings");
setObjectField(settings, "iconTint", Color.BLACK);
setObjectField(settings, "backgroundColor", colorInactive);
// setObjectField(settings, "backgroundColor", colorInactive);

// We must use the classes defined in the apk. Using our own will fail.
Class<?> StateFlowImplClass = findClass("kotlinx.coroutines.flow.StateFlowImpl", loadPackageParam.classLoader);
Class<?> ReadonlyStateFlowClass = findClass("kotlinx.coroutines.flow.ReadonlyStateFlow", loadPackageParam.classLoader);

Object zeroAlphaFlow = StateFlowImplClass.getConstructor(Object.class).newInstance(0f);
setObjectField(param.thisObject, "backgroundAlpha", ReadonlyStateFlowClass.getConstructors()[0].newInstance(zeroAlphaFlow));
try {
Object zeroAlphaFlow = StateFlowImplClass.getConstructor(Object.class).newInstance(0f);
setObjectField(param.thisObject, "backgroundAlpha", ReadonlyStateFlowClass.getConstructors()[0].newInstance(zeroAlphaFlow));
} catch (Throwable throwable) {
log(TAG + throwable);
}
}
});

Expand Down

0 comments on commit 98933d9

Please sign in to comment.