what-the-bank/sources/com/huawei/hms/framework/common/AssetsUtil.java

114 lines
4.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.huawei.hms.framework.common;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Color;
import android.os.SystemClock;
import android.view.ViewConfiguration;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import o.xzZ;
/* loaded from: classes2.dex */
public class AssetsUtil {
private static final int GET_SP_TIMEOUT = 5;
private static final String TAG = "AssetsUtil";
private static int a = 1;
private static int c;
private static final String THREAD_NAME = "AssetsUtil_Operate";
private static final ExecutorService EXECUTOR_SERVICE = ExecutorsUtils.newSingleThreadExecutor(THREAD_NAME);
public static String[] list(Context context, String str) {
if (context == null) {
Logger.w(TAG, "context is null");
return new String[0];
}
FutureTask futureTask = new FutureTask(new Callable<String[]>(context, str) { // from class: com.huawei.hms.framework.common.AssetsUtil.1
final Context val$context;
final String val$path;
{
this.val$context = context;
this.val$path = str;
}
@Override // java.util.concurrent.Callable
public String[] call() throws Exception {
return this.val$context.getAssets().list(this.val$path);
}
});
EXECUTOR_SERVICE.execute(futureTask);
try {
return (String[]) futureTask.get(5L, TimeUnit.SECONDS);
} catch (TimeoutException unused) {
Logger.w(TAG, "get local config files from sp task timed out");
return new String[0];
} catch (Exception unused2) {
Logger.w(TAG, "get local config files from sp task occur unknown Exception");
return new String[0];
} catch (InterruptedException e) {
Logger.w(TAG, "get local config files from sp task interrupted", e);
return new String[0];
} catch (ExecutionException e2) {
Logger.w(TAG, "get local config files from sp task failed", e2);
return new String[0];
} finally {
futureTask.cancel(true);
}
}
public static InputStream open(Context context, String str) throws IOException {
InputStream inputStream;
int i = 2 % 2;
int i2 = c + 7;
int i3 = i2 % 128;
a = i3;
int i4 = i2 % 2;
Object obj = null;
if (context == null) {
int i5 = i3 + 65;
c = i5 % 128;
int i6 = i5 % 2;
Logger.w(TAG, "context is null");
return null;
}
try {
Object[] objArr = {context.getAssets(), str};
Object obj2 = xzZ.y.get(-867414553);
if (obj2 == null) {
obj2 = ((Class) xzZ.c((ViewConfiguration.getKeyRepeatDelay() >> 16) + 5, 5 - Color.argb(0, 0, 0, 0), (char) (1 - (SystemClock.elapsedRealtimeNanos() > 0L ? 1 : (SystemClock.elapsedRealtimeNanos() == 0L ? 0 : -1))))).getMethod("NN_", AssetManager.class, String.class);
xzZ.y.put(-867414553, obj2);
}
inputStream = (InputStream) ((Method) obj2).invoke(null, objArr);
int i7 = a + 55;
c = i7 % 128;
int i8 = i7 % 2;
int i9 = a + 61;
c = i9 % 128;
if (i9 % 2 == 0) {
return inputStream;
}
obj.hashCode();
throw null;
} catch (Throwable th) {
try {
Throwable cause = th.getCause();
if (cause != null) {
throw cause;
}
throw th;
} catch (RuntimeException e) {
Logger.e(TAG, "AssetManager has been destroyed", e);
inputStream = null;
}
}
}
}