LocalBroadcastManager.java
8.86 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
package android.support.v4.content;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
public final class LocalBroadcastManager
{
private static final Object f = new Object();
private static LocalBroadcastManager g;
private final Context a;
private final HashMap<BroadcastReceiver, ArrayList<IntentFilter>> b = new HashMap();
private final HashMap<String, ArrayList<b>> c = new HashMap();
private final ArrayList<a> d = new ArrayList();
private final Handler e;
private LocalBroadcastManager(Context paramContext)
{
this.a = paramContext;
this.e = new Handler(paramContext.getMainLooper())
{
public final void handleMessage(Message paramAnonymousMessage)
{
switch (paramAnonymousMessage.what)
{
default:
super.handleMessage(paramAnonymousMessage);
return;
}
LocalBroadcastManager.a(LocalBroadcastManager.this);
}
};
}
private void a()
{
for (;;)
{
int i;
synchronized (this.b)
{
i = this.d.size();
if (i <= 0) {
return;
}
a[] arrayOfa = new a[i];
this.d.toArray(arrayOfa);
this.d.clear();
i = 0;
if (i >= arrayOfa.length) {
continue;
}
??? = arrayOfa[i];
int j = 0;
if (j < ???.b.size())
{
((b)???.b.get(j)).b.onReceive(this.a, ???.a);
j += 1;
}
}
i += 1;
}
}
public static LocalBroadcastManager getInstance(Context paramContext)
{
synchronized (f)
{
if (g == null) {
g = new LocalBroadcastManager(paramContext.getApplicationContext());
}
paramContext = g;
return paramContext;
}
}
public final void registerReceiver(BroadcastReceiver paramBroadcastReceiver, IntentFilter paramIntentFilter)
{
synchronized (this.b)
{
b localb = new b(paramIntentFilter, paramBroadcastReceiver);
Object localObject2 = (ArrayList)this.b.get(paramBroadcastReceiver);
Object localObject1 = localObject2;
if (localObject2 == null)
{
localObject1 = new ArrayList(1);
this.b.put(paramBroadcastReceiver, localObject1);
}
((ArrayList)localObject1).add(paramIntentFilter);
int i = 0;
while (i < paramIntentFilter.countActions())
{
localObject2 = paramIntentFilter.getAction(i);
localObject1 = (ArrayList)this.c.get(localObject2);
paramBroadcastReceiver = (BroadcastReceiver)localObject1;
if (localObject1 == null)
{
paramBroadcastReceiver = new ArrayList(1);
this.c.put(localObject2, paramBroadcastReceiver);
}
paramBroadcastReceiver.add(localb);
i += 1;
}
return;
}
}
public final boolean sendBroadcast(Intent paramIntent)
{
int i;
label155:
int j;
Object localObject;
int k;
ArrayList localArrayList1;
synchronized (this.b)
{
String str1 = paramIntent.getAction();
String str2 = paramIntent.resolveTypeIfNeeded(this.a.getContentResolver());
Uri localUri = paramIntent.getData();
String str3 = paramIntent.getScheme();
Set localSet = paramIntent.getCategories();
if ((paramIntent.getFlags() & 0x8) == 0) {
break label485;
}
i = 1;
if (i != 0) {
Log.v("LocalBroadcastManager", "Resolving type " + str2 + " scheme " + str3 + " of intent " + paramIntent);
}
ArrayList localArrayList2 = (ArrayList)this.c.get(paramIntent.getAction());
if (localArrayList2 == null) {
break label462;
}
if (i == 0) {
break label470;
}
Log.v("LocalBroadcastManager", "Action list: " + localArrayList2);
break label470;
if (j >= localArrayList2.size()) {
break label521;
}
localObject = (b)localArrayList2.get(j);
if (i != 0) {
Log.v("LocalBroadcastManager", "Matching against filter " + ((b)localObject).a);
}
if (((b)localObject).c)
{
if (i == 0) {
break label490;
}
Log.v("LocalBroadcastManager", " Filter's target already added");
}
else
{
k = ((b)localObject).a.match(str1, str2, str3, localUri, localSet, "LocalBroadcastManager");
if (k >= 0)
{
if (i != 0) {
Log.v("LocalBroadcastManager", " Filter matched! match=0x" + Integer.toHexString(k));
}
if (localArrayList1 != null) {
break label467;
}
localArrayList1 = new ArrayList();
label299:
localArrayList1.add(localObject);
((b)localObject).c = true;
}
}
}
if (i != 0) {
switch (k)
{
default:
localObject = "unknown reason";
label364:
Log.v("LocalBroadcastManager", " Filter did not match: " + (String)localObject);
break;
}
}
for (;;)
{
if (i < localArrayList1.size())
{
((b)localArrayList1.get(i)).c = false;
i += 1;
}
else
{
this.d.add(new a(paramIntent, localArrayList1));
if (!this.e.hasMessages(1)) {
this.e.sendEmptyMessage(1);
}
return true;
label462:
label467:
label470:
label485:
label490:
label521:
do
{
return false;
break label299;
localArrayList1 = null;
j = 0;
break label155;
for (;;)
{
j += 1;
break label155;
i = 0;
break;
}
localObject = "action";
break label364;
localObject = "category";
break label364;
localObject = "data";
break label364;
localObject = "type";
break label364;
} while (localArrayList1 == null);
i = 0;
}
}
}
public final void sendBroadcastSync(Intent paramIntent)
{
if (sendBroadcast(paramIntent)) {
a();
}
}
public final void unregisterReceiver(BroadcastReceiver paramBroadcastReceiver)
{
for (;;)
{
int k;
int i;
synchronized (this.b)
{
ArrayList localArrayList1 = (ArrayList)this.b.remove(paramBroadcastReceiver);
if (localArrayList1 != null) {
break label167;
}
return;
if (j < localArrayList1.size())
{
IntentFilter localIntentFilter = (IntentFilter)localArrayList1.get(j);
k = 0;
if (k >= localIntentFilter.countActions()) {
break label188;
}
String str = localIntentFilter.getAction(k);
ArrayList localArrayList2 = (ArrayList)this.c.get(str);
if (localArrayList2 == null) {
break label179;
}
i = 0;
if (i < localArrayList2.size())
{
if (((b)localArrayList2.get(i)).b == paramBroadcastReceiver)
{
localArrayList2.remove(i);
i -= 1;
break label172;
}
}
else
{
if (localArrayList2.size() > 0) {
break label179;
}
this.c.remove(str);
break label179;
}
}
else
{
return;
}
}
break label172;
label167:
int j = 0;
continue;
label172:
i += 1;
continue;
label179:
k += 1;
continue;
label188:
j += 1;
}
}
static final class a
{
final Intent a;
final ArrayList<LocalBroadcastManager.b> b;
a(Intent paramIntent, ArrayList<LocalBroadcastManager.b> paramArrayList)
{
this.a = paramIntent;
this.b = paramArrayList;
}
}
static final class b
{
final IntentFilter a;
final BroadcastReceiver b;
boolean c;
b(IntentFilter paramIntentFilter, BroadcastReceiver paramBroadcastReceiver)
{
this.a = paramIntentFilter;
this.b = paramBroadcastReceiver;
}
public final String toString()
{
StringBuilder localStringBuilder = new StringBuilder(128);
localStringBuilder.append("Receiver{");
localStringBuilder.append(this.b);
localStringBuilder.append(" filter=");
localStringBuilder.append(this.a);
localStringBuilder.append("}");
return localStringBuilder.toString();
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/content/LocalBroadcastManager.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/