Skip to content

Commit

Permalink
Improve OOS 13 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 25, 2024
1 parent 5483769 commit b03da68
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});*/

Class<?> NotificationShadeWindowView = findClass("com.android.systemui.shade.NotificationShadeWindowView", lpparam.classLoader);
Class<?> NotificationShadeWindowView;
try {
NotificationShadeWindowView = findClass("com.android.systemui.shade.NotificationShadeWindowView", lpparam.classLoader);
} catch (Throwable t) {
NotificationShadeWindowView = findClass("com.android.systemui.statusbar.phone.NotificationShadeWindowView", lpparam.classLoader);
}
hookAllConstructors(NotificationShadeWindowView, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -156,7 +161,12 @@ protected void afterHookedMethod(XC_MethodHook.MethodHookParam methodHookParam)
}
});

Class<?> AodRootLayout = findClass("com.oplus.systemui.aod.aodclock.off.AodRootLayout", lpparam.classLoader);
Class<?> AodRootLayout;
try {
AodRootLayout = findClass("com.oplus.systemui.aod.aodclock.off.AodRootLayout", lpparam.classLoader);
} catch (Throwable t) {
AodRootLayout = findClass("com.oplusos.systemui.aod.aodclock.off.AodRootLayout", lpparam.classLoader);
}
hookAllConstructors(AodRootLayout, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -175,21 +185,13 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
try {
mStartButton = mKeyguardBottomArea.findViewById(mContext.getResources().getIdentifier("start_button", "id", Constants.Packages.SYSTEM_UI));
mEndButton = mKeyguardBottomArea.findViewById(mContext.getResources().getIdentifier("end_button", "id", Constants.Packages.SYSTEM_UI));
} catch (Throwable e) {
e.printStackTrace();
} catch (Throwable t) {
log(TAG + "Failed to find start/end button");
}
updateLockscreenIcons();
}
});


hookAllConstructors(CentralSurfacesImpl, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {

}
});

hookAllMethods(CentralSurfacesImpl, "keyguardGoingAway", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,16 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});

Class<?> VolumeDialogImpl = findClass("com.android.systemui.volume.VolumeDialogImpl", lpparam.classLoader);
hookAllMethods(VolumeDialogImpl, "showSafetyWarningH", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (mDisableVolumeWarning) {
param.setResult(null);
}
}
});

Class<?> OplusVolumeDialog = findClass("com.oplus.systemui.volume.OplusVolumeDialogImpl", lpparam.classLoader);

hookAllConstructors(OplusVolumeDialogImpl, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
OVDI = param.thisObject;
}
});

hookAllMethods(OplusVolumeDialog, "initRow", new XC_MethodHook() {
hookAllMethods(OplusVolumeDialogImpl, "initRow", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (!sliderCustomizable) return;
Expand Down Expand Up @@ -209,13 +200,23 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
} }
});

hookAllMethods(OplusVolumeDialog, "updateVolumeRowH", volumeIconHook);
hookAllMethods(OplusVolumeDialogImpl, "updateVolumeRowH", volumeIconHook);

hookAllMethods(OplusVolumeDialog, "updateVolumeRowSliderH", volumeIconHook);
hookAllMethods(OplusVolumeDialog, "updateVolumeRowTintH", volumeIconHook);
hookAllMethods(OplusVolumeDialog, "refreshVisibleRow", volumeIconHook);
hookAllMethods(OplusVolumeDialogImpl, "updateVolumeRowSliderH", volumeIconHook);
hookAllMethods(OplusVolumeDialogImpl, "updateVolumeRowTintH", volumeIconHook);
hookAllMethods(OplusVolumeDialogImpl, "refreshVisibleRow", volumeIconHook);


Class<?> VolumeDialogImpl = findClass("com.android.systemui.volume.VolumeDialogImpl", lpparam.classLoader);
hookAllMethods(VolumeDialogImpl, "showSafetyWarningH", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (mDisableVolumeWarning) {
param.setResult(null);
}
}
});

}

private void updateVolumePanel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,24 @@ private boolean isMethodSecure() {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals(listenPackage)) return;


KeyguardHelper = findClass("com.oplus.systemui.common.helper.KeyguardHelper", lpparam.classLoader);

Class<?> OplusEmergencyButtonExImpl = findClass("com.oplus.keyguard.OplusEmergencyButtonExImpl", lpparam.classLoader);
try {
Class<?> OplusEmergencyButtonExImpl = findClass("com.oplus.keyguard.OplusEmergencyButtonExImpl", lpparam.classLoader);
findAndHookMethod(OplusEmergencyButtonExImpl, "disableShowEmergencyButton", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (removeSOS) param.setResult(true);
}
});
} catch (Throwable t) {
log(TAG + "disableShowEmergencyButton not found");
log(TAG + "OplusEmergencyButtonExImpl not found");
}

Class<?> OnScreenFingerprint = findClass("com.oplus.systemui.biometrics.finger.udfps.OnScreenFingerprintUiMach", lpparam.classLoader);
Class<?> OnScreenFingerprint;
try {
OnScreenFingerprint = findClass("com.oplus.systemui.biometrics.finger.udfps.OnScreenFingerprintUiMach", lpparam.classLoader);
} catch (Throwable t) {
OnScreenFingerprint = findClass("com.oplus.systemui.keyguard.finger.onscreenfingerprint.OnScreenFingerprintUiMech", lpparam.classLoader);
}
hookAllMethods(OnScreenFingerprint, "initFpIconWin", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,12 @@ protected void afterHookedMethod(MethodHookParam param) {
}
});

