CrackMe.apk
Download file
package com.google.android.exoplayer2.video;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.view.Surface;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.EGLSurfaceTexture;
import com.google.android.exoplayer2.util.GlUtil;
import com.google.android.exoplayer2.util.Log;
public final class PlaceholderSurface extends Surface {
private static final String TAG = "PlaceholderSurface";
private static int secureMode;
private static boolean secureModeInitialized;
public final boolean secure;
private final PlaceholderSurfaceThread thread;
private boolean threadReleased;
public static synchronized boolean isSecureSupported(Context context) {
boolean z;
synchronized (PlaceholderSurface.class) {
z = true;
if (!secureModeInitialized) {
secureMode = getSecureMode(context);
secureModeInitialized = true;
}
if (secureMode == 0) {
z = false;
}
}
return z;
}
public static PlaceholderSurface newInstanceV17(Context context, boolean z) {
int i = 0;
Assertions.checkState(!z || isSecureSupported(context));
PlaceholderSurfaceThread placeholderSurfaceThread = new PlaceholderSurfaceThread();
if (z) {
i = secureMode;
}
return placeholderSurfaceThread.init(i);
}
private PlaceholderSurface(PlaceholderSurfaceThread placeholderSurfaceThread, SurfaceTexture surfaceTexture, boolean z) {
super(surfaceTexture);
this.thread = placeholderSurfaceThread;
this.secure = z;
}
public void release() {
super.release();
synchronized (this.thread) {
if (!this.threadReleased) {
this.thread.release();
this.threadReleased = true;
}
}
}
private static int getSecureMode(Context context) {
if (GlUtil.isProtectedContentExtensionSupported(context)) {
return GlUtil.isSurfacelessContextExtensionSupported() ? 1 : 2;
}
return 0;
}
private static class PlaceholderSurfaceThread extends HandlerThread implements Handler.Callback {
private static final int MSG_INIT = 1;
private static final int MSG_RELEASE = 2;
private EGLSurfaceTexture eglSurfaceTexture;
private Handler handler;
private Error initError;
private RuntimeException initException;
private PlaceholderSurface surface;
public PlaceholderSurfaceThread() {
super("ExoPlayer:PlaceholderSurface");
}
public PlaceholderSurface init(int i) {
boolean z;
start();
this.handler = new Handler(getLooper(), this);
this.eglSurfaceTexture = new EGLSurfaceTexture(this.handler);
synchronized (this) {
z = false;
this.handler.obtainMessage(1, i, 0).sendToTarget();
while (this.surface == null && this.initException == null && this.initError == null) {
try {
wait();
} catch (InterruptedException unused) {
z = true;
}
}
}
if (z) {
Thread.currentThread().interrupt();
}
RuntimeException runtimeException = this.initException;
if (runtimeException == null) {
Error error = this.initError;
if (error == null) {
return (PlaceholderSurface) Assertions.checkNotNull(this.surface);
}
throw error;
}
throw runtimeException;
}
public void release() {
Assertions.checkNotNull(this.handler);
this.handler.sendEmptyMessage(2);
}
public boolean handleMessage(Message message) {
int i = message.what;
if (i == 1) {
try {
initInternal(message.arg1);
synchronized (this) {
notify();
}
} catch (RuntimeException e) {
Log.e(PlaceholderSurface.TAG, "Failed to initialize placeholder surface", e);
this.initException = e;
synchronized (this) {
notify();
}
} catch (Error e2) {
try {
Log.e(PlaceholderSurface.TAG, "Failed to initialize placeholder surface", e2);
this.initError = e2;
synchronized (this) {
notify();
}
} catch (Throwable th) {
synchronized (this) {
notify();
throw th;
}
}
}
return true;
} else if (i != 2) {
return true;
} else {
try {
releaseInternal();
} catch (Throwable th2) {
quit();
throw th2;
}
quit();
return true;
}
}
private void initInternal(int i) {
Assertions.checkNotNull(this.eglSurfaceTexture);
this.eglSurfaceTexture.init(i);
this.surface = new PlaceholderSurface(this, this.eglSurfaceTexture.getSurfaceTexture(), i != 0);
}
private void releaseInternal() {
Assertions.checkNotNull(this.eglSurfaceTexture);
this.eglSurfaceTexture.release();
}
}
}
Download file