Skip to content

Commit

Permalink
fix: is_tablet type got failed cause of zygisk crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed May 5, 2024
1 parent 3435027 commit def5549
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.app;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.base.HookExpand;
Expand All @@ -41,6 +41,6 @@ public void handleLoadPackage() {
initHook(new Taplus(), mPrefsMap.getBoolean("security_center_taplus"));
initHook(new LinkOpenMode(), true);
initHook(HorizontalContentExtension.INSTANCE, mPrefsMap.getBoolean("content_extension_unlock_taplus_horizontal"));
initHook(UnlockTaplus.INSTANCE, mPrefsMap.getBoolean("content_extension_unlock_taplus") && isPad());
initHook(UnlockTaplus.INSTANCE, mPrefsMap.getBoolean("content_extension_unlock_taplus") && getIS_TABLET());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.app.Home.Phone;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.base.HookExpand;
Expand Down Expand Up @@ -220,14 +220,14 @@ public void handleLoadPackage() {
initHook(RecentResource.INSTANCE, mPrefsMap.getInt("task_view_corners", 20) != 20 ||
mPrefsMap.getInt("task_view_header_height", 40) != 40);
initHook(RealMemory.INSTANCE, mPrefsMap.getBoolean("home_recent_show_real_memory"));
initHook(MemInfoShow.INSTANCE, mPrefsMap.getBoolean("home_recent_show_memory_info") && isPad());
initHook(MemInfoShow.INSTANCE, mPrefsMap.getBoolean("home_recent_show_memory_info") && getIS_TABLET());
initHook(AlwaysShowCleanUp.INSTANCE, mPrefsMap.getBoolean("always_show_clean_up"));
initHook(new BackgroundBlur(), mPrefsMap.getBoolean("home_recent_blur"));

// 图标
initHook(BigIconCorner.INSTANCE, mPrefsMap.getBoolean("home_title_big_icon_corner"));
initHook(new DownloadAnimation(), mPrefsMap.getBoolean("home_title_download_animation"));
initHook(DisableHideTheme.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_theme") && isPad());
initHook(DisableHideTheme.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_theme") && getIS_TABLET());
initHook(DisableHideFile.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_file"));
initHook(DisableHideGoogle.INSTANCE, mPrefsMap.getBoolean("home_title_disable_hide_google"));
initHook(new FakeNonDefaultIcon(), mPrefsMap.getBoolean("fake_non_default_icon"));
Expand Down Expand Up @@ -267,7 +267,7 @@ public void handleLoadPackage() {
initHook(new HomeMode(), mPrefsMap.getStringAsInt("home_other_home_mode", 0) > 0);
initHook(AlwaysShowStatusClock.INSTANCE, mPrefsMap.getBoolean("home_other_show_clock"));
initHook(new InfiniteScroll(), mPrefsMap.getBoolean("home_other_infinite_scroll"));
if (isPad()) {
if (getIS_TABLET()) {
initHook(new FreeformShortcutMenu(), mPrefsMap.getBoolean("home_other_freeform_shortcut_menu"));
initHook(new TasksShortcutMenu(), mPrefsMap.getBoolean("home_other_tasks_shortcut_menu"));
} else {
Expand Down Expand Up @@ -305,7 +305,7 @@ public void handleLoadPackage() {
initHook(SetDeviceLevel.INSTANCE, mPrefsMap.getBoolean("home_other_high_models"));

// 小米/红米平板相关
if (isPad()) {
if (getIS_TABLET()) {
boolean mMoreSetting = mPrefsMap.getBoolean("home_other_mi_pad_enable_more_setting");
initHook(SetGestureNeedFingerNum.INSTANCE, mPrefsMap.getBoolean("mipad_input_need_finger_num"));
initHook(EnableMoreSetting.INSTANCE, mMoreSetting);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.app.SystemFramework.Phone;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;

import com.sevtinge.hyperceiler.module.base.BaseModule;
Expand Down Expand Up @@ -138,7 +138,7 @@ public void handleLoadPackage() {
// initHook(new LocationSimulation(), false);

// 小米/红米平板设置相关
if (isPad()) {
if (getIS_TABLET()) {
initHook(IgnoreStylusKeyGesture.INSTANCE, mPrefsMap.getBoolean("mipad_input_ingore_gesture"));
initHook(NoMagicPointer.INSTANCE, mPrefsMap.getBoolean("mipad_input_close_magic"));
initHook(RemoveStylusBluetoothRestriction.INSTANCE, mPrefsMap.getBoolean("mipad_input_disable_bluetooth"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ private boolean invokeHookInit(LoadPackageParam lpparam) {
if (mPkgName.equals(mPkg)) {
// 需要限制安卓版本和设备取消这些注释,并删除下面的invoke方法。
// if (!isAndroidVersion(android)) continue;
// if (isPad() && isPad) {
// if (getIS_TABLET() && isPad) {
// return invoke(lpparam, clzz);
// } else if (isPad() && !isPad) {
// } else if (getIS_TABLET() && !isPad) {
// continue;
// } else {
// return invoke(lpparam, clzz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package com.sevtinge.hyperceiler.module.hook.home;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;

import android.content.Context;
import android.database.ContentObserver;
import android.os.Handler;
Expand All @@ -32,6 +30,8 @@

import de.robv.android.xposed.XposedHelpers;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

/**
* @author 焕晨HChen
*/
Expand All @@ -42,7 +42,7 @@ public class LockApp extends BaseHook {

@Override
public void init() throws NoSuchMethodException {
if (isPad()) {
if (getIS_TABLET()) {
// 平板
findAndHookConstructor("com.miui.home.recents.GestureStubView",
Context.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.view.View;

Expand All @@ -30,7 +30,7 @@ public class UserPresentAnimation extends BaseHook {

@Override
public void init() {
mUserPresentAnimationCompatV12Phone = !isPad() ?
mUserPresentAnimationCompatV12Phone = !getIS_TABLET() ?
findClassIfExists("com.miui.home.launcher.compat.UserPresentAnimationCompatV12Phone") :
findClassIfExists("com.miui.home.launcher.compat.UserPresentAnimationCompatV12Spring");
findAndHookMethod(mUserPresentAnimationCompatV12Phone, "getSpringAnimator", View.class, int.class, float.class, float.class, float.class, float.class, new MethodHook() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home.folder;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.content.Context;
import android.os.Build;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void init() {
mDragView = findClassIfExists("com.miui.home.launcher.DragView");
mFolderIcon2x2 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon2x2");

if (isPad()) {
if (getIS_TABLET()) {
mFolderIcon2x2_4 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon4x4_16");
mFolderIcon2x2_9 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon3x3_9");
} else {
Expand Down Expand Up @@ -97,7 +97,7 @@ protected void after(MethodHookParam param) {
FrameLayout.LayoutParams lp1 = (FrameLayout.LayoutParams) mDockBlur.getLayoutParams();
lp1.gravity = Gravity.CENTER;

if(isPad()){
if(getIS_TABLET()){
lp1.width = mFolderWidth * 2;
lp1.height = mFolderHeight *2;
}else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home.folder;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.view.Gravity;
import android.view.View;
Expand All @@ -44,7 +44,7 @@ public class BigFolderIconBlur1x2 extends BaseHook {

@Override
public void init() {
if (isPad()) {
if (getIS_TABLET()) {
mFolderIcon1x2 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon2x2_4");
} else {
mFolderIcon1x2 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon1x2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.home.folder;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.os.Build;
import android.view.Gravity;
Expand All @@ -45,7 +45,7 @@ public class BigFolderIconBlur2x1 extends BaseHook {

@Override
public void init() {
if (isPad()) {
if (getIS_TABLET()) {
mFolderIcon2x1 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon4x2_8");
} else {
mFolderIcon2x1 = findClassIfExists("com.miui.home.launcher.folder.FolderIcon2x1");
Expand Down Expand Up @@ -77,7 +77,7 @@ protected void after(MethodHookParam param) {
mIconContainer.addView(mDockBlur, 0);
FrameLayout.LayoutParams lp1 = (FrameLayout.LayoutParams) mDockBlur.getLayoutParams();
lp1.gravity = Gravity.CENTER;
if (isPad()) {
if (getIS_TABLET()) {
lp1.width = mFolderWidth * 2;
lp1.height = mFolderHeight * 2;
}else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package com.sevtinge.hyperceiler.module.hook.home.other;

import static com.sevtinge.hyperceiler.module.base.tool.OtherTool.getModuleRes;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static de.robv.android.xposed.XposedHelpers.callMethod;

import android.annotation.SuppressLint;
Expand Down Expand Up @@ -61,7 +61,7 @@ public class FreeformShortcutMenu extends BaseHook {
@Override
public void init() {

if (isPad()) {
if (getIS_TABLET()) {
hookAllMethods("com.miui.home.launcher.shortcuts.SystemShortcutMenuItem$SmallWindowShortcutMenuItem", "isValid",
MethodHook.returnConstant(true));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.sevtinge.hyperceiler.utils.devicesdk.*
object AlwaysShowCleanUp: BaseHook() {
override fun init() {
loadClass(
when (isPad()) {
when (IS_TABLET) {
false -> "com.miui.home.recents.views.RecentsContainer"
true -> "com.miui.home.recents.views.RecentsDecorations"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object BlurLevel : BaseHook() {
it.result = false
}

if (isPad()) {
if (IS_TABLET) {
navStubViewClass.hookAfterAllMethods("onTouchEvent") {
val mLauncher = applicationClass.callStaticMethod("getLauncher") as Activity
blurClass.callStaticMethod("fastBlur", 1.0f, mLauncher.window, true, 500L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object RealMemory : BaseHook() {
fun Any.formatSize(): String = Formatter.formatFileSize(context, this as Long)

val recentContainerClass = loadClass(
when (isPad()) {
when (IS_TABLET) {
false -> "com.miui.home.recents.views.RecentsContainer"
true -> "com.miui.home.recents.views.RecentsDecorations"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemframework;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.content.Context;
import android.database.ContentObserver;
Expand Down Expand Up @@ -112,7 +112,7 @@ protected void before(MethodHookParam param) {
}
);

if (isPad()) {
if (getIS_TABLET()) {
findAndHookMethod("com.android.server.wm.MiuiCvwGestureController$GesturePointerEventListener",
"onPointerEvent", MotionEvent.class,
new MethodHook() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import static com.sevtinge.hyperceiler.utils.devicesdk.DisplayUtils.dp2px;
import static com.sevtinge.hyperceiler.utils.devicesdk.DisplayUtils.sp2px;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getBaseOs;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getRomAuthor;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;
Expand Down Expand Up @@ -154,7 +154,7 @@ public void initPrefs() {
mAod.setTitle(R.string.aod);
mMiLink.setTitle(R.string.milink);
mGuardProvider.setTitle(R.string.guard_provider);
if (isPad()) {
if (getIS_TABLET()) {
mSecurityCenter.setTitle(R.string.security_center_pad);
} else {
mSecurityCenter.setTitle(R.string.security_center);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.Manifest;
Expand Down Expand Up @@ -50,7 +50,7 @@ public int getContentResId() {

@Override
public View.OnClickListener addRestartListener() {
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!isPad() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!getIS_TABLET() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
return view -> ((BaseSettingsActivity)getActivity()).showRestartDialog(
mSecurity,
"com.miui.securitycenter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import android.view.View;
Expand All @@ -37,7 +37,7 @@ public int getContentResId() {

@Override
public View.OnClickListener addRestartListener() {
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!isPad() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
mSecurity = getResources().getString(!isMoreHyperOSVersion(1f) ? (!getIS_TABLET() ? R.string.security_center : R.string.security_center_pad) : R.string.security_center_hyperos);
return view -> ((BaseSettingsActivity)getActivity()).showRestartDialog(
mSecurity,
"com.miui.securitycenter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreAndroidVersion;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;
Expand Down Expand Up @@ -71,12 +71,12 @@ public void initPrefs() {
mNotice = findPreference("prefs_key_system_settings_more_notification_settings");
mUiMode = findPreference("prefs_key_system_settings_unlock_ui_mode");

mUiMode.setVisible(isPad());
mUiMode.setVisible(getIS_TABLET());
mHighMode.setVisible(!isAndroidVersion(30));
mAreaScreenshot.setVisible(isAndroidVersion(30));
mNewNfc.setVisible((isMoreMiuiVersion(14f) || isMoreHyperOSVersion(1f)) && isMoreAndroidVersion(33));
mNoveltyHaptic.setVisible((isMoreMiuiVersion(14f) || isMoreHyperOSVersion(1f)) && isMoreAndroidVersion(31));
mPad.setVisible(isPad());
mPad.setVisible(getIS_TABLET());

if (isMoreHyperOSVersion(1f)) {
mNotice.setSummary(R.string.system_settings_more_notification_settings_summary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.os.Handler;

Expand Down Expand Up @@ -57,7 +57,7 @@ public void initPrefs() {
mDefault = findPreference("prefs_key_various_super_clipboard_key");
mMipad = findPreference("prefs_key_various_mipad");
mClipboard = findPreference("prefs_key_sogou_xiaomi_clipboard");
mMipad.setVisible(isPad());
mMipad.setVisible(getIS_TABLET());
handler = new Handler();

mClipboard.setOnPreferenceChangeListener((preference, o) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package com.sevtinge.hyperceiler.ui.fragment.home;

import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.getIS_TABLET;

import android.view.View;

Expand Down Expand Up @@ -55,7 +55,7 @@ public View.OnClickListener addRestartListener() {
@Override
public void initPrefs() {
mDisableRecentIcon = findPreference("prefs_key_home_dock_disable_recents_icon");
mDisableRecentIcon.setVisible(isPad());
mDisableRecentIcon.setVisible(getIS_TABLET());
mDockBackgroundBlur = findPreference("prefs_key_home_dock_bg_custom");
mDockBackgroundColor = findPreference("prefs_key_home_dock_bg_color");
int mBlurMode = Integer.parseInt(PrefsUtils.getSharedStringPrefs(getContext(), "prefs_key_home_dock_add_blur", "0"));
Expand Down
Loading

0 comments on commit def5549

Please sign in to comment.