ADMRegistrar.java
4.2 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
package com.arellomobile.android.push;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.util.Log;
import com.amazon.device.messaging.ADM;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public final class ADMRegistrar
{
public static final String INTENT_FROM_ADM_MESSAGE = "com.amazon.device.messaging.intent.RECEIVE";
public static final String INTENT_FROM_ADM_REGISTRATION_CALLBACK = "com.amazon.device.messaging.intent.REGISTRATION";
public static final String PERMISSION_ADM_INTENTS = "com.amazon.device.messaging.permission.SEND";
private static void a(Context paramContext, Set<String> paramSet, String paramString)
{
PackageManager localPackageManager = paramContext.getPackageManager();
paramContext = paramContext.getPackageName();
Intent localIntent = new Intent(paramString);
localIntent.setPackage(paramContext);
paramContext = localPackageManager.queryBroadcastReceivers(localIntent, 32);
if (paramContext.isEmpty()) {
throw new IllegalStateException("No receivers for action " + paramString);
}
if (Log.isLoggable("ADMRegistrar", 2)) {
Log.v("ADMRegistrar", "Found " + paramContext.size() + " receivers for action " + paramString);
}
paramContext = paramContext.iterator();
while (paramContext.hasNext())
{
paramString = ((ResolveInfo)paramContext.next()).activityInfo.name;
if (!paramSet.contains(paramString)) {
throw new IllegalStateException("Receiver " + paramString + " is not set with permission com.amazon.device.messaging.permission.SEND");
}
}
}
public static void checkDevice(ADM paramADM)
{
if (!paramADM.isSupported()) {
throw new UnsupportedOperationException("ADM is not supported on the current device");
}
}
public static void checkManifest(Context paramContext)
{
PackageManager localPackageManager = paramContext.getPackageManager();
Object localObject1 = paramContext.getPackageName();
Object localObject2 = (String)localObject1 + ".permission.RECEIVE_ADM_MESSAGE";
try
{
localPackageManager.getPermissionInfo((String)localObject2, 4096);
if (!Log.isLoggable("ADMRegistrar", 2)) {
break label187;
}
}
catch (PackageManager.NameNotFoundException paramContext)
{
try
{
localObject2 = localPackageManager.getPackageInfo((String)localObject1, 2);
localObject2 = ((PackageInfo)localObject2).receivers;
if ((localObject2 != null) && (localObject2.length != 0)) {
break label145;
}
throw new IllegalStateException("No receiver for package " + (String)localObject1);
}
catch (PackageManager.NameNotFoundException paramContext)
{
throw new IllegalStateException("Could not get receivers for package " + (String)localObject1);
}
paramContext = paramContext;
throw new IllegalStateException("Application does not define permission " + (String)localObject2);
}
label145:
Log.v("ADMRegistrar", "number of receivers for " + (String)localObject1 + ": " + localObject2.length);
label187:
localObject1 = new HashSet();
int j = localObject2.length;
int i = 0;
while (i < j)
{
localPackageManager = localObject2[i];
if ("com.amazon.device.messaging.permission.SEND".equals(localPackageManager.permission)) {
((Set)localObject1).add(localPackageManager.name);
}
i += 1;
}
if (((Set)localObject1).isEmpty()) {
throw new IllegalStateException("No receiver allowed to receive com.amazon.device.messaging.permission.SEND");
}
a(paramContext, (Set)localObject1, "com.amazon.device.messaging.intent.REGISTRATION");
a(paramContext, (Set)localObject1, "com.amazon.device.messaging.intent.RECEIVE");
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/ADMRegistrar.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/