├── .gitignore ├── Readme.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── xposed_init │ ├── java │ └── com │ │ └── bintianqi │ │ └── hookdpm │ │ ├── DefaultApplication.kt │ │ ├── MainActivity.kt │ │ └── hook │ │ └── HookEntry.kt │ ├── res │ ├── values-zh-rCN │ │ └── strings.xml │ └── values │ │ ├── array.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── resources │ └── META-INF │ └── yukihookapi_init ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | .cxx 10 | local.properties -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # HookDPM 2 | 3 | A Xposed module that hooks DevicePolicyManagerService. 4 | 5 | 一个hook DevicePolicyManagerService的Xposed模块 6 | 7 | Build with YukiHook API / 使用YukiHookAPI构建 8 | 9 | ## Features 10 | 11 | - Bypass account check 12 | 13 | - **[Danger]** Force set Device owner 14 | - **[Danger]** Force set Profile owner 15 | - **[Danger]** Always allow provisioning (create work profile) 16 | - **[Danger]** Skip provisioning check 17 | 18 | ## 功能 19 | 20 | - 绕过账号检查 21 | 22 | - **【危险】** 强制设置Device owner 23 | - **【危险】** 强制设置Profile owner 24 | - **【危险】** 总是允许创建工作资料 25 | - **【危险】** 跳过创建工作资料的检查 26 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | /debug -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) 3 | alias(libs.plugins.kotlin.android) 4 | alias(libs.plugins.ksp) 5 | } 6 | 7 | android { 8 | namespace = "com.bintianqi.hookdpm" 9 | compileSdk = 34 10 | 11 | defaultConfig { 12 | applicationId = "com.bintianqi.hookdpm" 13 | minSdk = 23 14 | targetSdk = 34 15 | versionName = "1.1" 16 | versionCode = 2 17 | } 18 | buildTypes { 19 | release { 20 | isMinifyEnabled = true 21 | isShrinkResources = true 22 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility = JavaVersion.VERSION_17 27 | targetCompatibility = JavaVersion.VERSION_17 28 | } 29 | kotlinOptions { 30 | jvmTarget = "17" 31 | freeCompilerArgs = listOf( 32 | "-Xno-param-assertions", 33 | "-Xno-call-assertions", 34 | "-Xno-receiver-assertions" 35 | ) 36 | } 37 | buildFeatures { 38 | buildConfig = true 39 | compose = true 40 | } 41 | composeOptions { 42 | kotlinCompilerExtensionVersion = "1.5.14" 43 | } 44 | } 45 | 46 | dependencies { 47 | compileOnly(libs.xposed.api) 48 | implementation(libs.yukihook.api) 49 | ksp(libs.yukihook.ksp.xposed) 50 | implementation(libs.androidx.activity.compose) 51 | implementation(libs.androidx.material3) 52 | implementation(libs.androidx.ui) 53 | } 54 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle.kts. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | # FreeReflection 24 | -keep class me.weishu.reflection.** {*;} 25 | 26 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics { 27 | public static *** throwUninitializedProperty(...); 28 | public static *** throwUninitializedPropertyAccessException(...); 29 | } 30 | 31 | -keepclassmembers class * implements androidx.viewbinding.ViewBinding { 32 | *** inflate(android.view.LayoutInflater); 33 | } 34 | 35 | -keep class * extends android.app.Activity 36 | -keep class * implements androidx.viewbinding.ViewBinding { 37 | (); 38 | *** inflate(android.view.LayoutInflater); 39 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | com.bintianqi.hookdpm.hook.HookEntry_YukiHookXposedInit -------------------------------------------------------------------------------- /app/src/main/java/com/bintianqi/hookdpm/DefaultApplication.kt: -------------------------------------------------------------------------------- 1 | package com.bintianqi.hookdpm 2 | 3 | import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication 4 | 5 | class DefaultApplication : ModuleApplication() { 6 | override fun onCreate() { 7 | super.onCreate() 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/bintianqi/hookdpm/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.bintianqi.hookdpm 2 | 3 | import android.content.ComponentName 4 | import android.content.Context 5 | import android.content.pm.PackageManager 6 | import android.os.Build.VERSION 7 | import android.os.Bundle 8 | import androidx.activity.ComponentActivity 9 | import androidx.activity.compose.setContent 10 | import androidx.activity.enableEdgeToEdge 11 | import androidx.compose.foundation.* 12 | import androidx.compose.foundation.layout.* 13 | import androidx.compose.foundation.shape.RoundedCornerShape 14 | import androidx.compose.material3.* 15 | import androidx.compose.runtime.* 16 | import androidx.compose.ui.Alignment 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.draw.clip 19 | import androidx.compose.ui.graphics.Color 20 | import androidx.compose.ui.graphics.toArgb 21 | import androidx.compose.ui.platform.LocalContext 22 | import androidx.compose.ui.platform.LocalView 23 | import androidx.compose.ui.res.stringResource 24 | import androidx.compose.ui.unit.dp 25 | import androidx.core.view.WindowCompat 26 | import com.highcapable.yukihookapi.YukiHookAPI 27 | import com.highcapable.yukihookapi.hook.factory.prefs 28 | 29 | class MainActivity : ComponentActivity() { 30 | override fun onCreate(savedInstanceState: Bundle?) { 31 | super.onCreate(savedInstanceState) 32 | WindowCompat.setDecorFitsSystemWindows(window, false) 33 | enableEdgeToEdge() 34 | setContent { 35 | val context = LocalContext.current 36 | val darkTheme = isSystemInDarkTheme() 37 | val view = LocalView.current 38 | SideEffect { 39 | window.statusBarColor = Color.Transparent.toArgb() 40 | WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme 41 | } 42 | if(VERSION.SDK_INT >= 31) { 43 | val colorScheme = if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) 44 | MaterialTheme( 45 | colorScheme = colorScheme 46 | ) { 47 | Home() 48 | } 49 | } else { 50 | Home() 51 | } 52 | } 53 | } 54 | } 55 | 56 | @OptIn(ExperimentalMaterial3Api::class) 57 | @Composable 58 | private fun Home() { 59 | val context = LocalContext.current 60 | Scaffold( 61 | topBar = { 62 | TopAppBar(title = { Text(stringResource(R.string.app_name)) }) 63 | } 64 | ) { paddingValues -> 65 | Column( 66 | modifier = Modifier 67 | .fillMaxSize() 68 | .verticalScroll(rememberScrollState()) 69 | .padding(top = paddingValues.calculateTopPadding(), start = 12.dp, end = 12.dp), 70 | ){ 71 | val active = YukiHookAPI.Status.isXposedModuleActive 72 | // IPA: isProvisioningAllowed 73 | // CPP: checkProvisioningPreCondition 74 | var forceDO by remember { mutableStateOf(false) } 75 | var forcePO by remember { mutableStateOf(false) } 76 | var hookIPA by remember { mutableStateOf(false) } 77 | var hookCPP by remember { mutableStateOf(false) } 78 | var hideIcon by remember { mutableStateOf(false) } 79 | var bypassAccountCheck by remember { mutableStateOf(false) } 80 | LaunchedEffect(Unit) { 81 | if(active) { 82 | forceDO = context.prefs().getBoolean("force_do", false) 83 | forcePO = context.prefs().getBoolean("force_po", false) 84 | hookIPA = context.prefs().getBoolean("hook_ipa", false) 85 | hookCPP = context.prefs().getBoolean("hook_cpp", false) 86 | bypassAccountCheck = context.prefs().getBoolean("bypass_account_check", false) 87 | } 88 | hideIcon = isLauncherIconHiding(context) 89 | } 90 | Column( 91 | modifier = Modifier 92 | .fillMaxWidth() 93 | .clip(RoundedCornerShape(15)) 94 | .background(MaterialTheme.colorScheme.primary) 95 | .padding(10.dp) 96 | ) { 97 | Text( 98 | text = stringResource(if(active) R.string.module_activated else R.string.module_not_activated), 99 | style = MaterialTheme.typography.titleLarge, 100 | color = MaterialTheme.colorScheme.onPrimary 101 | ) 102 | Text( 103 | text = stringResource(R.string.module_version_is) + BuildConfig.VERSION_NAME, 104 | color = MaterialTheme.colorScheme.onPrimary 105 | ) 106 | } 107 | SwitchItem( 108 | text = stringResource(R.string.hide_launcher_icon), 109 | checked = hideIcon, 110 | onCheckedChange = { 111 | context.packageManager?.setComponentEnabledSetting( 112 | ComponentName(context.packageName, "${context.packageName}.Home"), 113 | if (it) PackageManager.COMPONENT_ENABLED_STATE_DISABLED 114 | else PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 115 | PackageManager.DONT_KILL_APP 116 | ) 117 | hideIcon = isLauncherIconHiding(context) 118 | } 119 | ) 120 | Spacer(Modifier.padding(vertical = 10.dp)) 121 | if(active) { 122 | Text( 123 | text = "Hook", 124 | style = MaterialTheme.typography.titleLarge 125 | ) 126 | SwitchItem( 127 | text = stringResource(R.string.bypass_account_check), 128 | checked = bypassAccountCheck, 129 | onCheckedChange = { 130 | context.prefs().edit{ putBoolean("bypass_account_check", it) } 131 | bypassAccountCheck = context.prefs().getBoolean("bypass_account_check", false) 132 | } 133 | ) 134 | Spacer(Modifier.padding(vertical = 10.dp)) 135 | Text( 136 | text = stringResource(R.string.danger_zone), 137 | style = MaterialTheme.typography.titleLarge 138 | ) 139 | SwitchItem( 140 | text = stringResource(R.string.force_set_device_owner), 141 | checked = forceDO, 142 | onCheckedChange = { 143 | context.prefs().edit{ putBoolean("force_do", it) } 144 | forceDO = context.prefs().getBoolean("force_do", false) 145 | } 146 | ) 147 | SwitchItem( 148 | text = stringResource(R.string.force_set_profile_owner), 149 | checked = forcePO, 150 | onCheckedChange = { 151 | context.prefs().edit{ putBoolean("force_po", it) } 152 | forcePO = context.prefs().getBoolean("force_po", false) 153 | } 154 | ) 155 | SwitchItem( 156 | text = stringResource(R.string.always_allow_provisioning), 157 | checked = hookIPA, 158 | onCheckedChange = { 159 | context.prefs().edit{ putBoolean("hook_ipa", it) } 160 | hookIPA = context.prefs().getBoolean("hook_ipa", false) 161 | } 162 | ) 163 | SwitchItem( 164 | text = stringResource(R.string.skip_provisioning_check), 165 | checked = hookCPP, 166 | onCheckedChange = { 167 | context.prefs().edit{ putBoolean("hook_cpp", it) } 168 | hookCPP = context.prefs().getBoolean("hook_cpp", false) 169 | } 170 | ) 171 | } 172 | } 173 | } 174 | } 175 | 176 | @Composable 177 | private fun SwitchItem( 178 | text: String, checked: Boolean, onCheckedChange: (Boolean) -> Unit 179 | ) { 180 | Row( 181 | modifier = Modifier.fillMaxWidth(), 182 | horizontalArrangement = Arrangement.SpaceBetween, 183 | verticalAlignment = Alignment.CenterVertically 184 | ) { 185 | Text(text = text) 186 | Switch( 187 | checked = checked, 188 | onCheckedChange = onCheckedChange 189 | ) 190 | } 191 | } 192 | 193 | private fun isLauncherIconHiding(context: Context):Boolean { 194 | return context.packageManager?.getComponentEnabledSetting( 195 | ComponentName(context.packageName, "${context.packageName}.Home") 196 | ) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED 197 | } 198 | 199 | -------------------------------------------------------------------------------- /app/src/main/java/com/bintianqi/hookdpm/hook/HookEntry.kt: -------------------------------------------------------------------------------- 1 | package com.bintianqi.hookdpm.hook 2 | 3 | import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed 4 | import com.highcapable.yukihookapi.hook.factory.encase 5 | import com.highcapable.yukihookapi.hook.factory.method 6 | import com.highcapable.yukihookapi.hook.type.java.BooleanType 7 | import com.highcapable.yukihookapi.hook.type.java.IntType 8 | import com.highcapable.yukihookapi.hook.type.java.StringClass 9 | import com.highcapable.yukihookapi.hook.type.java.UnitType 10 | import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit 11 | 12 | @InjectYukiHookWithXposed 13 | object HookEntry : IYukiHookXposedInit { 14 | override fun onHook() = encase { 15 | loadSystem { 16 | val dpms = "com.android.server.devicepolicy.DevicePolicyManagerService".toClass() 17 | dpms.method { 18 | name = "enforceCanSetDeviceOwnerLocked" 19 | paramCount = 4 20 | returnType = UnitType 21 | }.hook { 22 | if(prefs.getBoolean("force_do", false)) { 23 | replaceUnit { } 24 | } 25 | } 26 | dpms.method { 27 | name = "checkDeviceOwnerProvisioningPreConditionLocked" 28 | paramCount = 5 29 | returnType = IntType 30 | }.hook { 31 | after { 32 | if(prefs.getBoolean("force_do", false)) { 33 | result = 0 34 | } 35 | } 36 | } 37 | dpms.method { 38 | name = "enforceCanSetProfileOwnerLocked" 39 | paramCount = 4 40 | returnType = UnitType 41 | }.hook { 42 | if(prefs.getBoolean("force_po", false)) { 43 | replaceUnit { } 44 | } 45 | } 46 | dpms.method { 47 | name = "hasIncompatibleAccountsOnAnyUser" 48 | emptyParam() 49 | returnType = BooleanType 50 | }.hook { 51 | after { 52 | if(prefs.getBoolean("bypass_account_check", false)) { 53 | result = false 54 | } 55 | } 56 | } 57 | dpms.method { 58 | name = "hasAccountsOnAnyUser" 59 | emptyParam() 60 | returnType = BooleanType 61 | }.hook { 62 | after { 63 | if(prefs.getBoolean("bypass_account_check", false)) { 64 | result = false 65 | } 66 | } 67 | } 68 | dpms.method { 69 | name = "nonTestNonPrecreatedUsersExist" 70 | emptyParam() 71 | returnType = BooleanType 72 | }.hook { 73 | after { 74 | if(prefs.getBoolean("enhanced_mode", false)) { 75 | result = false 76 | } 77 | } 78 | } 79 | dpms.method { 80 | name = "isProvisioningAllowed" 81 | param(StringClass, StringClass) 82 | returnType = BooleanType 83 | }.hook { 84 | after { 85 | if(prefs.getBoolean("hook_ipa", false)) { 86 | result = true 87 | } 88 | } 89 | } 90 | dpms.method { 91 | name = "checkProvisioningPrecondition" 92 | param(StringClass, StringClass) 93 | returnType = IntType 94 | }.hook { 95 | after { 96 | if(prefs.getBoolean("hook_cpp", false)) { 97 | result = 0 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hook DevicePolicyManager 4 | 模块已激活 5 | 模块未激活 6 | 模块版本: 7 | 隐藏启动器图标 8 | 绕过账号检查 9 | 强制设置Device owner 10 | 强制设置Profile owner 11 | 危险功能 12 | 总是允许创建工作资料 13 | 跳过创建工作资料检查 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/array.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | android 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HookDPM 3 | Hook DevicePolicyManager 4 | Module activated 5 | Module not activated 6 | Module version: 7 | Hide launcher icon 8 | Bypass account check 9 | Force set Device owner 10 | Force set Profile owner 11 | Danger zone 12 | Always allow provisioning 13 | Skip provisioning check 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/resources/META-INF/yukihookapi_init: -------------------------------------------------------------------------------- 1 | com.bintianqi.hookdpm.hook.HookEntry -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) apply false 3 | alias(libs.plugins.kotlin.android) apply false 4 | alias(libs.plugins.ksp) apply false 5 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Compiler Configuration 2 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 3 | android.useAndroidX=true 4 | android.nonTransitiveRClass=true 5 | kotlin.code.style=official 6 | kotlin.incremental.useClasspathSnapshot=true 7 | # Project Configuration 8 | project.name=HookDPM 9 | project.android.compileSdk=34 10 | project.android.minSdk=27 11 | project.android.targetSdk=34 12 | project.app.packageName=com.bintianqi.hookdpm 13 | project.app.versionName="1.0.0" 14 | project.app.versionCode=1 15 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.5.0" 3 | kt = "1.9.24" 4 | ksp = "1.9.24-1.0.20" 5 | 6 | androidx-activity-compose = "1.9.0" 7 | material3 = "1.2.1" 8 | xposed-api = "82" 9 | yukihook-api = "1.2.0" 10 | 11 | [libraries] 12 | androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" } 13 | androidx-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" } 14 | androidx-ui = { module = "androidx.compose.ui:ui" } 15 | 16 | 17 | xposed-api = { module = "de.robv.android.xposed:api", name = "api", version.ref = "xposed-api" } 18 | yukihook-api = { module = "com.highcapable.yukihookapi:api", name = "api", version.ref = "yukihook-api" } 19 | yukihook-ksp-xposed = { module = "com.highcapable.yukihookapi:ksp-xposed", name = "ksp-xposed", version.ref = "yukihook-api" } 20 | 21 | [plugins] 22 | android-application = { id = "com.android.application", version.ref = "agp" } 23 | kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kt" } 24 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } 25 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinTianqi/HookDPM/60b068fba9548becd223faa9394e8920ccbb6511/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Apr 27 09:45:11 CST 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositories { 10 | google() 11 | mavenCentral() 12 | maven("https://jitpack.io") 13 | maven("https://api.xposed.info") 14 | } 15 | } 16 | rootProject.name = "HookDPM" 17 | 18 | include(":app") 19 | --------------------------------------------------------------------------------