ContextCompat.java
7.36 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
package android.support.v4.content;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.os.BuildCompat;
import android.util.TypedValue;
import java.io.File;
public class ContextCompat
{
private static final Object a = new Object();
private static TypedValue b;
/* Error */
private static File a(File paramFile)
{
// Byte code:
// 0: ldc 2
// 2: monitorenter
// 3: aload_0
// 4: astore_2
// 5: aload_0
// 6: invokevirtual 23 java/io/File:exists ()Z
// 9: ifne +23 -> 32
// 12: aload_0
// 13: astore_2
// 14: aload_0
// 15: invokevirtual 26 java/io/File:mkdirs ()Z
// 18: ifne +14 -> 32
// 21: aload_0
// 22: invokevirtual 23 java/io/File:exists ()Z
// 25: istore_1
// 26: iload_1
// 27: ifeq +10 -> 37
// 30: aload_0
// 31: astore_2
// 32: ldc 2
// 34: monitorexit
// 35: aload_2
// 36: areturn
// 37: ldc 28
// 39: new 30 java/lang/StringBuilder
// 42: dup
// 43: ldc 32
// 45: invokespecial 35 java/lang/StringBuilder:<init> (Ljava/lang/String;)V
// 48: aload_0
// 49: invokevirtual 39 java/io/File:getPath ()Ljava/lang/String;
// 52: invokevirtual 43 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 55: invokevirtual 46 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 58: invokestatic 52 android/util/Log:w (Ljava/lang/String;Ljava/lang/String;)I
// 61: pop
// 62: aconst_null
// 63: astore_2
// 64: goto -32 -> 32
// 67: astore_0
// 68: ldc 2
// 70: monitorexit
// 71: aload_0
// 72: athrow
// Local variable table:
// start length slot name signature
// 0 73 0 paramFile File
// 25 2 1 bool boolean
// 4 60 2 localFile File
// Exception table:
// from to target type
// 5 12 67 finally
// 14 26 67 finally
// 37 62 67 finally
}
public static int checkSelfPermission(@NonNull Context paramContext, @NonNull String paramString)
{
if (paramString == null) {
throw new IllegalArgumentException("permission is null");
}
return paramContext.checkPermission(paramString, Process.myPid(), Process.myUid());
}
public static Context createDeviceProtectedStorageContext(Context paramContext)
{
if (BuildCompat.isAtLeastN()) {
return paramContext.createDeviceProtectedStorageContext();
}
return null;
}
public static File getCodeCacheDir(Context paramContext)
{
if (Build.VERSION.SDK_INT >= 21) {
return paramContext.getCodeCacheDir();
}
return a(new File(paramContext.getApplicationInfo().dataDir, "code_cache"));
}
@ColorInt
public static final int getColor(Context paramContext, @ColorRes int paramInt)
{
if (Build.VERSION.SDK_INT >= 23) {
return paramContext.getColor(paramInt);
}
return paramContext.getResources().getColor(paramInt);
}
public static final ColorStateList getColorStateList(Context paramContext, @ColorRes int paramInt)
{
if (Build.VERSION.SDK_INT >= 23) {
return paramContext.getColorStateList(paramInt);
}
return paramContext.getResources().getColorStateList(paramInt);
}
public static File getDataDir(Context paramContext)
{
if (BuildCompat.isAtLeastN()) {
return paramContext.getDataDir();
}
paramContext = paramContext.getApplicationInfo().dataDir;
if (paramContext != null) {
return new File(paramContext);
}
return null;
}
public static final Drawable getDrawable(Context paramContext, @DrawableRes int paramInt)
{
int i = Build.VERSION.SDK_INT;
if (i >= 21) {
return paramContext.getDrawable(paramInt);
}
if (i >= 16) {
return paramContext.getResources().getDrawable(paramInt);
}
synchronized (a)
{
if (b == null) {
b = new TypedValue();
}
paramContext.getResources().getValue(paramInt, b, true);
paramInt = b.resourceId;
return paramContext.getResources().getDrawable(paramInt);
}
}
public static File[] getExternalCacheDirs(Context paramContext)
{
if (Build.VERSION.SDK_INT >= 19) {
return paramContext.getExternalCacheDirs();
}
return new File[] { paramContext.getExternalCacheDir() };
}
public static File[] getExternalFilesDirs(Context paramContext, String paramString)
{
if (Build.VERSION.SDK_INT >= 19) {
return paramContext.getExternalFilesDirs(paramString);
}
return new File[] { paramContext.getExternalFilesDir(paramString) };
}
public static final File getNoBackupFilesDir(Context paramContext)
{
if (Build.VERSION.SDK_INT >= 21) {
return paramContext.getNoBackupFilesDir();
}
return a(new File(paramContext.getApplicationInfo().dataDir, "no_backup"));
}
public static File[] getObbDirs(Context paramContext)
{
int i = Build.VERSION.SDK_INT;
if (i >= 19) {
return paramContext.getObbDirs();
}
if (i >= 11) {
localObject = paramContext.getObbDir();
}
String str;
do
{
return new File[] { localObject };
localObject = Environment.getExternalStorageDirectory();
str = paramContext.getPackageName();
i = 0;
paramContext = (Context)localObject;
localObject = paramContext;
} while (i >= 3);
Object localObject = new String[] { "Android", "obb", str }[i];
if (paramContext == null) {
paramContext = new File((String)localObject);
}
for (;;)
{
i += 1;
break;
if (localObject != null) {
paramContext = new File(paramContext, (String)localObject);
}
}
}
public static boolean isDeviceProtectedStorage(Context paramContext)
{
if (BuildCompat.isAtLeastN()) {
return paramContext.isDeviceProtectedStorage();
}
return false;
}
public static boolean startActivities(Context paramContext, Intent[] paramArrayOfIntent)
{
return startActivities(paramContext, paramArrayOfIntent, null);
}
public static boolean startActivities(Context paramContext, Intent[] paramArrayOfIntent, Bundle paramBundle)
{
int i = Build.VERSION.SDK_INT;
if (i >= 16)
{
paramContext.startActivities(paramArrayOfIntent, paramBundle);
return true;
}
if (i >= 11)
{
paramContext.startActivities(paramArrayOfIntent);
return true;
}
return false;
}
public static void startActivity(Context paramContext, Intent paramIntent, @Nullable Bundle paramBundle)
{
if (Build.VERSION.SDK_INT >= 16)
{
paramContext.startActivity(paramIntent, paramBundle);
return;
}
paramContext.startActivity(paramIntent);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/content/ContextCompat.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/