Skip to content

Commit

Permalink
Merge pull request #23 from DerGoogler/1.6.3
Browse files Browse the repository at this point in the history
1.6.3
  • Loading branch information
DerGoogler authored Sep 17, 2023
2 parents 031aaf1 + a2201bf commit 580cbe0
Show file tree
Hide file tree
Showing 94 changed files with 27,281 additions and 10,782 deletions.
4 changes: 2 additions & 2 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId 'com.dergoogler.mmrl'
minSdk 26
targetSdk 33
versionName '1.6.2'
versionCode 162
versionName '1.6.3'
versionCode 163
externalNativeBuild {
cmake {
cppFlags "-llog"
Expand Down
4 changes: 2 additions & 2 deletions Android/app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 161,
"versionName": "1.6.1",
"versionCode": 163,
"versionName": "1.6.3",
"outputFile": "app-release.apk"
}
],
Expand Down
1 change: 1 addition & 0 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<queries>
<package android:name="com.topjohnwu.magisk" />
<package android:name="io.github.huskydg.magisk" />
<package android:name="me.weishu.kernelsu" />
</queries>

<application
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.dergoogler.core;

import android.content.Context;
import android.content.ContextWrapper;
import android.os.Environment;
import android.webkit.JavascriptInterface;

public class NativeEnvironment {

private final Context ctx;

public NativeEnvironment(Context ctx) {
this.ctx = ctx;
}

@JavascriptInterface
public String getExternalStorageDir() {
return Environment.getExternalStorageDirectory().getAbsolutePath();
}

@JavascriptInterface
public String getPackageDataDir() {
return this.ctx.getExternalFilesDir(null).getAbsolutePath();
}

@JavascriptInterface
public String getPublicDir(String type) {
return Environment.getExternalStoragePublicDirectory(type).getAbsolutePath();
}

@JavascriptInterface
public String getDataDir() {
return new ContextWrapper(this.ctx).getFilesDir().getPath();
}

}
167 changes: 0 additions & 167 deletions Android/app/src/main/java/com/dergoogler/core/NativeFs.java

This file was deleted.

22 changes: 22 additions & 0 deletions Android/app/src/main/java/com/dergoogler/core/NativeShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.ShellUtils;

import java.io.IOException;
import java.util.ArrayList;


Expand All @@ -28,6 +29,27 @@ public String result(String command) {
return ShellUtils.fastCmd(command);
}

@JavascriptInterface
public void isSuccess(String command) {
Shell.cmd(command).exec().isSuccess();
}

@JavascriptInterface
public void getCode(String command) {
Shell.cmd(command).exec().getCode();
}

@JavascriptInterface
public boolean isSuAvailable() {
try {
Runtime.getRuntime().exec("su --version");
return true;
} catch (IOException e) {
// java.io.IOException: Cannot run program "su": error=2, No such file or directory
return false;
}
}

@JavascriptInterface
public boolean isAppGrantedRoot() {
return Shell.cmd("if grep ' / ' /proc/mounts | grep -q '/dev/root' &> /dev/null; " +
Expand Down
Loading

0 comments on commit 580cbe0

Please sign in to comment.