From 06ffc52e110c75d3a8d8b55bd79797330a3e5bb0 Mon Sep 17 00:00:00 2001 From: Aefyr Date: Thu, 29 Aug 2019 21:15:57 +0300 Subject: [PATCH] fix session creation in rooted installer increment version --- app/build.gradle | 4 ++-- .../rooted/RootedSAIPackageInstaller.java | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1332fbc7..7da24a8f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.aefyr.sai" minSdkVersion 21 targetSdkVersion 28 - versionCode 33 - versionName "2.3" + versionCode 34 + versionName "2.4" } buildTypes { release { diff --git a/app/src/main/java/com/aefyr/sai/installer/rooted/RootedSAIPackageInstaller.java b/app/src/main/java/com/aefyr/sai/installer/rooted/RootedSAIPackageInstaller.java index 50ea4686..f19c5174 100644 --- a/app/src/main/java/com/aefyr/sai/installer/rooted/RootedSAIPackageInstaller.java +++ b/app/src/main/java/com/aefyr/sai/installer/rooted/RootedSAIPackageInstaller.java @@ -126,10 +126,15 @@ private int createSession() throws RuntimeException { List> attemptedCommands = new ArrayList<>(); for (String commandToAttempt : commandsToAttempt) { - String result = ensureCommandSucceeded(Root.exec(commandToAttempt)); - attemptedCommands.add(new Pair<>(commandToAttempt, result)); + Root.Result result = Root.exec(commandToAttempt); + attemptedCommands.add(new Pair<>(commandToAttempt, result.toString())); - Integer sessionId = extractSessionId(result); + if (!result.isSuccessful()) { + Log.w(TAG, String.format("Command failed: %s > %s", commandToAttempt, result)); + continue; + } + + Integer sessionId = extractSessionId(result.out); if (sessionId != null) return sessionId; else @@ -137,8 +142,9 @@ private int createSession() throws RuntimeException { } StringBuilder exceptionMessage = new StringBuilder("Unable to create session, attempted commands: "); + int i = 1; for (Pair attemptedCommand : attemptedCommands) { - exceptionMessage.append("\n\n==========================\n") + exceptionMessage.append("\n\n").append(i++).append(") ==========================\n") .append(attemptedCommand.first) .append("\nVVVVVVVVVVVVVVVV\n") .append(attemptedCommand.second);