Skip to content

Commit

Permalink
fix: openbydefaultsetting hook failed on sc ver > 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Oct 14, 2024
1 parent e5b695b commit 5621775
Show file tree
Hide file tree
Showing 14 changed files with 339 additions and 160 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ android {

dependencies {
compileOnly(project(":hidden-api"))
compileOnly(project(":miuistub"))
compileOnly(libs.xposed.api)
compileOnly(libs.androidx.preference)

implementation(libs.dexkit)
implementation(libs.ezxhelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void handleLoadPackage() {
initHook(new AppDetails(), mPrefsMap.getBoolean("security_center_app_details"));
initHook(DisableReport.INSTANCE, mPrefsMap.getBoolean("security_center_disable_ban"));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
initHook(OpenByDefaultSetting.INSTANCE, mPrefsMap.getBoolean("security_center_app_default_setting"));
initHook(new OpenByDefaultSetting(), mPrefsMap.getBoolean("security_center_app_default_setting"));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
initHook(new UnlockAppSandbox(), mPrefsMap.getBoolean("secutity_center_unlock_app_sandbox"));
Expand Down

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions app/src/main/res/xml/prefs_about_use.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@
android:action="android.intent.action.VIEW"
android:data="https://github.com/google/gson" />
</Preference>
<Preference
android:summary="RikkaApps | MIT"
android:title="HiddenApiRefinePlugin">
<intent
android:action="android.intent.action.VIEW"
android:data="https://github.com/RikkaApps/HiddenApiRefinePlugin" />
</Preference>
<Preference
android:summary="zerorooot | GPL-3.0"
android:title="HideMiuiClipboardDialog">
Expand Down
15 changes: 15 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
agp = "8.7.0"
annotationProcessor = "4.4.0"
hooktool = "v.0.9.6.5"
kotlinAndroid = "2.0.20"
lsparanoid = "0.6.0"
Expand All @@ -9,6 +10,7 @@ annotation = "1.8.2"
core = "1.13.1"
collection = "1.4.4"
fragment = "1.8.4"
preferenceVersion = "1.2.1"
recyclerview = "1.3.2"
lifecycle-common = "2.8.6"
vectordrawable = "1.2.0"
Expand All @@ -23,16 +25,24 @@ gson = "2.11.0"
dexkit = "2.0.2"
ezxhelper = "2.2.0"
hiddenapibypass = "4.3"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
appcompat = "1.6.1"
material = "1.10.0"

[libraries]
androidx-preference = { module = "androidx.preference:preference", version.ref = "preferenceVersion" }
annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
annotation-processor = { module = "dev.rikka.tools.refine:annotation-processor", version.ref = "annotationProcessor" }
core = { group = "androidx.core", name = "core", version.ref = "core" }
collection = { group = "androidx.collection", name = "collection", version.ref = "collection" }
fragment = { group = "androidx.fragment", name = "fragment", version.ref = "fragment" }
hooktool = { module = "com.github.HChenX:HookTool", version.ref = "hooktool" }
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" }
lifecycle-common = { group = "androidx.lifecycle", name = "lifecycle-common", version.ref = "lifecycle-common" }

refine-annotation = { module = "dev.rikka.tools.refine:annotation", version.ref = "annotationProcessor" }
vectordrawable = { group = "androidx.vectordrawable", name = "vectordrawable", version.ref = "vectordrawable" }
vectordrawable-animated = { group = "androidx.vectordrawable", name = "vectordrawable-animated", version.ref = "vectordrawable-animated" }
customview = { group = "androidx.customview", name = "customview", version.ref = "customview" }
Expand All @@ -45,6 +55,11 @@ gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
dexkit = { group = "org.luckypray", name = "dexkit", version.ref = "dexkit" }
ezxhelper = { group = "com.github.kyuubiran", name = "EzXHelper", version.ref = "ezxhelper" }
hiddenapibypass = { group = "org.lsposed.hiddenapibypass", name = "hiddenapibypass", version.ref = "hiddenapibypass" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
Expand Down
1 change: 1 addition & 0 deletions miuistub/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
14 changes: 14 additions & 0 deletions miuistub/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
alias(libs.plugins.androidLibrary)
}

android {
namespace = "miui.os"
compileSdk = 35
}

dependencies {
annotationProcessor(libs.annotation.processor)
compileOnly(libs.refine.annotation)
compileOnly(libs.androidx.preference)
}
10 changes: 10 additions & 0 deletions miuistub/src/main/java/android/app/ActivityManagerHidden.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package android.app;

import dev.rikka.tools.refine.RefineAs;

@RefineAs(ActivityManager.class)
public class ActivityManagerHidden {
public static int getCurrentUser() {
throw new RuntimeException("Stub!");
}
}
13 changes: 13 additions & 0 deletions miuistub/src/main/java/android/content/ContextHidden.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package android.content;

import android.os.UserHandle;

import dev.rikka.tools.refine.RefineAs;

@RefineAs(Context.class)
public class ContextHidden {
public void startActivityAsUser(Intent intent,
UserHandle user) {
throw new RuntimeException("Stub!");
}
}
15 changes: 15 additions & 0 deletions miuistub/src/main/java/android/os/SystemProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package android.os;

public class SystemProperties {
private SystemProperties() {

}

public static String get(String key) {
throw new RuntimeException("Stub!");
}

public static int getInt(String string, int i) {
throw new RuntimeException("Stub!");
}
}
16 changes: 16 additions & 0 deletions miuistub/src/main/java/android/os/UserHandleHidden.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package android.os;

import dev.rikka.tools.refine.RefineAs;

@RefineAs(UserHandle.class)
public class UserHandleHidden {
public static final int USER_ALL = -1;
public static final int USER_CURRENT = -2;

public static final UserHandle CURRENT = null /*new UserHandle(USER_CURRENT) */;

public static UserHandle of(int userId) {
throw new RuntimeException("Stub!");
}

}
5 changes: 5 additions & 0 deletions miuistub/src/main/java/miui/os/Build.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package miui.os;

public class Build extends android.os.Build {
public static boolean IS_INTERNATIONAL_BUILD;
}
18 changes: 18 additions & 0 deletions miuistub/src/main/java/miuix/preference/TextPreference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package miuix.preference;

import android.content.Context;
import android.util.AttributeSet;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.Preference;

public class TextPreference extends Preference {
public TextPreference(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}

public void setText(String str) {
throw new RuntimeException("Stub!");
}
}
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
@file:Suppress("UnstableApiUsage")

include(":miuix")


pluginManagement {
repositories {
gradlePluginPortal()
Expand All @@ -20,3 +23,4 @@ dependencyResolutionManagement {

rootProject.name = "HyperCeiler"
include(":app", ":hidden-api")
include(":app", ":miuistub")

0 comments on commit 5621775

Please sign in to comment.