GeneralUtils.java
5.48 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
package com.arellomobile.android.push.utils;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.util.TypedValue;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
public class GeneralUtils
{
public static final String[] SUPPORTED_AUDIO_FORMATS = { ".mp3", ".3gp", ".mp4", ".m4a", ".aac", ".flac", ".ogg", ".wav" };
private static List<String> a;
static
{
ArrayList localArrayList = new ArrayList();
a = localArrayList;
localArrayList.add("9774d56d682e549c");
}
public static void checkNotNull(Object paramObject, String paramString)
{
if (paramObject == null) {
throw new IllegalArgumentException(String.format("Please set the %1$s constant and recompile the app.", new Object[] { paramString }));
}
}
public static void checkNotNullOrEmpty(String paramString1, String paramString2)
{
checkNotNull(paramString1, paramString2);
if (paramString1.length() == 0) {
throw new IllegalArgumentException(String.format("Please set the %1$s constant and recompile the app.", new Object[] { paramString2 }));
}
}
public static boolean checkStickyBroadcastPermissions(Context paramContext)
{
return paramContext.getPackageManager().checkPermission("android.permission.BROADCAST_STICKY", paramContext.getPackageName()) == 0;
}
@SuppressLint({"WorldWriteableFiles"})
public static String getDeviceUUID(Context paramContext)
{
Object localObject1 = Settings.Secure.getString(paramContext.getContentResolver(), "android_id");
if ((localObject1 != null) && (!a.contains(localObject1))) {}
do
{
for (;;)
{
return (String)localObject1;
try
{
localObject2 = ((TelephonyManager)paramContext.getSystemService("phone")).getDeviceId();
localObject1 = localObject2;
if (localObject2 != null) {}
}
catch (RuntimeException localRuntimeException)
{
Object localObject2;
for (;;) {}
}
}
localObject2 = paramContext.getSharedPreferences("com.arellomobile.android.push.deviceid", 2);
paramContext = ((SharedPreferences)localObject2).getString("deviceid", null);
localObject1 = paramContext;
} while (paramContext != null);
paramContext = UUID.randomUUID().toString();
localObject1 = ((SharedPreferences)localObject2).edit();
((SharedPreferences.Editor)localObject1).putString("deviceid", paramContext);
((SharedPreferences.Editor)localObject1).commit();
return paramContext;
}
public static ArrayList<String> getRawResourses(Context paramContext)
{
localArrayList = new ArrayList();
try
{
Field[] arrayOfField = Class.forName(paramContext.getPackageName() + ".R$raw").getFields();
int i = 0;
while (i < arrayOfField.length)
{
String str = arrayOfField[i].getName();
int j = paramContext.getResources().getIdentifier(str, "raw", paramContext.getPackageName());
TypedValue localTypedValue = new TypedValue();
paramContext.getResources().getValue(j, localTypedValue, true);
if (isSound(localTypedValue.string.toString())) {
localArrayList.add(str);
}
i += 1;
}
return localArrayList;
}
catch (ClassNotFoundException paramContext) {}
}
public static boolean isAmazonDevice()
{
try
{
Class.forName("com.amazon.device.messaging.ADM");
return true;
}
catch (ClassNotFoundException localClassNotFoundException) {}
return false;
}
public static boolean isAppOnForeground(Context paramContext)
{
Object localObject = ((ActivityManager)paramContext.getSystemService("activity")).getRunningAppProcesses();
if (localObject == null) {
return false;
}
paramContext = paramContext.getPackageName();
localObject = ((List)localObject).iterator();
while (((Iterator)localObject).hasNext())
{
ActivityManager.RunningAppProcessInfo localRunningAppProcessInfo = (ActivityManager.RunningAppProcessInfo)((Iterator)localObject).next();
if ((localRunningAppProcessInfo.importance == 100) && (localRunningAppProcessInfo.processName.equals(paramContext))) {
return true;
}
}
return false;
}
protected static boolean isSound(String paramString)
{
boolean bool2 = false;
int i = 0;
for (;;)
{
boolean bool1 = bool2;
if (i < SUPPORTED_AUDIO_FORMATS.length)
{
String str = SUPPORTED_AUDIO_FORMATS[i];
if (paramString.toLowerCase(Locale.US).endsWith(str)) {
bool1 = true;
}
}
else
{
return bool1;
}
i += 1;
}
}
@SuppressLint({"InlinedApi"})
public static boolean isTablet(Context paramContext)
{
return (paramContext.getResources().getConfiguration().screenLayout & 0x4) == 4;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/utils/GeneralUtils.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/