mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 15:50:20 +00:00
Add hide Magisk Manager feature
This commit is contained in:
1
unhide/.gitignore
vendored
Normal file
1
unhide/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
25
unhide/build.gradle
Normal file
25
unhide/build.gradle
Normal file
@@ -0,0 +1,25 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.1"
|
||||
defaultConfig {
|
||||
applicationId "com.topjohnwu.unhide"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
shrinkResources true
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation project(':resource')
|
||||
}
|
25
unhide/proguard-rules.pro
vendored
Normal file
25
unhide/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/topjohnwu/Library/Android/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
17
unhide/src/main/AndroidManifest.xml
Normal file
17
unhide/src/main/AndroidManifest.xml
Normal file
@@ -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>
|
33
unhide/src/main/java/com/topjohnwu/unhide/MainActivity.java
Normal file
33
unhide/src/main/java/com/topjohnwu/unhide/MainActivity.java
Normal file
@@ -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