zzb.java
6.66 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
package com.google.firebase.iid;
import android.app.Service;
import android.content.BroadcastReceiver.PendingResult;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import android.os.Process;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import android.util.Pair;
import com.google.android.gms.common.stats.zza;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public abstract class zzb
extends Service
{
private Binder a;
private final Object b = new Object();
@VisibleForTesting
final ExecutorService c = Executors.newSingleThreadExecutor();
private int d;
private int e = 0;
private void a(Intent arg1)
{
if (??? != null) {
WakefulBroadcastReceiver.completeWakefulIntent(???);
}
synchronized (this.b)
{
this.e -= 1;
if (this.e == 0) {
stopSelfResult(this.d);
}
return;
}
}
public abstract void handleIntent(Intent paramIntent);
public final IBinder onBind(Intent paramIntent)
{
try
{
Log.isLoggable("EnhancedIntentService", 3);
if (this.a == null) {
this.a = new zza(this);
}
paramIntent = this.a;
return paramIntent;
}
finally {}
}
public final int onStartCommand(final Intent paramIntent, int paramInt1, int paramInt2)
{
synchronized (this.b)
{
this.d = paramInt2;
this.e += 1;
??? = zzD(paramIntent);
if (??? == null)
{
a(paramIntent);
return 2;
}
}
if (zzE((Intent)???))
{
a(paramIntent);
return 2;
}
this.c.execute(new Runnable()
{
public final void run()
{
zzb.this.handleIntent(localObject);
zzb.a(zzb.this, paramIntent);
}
});
return 3;
}
protected Intent zzD(Intent paramIntent)
{
return paramIntent;
}
public boolean zzE(Intent paramIntent)
{
return false;
}
public static class zza
extends Binder
{
private final zzb a;
zza(zzb paramzzb)
{
this.a = paramzzb;
}
private static void b(@Nullable BroadcastReceiver.PendingResult paramPendingResult)
{
if (paramPendingResult != null) {
paramPendingResult.finish();
}
}
public void zza(final Intent paramIntent, @Nullable final BroadcastReceiver.PendingResult paramPendingResult)
{
if (Binder.getCallingUid() != Process.myUid()) {
throw new SecurityException("Binding only allowed within app");
}
Log.isLoggable("EnhancedIntentService", 3);
if (this.a.zzE(paramIntent))
{
b(paramPendingResult);
return;
}
Log.isLoggable("EnhancedIntentService", 3);
this.a.c.execute(new Runnable()
{
public final void run()
{
Log.isLoggable("EnhancedIntentService", 3);
zzb.this.handleIntent(paramIntent);
zzb.zza.a(paramPendingResult);
}
});
}
}
public static class zzb
implements ServiceConnection
{
private final Context a;
private final Intent b;
private final Queue<Pair<Intent, BroadcastReceiver.PendingResult>> c = new LinkedList();
private zzb.zza d;
private boolean e = false;
public zzb(Context paramContext, String paramString)
{
this.a = paramContext.getApplicationContext();
this.b = new Intent(paramString).setPackage(this.a.getPackageName());
}
private void a()
{
try
{
Log.isLoggable("EnhancedIntentService", 3);
for (;;)
{
if (this.c.isEmpty()) {
break label165;
}
Log.isLoggable("EnhancedIntentService", 3);
if ((this.d == null) || (!this.d.isBinderAlive())) {
break;
}
Log.isLoggable("EnhancedIntentService", 3);
Pair localPair = (Pair)this.c.poll();
this.d.zza((Intent)localPair.first, (BroadcastReceiver.PendingResult)localPair.second);
}
if (!Log.isLoggable("EnhancedIntentService", 3)) {
break label131;
}
}
finally {}
boolean bool;
if (!this.e)
{
bool = true;
new StringBuilder(39).append("binder is dead. start connection? ").append(bool);
label131:
if (!this.e) {
this.e = true;
}
}
for (;;)
{
try
{
bool = zza.zzyJ().zza(this.a, this.b, this, 65);
if (bool)
{
label165:
return;
bool = false;
break;
}
Log.e("EnhancedIntentService", "binding to the service failed");
}
catch (SecurityException localSecurityException)
{
Log.e("EnhancedIntentService", "Exception while binding the service", localSecurityException);
continue;
}
if (!this.c.isEmpty()) {
((BroadcastReceiver.PendingResult)((Pair)this.c.poll()).second).finish();
}
}
}
public void onServiceConnected(ComponentName paramComponentName, IBinder paramIBinder)
{
try
{
this.e = false;
this.d = ((zzb.zza)paramIBinder);
if (Log.isLoggable("EnhancedIntentService", 3))
{
paramComponentName = String.valueOf(paramComponentName);
new StringBuilder(String.valueOf(paramComponentName).length() + 20).append("onServiceConnected: ").append(paramComponentName);
}
a();
return;
}
finally {}
}
public void onServiceDisconnected(ComponentName paramComponentName)
{
if (Log.isLoggable("EnhancedIntentService", 3))
{
paramComponentName = String.valueOf(paramComponentName);
new StringBuilder(String.valueOf(paramComponentName).length() + 23).append("onServiceDisconnected: ").append(paramComponentName);
}
a();
}
public void zzb(Intent paramIntent, BroadcastReceiver.PendingResult paramPendingResult)
{
try
{
Log.isLoggable("EnhancedIntentService", 3);
this.c.add(new Pair(paramIntent, paramPendingResult));
a();
return;
}
finally
{
paramIntent = finally;
throw paramIntent;
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/firebase/iid/zzb.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/