This callback should process the line as quickly as possible. Delays in this callback may pause the
39 | * native process or even type in a deadlock
40 | *
41 | * @param line
42 | * String that was gobbled
43 | */
44 | void onLine(String line);
45 | }
46 |
47 | private final BufferedReader reader;
48 | private List writer;
49 | private OnLineListener listener;
50 |
51 | /**
52 | * StreamGobbler constructor
53 | *
54 | * We use this class because shell STDOUT and STDERR should be readConfig as quickly as possible to prevent a
55 | * deadlock from occurring, or Process.waitFor() never returning (as the buffer is full, pausing the native
56 | * process)
57 | *
58 | * @param inputStream
59 | * InputStream to readConfig from
60 | * @param outputList
61 | * List to write to, or null
62 | */
63 | public StreamGobbler(InputStream inputStream, List outputList) {
64 | reader = new BufferedReader(new InputStreamReader(inputStream));
65 | writer = outputList;
66 | }
67 |
68 | /**
69 | * StreamGobbler constructor
70 | *
71 | * We use this class because shell STDOUT and STDERR should be readConfig as quickly as possible to prevent a
72 | * deadlock from occurring, or Process.waitFor() never returning (as the buffer is full, pausing the native
73 | * process)
74 | *
75 | * @param inputStream
76 | * InputStream to readConfig from
77 | * @param onLineListener
78 | * OnLineListener callback
79 | */
80 | public StreamGobbler(InputStream inputStream, OnLineListener onLineListener) {
81 | reader = new BufferedReader(new InputStreamReader(inputStream));
82 | listener = onLineListener;
83 | }
84 |
85 | @Override
86 | public void run() {
87 | // keep reading the InputStream until it ends (or an error occurs)
88 | try {
89 | String line;
90 | while ((line = reader.readLine()) != null) {
91 | if (writer != null) {
92 | writer.add(line);
93 | }
94 | if (listener != null) {
95 | listener.onLine(line);
96 | }
97 | }
98 | } catch (IOException e) {
99 | // reader probably closed, expected exit condition
100 | }
101 |
102 | // make sure our stream is closed and resources will be freed
103 | try {
104 | reader.close();
105 | } catch (IOException ignored) {
106 | }
107 | }
108 |
109 | }
--------------------------------------------------------------------------------
/hotxposed/src/main/java/net/androidwing/hotxposed/thread/ThreadPool.java:
--------------------------------------------------------------------------------
1 | package net.androidwing.hotxposed.thread;
2 |
3 | import java.util.concurrent.ArrayBlockingQueue;
4 | import java.util.concurrent.Executors;
5 | import java.util.concurrent.ScheduledExecutorService;
6 | import java.util.concurrent.ThreadPoolExecutor;
7 | import java.util.concurrent.TimeUnit;
8 |
9 | /**
10 | * 线程池工具
11 | *
12 | * @author z.houbin
13 | */
14 | public class ThreadPool {
15 | private static ThreadPoolExecutor executor;
16 | private static ScheduledExecutorService scheduledExecutorService;
17 |
18 | private static void init() {
19 | if (executor == null) {
20 | executor = new ThreadPoolExecutor(4, 10, 5000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.DiscardPolicy());
21 | }
22 | if (scheduledExecutorService == null) {
23 | scheduledExecutorService = Executors.newScheduledThreadPool(5);
24 | }
25 | }
26 |
27 | public static void post(Runnable runnable) {
28 | init();
29 | executor.submit(runnable);
30 | }
31 |
32 | public static void postDelay(Runnable runnable, long delay) {
33 | init();
34 | scheduledExecutorService.schedule(runnable, delay, TimeUnit.MILLISECONDS);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/hotxposed/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | HotXposed
3 |
4 |
--------------------------------------------------------------------------------
/image/screenshot1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ysnows/wx_hook/05f4877bbd63b33d92343236c28aef261393e0fb/image/screenshot1.jpg
--------------------------------------------------------------------------------
/image/screenshot2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ysnows/wx_hook/05f4877bbd63b33d92343236c28aef261393e0fb/image/screenshot2.jpg
--------------------------------------------------------------------------------
/image/screenshot3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ysnows/wx_hook/05f4877bbd63b33d92343236c28aef261393e0fb/image/screenshot3.jpg
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':hotxposed'
2 |
--------------------------------------------------------------------------------