Skip to content

Commit

Permalink
[skp] opt: 导入优化 && 更新依赖 && 去除无用字符串 && 杂七杂八的修复
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Jan 30, 2025
1 parent f315837 commit 06288bc
Show file tree
Hide file tree
Showing 63 changed files with 172 additions and 496 deletions.
31 changes: 24 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,30 @@ dependencies {
exclude("androidx.appcompat", "appcompat")
}

implementation(projects.miuix)
val directory = File("libs")
val files = directory.listFiles()?.filter { it.isFile } ?: emptyList()
files.forEach { i ->
val groupName = i.name.substring(startIndex = 0, endIndex = i.name.length - 10)
implementation("fan:$groupName:3.0")
}
implementation(libs.miuix.animation)
implementation(libs.miuix.appcompat)
implementation(libs.miuix.basewidget)
implementation(libs.miuix.bottomsheet)
implementation(libs.miuix.cardview)
implementation(libs.miuix.core)
implementation(libs.miuix.flexible)
implementation(libs.miuix.folme)
implementation(libs.miuix.graphics)
implementation(libs.miuix.haptic)
implementation(libs.miuix.navigator)
implementation(libs.miuix.nestedheader)
implementation(libs.miuix.pickerwidget)
implementation(libs.miuix.popupwidget)
implementation(libs.miuix.preference)
implementation(libs.miuix.recyclerview)
implementation(libs.miuix.slidingwidget)
implementation(libs.miuix.smooth)
implementation(libs.miuix.springback)
implementation(libs.miuix.stretchablewidget)
implementation(libs.miuix.theme)
implementation(libs.miuix.viewpager)
implementation(libs.miuix.visualcheck)
implementation(files("libs/hyperceiler_expansion_packs-debug.aar"))

compileOnly(projects.hiddenApi)
compileOnly(libs.xposed.api)
Expand Down
File renamed without changes.
16 changes: 11 additions & 5 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
-keep class com.sevtinge.hyperceiler.utils.blur.*
-keep class com.sevtinge.hyperceiler.module.base.tool.AppsTool { boolean isModuleActive; }
-keep class com.sevtinge.hyperceiler.module.base.tool.AppsTool { int XposedVersion; }
-keep class fan.**{ *; }
-keep class androidx.preference.**{ *; }
-keep class org.luckypray.dexkit.**{ *; }
-keep class cn.lyric.getter.api.**{ *; }
-keep class com.sevtinge.hyperceiler.module.base.**{ *; }
-keep class com.sevtinge.hyperceiler.holiday.**{ *; }
-keep class com.sevtinge.hyperceiler.ui.app.holiday.**{ *; }
-keep class * extends com.sevtinge.hyperceiler.ui.base.BasePreferenceFragment
-keep class * extends com.sevtinge.hyperceiler.module.base.BaseHook { <init>(); }
-keep class com.sevtinge.hyperceiler.module.base.dexkit.**{ *; }
Expand All @@ -19,6 +15,16 @@
-keep class com.sevtinge.hyperceiler.utils.ContentModel {*;}
-keep class com.sevtinge.hyperceiler.utils.FileHelper {*;}

-keep class androidx.preference.**{ *; }
-keep class com.sevtinge.provision.activity.** { *; }
-keep class com.sevtinge.provision.fragment.** { *; }

-keep class fan.**{ *; }
-keep class miuix.mgl.** { *; }

-keep class cn.lyric.getter.api.**{ *; }
-keep class org.luckypray.dexkit.**{ *; }

