CrackMe.apk
Download file
package androidx.asynclayoutinflater.view;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.core.util.Pools;
import java.util.Objects;
import java.util.concurrent.ArrayBlockingQueue;
public final class AsyncLayoutInflater {
private static final String TAG = "AsyncLayoutInflater";
Handler mHandler;
private Handler.Callback mHandlerCallback = new Handler.Callback() {
public boolean handleMessage(Message message) {
InflateRequest inflateRequest = (InflateRequest) message.obj;
if (inflateRequest.view == null) {
inflateRequest.view = AsyncLayoutInflater.this.mInflater.inflate(inflateRequest.resid, inflateRequest.parent, false);
}
inflateRequest.callback.onInflateFinished(inflateRequest.view, inflateRequest.resid, inflateRequest.parent);
AsyncLayoutInflater.this.mInflateThread.releaseRequest(inflateRequest);
return true;
}
};
InflateThread mInflateThread;
LayoutInflater mInflater;
public interface OnInflateFinishedListener {
void onInflateFinished(View view, int i, ViewGroup viewGroup);
}
public AsyncLayoutInflater(Context context) {
this.mInflater = new BasicInflater(context);
this.mHandler = new Handler(this.mHandlerCallback);
this.mInflateThread = InflateThread.getInstance();
}
public void inflate(int i, ViewGroup viewGroup, OnInflateFinishedListener onInflateFinishedListener) {
Objects.requireNonNull(onInflateFinishedListener, "callback argument may not be null!");
InflateRequest obtainRequest = this.mInflateThread.obtainRequest();
obtainRequest.inflater = this;
obtainRequest.resid = i;
obtainRequest.parent = viewGroup;
obtainRequest.callback = onInflateFinishedListener;
this.mInflateThread.enqueue(obtainRequest);
}
private static class InflateRequest {
OnInflateFinishedListener callback;
AsyncLayoutInflater inflater;
ViewGroup parent;
int resid;
View view;
InflateRequest() {
}
}
private static class BasicInflater extends LayoutInflater {
private static final String[] sClassPrefixList = {"android.widget.", "android.webkit.", "android.app."};
BasicInflater(Context context) {
super(context);
}
public LayoutInflater cloneInContext(Context context) {
return new BasicInflater(context);
}
/* access modifiers changed from: protected */
public View onCreateView(String str, AttributeSet attributeSet) throws ClassNotFoundException {
String[] strArr = sClassPrefixList;
int length = strArr.length;
int i = 0;
while (i < length) {
try {
View createView = createView(str, strArr[i], attributeSet);
if (createView != null) {
return createView;
}
i++;
} catch (ClassNotFoundException unused) {
}
}
return super.onCreateView(str, attributeSet);
}
}
private static class InflateThread extends Thread {
private static final InflateThread sInstance;
private ArrayBlockingQueue<InflateRequest> mQueue = new ArrayBlockingQueue<>(10);
private Pools.SynchronizedPool<InflateRequest> mRequestPool = new Pools.SynchronizedPool<>(10);
private InflateThread() {
}
static {
InflateThread inflateThread = new InflateThread();
sInstance = inflateThread;
inflateThread.start();
}
public static InflateThread getInstance() {
return sInstance;
}
public void runInner() {
try {
InflateRequest take = this.mQueue.take();
try {
take.view = take.inflater.mInflater.inflate(take.resid, take.parent, false);
} catch (RuntimeException e) {
Log.w(AsyncLayoutInflater.TAG, "Failed to inflate resource in the background! Retrying on the UI thread", e);
}
Message.obtain(take.inflater.mHandler, 0, take).sendToTarget();
} catch (InterruptedException e2) {
Log.w(AsyncLayoutInflater.TAG, e2);
}
}
public void run() {
while (true) {
runInner();
}
}
public InflateRequest obtainRequest() {
InflateRequest acquire = this.mRequestPool.acquire();
return acquire == null ? new InflateRequest() : acquire;
}
public void releaseRequest(InflateRequest inflateRequest) {
inflateRequest.callback = null;
inflateRequest.inflater = null;
inflateRequest.parent = null;
inflateRequest.resid = 0;
inflateRequest.view = null;
this.mRequestPool.release(inflateRequest);
}
public void enqueue(InflateRequest inflateRequest) {
try {
this.mQueue.put(inflateRequest);
} catch (InterruptedException e) {
throw new RuntimeException("Failed to enqueue async inflate request", e);
}
}
}
}
Download file