release签名

This commit is contained in:
Administrator 2025-07-18 18:51:31 +08:00
parent 42da6261fd
commit 54ec5023fc
3 changed files with 12 additions and 34 deletions

View File

@ -1,3 +1,4 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
@ -7,6 +8,15 @@ android {
namespace = "com.android.grape"
compileSdk = 35
signingConfigs {
getByName("release") {
storeFile = file("key.jks")
storePassword = "androidgrape"
keyAlias = "key0"
keyPassword = "androidgrape"
}
}
defaultConfig {
applicationId = "com.android.grape"
minSdk = 23

View File

@ -111,8 +111,8 @@ class RootlessSaiPackageInstaller private constructor(c: Context) :
val callbackIntent: Intent =
Intent(RootlessSaiPiBroadcastReceiver.ACTION_DELIVER_PI_EVENT)
val pendingIntent = PendingIntent.getBroadcast(context, 0, callbackIntent,
0)
session!!.commit(pendingIntent.intentSender)
PendingIntent.FLAG_IMMUTABLE)
session.commit(pendingIntent.intentSender)
}
} catch (e: Exception) {
Log.w(TAG, e)

View File

@ -100,33 +100,11 @@ public class ShellUtil {
public static String execRootCmdAndGetResult(String cmd) {
Log.d("ShellUtils", "execRootCmdAndGetResult - Started execution for command: " + cmd);
if (cmd == null || cmd.trim().isEmpty()) {
LogUtils.d(Log.ERROR, "ShellUtils", "Unsafe or empty command. Aborting execution.", null);
throw new IllegalArgumentException("Unsafe or empty command.");
}
// if (!isCommandSafe(cmd)) { // 检查命令的合法性
// Log.e("ShellUtils", "Detected unsafe command. Aborting execution.");
// throw new IllegalArgumentException("Detected unsafe command.");
// }
Process process = null;
ExecutorService executor = Executors.newFixedThreadPool(2);
try {
Log.d("ShellUtils", "Determining appropriate shell for execution...");
// if (hasBin("su")) {
// Log.d("ShellUtils", "'su' binary found, using 'su' shell.");
// process = Runtime.getRuntime().exec("su");
// } else if (hasBin("xu")) {
// Log.d("ShellUtils", "'xu' binary found, using 'xu' shell.");
// process = Runtime.getRuntime().exec("xu");
// } else if (hasBin("vu")) {
// Log.d("ShellUtils", "'vu' binary found, using 'vu' shell.");
// process = Runtime.getRuntime().exec("vu");
// } else {
// Log.d("ShellUtils", "No specific binary found, using 'sh' shell.");
// process = Runtime.getRuntime().exec("sh");
// }
process = Runtime.getRuntime().exec("vu");
try (OutputStream os = new BufferedOutputStream(process.getOutputStream());
@ -134,8 +112,6 @@ public class ShellUtil {
InputStream errorStream = process.getErrorStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
BufferedReader errorReader = new BufferedReader(new InputStreamReader(errorStream, StandardCharsets.UTF_8))) {
Log.d("ShellUtils", "Starting separate thread to process error stream...");
executor.submit(() -> {
String line;
try {
@ -146,12 +122,9 @@ public class ShellUtil {
LogUtils.d(Log.ERROR, "ShellUtils", "Error while reading process error stream: " + e.getMessage(), e);
}
});
Log.d("ShellUtils", "Writing the command to the shell...");
os.write((cmd + "\n").getBytes());
os.write("exit\n".getBytes());
os.flush();
Log.d("ShellUtils", "Command written to shell. Waiting for process to complete.");
StringBuilder output = new StringBuilder();
String line;
@ -159,8 +132,6 @@ public class ShellUtil {
Log.d("ShellUtils", "Shell Output: " + line);
output.append(line).append("\n");
}
Log.d("ShellUtils", "Awaiting process termination...");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (!process.waitFor(10, TimeUnit.SECONDS)) {
LogUtils.d(Log.ERROR, "ShellUtils", "Process execution timed out. Destroying process.", null);
@ -168,7 +139,6 @@ public class ShellUtil {
throw new RuntimeException("Shell command execution timeout.");
}
} else {
Log.d("ShellUtils", "Using manual time tracking method for process termination (API < 26).");
long startTime = System.currentTimeMillis();
while (true) {
try {
@ -184,8 +154,6 @@ public class ShellUtil {
}
}
}
Log.d("ShellUtils", "Process terminated successfully. Returning result.");
return output.toString().trim();
}
} catch (IOException | InterruptedException e) {