Update PA-jellybean-legacy patches
[auto-patcher.git] / patches / pdroid / common / 20120506 / core.patch
blob42cf8871984994cd08ddb9f660caa1b9ac0353e9
1 diff -Npru stock_core/smali/java/lang/PrivacyInputStream.smali moded_core/smali/java/lang/PrivacyInputStream.smali
2 --- stock_core/smali/java/lang/PrivacyInputStream.smali 1969-12-31 18:00:00.000000000 -0600
3 +++ moded_core/smali/java/lang/PrivacyInputStream.smali 2012-06-14 15:22:52.480092132 -0500
4 @@ -0,0 +1,67 @@
5 +.class public Ljava/lang/PrivacyInputStream;
6 +.super Ljava/io/InputStream;
7 +.source "PrivacyInputStream.java"
10 +# direct methods
11 +.method public constructor <init>()V
12 + .registers 1
14 + invoke-direct {p0}, Ljava/io/InputStream;-><init>()V
16 + return-void
17 +.end method
20 +# virtual methods
21 +.method public close()V
22 + .registers 1
23 + .annotation system Ldalvik/annotation/Throws;
24 + value = {
25 + Ljava/io/IOException;
26 + }
27 + .end annotation
29 + invoke-super {p0}, Ljava/io/InputStream;->close()V
31 + return-void
32 +.end method
34 +.method public read()I
35 + .registers 2
36 + .annotation system Ldalvik/annotation/Throws;
37 + value = {
38 + Ljava/io/IOException;
39 + }
40 + .end annotation
42 + const/4 v0, -0x1
44 + return v0
45 +.end method
47 +.method public read([B)I
48 + .registers 3
49 + .annotation system Ldalvik/annotation/Throws;
50 + value = {
51 + Ljava/io/IOException;
52 + }
53 + .end annotation
55 + const/4 v0, -0x1
57 + return v0
58 +.end method
60 +.method public read([BII)I
61 + .registers 5
62 + .annotation system Ldalvik/annotation/Throws;
63 + value = {
64 + Ljava/io/IOException;
65 + }
66 + .end annotation
68 + const/4 v0, -0x1
70 + return v0
71 +.end method
72 diff -Npru stock_core/smali/java/lang/PrivacyProcessManager$PrivacyFileReader.smali moded_core/smali/java/lang/PrivacyProcessManager$PrivacyFileReader.smali
73 --- stock_core/smali/java/lang/PrivacyProcessManager$PrivacyFileReader.smali 1969-12-31 18:00:00.000000000 -0600
74 +++ moded_core/smali/java/lang/PrivacyProcessManager$PrivacyFileReader.smali 2012-06-14 15:22:52.480092132 -0500
75 @@ -0,0 +1,91 @@
76 +.class public Ljava/lang/PrivacyProcessManager$PrivacyFileReader;
77 +.super Ljava/lang/Object;
78 +.source "PrivacyProcessManager.java"
81 +# annotations
82 +.annotation system Ldalvik/annotation/EnclosingClass;
83 + value = Ljava/lang/PrivacyProcessManager;
84 +.end annotation
86 +.annotation system Ldalvik/annotation/InnerClass;
87 + accessFlags = 0x9
88 + name = "PrivacyFileReader"
89 +.end annotation
92 +# instance fields
93 +.field private buffReader:Ljava/io/BufferedReader;
95 +.field private inputStream:Ljava/io/FileInputStream;
98 +# direct methods
99 +.method public constructor <init>(Ljava/lang/String;)V
100 + .registers 5
101 + .annotation system Ldalvik/annotation/Throws;
102 + value = {
103 + Ljava/io/FileNotFoundException;
105 + .end annotation
107 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V
109 + new-instance v0, Ljava/io/FileInputStream;
111 + new-instance v1, Ljava/io/File;
113 + invoke-direct {v1, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
115 + invoke-direct {v0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
117 + iput-object v0, p0, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->inputStream:Ljava/io/FileInputStream;
119 + new-instance v0, Ljava/io/BufferedReader;
121 + new-instance v1, Ljava/io/InputStreamReader;
123 + iget-object v2, p0, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->inputStream:Ljava/io/FileInputStream;
125 + invoke-direct {v1, v2}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V
127 + invoke-direct {v0, v1}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
129 + iput-object v0, p0, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->buffReader:Ljava/io/BufferedReader;
131 + return-void
132 +.end method
135 +# virtual methods
136 +.method public close()V
137 + .registers 2
138 + .annotation system Ldalvik/annotation/Throws;
139 + value = {
140 + Ljava/io/IOException;
142 + .end annotation
144 + iget-object v0, p0, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->inputStream:Ljava/io/FileInputStream;
146 + invoke-virtual {v0}, Ljava/io/FileInputStream;->close()V
148 + return-void
149 +.end method
151 +.method public readLine()Ljava/lang/String;
152 + .registers 2
153 + .annotation system Ldalvik/annotation/Throws;
154 + value = {
155 + Ljava/io/IOException;
157 + .end annotation
159 + iget-object v0, p0, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->buffReader:Ljava/io/BufferedReader;
161 + invoke-virtual {v0}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
163 + move-result-object v0
165 + return-object v0
166 +.end method
167 diff -Npru stock_core/smali/java/lang/PrivacyProcessManager.smali moded_core/smali/java/lang/PrivacyProcessManager.smali
168 --- stock_core/smali/java/lang/PrivacyProcessManager.smali 1969-12-31 18:00:00.000000000 -0600
169 +++ moded_core/smali/java/lang/PrivacyProcessManager.smali 2012-06-14 15:22:52.480092132 -0500
170 @@ -0,0 +1,305 @@
171 +.class public Ljava/lang/PrivacyProcessManager;
172 +.super Ljava/lang/Object;
173 +.source "PrivacyProcessManager.java"
176 +# annotations
177 +.annotation system Ldalvik/annotation/MemberClasses;
178 + value = {
179 + Ljava/lang/PrivacyProcessManager$PrivacyFileReader;
181 +.end annotation
184 +# static fields
185 +.field private static final GET_COMMAND_WAIT_MS:I = 0xa
187 +.field private static final GET_COMMAND_WAIT_STEP:I = 0x5
190 +# direct methods
191 +.method public constructor <init>()V
192 + .registers 1
194 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V
196 + return-void
197 +.end method
199 +.method private static getPackageName()Ljava/lang/String;
200 + .registers 3
201 + .annotation system Ldalvik/annotation/Throws;
202 + value = {
203 + Ljava/io/IOException;,
204 + Ljava/io/FileNotFoundException;
206 + .end annotation
208 + new-instance v0, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;
210 + const-string v2, "/proc/self/cmdline"
212 + invoke-direct {v0, v2}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;-><init>(Ljava/lang/String;)V
214 + invoke-virtual {v0}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->readLine()Ljava/lang/String;
216 + move-result-object v2
218 + invoke-virtual {v2}, Ljava/lang/String;->trim()Ljava/lang/String;
220 + move-result-object v1
222 + invoke-virtual {v0}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->close()V
224 + return-object v1
225 +.end method
227 +.method public static hasPrivacyPermission(Ljava/lang/String;I)Z
228 + .registers 16
230 + const/4 v7, 0x0
232 + const/4 v6, 0x1
234 + :try_start_2
235 + invoke-static {}, Ljava/lang/PrivacyProcessManager;->getPackageName()Ljava/lang/String;
236 + :try_end_5
237 + .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_5} :catch_38
239 + move-result-object v7
241 + :goto_6
242 + const/4 v2, 0x0
244 + :try_start_7
245 + new-instance v11, Ljava/lang/StringBuilder;
247 + invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V
249 + const-string v12, "/proc/"
251 + invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
253 + move-result-object v11
255 + invoke-virtual {v11, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
257 + move-result-object v11
259 + const-string v12, "/cmdline"
261 + invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
263 + move-result-object v11
265 + invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
267 + move-result-object v0
269 + new-instance v3, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;
271 + invoke-direct {v3, v0}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;-><init>(Ljava/lang/String;)V
272 + :try_end_25
273 + .catch Ljava/io/FileNotFoundException; {:try_start_7 .. :try_end_25} :catch_b8
274 + .catch Ljava/lang/Exception; {:try_start_7 .. :try_end_25} :catch_96
276 + :try_start_25
277 + const-string v8, ""
279 + const/16 v4, 0xa
281 + :goto_29
282 + invoke-virtual {v3}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->readLine()Ljava/lang/String;
283 + :try_end_2c
284 + .catch Ljava/io/FileNotFoundException; {:try_start_25 .. :try_end_2c} :catch_ba
285 + .catch Ljava/lang/Exception; {:try_start_25 .. :try_end_2c} :catch_b5
287 + move-result-object v8
289 + if-nez v8, :cond_44
291 + if-ltz v4, :cond_44
293 + const-wide/16 v11, 0x5
295 + :try_start_33
296 + invoke-static {v11, v12}, Ljava/lang/Thread;->sleep(J)V
297 + :try_end_36
298 + .catch Ljava/lang/InterruptedException; {:try_start_33 .. :try_end_36} :catch_b3
299 + .catch Ljava/io/FileNotFoundException; {:try_start_33 .. :try_end_36} :catch_ba
300 + .catch Ljava/lang/Exception; {:try_start_33 .. :try_end_36} :catch_b5
302 + :goto_36
303 + const/4 v4, -0x5
305 + goto :goto_29
307 + :catch_38
308 + move-exception v1
310 + sget-object v11, Ljava/lang/System;->err:Ljava/io/PrintStream;
312 + const-string v12, "PrivacyProcessManager: could not find package name or UID"
314 + invoke-virtual {v11, v12}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
316 + invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
318 + goto :goto_6
320 + :cond_44
321 + :try_start_44
322 + invoke-virtual {v3}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->close()V
324 + if-eqz v8, :cond_bd
326 + invoke-virtual {v8}, Ljava/lang/String;->trim()Ljava/lang/String;
328 + move-result-object v11
330 + invoke-virtual {v11}, Ljava/lang/String;->length()I
332 + move-result v11
334 + const/4 v12, 0x5
336 + if-le v11, v12, :cond_bd
338 + const-string v11, "logcat"
340 + invoke-virtual {v8, v11}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
342 + move-result v11
344 + if-eqz v11, :cond_bd
346 + new-instance v11, Ljava/lang/StringBuilder;
348 + invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V
350 + const-string v12, "/data/system/privacy/"
352 + invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
354 + move-result-object v11
356 + invoke-virtual {v11, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
358 + move-result-object v11
360 + const-string v12, "/"
362 + invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
364 + move-result-object v11
366 + invoke-virtual {v11, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
368 + move-result-object v11
370 + invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
372 + move-result-object v9
374 + new-instance v2, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;
376 + invoke-direct {v2, v9}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;-><init>(Ljava/lang/String;)V
377 + :try_end_7e
378 + .catch Ljava/io/FileNotFoundException; {:try_start_44 .. :try_end_7e} :catch_ba
379 + .catch Ljava/lang/Exception; {:try_start_44 .. :try_end_7e} :catch_b5
381 + :try_start_7e
382 + invoke-virtual {v2}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->readLine()Ljava/lang/String;
384 + move-result-object v5
386 + if-eqz v5, :cond_94
388 + invoke-virtual {v5}, Ljava/lang/String;->trim()Ljava/lang/String;
390 + move-result-object v11
392 + invoke-static {v11}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
394 + move-result v10
396 + :goto_8c
397 + invoke-virtual {v2}, Ljava/lang/PrivacyProcessManager$PrivacyFileReader;->close()V
398 + :try_end_8f
399 + .catch Ljava/io/FileNotFoundException; {:try_start_7e .. :try_end_8f} :catch_b8
400 + .catch Ljava/lang/Exception; {:try_start_7e .. :try_end_8f} :catch_96
402 + const/4 v11, 0x1
404 + if-ne v10, v11, :cond_93
406 + const/4 v6, 0x0
408 + :cond_93
409 + :goto_93
410 + return v6
412 + :cond_94
413 + const/4 v10, -0x1
415 + goto :goto_8c
417 + :catch_96
418 + move-exception v1
420 + :goto_97
421 + sget-object v11, Ljava/lang/System;->err:Ljava/io/PrintStream;
423 + new-instance v12, Ljava/lang/StringBuilder;
425 + invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V
427 + const-string v13, "PrivacyProcessManager: could not read privacy settings: "
429 + invoke-virtual {v12, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
431 + move-result-object v12
433 + invoke-virtual {v12, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
435 + move-result-object v12
437 + invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
439 + move-result-object v12
441 + invoke-virtual {v11, v12}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
443 + invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
445 + goto :goto_93
447 + :catch_b3
448 + move-exception v11
450 + goto :goto_36
452 + :catch_b5
453 + move-exception v1
455 + move-object v2, v3
457 + goto :goto_97
459 + :catch_b8
460 + move-exception v11
462 + goto :goto_93
464 + :catch_ba
465 + move-exception v11
467 + move-object v2, v3
469 + goto :goto_93
471 + :cond_bd
472 + move-object v2, v3
474 + goto :goto_93
475 +.end method
476 diff -Npru stock_core/smali/java/lang/ProcessManager$ProcessImpl.smali moded_core/smali/java/lang/ProcessManager$ProcessImpl.smali
477 --- stock_core/smali/java/lang/ProcessManager$ProcessImpl.smali 2012-06-14 15:21:02.827548393 -0500
478 +++ moded_core/smali/java/lang/ProcessManager$ProcessImpl.smali 2012-06-14 15:22:52.504092243 -0500
479 @@ -52,12 +52,21 @@
481 iput-object v0, p0, Ljava/lang/ProcessManager$ProcessImpl;->errorStream:Ljava/io/InputStream;
483 + const-string v0, "systemLogsSetting"
485 + invoke-static {v0, p1}, Ljava/lang/PrivacyProcessManager;->hasPrivacyPermission(Ljava/lang/String;I)Z
487 + move-result v0
489 + if-eqz v0, :cond_2d
491 new-instance v0, Ljava/lang/ProcessManager$ProcessInputStream;
493 invoke-direct {v0, p2, v1}, Ljava/lang/ProcessManager$ProcessInputStream;-><init>(Ljava/io/FileDescriptor;Ljava/lang/ProcessManager$1;)V
495 iput-object v0, p0, Ljava/lang/ProcessManager$ProcessImpl;->inputStream:Ljava/io/InputStream;
497 + :goto_25
498 new-instance v0, Ljava/lang/ProcessManager$ProcessOutputStream;
500 invoke-direct {v0, p3, v1}, Ljava/lang/ProcessManager$ProcessOutputStream;-><init>(Ljava/io/FileDescriptor;Ljava/lang/ProcessManager$1;)V
501 @@ -65,6 +74,15 @@
502 iput-object v0, p0, Ljava/lang/ProcessManager$ProcessImpl;->outputStream:Ljava/io/OutputStream;
504 return-void
506 + :cond_2d
507 + new-instance v0, Ljava/lang/PrivacyInputStream;
509 + invoke-direct {v0}, Ljava/lang/PrivacyInputStream;-><init>()V
511 + iput-object v0, p0, Ljava/lang/ProcessManager$ProcessImpl;->inputStream:Ljava/io/InputStream;
513 + goto :goto_25
514 .end method
516 .method static synthetic access$300(Ljava/lang/ProcessManager$ProcessImpl;)I