-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ava/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/DisableDeviceManaged.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.sevtinge.hyperceiler.module.hook.systemui.controlcenter; | ||
|
||
import static de.robv.android.xposed.XposedHelpers.setBooleanField; | ||
|
||
import android.app.admin.DevicePolicyManager; | ||
import android.graphics.drawable.Drawable; | ||
|
||
import com.sevtinge.hyperceiler.module.base.BaseHook; | ||
|
||
public class DisableDeviceManaged extends BaseHook { | ||
@Override | ||
public void init() throws NoSuchMethodException { | ||
findAndHookMethod(DevicePolicyManager.class, "isDeviceManaged", new MethodHook(){ | ||
@Override | ||
protected void before(MethodHookParam param) throws Throwable { | ||
param.setResult(false); | ||
} | ||
}); | ||
findAndHookMethod("com.android.systemui.statusbar.policy.SecurityControllerImpl", "isDeviceManaged", new MethodHook(){ | ||
@Override | ||
protected void before(MethodHookParam param) throws Throwable { | ||
param.setResult(false); | ||
} | ||
}); | ||
findAndHookMethod("com.android.systemui.statusbar.policy.SecurityControllerImpl", "hasCACertInCurrentUser", new MethodHook(){ | ||
@Override | ||
protected void before(MethodHookParam param) throws Throwable { | ||
param.setResult(false); | ||
} | ||
}); | ||
findAndHookMethod("com.android.systemui.statusbar.policy.SecurityControllerImpl", "hasCACertInWorkProfile", new MethodHook(){ | ||
@Override | ||
protected void before(MethodHookParam param) throws Throwable { | ||
param.setResult(false); | ||
} | ||
}); | ||
findAndHookConstructor("com.android.systemui.security.data.model.SecurityModel", boolean.class, boolean.class, boolean.class, boolean.class, String.class, String.class, boolean.class, boolean.class, String.class, String.class, boolean.class, boolean.class, boolean.class, Drawable.class, new MethodHook(){ | ||
@Override | ||
protected void before(MethodHookParam param) throws Throwable { | ||
param.args[0] = false; | ||
param.args[10] = false; | ||
param.args[11] = false; | ||
setBooleanField(param.thisObject, "isDeviceManaged", false); | ||
setBooleanField(param.thisObject, "hasCACertInCurrentUser", false); | ||
setBooleanField(param.thisObject, "hasCACertInWorkProfile", false); | ||
} | ||
}); | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
.../java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/DisableDeviceManaged.kt
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
.../main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/DisableDeviceManaged.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.sevtinge.hyperceiler.module.hook.systemui.plugin; | ||
|
||
import android.app.admin.DevicePolicyManager; | ||
import android.content.Context; | ||
import android.os.Handler; | ||
|
||
import java.util.concurrent.Executor; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XC_MethodReplacement; | ||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
public class DisableDeviceManaged { | ||
public static void initDisableDeviceManaged(ClassLoader classLoader) { | ||
XposedHelpers.findAndHookMethod(DevicePolicyManager.class, "isDeviceManaged", XC_MethodReplacement.returnConstant(false)); | ||
XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.policy.SecurityController", classLoader, "isDeviceManaged", XC_MethodReplacement.returnConstant(false)); | ||
XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.policy.SecurityController", classLoader, "hasCACertInCurrentUser", XC_MethodReplacement.returnConstant(false)); | ||
XposedHelpers.findAndHookMethod("miui.systemui.controlcenter.policy.SecurityController", classLoader, "hasCACertInWorkProfile", XC_MethodReplacement.returnConstant(false)); | ||
XposedHelpers.findAndHookConstructor("miui.systemui.controlcenter.policy.SecurityController", classLoader, Context.class, Handler.class, Executor.class, "miui.systemui.boardcast.BroadcastDispatcher", "miui.systemui.util.SystemUIResourcesHelper", new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
XposedHelpers.setObjectField(param.thisObject, "hasCACerts", null); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters