package o; import android.app.Service; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Rect; import android.media.AudioTrack; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.Process; import android.os.RemoteException; import android.os.SystemClock; import android.text.AndroidCharacter; import android.text.TextUtils; import android.util.SparseArray; import android.view.View; import android.view.ViewConfiguration; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import o.fQX; import org.bouncycastle.crypto.tls.CipherSuite; /* loaded from: classes5.dex */ public class fQT extends Service { private fQX.RVV e = new fQX.RVV(this) { // from class: o.fQT.4 private fQT a; private byte[] c; private Bitmap e; private SparseArray b = new SparseArray<>(); private SparseArray d = new SparseArray<>(); private static Bitmap aCm_(InputStream inputStream, C13110fQx c13110fQx) throws IOException, InterruptedException { float f; Bitmap decodeStream = BitmapFactory.decodeStream(inputStream, null, null); BitmapFactory.Options options = new BitmapFactory.Options(); if (decodeStream == null) { return null; } decodeStream.getWidth(); decodeStream.getHeight(); if (c13110fQx == null) { return decodeStream; } Rect rect = c13110fQx.e; if (c13110fQx.e != null && c13110fQx.e.left + c13110fQx.e.width() <= decodeStream.getWidth() && c13110fQx.e.top + c13110fQx.e.height() <= decodeStream.getHeight()) { Rect rect2 = c13110fQx.e; decodeStream = Bitmap.createBitmap(decodeStream, rect2.left, rect2.top, rect2.width(), rect2.height()); decodeStream.getAllocationByteCount(); } if (c13110fQx.b > 0 && Math.max(decodeStream.getWidth(), decodeStream.getHeight()) > c13110fQx.b) { int i = options.inSampleSize; Float valueOf = Float.valueOf(c13110fQx.b / Math.max(decodeStream.getWidth(), decodeStream.getHeight())); decodeStream = Bitmap.createScaledBitmap(decodeStream, Math.round(decodeStream.getWidth() * valueOf.floatValue()), Math.round(decodeStream.getHeight() * valueOf.floatValue()), false); } if (decodeStream.getWidth() > decodeStream.getHeight() && c13110fQx.c == C13110fQx.a) { f = -90.0f; } else { if (decodeStream.getWidth() >= decodeStream.getHeight() || c13110fQx.c != C13110fQx.d) { return decodeStream; } f = 90.0f; } return aCl_(decodeStream, f); } private static Bitmap aCn_(ParcelFileDescriptor parcelFileDescriptor, C13110fQx c13110fQx) throws IOException, InterruptedException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); C13085fQR.b(new ParcelFileDescriptor.AutoCloseInputStream(parcelFileDescriptor), byteArrayOutputStream); byteArrayOutputStream.size(); return aCm_(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), c13110fQx); } @Override // o.fQX public final byte[] d(int i, C13110fQx c13110fQx) throws RemoteException { try { InputStream inputStream = this.b.get(i); if (inputStream == null) { return null; } inputStream.reset(); return fQO.a(aCm_(inputStream, c13110fQx), Bitmap.CompressFormat.JPEG, 60); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final void a(int i) throws RemoteException { int max; Bitmap bitmap = this.e; if (bitmap != null && (max = Math.max(bitmap.getWidth(), this.e.getHeight())) >= i) { Bitmap bitmap2 = this.e; Float valueOf = Float.valueOf(max / i); this.e = Bitmap.createScaledBitmap(bitmap2, Math.round(bitmap2.getWidth() * valueOf.floatValue()), Math.round(bitmap2.getHeight() * valueOf.floatValue()), false); } } @Override // o.fQX public final byte[] c() throws RemoteException { Bitmap bitmap = this.e; if (bitmap == null) { return null; } try { byte[] a2 = fQO.a(bitmap, Bitmap.CompressFormat.JPEG, 60); this.c = a2; int length = a2.length; return a2; } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final Bitmap aCx_() throws RemoteException { return this.e; } @Override // o.fQX public final ParcelFileDescriptor aCw_() throws RemoteException { try { if (this.e == null) { return null; } return C13085fQR.aCk_(new ByteArrayInputStream(c())); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final void d() throws RemoteException { this.e = null; this.c = null; } @Override // o.fQX public final String b() throws RemoteException { Bitmap bitmap = this.e; if (bitmap == null) { return null; } try { if (this.c == null) { this.c = fQO.a(bitmap, Bitmap.CompressFormat.JPEG, 60); } return C13096fQj.d(this.c); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final boolean e() throws RemoteException { Bitmap bitmap = this.e; return bitmap != null && bitmap.getWidth() > this.e.getHeight(); } @Override // o.fQX public final void e(int i) throws RemoteException { try { ByteArrayOutputStream byteArrayOutputStream = this.d.get(i); if (byteArrayOutputStream == null) { return; } this.b.put(i, new ByteArrayInputStream(byteArrayOutputStream.toByteArray())); this.d.get(i).flush(); this.d.get(i).close(); this.d.setValueAt(i, null); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final ParcelFileDescriptor aCv_(int i, C13110fQx c13110fQx) throws RemoteException { try { byte[] d2 = d(i, c13110fQx); if (d2 == null) { return null; } return C13085fQR.aCk_(new ByteArrayInputStream(d2)); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final void a(ParcelFileDescriptor parcelFileDescriptor, C13110fQx c13110fQx) throws RemoteException { try { this.e = aCn_(parcelFileDescriptor, c13110fQx); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final void a(int i, byte[] bArr) throws RemoteException { try { this.d.get(i).write(bArr); } catch (Exception e) { throw new RemoteException(e.getMessage()); } } @Override // o.fQX public final void d(float f) throws RemoteException { this.e = aCl_(this.e, f); } @Override // o.fQX public final int b(int i) throws RemoteException { int size = this.d.size(); this.d.put(size, new ByteArrayOutputStream(i)); return size; } @Override // o.fQX public final int a() { return Process.myPid(); } private static Bitmap aCl_(Bitmap bitmap, float f) { if (bitmap == null) { return null; } Matrix matrix = new Matrix(); matrix.postRotate(f); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } { this.a = this; } }; private static final byte[] $$a = {71, -71, -97, 59}; private static final int $$b = CipherSuite.TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA; private static int $10 = 0; private static int $11 = 1; private static int c = 0; private static int a = 1; private static long d = -4697141034000414819L; /* JADX WARN: Removed duplicated region for block: B:10:0x0027 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001f */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0027 -> B:4:0x0029). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void g(byte r6, byte r7, int r8, java.lang.Object[] r9) { /* int r7 = r7 + 4 byte[] r0 = o.fQT.$$a int r8 = r8 * 2 int r8 = 121 - r8 int r6 = r6 * 3 int r6 = r6 + 1 byte[] r1 = new byte[r6] r2 = 0 if (r0 != 0) goto L15 r3 = r8 r5 = r2 r8 = r6 goto L29 L15: r3 = r2 L16: byte r4 = (byte) r8 int r5 = r3 + 1 r1[r3] = r4 int r7 = r7 + 1 if (r5 != r6) goto L27 java.lang.String r6 = new java.lang.String r6.(r1, r2) r9[r2] = r6 return L27: r3 = r0[r7] L29: int r8 = r8 + r3 r3 = r5 goto L16 */ throw new UnsupportedOperationException("Method not decompiled: o.fQT.g(byte, byte, int, java.lang.Object[]):void"); } private static void f(char[] cArr, int i, Object[] objArr) { int i2 = 2 % 2; GuL guL = new GuL(); char[] a2 = GuL.a(d ^ (-7538262848231253921L), cArr, i); guL.a = 4; int i3 = $11 + 49; $10 = i3 % 128; int i4 = i3 % 2; while (guL.a < a2.length) { int i5 = $10 + 25; $11 = i5 % 128; int i6 = i5 % 2; guL.c = guL.a - 4; int i7 = guL.a; try { Object[] objArr2 = {Long.valueOf(a2[guL.a] ^ a2[guL.a % 4]), Long.valueOf(guL.c), Long.valueOf(d)}; Object obj = xzZ.y.get(428080616); if (obj == null) { Class cls = (Class) xzZ.c(Color.red(0) + 208, Process.getGidForName("") + 6, (char) (1706 - (ViewConfiguration.getScrollBarFadeDuration() >> 16))); byte b = (byte) 0; byte b2 = (byte) (b - 1); Object[] objArr3 = new Object[1]; g(b, b2, (byte) (-b2), objArr3); obj = cls.getMethod((String) objArr3[0], Long.TYPE, Long.TYPE, Long.TYPE); xzZ.y.put(428080616, obj); } a2[i7] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); Object[] objArr4 = {guL, guL}; Object obj2 = xzZ.y.get(-1875914398); if (obj2 == null) { Class cls2 = (Class) xzZ.c((AudioTrack.getMinVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMinVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 392, '5' - AndroidCharacter.getMirror('0'), (char) (ViewConfiguration.getEdgeSlop() >> 16)); byte b3 = (byte) 0; byte b4 = (byte) (b3 - 1); Object[] objArr5 = new Object[1]; g(b3, b4, (byte) (b4 + 1), objArr5); obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class); xzZ.y.put(-1875914398, obj2); } ((Method) obj2).invoke(null, objArr4); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } objArr[0] = new String(a2, 4, a2.length - 4); } @Override // android.app.Service, android.content.ContextWrapper public void attachBaseContext(Context context) { int i = 2 % 2; super.attachBaseContext(context); Object[] objArr = new Object[1]; f(new char[]{20035, 20002, 22353, 30578, 52027, 2301, 51346, 54287, 12580, 35314, 18842, 21851, 45116, 2800, 51912, 54845, 13097, 35812, 19341, 22272, 45584, 3264}, View.MeasureSpec.getSize(0), objArr); Class cls = Class.forName((String) objArr[0]); Object[] objArr2 = new Object[1]; f(new char[]{54795, 54886, 14237, 37731, 30337, 26662, 11442, 27054, 43367}, ViewConfiguration.getMaximumDrawingCacheSize() >> 24, objArr2); int intValue = ((Integer) cls.getDeclaredMethod((String) objArr2[0], new Class[0]).invoke(null, new Object[0])).intValue() % 100000; if (intValue >= 99000) { int i2 = c + 59; a = i2 % 128; int i3 = i2 % 2; if (intValue <= 99999) { return; } } Context applicationContext = context != null ? context.getApplicationContext() : context; if (applicationContext != null) { try { Object obj = xzZ.y.get(125943855); if (obj == null) { obj = ((Class) xzZ.c((ViewConfiguration.getLongPressTimeout() >> 16) + 492, 5 - TextUtils.getOffsetAfter("", 0), (char) View.getDefaultSize(0, 0))).getMethod("a", null); xzZ.y.put(125943855, obj); } Object invoke = ((Method) obj).invoke(null, null); Object[] objArr3 = new Object[1]; f(new char[]{48598, 48615, 61887, 4710, 50639, 44618, 44502, 56043, 49901, 12054, 11404, 23520, 17316, 44116, 44992, 55544, 49405, 11527, 11977, 22953, 16788, 43630, 43504, 56977, 50893, 11105, 10411, 24472, 18304, 43131, 43953, 56460, 50317, 10620, 10942, 23936, 17831, 43400, 42394, 53880, 51960, 9936, 9416, 21283, 19380, 42905, 42891, 53356, 51437, 9373, 9951, 20837}, (-16777216) - Color.rgb(0, 0, 0), objArr3); String str = (String) objArr3[0]; Object[] objArr4 = new Object[1]; f(new char[]{61295, 61194, 44049, 17279, 32276, 62385, 64717, 24887, 36945, 29369, 32199, 57443, 4378, 61942, 65241, 25460, 37445, 28925, 32724, 57979, 4985, 63431, 63722, 25920, 37924, 30413, 31154, 58446, 5484, 62933, 64251, 26369, 38501, 29906, 31731, 58962, 5912, 62500, 62606, 27123, 38930, 31523, 30161, 59640, 6409, 64097, 63178, 27572, 39426, 31034, 30613, 60136, 7019, 63499, 61693, 28037, 40036, 32515, 29094, 60632, 7463, 65088, 62138, 28570, 40481, 32073, 29666, 61135}, View.resolveSizeAndState(0, 0, 0), objArr4); String str2 = (String) objArr4[0]; Object[] objArr5 = new Object[1]; f(new char[]{55606, 55639, 35846, 52598, 6384, 54268, 29378, 1925, 42591, 21247, 62367, 34523, 10004, 53741, 28881, 1475, 42060, 20712, 61914, 33942, 9591, 55174, 30388, 934, 41519, 22236, 63469, 33452, 9061, 54732, 29860, 483, 41014, 21706, 62963, 33002, 8514, 54374, 31443, 3907, 44619, 23358, 64395, 36431, 12115, 55844, 30871, 3413, 44040, 22911, 63900, 35851, 11572, 55361, 32416, 2926, 43624, 24341, 65450, 35384, 11126, 56917, 31972, 2343, 43131, 23812, 65001, 34937}, ViewConfiguration.getLongPressTimeout() >> 16, objArr5); String str3 = (String) objArr5[0]; Object[] objArr6 = new Object[1]; f(new char[]{48021, 48125, 49687, 33445, 22214, 40353, 15701, 18928, 50414, 7399, 48134, 51367, 17910, 40876, 16208, 19453, 50926, 7842, 48724, 51957, 18384, 39303, 14690, 19913, 49372, 6289, 47211, 52425, 16843, 39822, 15167, 20420, 49861, 6815, 47740, 52953, 17313, 39542, 13568, 16691, 52393, 5427, 46094, 49213, 19876, 38007, 14101, 17187, 52924, 6008, 46616, 49706, 20368, 38427, 12578, 17679, 51344, 4370, 45096, 50200, 18828, 36874, 13112, 18206, 51850, 4936, 45610, 50700, 19258, 37411, 12947, 22831, 54392, 3371, 44492, 55398, 21873, 35894}, ViewConfiguration.getScrollBarSize() >> 8, objArr6); String str4 = (String) objArr6[0]; Object[] objArr7 = new Object[1]; f(new char[]{39185, 39208, 6422, 1712, 35803, 18170, 47372, 38067, 58921}, View.MeasureSpec.getSize(0), objArr7); String str5 = (String) objArr7[0]; Object[] objArr8 = new Object[1]; f(new char[]{32768, 32869, 10375, 17190, 55072, 30500, 64656, 51282, 65388, 63092, 32158, 18782, 32317, 30051, 65154, 51731, 64890, 62576, 32654, 19276, 31761, 29524, 63663, 52263, 64330, 61960, 31209, 19811, 31234, 28950, 64160, 52791, 63759, 61464, 31737, 20331, 30836, 28848, 62675, 49347}, 1 - (SystemClock.uptimeMillis() > 0L ? 1 : (SystemClock.uptimeMillis() == 0L ? 0 : -1)), objArr8); Object[] objArr9 = {applicationContext, str, str2, str3, str4, true, str5, (String) objArr8[0]}; Object obj2 = xzZ.y.get(1656189573); if (obj2 == null) { obj2 = ((Class) xzZ.c((ViewConfiguration.getKeyRepeatTimeout() >> 16) + 487, 5 - (ViewConfiguration.getLongPressTimeout() >> 16), (char) View.resolveSizeAndState(0, 0, 0))).getMethod("e", Context.class, String.class, String.class, String.class, String.class, Boolean.TYPE, String.class, String.class); xzZ.y.put(1656189573, obj2); } ((Method) obj2).invoke(invoke, objArr9); int i4 = a + 31; c = i4 % 128; int i5 = i4 % 2; } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } } @Override // android.app.Service public void onCreate() { int i = 2 % 2; int i2 = c + 23; a = i2 % 128; int i3 = i2 % 2; super.onCreate(); if (i3 == 0) { throw null; } } @Override // android.app.Service public IBinder onBind(Intent intent) { int i = 2 % 2; int i2 = a + 57; c = i2 % 128; if (i2 % 2 == 0) { return this.e; } throw null; } }