Skip to content

Commit 7e8ef2a

Browse files
committed
Last version
1 parent d17a490 commit 7e8ef2a

File tree

13 files changed

+614
-47
lines changed

13 files changed

+614
-47
lines changed

src/main/java/helper/ExternalProcess2.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,12 @@ public static void clearData(String packageName) throws Exception {
182182
*
183183
* @param Filename
184184
* is the path where the file will be saved.
185+
* @throws RipException
186+
* @throws IOException
185187
* @throws Exception
186188
* if filename is wrong, not valid directory
187189
*/
188-
public static void takeScreenshot(String filename) throws Exception {
190+
public static void takeScreenshot(String filename) throws IOException, RipException {
189191

190192
String example = "/sdcard/screen.png";
191193

@@ -203,10 +205,12 @@ public static void takeScreenshot(String filename) throws Exception {
203205
* must be replaced with the path of the file in the device
204206
* @param LocalFilePath
205207
* is the path where the file will be stored in the computer.
208+
* @throws RipException
209+
* @throws IOException
206210
* @throws Exception
207211
* if any path is wrong
208212
*/
209-
public static void pullFile(String remotePath, String localPath) throws Exception {
213+
public static void pullFile(String remotePath, String localPath) throws IOException, RipException {
210214

211215
String remotePathEx = "/sdcard/sreen.png";
212216
String localPathEx = "screenPull.png";
@@ -229,10 +233,12 @@ public static void pullFile(String remotePath, String localPath) throws Exceptio
229233
* is the path where the file will be stored in the computer.
230234
* @param Filename
231235
* is the path where the file will be saved.
236+
* @throws RipException
237+
* @throws IOException
232238
* @throws Exception
233239
* if filename is wrong, not valid directory or any path is wrong
234240
*/
235-
public static void pullScreenshot(String filename, String remotePath, String localPath) throws Exception {
241+
public static void pullScreenshot(String filename, String remotePath, String localPath) throws IOException, RipException {
236242

237243
String filenameEx = "/sdcard/screen2.png";
238244
String remotePathEx = "/sdcard/screen2.png";
@@ -377,8 +383,10 @@ public static void scroll(String coordX1, String coordY1, String coordX2, String
377383
/**
378384
* Simulates the effect of touching back soft button, return to the last
379385
* activity. 4 is KEYCODE_BACK
386+
* @throws RipException
387+
* @throws IOException
380388
*/
381-
public static void goBack() throws Exception {
389+
public static void goBack() throws IOException, RipException {
382390

383391
List<String> commands = Arrays.asList("adb", "shell", "input", "keyevent", "4");
384392
executeProcess(commands, "GO BACK", null, null);
@@ -388,8 +396,10 @@ public static void goBack() throws Exception {
388396
/**
389397
* Simulates the effect of touching home soft button, return home. 3 is
390398
* KEYCODE_HOME
399+
* @throws RipException
400+
* @throws IOException
391401
*/
392-
public static void goHome() throws Exception {
402+
public static void goHome() throws IOException, RipException {
393403

394404
List<String> commands = Arrays.asList("adb", "shell", "input", "keyevent", "3");
395405
executeProcess(commands, "GO HOME", null, null);
@@ -1333,5 +1343,4 @@ public static void readWebViewConsole() throws InterruptedException {
13331343
e.printStackTrace();
13341344
}
13351345
}
1336-
13371346
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package hybridResources;
2+
3+
import java.io.BufferedReader;
4+
import java.io.IOException;
5+
import java.io.InputStream;
6+
import java.io.InputStreamReader;
7+
8+
import main.Rip2;
9+
10+
public class JSConsoleReader extends Thread {
11+
12+
private static Rip2 rip;
13+
14+
private static boolean isRunning = true;
15+
16+
public JSConsoleReader(Rip2 mainThread) {
17+
super();
18+
rip = mainThread;
19+
}
20+
21+
public void run() {
22+
try {
23+
readWebViewConsole();
24+
} catch (InterruptedException e) {
25+
e.printStackTrace();
26+
}
27+
}
28+
29+
public static void readWebViewConsole() throws InterruptedException {
30+
try {
31+
Process proc = Runtime.getRuntime().exec("adb logcat chromium:D SystemWebViewClient:D *:S");
32+
InputStream inputStream = proc.getInputStream();
33+
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
34+
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
35+
String line = null;
36+
while ((line = bufferedReader.readLine()) != null && isRunning) {
37+
System.out.println(line);
38+
if(line.contains("E chromium")) {
39+
40+
}
41+
}
42+
proc.waitFor();
43+
} catch (IOException e) {
44+
e.printStackTrace();
45+
}
46+
}
47+
48+
public void kill() {
49+
isRunning = false;
50+
}
51+
52+
}

0 commit comments

Comments
 (0)