You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Add hide Magisk Manager feature
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.topjohnwu.unhide">
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="Unhide Magisk Manager"
|
||||
android:theme="@android:style/Theme.NoDisplay">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.topjohnwu.unhide;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String command = String.format(
|
||||
"pm unhide com.topjohnwu.magisk\n" +
|
||||
"am start -n com.topjohnwu.magisk/.SplashActivity\n" +
|
||||
"pm uninstall %s\n" +
|
||||
"exit\n",
|
||||
getApplicationInfo().packageName);
|
||||
Process process;
|
||||
try {
|
||||
process = Runtime.getRuntime().exec("su");
|
||||
OutputStream in = process.getOutputStream();
|
||||
in.write(command.getBytes("UTF-8"));
|
||||
in.flush();
|
||||
process.waitFor();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user