-keepattributes SourceFile,LineNumberTable
-dontwarn android.app.ActivityTaskManager$RootTaskInfo
-dontwarn miui.app.MiuiFreeFormManager$MiuiFreeFormStackInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class QuickBack extends BaseHC {
@Override
protected void init() {
try {
Class<?> mReadyStateClass = findClass("com.miui.home.recents.GestureBackArrowView$ReadyState").get();
Class<?> mReadyStateClass = findClass("com.miui.home.recents.GestureBackArrowView$ReadyState");
Enum<?> READY_STATE_BACK = (Enum<?>) getStaticField(mReadyStateClass, "READY_STATE_BACK");
Enum<?> READY_STATE_RECENT = (Enum<?>) getStaticField(mReadyStateClass, "READY_STATE_RECENT");
Enum<?> READY_STATE_NONE = (Enum<?>) getStaticField(mReadyStateClass, "READY_STATE_NONE");
Expand Down Expand Up @@ -76,8 +76,8 @@ public void before() {
int ordinal = (int) callMethod(getCurrentState, "ordinal");
if (values == null) {
Class<?> mGestureStubView$X = existsClass("com.miui.home.recents.GestureStubView$4") ?
findClass("com.miui.home.recents.GestureStubView$4").get()
: findClass("com.miui.home.recents.GestureStubView$5").get();
findClass("com.miui.home.recents.GestureStubView$4")
: findClass("com.miui.home.recents.GestureStubView$5");
int[] mState = (int[]) getStaticField(mGestureStubView$X, "$SwitchMap$com$miui$home$recents$GestureBackArrowView$ReadyState");
ordinal = mState[ordinal];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public void before() {
Field effectSelectionField = mDexKit.findField(FindField.create()
.matcher(FieldMatcher.create()
.declaredClass(activityClass)
.type(findClass("miuix.preference.DropDownPreference").get())
.type(findClass("miuix.preference.DropDownPreference"))
.addReadMethod(MethodMatcher.create()
.declaredClass(activityClass)
.usingStrings("updateEffectSelectionPreference(): set as ")
)
)).singleOrNull().getFieldInstance(classLoader);

Class<?> preferenceCategoryClass = findClass("miuix.preference.PreferenceCategory").get();
Class<?> preferenceClass = findClass("androidx.preference.Preference").get();
Class<?> preferenceCategoryClass = findClass("miuix.preference.PreferenceCategory");
Class<?> preferenceClass = findClass("androidx.preference.Preference");
hook(create, new IHook() {
@Override
public void after() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public void before() {
Field prefsField = mDexKit.findField(FindField.create()
.matcher(FieldMatcher.create()
.declaredClass(activityClass)
.type(findClass("miuix.preference.DropDownPreference").get())
.type(findClass("miuix.preference.DropDownPreference"))
)
).singleOrNull().getFieldInstance(classLoader);

Class<?> preferenceCategoryClass = findClass("miuix.preference.PreferenceCategory").get();
Class<?> preferenceClass = findClass("androidx.preference.Preference").get();
Class<?> preferenceCategoryClass = findClass("miuix.preference.PreferenceCategory");
Class<?> preferenceClass = findClass("androidx.preference.Preference");
hook(create, new IHook() {
@Override
public void after() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void deoptimizeConstructors(Class<?> clazz) throws InvocationTargetExcept
for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
if (deoptimizeMethod != null) {
deoptimizeMethod.invoke(null, constructor);
Log.d("DisableFlagSecure", "Deoptimized constructor " + constructor);
Log.d("FlagSecure", "Deoptimized constructor " + constructor);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.sevtinge.hyperceiler.module.hook.systemframework;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import com.sevtinge.hyperceiler.module.base.BaseHook;

import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -80,10 +82,13 @@ protected void after(MethodHookParam param) throws Throwable {
fakeCts = false;
}
});
try {
deoptimizeMethod(method);
} catch (Throwable t) {
logE("UseAndroidPackageInstaller", "android", t);

if (isMoreHyperOSVersion(2f)) {
try {
deoptimizeMethod(method);
} catch (Throwable t) {
logE("UseAndroidPackageInstaller", "android", t);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.sevtinge.hyperceiler.module.hook.systemui.controlcenter.QSColor
import com.sevtinge.hyperceiler.module.hook.systemui.other.DefaultPluginTheme
import com.sevtinge.hyperceiler.module.hook.systemui.statusbar.icon.v.FocusNotifLyric
import com.sevtinge.hyperceiler.utils.api.PluginFactory
import com.sevtinge.hyperceiler.utils.devicesdk.isHyperOSVersion
import com.sevtinge.hyperceiler.utils.log.LogManager.logLevel
import java.lang.ref.WeakReference

Expand Down Expand Up @@ -83,7 +84,7 @@ object NewPluginHelperKt : BaseHook() {
),
Triple(
"NewShowVolumePct",
(isStyle == 2) && mPrefsMap.getBoolean("system_cc_volume_showpct_title"),
(isHyperOSVersion(1f) || isStyle == 2) && mPrefsMap.getBoolean("system_cc_volume_showpct_title"),
NewShowVolumePct::initLoader
),
Triple(
Expand Down Expand Up @@ -144,7 +145,7 @@ object NewPluginHelperKt : BaseHook() {
),
Triple(
"NewBrightnessPct",
(isStyle == 2) && mPrefsMap.getBoolean("system_showpct_title"),
(isHyperOSVersion(1f) || isStyle == 2) && mPrefsMap.getBoolean("system_showpct_title"),
NewBrightnessPct::initLoaderHook
),
Triple(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public NewUnPhraseLimit(DexKitBridge dexKitBridge) {
public void init() {
try {
// 解除 20 条限制
Class<?> InputMethodUtil = findClass("com.miui.inputmethod.InputMethodUtil").get();
Class<?> InputMethodUtil = findClass("com.miui.inputmethod.InputMethodUtil");
setStaticField(InputMethodUtil, "sPhraseListSize", 0);
hookMethod(InputMethodUtil, "queryPhrase", Context.class, new IHook() {
@Override
Expand All @@ -68,7 +68,7 @@ public void after() {
}
});

Class<?> AddPhraseActivity = findClass("com.miui.phrase.AddPhraseActivity").get();
Class<?> AddPhraseActivity = findClass("com.miui.phrase.AddPhraseActivity");
hookMethod("com.miui.phrase.PhraseEditActivity", "onClick", View.class, new IHook() {
@Override
public void before() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import android.content.Context;

import com.sevtinge.hyperceiler.module.hook.various.clipboard.LoadInputMethodDex;
import com.hchen.hooktool.BaseHC;
import com.hchen.hooktool.hook.IHook;
import com.hchen.hooktool.tool.additional.SystemPropTool;
Expand All @@ -48,7 +47,7 @@ public void load(ClassLoader classLoader) {
fakeSupportImeList(classLoader);
notDeleteNotSupportIme("com.miui.inputmethod.InputMethodBottomManager$MiuiSwitchInputMethodListener", classLoader);
if (!shouldHook) return;
Class<?> InputMethodBottomManager = findClass("com.miui.inputmethod.InputMethodBottomManager", classLoader).get();
Class<?> InputMethodBottomManager = findClass("com.miui.inputmethod.InputMethodBottomManager", classLoader);
if (InputMethodBottomManager != null) {
fakeIsSupportIme(InputMethodBottomManager);
fakeIsXiaoAiEnable(InputMethodBottomManager);
Expand All @@ -68,9 +67,9 @@ private void startHook() {
// 检查是否为小米定制输入法
if (Arrays.stream(miuiImeList).anyMatch(s -> s.equals(lpparam.packageName))) return;
shouldHook = true;
Class<?> sInputMethodServiceInjector = findClass("android.inputmethodservice.InputMethodServiceInjector").get();
Class<?> sInputMethodServiceInjector = findClass("android.inputmethodservice.InputMethodServiceInjector");
if (sInputMethodServiceInjector == null)
sInputMethodServiceInjector = findClass("android.inputmethodservice.InputMethodServiceStubImpl").get();
sInputMethodServiceInjector = findClass("android.inputmethodservice.InputMethodServiceStubImpl");
if (sInputMethodServiceInjector != null) {
fakeIsSupportIme(sInputMethodServiceInjector);
fakeIsXiaoAiEnable(sInputMethodServiceInjector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import static com.sevtinge.hyperceiler.utils.devicesdk.DeviceSDKKt.getDeviceToken;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.getSystemVersionIncremental;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
Expand Down Expand Up @@ -224,7 +222,6 @@ public void initPrefs() {
int lIIlllI = ClickCountsUtils.getClickCounts();
MainActivityContextHelper mainActivityContextHelper = new MainActivityContextHelper(requireContext());
Preference lIIllII = findPreference("prefs_key_various_enable_super_function");
Preference mQQGroup = findPreference("prefs_key_about_join_qq_group");
mDeviceName = findPreference("prefs_key_about_device_name");
mDeviceInfoDevice = findPreference("prefs_key_about_device_info_device");
mDeviceInfoAndroid = findPreference("prefs_key_about_device_info_android");
Expand Down Expand Up @@ -264,29 +261,6 @@ public void initPrefs() {
return false;
});
}

if (mQQGroup != null) {
mQQGroup.setOnPreferenceClickListener(preference -> {
joinQQGroup("MF68KGcOGYEfMvkV_htdyT6D6C13We_r");
return true;
});
}
}

/**
* 调用 joinQQGroup() 即可发起手Q客户端申请加群
*
* @param key 由官网生成的key
*/
private void joinQQGroup(String key) {
Intent intent = new Intent();
intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));

try {
startActivity(intent);
} catch (Exception e) {
// 未安装手Q或安装的版本不支持
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.sevtinge.hyperceiler.utils.devicesdk.MiDeviceAppUtilsKt.isPad;
import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isMoreHyperOSVersion;

import androidx.preference.PreferenceCategory;
import androidx.preference.SwitchPreference;

import com.sevtinge.hyperceiler.R;
Expand All @@ -37,6 +38,8 @@ public class HomeLayoutSettings extends DashboardFragment {
DropDownPreference mFolderTitlePosDropDownPref;
SwitchPreference mFolderHorPaddingSwitchPref;

PreferenceCategory mOldFunc;

@Override
public int getPreferenceScreenResId() {
return R.xml.home_layout;
Expand All @@ -49,6 +52,11 @@ public void initPrefs() {
mHotseatsMarginTopSwitchPref = findPreference("prefs_key_home_layout_hotseats_margin_top_enable");
mFolderTitlePosDropDownPref = findPreference("prefs_key_home_folder_title_pos");
mFolderHorPaddingSwitchPref = findPreference("prefs_key_home_folder_horizontal_padding_enable");
mOldFunc = findPreference("prefs_key_home_layout_old_func");

if (isMoreHyperOSVersion(2f)) {
mOldFunc.setVisible(false);
}

if (isPad()) {
mIconLayout.setVisible(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public class AudioEffectControlForSystem extends BaseEffectControl implements IC
private boolean mLast3dSurroundEnable = false;

public void init() {
mAudioManagerClass = findClass("android.media.AudioManager").get();
mMiSoundClass = findClass("android.media.audiofx.MiSound").get();
mAudioManagerClass = findClass("android.media.AudioManager");
mMiSoundClass = findClass("android.media.audiofx.MiSound");
if (existsClass("com.dolby.dax.DolbyAudioEffect")) {
mDolbyClass = findClass("com.dolby.dax.DolbyAudioEffect").get();
mDolbyClass = findClass("com.dolby.dax.DolbyAudioEffect");
isIntactDolbyClass = true;
} else
mDolbyClass = findClass("com.android.server.audio.dolbyeffect.DolbyEffectController$DolbyAudioEffectHelper").get();
mDolbyClass = findClass("com.android.server.audio.dolbyeffect.DolbyEffectController$DolbyAudioEffectHelper");

hookMethod("android.media.audiofx.AudioEffect",
"setEnabled",
Expand Down
Loading

0 comments on commit 06288bc

Please sign in to comment.