FileProvider.java
17.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
package android.support.v4.content;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.net.Uri.Builder;
import android.os.ParcelFileDescriptor;
import android.webkit.MimeTypeMap;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
public class FileProvider
extends ContentProvider
{
private static final String[] a = { "_display_name", "_size" };
private static final File b = new File("/");
private static HashMap<String, a> c = new HashMap();
private a d;
/* Error */
private static a a(Context paramContext, String paramString)
{
// Byte code:
// 0: getstatic 43 android/support/v4/content/FileProvider:c Ljava/util/HashMap;
// 3: astore 5
// 5: aload 5
// 7: monitorenter
// 8: getstatic 43 android/support/v4/content/FileProvider:c Ljava/util/HashMap;
// 11: aload_1
// 12: invokevirtual 54 java/util/HashMap:get (Ljava/lang/Object;)Ljava/lang/Object;
// 15: checkcast 6 android/support/v4/content/FileProvider$a
// 18: astore 4
// 20: aload 4
// 22: astore_3
// 23: aload 4
// 25: ifnonnull +340 -> 365
// 28: new 9 android/support/v4/content/FileProvider$b
// 31: dup
// 32: aload_1
// 33: invokespecial 55 android/support/v4/content/FileProvider$b:<init> (Ljava/lang/String;)V
// 36: astore 4
// 38: aload_0
// 39: invokevirtual 61 android/content/Context:getPackageManager ()Landroid/content/pm/PackageManager;
// 42: aload_1
// 43: sipush 128
// 46: invokevirtual 67 android/content/pm/PackageManager:resolveContentProvider (Ljava/lang/String;I)Landroid/content/pm/ProviderInfo;
// 49: aload_0
// 50: invokevirtual 61 android/content/Context:getPackageManager ()Landroid/content/pm/PackageManager;
// 53: ldc 69
// 55: invokevirtual 75 android/content/pm/ProviderInfo:loadXmlMetaData (Landroid/content/pm/PackageManager;Ljava/lang/String;)Landroid/content/res/XmlResourceParser;
// 58: astore 6
// 60: aload 6
// 62: ifnonnull +50 -> 112
// 65: new 77 java/lang/IllegalArgumentException
// 68: dup
// 69: ldc 79
// 71: invokespecial 80 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;)V
// 74: athrow
// 75: astore_0
// 76: new 77 java/lang/IllegalArgumentException
// 79: dup
// 80: ldc 82
// 82: aload_0
// 83: invokespecial 85 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;Ljava/lang/Throwable;)V
// 86: athrow
// 87: astore_0
// 88: aload 5
// 90: monitorexit
// 91: aload_0
// 92: athrow
// 93: aload_3
// 94: invokevirtual 89 java/io/File:getCanonicalFile ()Ljava/io/File;
// 97: astore 8
// 99: aload 4
// 101: getfield 91 android/support/v4/content/FileProvider$b:a Ljava/util/HashMap;
// 104: aload 7
// 106: aload 8
// 108: invokevirtual 95 java/util/HashMap:put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
// 111: pop
// 112: aload 6
// 114: invokeinterface 101 1 0
// 119: istore_2
// 120: iload_2
// 121: iconst_1
// 122: if_icmpeq +230 -> 352
// 125: iload_2
// 126: iconst_2
// 127: if_icmpne -15 -> 112
// 130: aload 6
// 132: invokeinterface 105 1 0
// 137: astore_3
// 138: aload 6
// 140: aconst_null
// 141: ldc 107
// 143: invokeinterface 111 3 0
// 148: astore 7
// 150: aload 6
// 152: aconst_null
// 153: ldc 113
// 155: invokeinterface 111 3 0
// 160: astore 8
// 162: ldc 115
// 164: aload_3
// 165: invokevirtual 119 java/lang/String:equals (Ljava/lang/Object;)Z
// 168: ifeq +55 -> 223
// 171: getstatic 37 android/support/v4/content/FileProvider:b Ljava/io/File;
// 174: astore_3
// 175: aload_3
// 176: ifnull -64 -> 112
// 179: aload_3
// 180: iconst_1
// 181: anewarray 21 java/lang/String
// 184: dup
// 185: iconst_0
// 186: aload 8
// 188: aastore
// 189: invokestatic 122 android/support/v4/content/FileProvider:a (Ljava/io/File;[Ljava/lang/String;)Ljava/io/File;
// 192: astore_3
// 193: aload 7
// 195: invokestatic 128 android/text/TextUtils:isEmpty (Ljava/lang/CharSequence;)Z
// 198: ifeq -105 -> 93
// 201: new 77 java/lang/IllegalArgumentException
// 204: dup
// 205: ldc -126
// 207: invokespecial 80 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;)V
// 210: athrow
// 211: astore_0
// 212: new 77 java/lang/IllegalArgumentException
// 215: dup
// 216: ldc 82
// 218: aload_0
// 219: invokespecial 85 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;Ljava/lang/Throwable;)V
// 222: athrow
// 223: ldc -124
// 225: aload_3
// 226: invokevirtual 119 java/lang/String:equals (Ljava/lang/Object;)Z
// 229: ifeq +11 -> 240
// 232: aload_0
// 233: invokevirtual 135 android/content/Context:getFilesDir ()Ljava/io/File;
// 236: astore_3
// 237: goto -62 -> 175
// 240: ldc -119
// 242: aload_3
// 243: invokevirtual 119 java/lang/String:equals (Ljava/lang/Object;)Z
// 246: ifeq +11 -> 257
// 249: aload_0
// 250: invokevirtual 140 android/content/Context:getCacheDir ()Ljava/io/File;
// 253: astore_3
// 254: goto -79 -> 175
// 257: ldc -114
// 259: aload_3
// 260: invokevirtual 119 java/lang/String:equals (Ljava/lang/Object;)Z
// 263: ifeq +10 -> 273
// 266: invokestatic 147 android/os/Environment:getExternalStorageDirectory ()Ljava/io/File;
// 269: astore_3
// 270: goto -95 -> 175
// 273: ldc -107
// 275: aload_3
// 276: invokevirtual 119 java/lang/String:equals (Ljava/lang/Object;)Z
// 279: ifeq +21 -> 300
// 282: aload_0
// 283: aconst_null
// 284: invokestatic 155 android/support/v4/content/ContextCompat:getExternalFilesDirs (Landroid/content/Context;Ljava/lang/String;)[Ljava/io/File;
// 287: astore_3
// 288: aload_3
// 289: arraylength
// 290: ifle +80 -> 370
// 293: aload_3
// 294: iconst_0
// 295: aaload
// 296: astore_3
// 297: goto -122 -> 175
// 300: ldc -99
// 302: aload_3
// 303: invokevirtual 119 java/lang/String:equals (Ljava/lang/Object;)Z
// 306: ifeq +64 -> 370
// 309: aload_0
// 310: invokestatic 161 android/support/v4/content/ContextCompat:getExternalCacheDirs (Landroid/content/Context;)[Ljava/io/File;
// 313: astore_3
// 314: aload_3
// 315: arraylength
// 316: ifle +54 -> 370
// 319: aload_3
// 320: iconst_0
// 321: aaload
// 322: astore_3
// 323: goto -148 -> 175
// 326: astore_0
// 327: new 77 java/lang/IllegalArgumentException
// 330: dup
// 331: new 163 java/lang/StringBuilder
// 334: dup
// 335: ldc -91
// 337: invokespecial 166 java/lang/StringBuilder:<init> (Ljava/lang/String;)V
// 340: aload_3
// 341: invokevirtual 170 java/lang/StringBuilder:append (Ljava/lang/Object;)Ljava/lang/StringBuilder;
// 344: invokevirtual 173 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 347: aload_0
// 348: invokespecial 85 java/lang/IllegalArgumentException:<init> (Ljava/lang/String;Ljava/lang/Throwable;)V
// 351: athrow
// 352: getstatic 43 android/support/v4/content/FileProvider:c Ljava/util/HashMap;
// 355: aload_1
// 356: aload 4
// 358: invokevirtual 95 java/util/HashMap:put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
// 361: pop
// 362: aload 4
// 364: astore_3
// 365: aload 5
// 367: monitorexit
// 368: aload_3
// 369: areturn
// 370: aconst_null
// 371: astore_3
// 372: goto -197 -> 175
// Local variable table:
// start length slot name signature
// 0 375 0 paramContext Context
// 0 375 1 paramString String
// 119 9 2 i int
// 22 350 3 localObject1 Object
// 18 345 4 localObject2 Object
// 3 363 5 localHashMap HashMap
// 58 93 6 localXmlResourceParser android.content.res.XmlResourceParser
// 104 90 7 localObject3 Object
// 97 90 8 localObject4 Object
// Exception table:
// from to target type
// 28 60 75 java/io/IOException
// 65 75 75 java/io/IOException
// 99 112 75 java/io/IOException
// 112 120 75 java/io/IOException
// 130 175 75 java/io/IOException
// 179 211 75 java/io/IOException
// 223 237 75 java/io/IOException
// 240 254 75 java/io/IOException
// 257 270 75 java/io/IOException
// 273 293 75 java/io/IOException
// 300 319 75 java/io/IOException
// 327 352 75 java/io/IOException
// 8 20 87 finally
// 28 60 87 finally
// 65 75 87 finally
// 76 87 87 finally
// 88 91 87 finally
// 93 99 87 finally
// 99 112 87 finally
// 112 120 87 finally
// 130 175 87 finally
// 179 211 87 finally
// 212 223 87 finally
// 223 237 87 finally
// 240 254 87 finally
// 257 270 87 finally
// 273 293 87 finally
// 300 319 87 finally
// 327 352 87 finally
// 352 362 87 finally
// 365 368 87 finally
// 28 60 211 org/xmlpull/v1/XmlPullParserException
// 65 75 211 org/xmlpull/v1/XmlPullParserException
// 93 99 211 org/xmlpull/v1/XmlPullParserException
// 99 112 211 org/xmlpull/v1/XmlPullParserException
// 112 120 211 org/xmlpull/v1/XmlPullParserException
// 130 175 211 org/xmlpull/v1/XmlPullParserException
// 179 211 211 org/xmlpull/v1/XmlPullParserException
// 223 237 211 org/xmlpull/v1/XmlPullParserException
// 240 254 211 org/xmlpull/v1/XmlPullParserException
// 257 270 211 org/xmlpull/v1/XmlPullParserException
// 273 293 211 org/xmlpull/v1/XmlPullParserException
// 300 319 211 org/xmlpull/v1/XmlPullParserException
// 327 352 211 org/xmlpull/v1/XmlPullParserException
// 93 99 326 java/io/IOException
}
private static File a(File paramFile, String... paramVarArgs)
{
int i = 0;
if (i <= 0)
{
String str = paramVarArgs[0];
if (str == null) {
break label33;
}
paramFile = new File(paramFile, str);
}
label33:
for (;;)
{
i += 1;
break;
return paramFile;
}
}
public static Uri getUriForFile(Context paramContext, String paramString, File paramFile)
{
return a(paramContext, paramString).a(paramFile);
}
public void attachInfo(Context paramContext, ProviderInfo paramProviderInfo)
{
super.attachInfo(paramContext, paramProviderInfo);
if (paramProviderInfo.exported) {
throw new SecurityException("Provider must not be exported");
}
if (!paramProviderInfo.grantUriPermissions) {
throw new SecurityException("Provider must grant uri permissions");
}
this.d = a(paramContext, paramProviderInfo.authority);
}
public int delete(Uri paramUri, String paramString, String[] paramArrayOfString)
{
if (this.d.a(paramUri).delete()) {
return 1;
}
return 0;
}
public String getType(Uri paramUri)
{
paramUri = this.d.a(paramUri);
int i = paramUri.getName().lastIndexOf('.');
if (i >= 0)
{
paramUri = paramUri.getName().substring(i + 1);
paramUri = MimeTypeMap.getSingleton().getMimeTypeFromExtension(paramUri);
if (paramUri != null) {
return paramUri;
}
}
return "application/octet-stream";
}
public Uri insert(Uri paramUri, ContentValues paramContentValues)
{
throw new UnsupportedOperationException("No external inserts");
}
public boolean onCreate()
{
return true;
}
public ParcelFileDescriptor openFile(Uri paramUri, String paramString)
throws FileNotFoundException
{
paramUri = this.d.a(paramUri);
int i;
if ("r".equals(paramString)) {
i = 268435456;
}
for (;;)
{
return ParcelFileDescriptor.open(paramUri, i);
if (("w".equals(paramString)) || ("wt".equals(paramString)))
{
i = 738197504;
}
else if ("wa".equals(paramString))
{
i = 704643072;
}
else if ("rw".equals(paramString))
{
i = 939524096;
}
else
{
if (!"rwt".equals(paramString)) {
break;
}
i = 1006632960;
}
}
throw new IllegalArgumentException("Invalid mode: " + paramString);
}
public Cursor query(Uri paramUri, String[] paramArrayOfString1, String paramString1, String[] paramArrayOfString2, String paramString2)
{
paramString1 = this.d.a(paramUri);
paramUri = paramArrayOfString1;
if (paramArrayOfString1 == null) {
paramUri = a;
}
paramArrayOfString2 = new String[paramUri.length];
paramArrayOfString1 = new Object[paramUri.length];
int m = paramUri.length;
int j = 0;
int i = 0;
int k;
if (j < m)
{
paramString2 = paramUri[j];
if ("_display_name".equals(paramString2))
{
paramArrayOfString2[i] = "_display_name";
k = i + 1;
paramArrayOfString1[i] = paramString1.getName();
i = k;
}
}
for (;;)
{
j += 1;
break;
if ("_size".equals(paramString2))
{
paramArrayOfString2[i] = "_size";
k = i + 1;
paramArrayOfString1[i] = Long.valueOf(paramString1.length());
i = k;
continue;
paramUri = new String[i];
System.arraycopy(paramArrayOfString2, 0, paramUri, 0, i);
paramString1 = new Object[i];
System.arraycopy(paramArrayOfString1, 0, paramString1, 0, i);
paramUri = new MatrixCursor(paramUri, 1);
paramUri.addRow(paramString1);
return paramUri;
}
}
}
public int update(Uri paramUri, ContentValues paramContentValues, String paramString, String[] paramArrayOfString)
{
throw new UnsupportedOperationException("No external updates");
}
static abstract interface a
{
public abstract Uri a(File paramFile);
public abstract File a(Uri paramUri);
}
static final class b
implements FileProvider.a
{
final HashMap<String, File> a = new HashMap();
private final String b;
public b(String paramString)
{
this.b = paramString;
}
public final Uri a(File paramFile)
{
for (;;)
{
String str1;
try
{
str1 = paramFile.getCanonicalPath();
paramFile = null;
Iterator localIterator = this.a.entrySet().iterator();
if (localIterator.hasNext())
{
Map.Entry localEntry2 = (Map.Entry)localIterator.next();
String str2 = ((File)localEntry2.getValue()).getPath();
if (!str1.startsWith(str2)) {
break label271;
}
Map.Entry localEntry1 = localEntry2;
if (paramFile != null)
{
if (str2.length() <= ((File)paramFile.getValue()).getPath().length()) {
break label271;
}
localEntry1 = localEntry2;
}
paramFile = localEntry1;
continue;
}
if (paramFile != null) {
break label157;
}
}
catch (IOException localIOException)
{
throw new IllegalArgumentException("Failed to resolve canonical path for " + paramFile);
}
throw new IllegalArgumentException("Failed to find configured root that contains " + str1);
label157:
Object localObject = ((File)paramFile.getValue()).getPath();
if (((String)localObject).endsWith("/")) {}
for (localObject = str1.substring(((String)localObject).length());; localObject = str1.substring(((String)localObject).length() + 1))
{
paramFile = Uri.encode((String)paramFile.getKey()) + '/' + Uri.encode((String)localObject, "/");
return new Uri.Builder().scheme("content").authority(this.b).encodedPath(paramFile).build();
}
label271:
localObject = paramFile;
}
}
public final File a(Uri paramUri)
{
Object localObject2 = paramUri.getEncodedPath();
int i = ((String)localObject2).indexOf('/', 1);
Object localObject1 = Uri.decode(((String)localObject2).substring(1, i));
localObject2 = Uri.decode(((String)localObject2).substring(i + 1));
localObject1 = (File)this.a.get(localObject1);
if (localObject1 == null) {
throw new IllegalArgumentException("Unable to find configured root for " + paramUri);
}
paramUri = new File((File)localObject1, (String)localObject2);
try
{
localObject2 = paramUri.getCanonicalFile();
if (!((File)localObject2).getPath().startsWith(((File)localObject1).getPath())) {
throw new SecurityException("Resolved path jumped beyond configured root");
}
}
catch (IOException localIOException)
{
throw new IllegalArgumentException("Failed to resolve canonical path for " + paramUri);
}
return (File)localObject2;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/content/FileProvider.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/