Class<?> SingleClockView = findClass("com.oplus.systemui.shared.clocks.SingleClockView", lpparam.classLoader);
Class<?> SingleClockView;
try {
SingleClockView = findClass("com.oplus.systemui.shared.clocks.SingleClockView", lpparam.classLoader);
} catch (Throwable t) {
SingleClockView = findClass("com.oplusos.systemui.keyguard.clock.SingleClockView", lpparam.classLoader); // OOS 13
}
findAndHookMethod(SingleClockView, "updateStandardTime", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -282,7 +287,12 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});

Class<?> RedTextClock = findClass("com.oplus.systemui.shared.clocks.RedTextClock", lpparam.classLoader);
Class<?> RedTextClock;
try {
RedTextClock = findClass("com.oplus.systemui.shared.clocks.RedTextClock", lpparam.classLoader);
} catch (Throwable t) {
RedTextClock = findClass("com.oplusos.systemui.keyguard.clock.RedTextClock", lpparam.classLoader); // OOS 13
}
findAndHookMethod(RedTextClock, "onTimeChanged", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void updatePrefs(String... Key) {
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (!listensTo(lpparam.packageName)) return;

Class<?> StatBatteryMeterView = findClass("com.oplus.systemui.statusbar.pipeline.battery.ui.view.StatBatteryMeterView", lpparam.classLoader);
//Class<?> StatBatteryMeterView = findClass("com.oplus.systemui.statusbar.pipeline.battery.ui.view.StatBatteryMeterView", lpparam.classLoader);
Class<?> BatteryIconColor = findClass("com.oplus.systemui.statusbar.pipeline.battery.ui.model.BatteryIconColor", lpparam.classLoader);

findAndHookConstructor(BatteryIconColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public class HeaderClock extends XposedMods {

private int stockClockDateBackgroundChipStyle;
private int mAccent;
private GradientDrawable mClockChipDrawale;
private GradientDrawable mDateChipDrawale;
private GradientDrawable mClockChipDrawale = new GradientDrawable();
private GradientDrawable mDateChipDrawale = new GradientDrawable();
private Typeface mStockClockTypeface, mStockDateTypeface;
private Object OQC = null;
private Object mActivityStarter = null;
Expand Down Expand Up @@ -231,9 +231,6 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
QuickStatusBarHeader = findClass("com.android.systemui.qs.QuickStatusBarHeader", lpparam.classLoader);
}

mClockChipDrawale = new GradientDrawable();
mDateChipDrawale = new GradientDrawable();

Class<?> Clock = findClass("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader);
hookAllConstructors(Clock, new XC_MethodHook() {
@Override
Expand Down Expand Up @@ -327,8 +324,6 @@ protected void afterHookedMethod(MethodHookParam param) {
hookAllMethods(OplusClockExImpl, "setTextWithRedOneStyleInternal", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
//log("setTextWithRedOneStyleInternal BEFORE");
//log("showHeaderClock: " + showHeaderClock + " stockClockRedStyle: " + stockClockRedStyle + " stockClockRedOverrideColor: " + stockClockRedOverrideColor + " param: " + (showHeaderClock || stockClockRedStyle == 1));
if (showHeaderClock || stockClockRedStyle == 1 ) {
param.setResult(null);
return;
Expand Down Expand Up @@ -401,7 +396,12 @@ protected void afterHookedMethod(MethodHookParam param) {
}


Class<?> QSSecurityFooterUtilsClass = findClass("com.android.systemui.qs.QSSecurityFooterUtils", lpparam.classLoader);
Class<?> QSSecurityFooterUtilsClass;
try {
QSSecurityFooterUtilsClass = findClass("com.android.systemui.qs.QSSecurityFooterUtils", lpparam.classLoader);
} catch (Throwable t) {
QSSecurityFooterUtilsClass = findClass("com.android.systemui.qs.QSSecurityFooter", lpparam.classLoader);
}
hookAllConstructors(QSSecurityFooterUtilsClass, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,6 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});

Class<?> OplusHeaderTileLayout = findClass("com.oplus.systemui.qs.widget.OplusHeaderTileLayout", lpparam.classLoader);
hookAllMethods(OplusHeaderTileLayout, "updateColumns",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (!mCustomizeQSTiles) return;

log("OplusHeaderTileLayout updateColumns");

int mColumns = getIntField(param.thisObject, "mColumns");
int orientation = mContext.getResources().getConfiguration().orientation;
int newColumns = orientation == Configuration.ORIENTATION_PORTRAIT ? QSColQty : QSColQtyL;
setIntField(param.thisObject, "mColumns", 8);
param.setResult(mColumns != 8);

}
});

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,17 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}

ViewGroup mStatusBar = (ViewGroup) getObjectField(mCollapsedStatusBarFragment, "mStatusBar");
mStatusbarStartSide = mStatusBar.findViewById(mContext.getResources().getIdentifier("status_bar_start_side_except_heads_up", "id", mContext.getPackageName()));
try {
mStatusbarStartSide = mStatusBar.findViewById(mContext.getResources().getIdentifier("status_bar_start_side_except_heads_up", "id", mContext.getPackageName()));
} catch (Throwable t) {
mStatusbarStartSide = mStatusBar.findViewById(mContext.getResources().getIdentifier("status_bar_left_side", "id", mContext.getPackageName())); // OOS 13
}

mSystemIconArea = mStatusBar.findViewById(mContext.getResources().getIdentifier("statusIcons", "id", mContext.getPackageName()));
try {
mSystemIconArea = mStatusBar.findViewById(mContext.getResources().getIdentifier("statusIcons", "id", mContext.getPackageName()));
} catch (Throwable t) {
mSystemIconArea = mStatusBar.findViewById(mContext.getResources().getIdentifier("system_icon_area", "id", mContext.getPackageName())); // OOS 13
}


try {
Expand Down
Loading

0 comments on commit b03da68

Please sign in to comment.