m.java
9.51 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
package com.instabug.library.util;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.opengl.GLSurfaceView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import com.instabug.library.internal.a.b;
import com.instabug.library.internal.layer.c;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.opengles.GL10;
public class m
{
private a a;
private Activity b;
private Dialog c;
private int[] d;
private View e;
private View f;
private Bitmap g;
private GLSurfaceView h;
private List<c> i;
private Exception j;
public m(Activity paramActivity, Dialog paramDialog, GLSurfaceView paramGLSurfaceView, List<c> paramList, b paramb)
{
this.b = paramActivity;
this.c = paramDialog;
this.h = paramGLSurfaceView;
this.i = paramList;
}
private void a(ViewGroup paramViewGroup, List<View> paramList)
{
LinkedList localLinkedList = new LinkedList();
int k = 0;
if (k < paramViewGroup.getChildCount())
{
View localView = paramViewGroup.getChildAt(k);
int m;
if (((localView.getClass().getCanonicalName() != null) && (localView.getClass().getCanonicalName().startsWith("com.instabug.library"))) || ((localView.getClass().getName() != null) && (localView.getClass().getName().startsWith("com.instabug.library"))))
{
m = 1;
label83:
if (m == 0) {
break label117;
}
localView.setVisibility(8);
paramList.add(localView);
}
for (;;)
{
k += 1;
break;
m = 0;
break label83;
label117:
if ((localView instanceof ViewGroup)) {
localLinkedList.add((ViewGroup)localView);
}
}
}
paramViewGroup = localLinkedList.iterator();
while (paramViewGroup.hasNext()) {
a((ViewGroup)paramViewGroup.next(), paramList);
}
}
private void c()
{
InstabugSDKLogger.d(this, "ScreenshotProcessor: start capturing " + Thread.currentThread().getName());
for (;;)
{
Object localObject1;
Object localObject2;
int k;
int m;
final int i1;
final int i2;
Object localObject4;
final Object localObject5;
try
{
this.e = this.b.getWindow().getDecorView();
if ((this.c != null) && (this.c.isShowing()))
{
this.f = this.c.getWindow().getDecorView();
this.d = new int[2];
this.f.getLocationOnScreen(this.d);
}
this.g = Bitmap.createBitmap(this.e.getWidth(), this.e.getHeight(), Bitmap.Config.ARGB_8888);
Canvas localCanvas = new Canvas();
localCanvas.setBitmap(this.g);
localObject1 = new ArrayList(3);
if ((this.b.getWindow().getDecorView().getRootView() instanceof ViewGroup)) {
a((ViewGroup)this.b.getWindow().getDecorView().getRootView(), (List)localObject1);
}
localObject2 = this.b.getWindow().getDecorView().getBackground();
if (localObject2 != null)
{
this.b.getWindow().setBackgroundDrawable(null);
((Drawable)localObject2).draw(localCanvas);
}
k = 0;
m = 0;
if (this.i != null)
{
localObject3 = this.i.iterator();
k = m;
if (((Iterator)localObject3).hasNext())
{
c localc = (c)((Iterator)localObject3).next();
try
{
localc.a(localCanvas);
k = 1;
}
catch (Exception localException2)
{
InstabugSDKLogger.e(this, "drawing screenshot error", localException2);
k = 1;
}
continue;
}
}
m = k;
if (this.h != null)
{
m = k;
if (this.h.getVisibility() == 0)
{
m = k;
if (this.h.getWindowToken() != null)
{
localObject3 = new int[2];
this.h.getLocationOnScreen((int[])localObject3);
i1 = this.h.getWidth();
i2 = this.h.getHeight();
localObject4 = new int[(i2 + 0) * i1];
localObject5 = IntBuffer.wrap((int[])localObject4);
((IntBuffer)localObject5).position(0);
final CountDownLatch localCountDownLatch = new CountDownLatch(1);
this.h.queueEvent(new Runnable()
{
public final void run()
{
Object localObject = (EGL10)EGLContext.getEGL();
((EGL10)localObject).eglWaitGL();
localObject = (GL10)((EGL10)localObject).eglGetCurrentContext().getGL();
((GL10)localObject).glFinish();
try
{
Thread.sleep(200L);
((GL10)localObject).glReadPixels(0, 0, i1, i2 + 0, 6408, 5121, localObject5);
localCountDownLatch.countDown();
return;
}
catch (InterruptedException localInterruptedException)
{
for (;;)
{
localInterruptedException.printStackTrace();
}
}
}
});
localCountDownLatch.await();
localObject5 = new int[i1 * i2];
m = 0;
k = 0;
break label854;
localObject4 = Bitmap.createBitmap((int[])localObject5, i1, i2, Bitmap.Config.ARGB_8888);
localCanvas.drawBitmap((Bitmap)localObject4, localObject3[0], localObject3[1], null);
((Bitmap)localObject4).recycle();
m = 1;
}
}
}
if (m == 0) {
break label700;
}
boolean bool = this.e.isDrawingCacheEnabled();
if (!bool) {
this.e.setDrawingCacheEnabled(true);
}
this.e.setDrawingCacheBackgroundColor(0);
Object localObject3 = this.e.getDrawingCache(true);
localCanvas.drawBitmap((Bitmap)localObject3, 0.0F, 0.0F, null);
((Bitmap)localObject3).recycle();
this.e.destroyDrawingCache();
this.e.setDrawingCacheEnabled(bool);
this.b.getWindow().setBackgroundDrawable((Drawable)localObject2);
localObject1 = ((List)localObject1).iterator();
if (!((Iterator)localObject1).hasNext()) {
break label712;
}
((View)((Iterator)localObject1).next()).setVisibility(0);
continue;
this.e.setDrawingCacheEnabled(false);
}
catch (Exception localException1)
{
this.j = localException1;
this.a.a(Log.getStackTraceString(localException1.getCause()), this.j);
}
label629:
if (this.g != null) {
if (!a().isFinishing())
{
InstabugSDKLogger.d(this, "ScreenShot ready");
this.a.a(this.g);
}
}
for (;;)
{
this.b = null;
this.a = null;
this.c = null;
this.e = null;
this.f = null;
return;
label700:
this.e.draw(localException1);
break;
label712:
if (this.f == null) {
break label629;
}
localObject1 = Bitmap.createBitmap(this.f.getWidth(), this.f.getHeight(), Bitmap.Config.ARGB_8888);
localObject2 = new Canvas((Bitmap)localObject1);
this.f.draw((Canvas)localObject2);
localException1.drawBitmap((Bitmap)localObject1, this.d[0], this.d[1], null);
((Canvas)localObject2).setBitmap(null);
this.f = null;
((Bitmap)localObject1).recycle();
break label629;
InstabugSDKLogger.d(this, "ScreenShot Error");
this.a.a("Top most activity changed while capturing screenshot. Aborting feedback process.", this.j);
continue;
InstabugSDKLogger.d(this, "ScreenShot Error equal null");
this.a.a("Could not capture screenshot", this.j);
}
label854:
while (m < i2)
{
int n = 0;
while (n < i1)
{
int i3 = localObject4[(m * i1 + n)];
localObject5[((i2 - k - 1) * i1 + n)] = (i3 & 0xFF00FF00 | i3 << 16 & 0xFF0000 | i3 >> 16 & 0xFF);
n += 1;
}
m += 1;
k += 1;
}
}
}
protected Activity a()
{
return this.b;
}
public void a(a parama)
{
this.a = parama;
}
public void b()
{
if (this.a == null) {
throw new IllegalStateException("OnScreenshotReady Listener cannot be null. Make sure you call setListener or pass a listener through the constructor");
}
if (this.b.isFinishing())
{
InstabugSDKLogger.d(this, "ScreenshotProcessor: Activity.isFinishing()");
this.a.a("Top most activity changed before capturing screenshot", this.j);
return;
}
c();
}
public static abstract interface a
{
public abstract void a(Bitmap paramBitmap);
public abstract void a(String paramString, Exception paramException);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/util/m.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/