Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
package com.baidu.license;
/* loaded from: classes.dex */
public interface INotProguard {
}

View File

@@ -0,0 +1,27 @@
package com.baidu.license;
import android.content.Context;
import com.baidu.license.util.oi;
/* loaded from: classes.dex */
public class LicenseManager implements INotProguard {
private static Context a;
public static void a(Context context, String str) {
a = context;
oi.a(context, str);
SDKHttpConfig.a(str);
SDKHttpConfig.b(context.getPackageName());
SDKHttpConfig.c("2.7.1");
oi.a(context);
}
public static boolean b() {
oi.a(a(), SDKHttpConfig.a());
return oi.b();
}
public static Context a() {
return a;
}
}

View File

@@ -0,0 +1,20 @@
package com.baidu.license;
/* loaded from: classes.dex */
public class SDKHttpConfig implements INotProguard {
private static String a = "";
public static String a() {
return a;
}
public static void b(String str) {
}
public static void c(String str) {
}
public static void a(String str) {
a = str;
}
}

View File

@@ -0,0 +1,38 @@
package com.baidu.license.api;
import com.baidu.license.template.bean.TemplateListModel;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
/* loaded from: classes.dex */
public interface ApiService {
@POST("/v1/sdk/filter?list")
Call<ResponseBody> reqFilter(@Body Map<String, Object> map);
@POST("v1/sdk/subtitle?get")
Call<ResponseBody> reqGetResolveResult(@Body Map<String, Object> map);
@POST("/v1/sdk/license?valid")
Call<Object> reqLicenseValid(@Body Map<String, Object> map);
@POST("/v1/sdk/face")
Call<Object> reqOneSticker(@Body Map<String, Object> map);
@POST("/v1/sdk/subtitle?process")
Call<ResponseBody> reqStartResolve(@Body Map<String, Object> map);
@POST("/v1/sdk/face?list")
Call<Object> reqStickerList(@Body Map<String, Object> map);
@POST("/v1/sdk/template?list")
Call<TemplateListModel> reqTemplateList(@Body Map<String, Object> map);
@POST("/v1/sdk/transition?list")
Call<ResponseBody> reqTransitions(@Body Map<String, Object> map);
@POST("/v1/sdk/subtitle?apply")
Call<ResponseBody> reqUploadParams(@Body Map<String, Object> map);
}

View File

@@ -0,0 +1,229 @@
package com.baidu.license.download;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.baidu.license.download.DownloadRequest;
import com.baidu.license.download.base.DownloadCallback;
import com.baidu.license.download.exception.DownloadException;
import com.baidu.license.download.utils.CommonUtils;
/* loaded from: classes.dex */
public class CaptureDownloadService extends Service {
private DownloadManager a;
private void a(String str) {
this.a.a(str);
}
private void b(String str) {
this.a.b(str);
}
@Override // android.app.Service
public IBinder onBind(Intent intent) {
return null;
}
@Override // android.app.Service
public void onCreate() {
super.onCreate();
this.a = DownloadManager.c();
}
@Override // android.app.Service
public void onDestroy() {
super.onDestroy();
this.a.b();
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Code restructure failed: missing block: B:5:0x0034, code lost:
if (r0.equals("com.baidu.cloudar.download.ACTION_DOWNLOAD") != false) goto L22;
*/
@Override // android.app.Service
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public int onStartCommand(android.content.Intent r12, int r13, int r14) {
/*
r11 = this;
if (r12 == 0) goto L7e
java.lang.String r0 = r12.getAction()
r1 = 0
java.lang.String r2 = "extra_position"
int r2 = r12.getIntExtra(r2, r1)
com.baidu.license.download.nx r3 = new com.baidu.license.download.nx
r3.<init>()
java.lang.String r4 = "extra_file_info"
java.lang.String r4 = r12.getStringExtra(r4)
r3.a(r4)
java.lang.String r4 = "extra_tag"
java.lang.String r4 = r12.getStringExtra(r4)
r5 = -1
int r6 = r0.hashCode()
r7 = 4
r8 = 3
r9 = 2
r10 = 1
switch(r6) {
case -1845641145: goto L55;
case -1229466579: goto L4b;
case -540402171: goto L41;
case 1657148651: goto L37;
case 1915551059: goto L2e;
default: goto L2d;
}
L2d:
goto L5f
L2e:
java.lang.String r6 = "com.baidu.cloudar.download.ACTION_DOWNLOAD"
boolean r0 = r0.equals(r6)
if (r0 == 0) goto L5f
goto L60
L37:
java.lang.String r1 = "com.baidu.cloudar.download.ACTION_PAUSE"
boolean r0 = r0.equals(r1)
if (r0 == 0) goto L5f
r1 = 1
goto L60
L41:
java.lang.String r1 = "com.baidu.cloudar.download.ACTION_CANCEL"
boolean r0 = r0.equals(r1)
if (r0 == 0) goto L5f
r1 = 2
goto L60
L4b:
java.lang.String r1 = "com.baidu.cloudar.download.ACTION_PAUSE_ALL"
boolean r0 = r0.equals(r1)
if (r0 == 0) goto L5f
r1 = 3
goto L60
L55:
java.lang.String r1 = "com.baidu.cloudar.download.ACTION_CANCEL_ALL"
boolean r0 = r0.equals(r1)
if (r0 == 0) goto L5f
r1 = 4
goto L60
L5f:
r1 = -1
L60:
if (r1 == 0) goto L7b
if (r1 == r10) goto L77
if (r1 == r9) goto L73
if (r1 == r8) goto L6f
if (r1 == r7) goto L6b
goto L7e
L6b:
r11.a()
goto L7e
L6f:
r11.b()
goto L7e
L73:
r11.a(r4)
goto L7e
L77:
r11.b(r4)
goto L7e
L7b:
r11.a(r2, r3, r4)
L7e:
int r12 = super.onStartCommand(r12, r13, r14)
return r12
*/
throw new UnsupportedOperationException("Method not decompiled: com.baidu.license.download.CaptureDownloadService.onStartCommand(android.content.Intent, int, int):int");
}
private void a() {
this.a.a();
}
private void b() {
this.a.b();
}
private void a(int i, nx nxVar, String str) {
DownloadRequest.Builder builder = new DownloadRequest.Builder();
builder.a(nxVar.b());
this.a.a(builder.a(), str, new ProgressCallback(i, nxVar, getApplicationContext()));
}
public static class ProgressCallback extends DownloadCallback {
private int a;
private nx b;
private LocalBroadcastManager c;
private long d;
private int e;
public ProgressCallback(int i, nx nxVar, Context context) {
this.a = i;
this.b = nxVar;
this.c = LocalBroadcastManager.a(context);
}
@Override // com.baidu.license.download.base.DownloadCallback
public void a(long j, long j2, int i) {
if (this.d == 0) {
this.d = System.currentTimeMillis();
}
this.b.b(3);
this.b.a(i);
this.b.b(CommonUtils.a(j, j2));
if (a(i)) {
a(this.b);
}
}
@Override // com.baidu.license.download.base.DownloadCallback
public void b() {
this.b.b(0);
this.b.a(0);
this.b.b("");
a(this.b);
}
@Override // com.baidu.license.download.base.DownloadCallback
public void c() {
this.b.b(4);
a(this.b);
}
@Override // com.baidu.license.download.base.DownloadCallback
public void a(String str) {
this.b.b(6);
this.b.a(100);
this.b.c(str);
a(this.b);
}
@Override // com.baidu.license.download.base.DownloadCallback
public void a(DownloadException downloadException) {
downloadException.printStackTrace();
this.b.b(5);
a(this.b);
}
private void a(nx nxVar) {
Intent intent = new Intent();
intent.setAction("com.baidu.cloudar.download.ACTION_BROAD_CAST");
intent.putExtra("extra_position", this.a);
intent.putExtra("extra_file_info", nxVar.a().toString());
this.c.a(intent);
}
private boolean a(int i) {
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - this.d <= 300 || i == this.e) {
return false;
}
this.d = currentTimeMillis;
this.e = i;
return true;
}
}
}

View File

@@ -0,0 +1,138 @@
package com.baidu.license.download;
import android.os.Handler;
import android.os.Looper;
import com.baidu.license.download.a.a;
import com.baidu.license.download.a.trw;
import com.baidu.license.download.base.DownloadCallback;
import com.baidu.license.download.base.DownloadStatusDelivery;
import com.baidu.license.download.base.Downloader;
import com.baidu.license.download.utils.LogUtils;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/* loaded from: classes.dex */
public class DownloadManager implements Downloader.OnDownloaderDestroyedListener {
private static DownloadManager f;
private oi b;
private ExecutorService c;
private DownloadStatusDelivery d;
private Handler e = new Handler(Looper.getMainLooper());
private Map<String, Downloader> a = new LinkedHashMap();
private DownloadManager() {
a(new oi());
}
public static DownloadManager c() {
if (f == null) {
synchronized (DownloadManager.class) {
if (f == null) {
f = new DownloadManager();
}
}
}
return f;
}
private boolean d(String str) {
Downloader downloader;
if (!this.a.containsKey(str) || (downloader = this.a.get(str)) == null) {
return false;
}
if (downloader.isRunning()) {
LogUtils.a("DownloadInfo has been started!");
return true;
}
LogUtils.a("DownloadInfo not started!");
return false;
}
public void b(String str) {
String c = c(str);
if (this.a.containsKey(c)) {
Downloader downloader = this.a.get(c);
if (downloader != null && downloader.isRunning()) {
downloader.pause();
}
this.a.remove(c);
}
}
private void a(oi oiVar) {
if (oiVar.b() > oiVar.a()) {
throw new IllegalArgumentException("thread num must < max thread num");
}
this.b = oiVar;
this.c = Executors.newFixedThreadPool(this.b.a());
this.d = new trw(this.e);
}
private String c(String str) {
if (str != null) {
return String.valueOf(str.hashCode());
}
throw new IllegalArgumentException("Tag can't be null!");
}
@Override // com.baidu.license.download.base.Downloader.OnDownloaderDestroyedListener
public void a(final String str, Downloader downloader) {
this.e.post(new Runnable() { // from class: com.baidu.license.download.DownloadManager.1
@Override // java.lang.Runnable
public void run() {
if (DownloadManager.this.a.containsKey(str)) {
DownloadManager.this.a.remove(str);
}
}
});
}
public void b() {
this.e.post(new Runnable() { // from class: com.baidu.license.download.DownloadManager.2
@Override // java.lang.Runnable
public void run() {
for (Downloader downloader : DownloadManager.this.a.values()) {
if (downloader != null && downloader.isRunning()) {
downloader.pause();
}
}
}
});
}
public void a(DownloadRequest downloadRequest, String str, DownloadCallback downloadCallback) {
String c = c(str);
if (d(c)) {
return;
}
a aVar = new a(downloadRequest, new com.baidu.license.download.a.nx(this.d, downloadCallback), this.c, c, this.b, this);
this.a.put(c, aVar);
aVar.start();
}
public void a(String str) {
String c = c(str);
if (this.a.containsKey(c)) {
Downloader downloader = this.a.get(c);
if (downloader != null) {
downloader.cancel();
}
this.a.remove(c);
}
}
public void a() {
this.e.post(new Runnable() { // from class: com.baidu.license.download.DownloadManager.3
@Override // java.lang.Runnable
public void run() {
for (Downloader downloader : DownloadManager.this.a.values()) {
if (downloader != null && downloader.isRunning()) {
downloader.cancel();
}
}
}
});
}
}

View File

@@ -0,0 +1,49 @@
package com.baidu.license.download;
import android.text.TextUtils;
import com.baidu.license.download.utils.FileUtils;
import java.io.File;
/* loaded from: classes.dex */
public class DownloadRequest {
private String a;
private File b;
private CharSequence c;
public static class Builder {
private String a;
private File b;
private CharSequence c;
private CharSequence d;
public Builder a(String str) {
this.a = str;
return this;
}
public DownloadRequest a() {
return new DownloadRequest(this.a, this.b, this.c, this.d);
}
}
public File a() {
return this.b;
}
public CharSequence b() {
if (TextUtils.isEmpty(this.c)) {
this.c = FileUtils.a(c());
}
return this.c;
}
public String c() {
return this.a;
}
private DownloadRequest(String str, File file, CharSequence charSequence, CharSequence charSequence2) {
this.a = str;
this.b = file;
this.c = charSequence;
}
}

View File

@@ -0,0 +1,255 @@
package com.baidu.license.download.a;
import com.baidu.license.download.DownloadRequest;
import com.baidu.license.download.base.DownloadResponse;
import com.baidu.license.download.base.DownloadTask;
import com.baidu.license.download.base.Downloader;
import com.baidu.license.download.base.HttpConnectTask;
import com.baidu.license.download.exception.DownloadException;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Executor;
/* compiled from: DownloaderImpl.java */
/* loaded from: classes.dex */
public final class a implements DownloadTask.OnDownloadListener, Downloader, HttpConnectTask.OnConnectListener {
private DownloadRequest a;
private DownloadResponse b;
private Executor c;
private String d;
private com.baidu.license.download.oi e;
private Downloader.OnDownloaderDestroyedListener f;
private int g;
private oi h;
private HttpConnectTask i;
private List<DownloadTask> j = new LinkedList();
public a(DownloadRequest downloadRequest, DownloadResponse downloadResponse, Executor executor, String str, com.baidu.license.download.oi oiVar, Downloader.OnDownloaderDestroyedListener onDownloaderDestroyedListener) {
this.a = downloadRequest;
this.b = downloadResponse;
this.c = executor;
this.d = str;
this.e = oiVar;
this.f = onDownloaderDestroyedListener;
this.h = new oi(this.a.b().toString(), this.a.c(), this.a.a());
}
private void c() {
File file = new File(this.h.b(), this.h.a());
if (file.exists() && file.isFile()) {
file.delete();
}
}
@Override // com.baidu.license.download.base.HttpConnectTask.OnConnectListener
public final void a(long j, long j2, boolean z) {
if (this.i.isCanceled()) {
l();
return;
}
this.g = 103;
this.b.a(j, j2, z);
this.h.a(z);
this.h.a(j2);
this.g = 104;
this.j.clear();
if (z) {
ArrayList arrayList = new ArrayList();
int b = this.e.b();
int i = 0;
int i2 = 0;
while (i2 < b) {
long j3 = j2 / b;
long j4 = j3 * i2;
arrayList.add(new e(i2, this.d, this.a.c(), j4, i2 == b + (-1) ? j2 : (j3 + j4) - 1));
i2++;
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
i = (int) (i + ((e) it.next()).d());
}
this.h.b(i);
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
this.j.add(new c(this.h, (e) it2.next(), this));
}
} else {
this.j.add(new d(this.h, new e(this.d, this.a.c()), this));
}
Iterator<DownloadTask> it3 = this.j.iterator();
while (it3.hasNext()) {
this.c.execute(it3.next());
}
}
public final void b() {
this.f.a(this.d, this);
}
@Override // com.baidu.license.download.base.Downloader
public final void cancel() {
HttpConnectTask httpConnectTask = this.i;
if (httpConnectTask != null) {
httpConnectTask.cancel();
}
Iterator<DownloadTask> it = this.j.iterator();
while (it.hasNext()) {
it.next().cancel();
}
if (this.g != 104) {
j();
}
}
@Override // com.baidu.license.download.base.HttpConnectTask.OnConnectListener
public final void i() {
this.g = 102;
this.b.i();
}
@Override // com.baidu.license.download.base.Downloader
public final boolean isRunning() {
int i = this.g;
return i == 101 || i == 102 || i == 103 || i == 104;
}
@Override // com.baidu.license.download.base.DownloadTask.OnDownloadListener
public final void j() {
boolean z;
Iterator<DownloadTask> it = this.j.iterator();
while (true) {
if (!it.hasNext()) {
z = true;
break;
} else if (it.next().h()) {
z = false;
break;
}
}
if (z) {
c();
this.g = 107;
this.b.j();
b();
}
}
@Override // com.baidu.license.download.base.DownloadTask.OnDownloadListener
public final void k() {
boolean z;
Iterator<DownloadTask> it = this.j.iterator();
while (true) {
if (!it.hasNext()) {
z = true;
break;
} else if (it.next().h()) {
z = false;
break;
}
}
if (z) {
this.g = 106;
this.b.k();
b();
}
}
@Override // com.baidu.license.download.base.HttpConnectTask.OnConnectListener
public final void l() {
c();
this.g = 107;
this.b.l();
b();
}
@Override // com.baidu.license.download.base.Downloader
public final void pause() {
HttpConnectTask httpConnectTask = this.i;
if (httpConnectTask != null) {
httpConnectTask.pause();
}
Iterator<DownloadTask> it = this.j.iterator();
while (it.hasNext()) {
it.next().pause();
}
if (this.g != 104) {
k();
}
}
@Override // com.baidu.license.download.base.Downloader
public final void start() {
this.g = 101;
this.b.m();
this.i = new b(this.a.c(), this);
this.c.execute(this.i);
}
@Override // com.baidu.license.download.base.DownloadTask.OnDownloadListener
public final void b(DownloadException downloadException) {
boolean z;
Iterator<DownloadTask> it = this.j.iterator();
while (true) {
if (!it.hasNext()) {
z = true;
break;
} else if (it.next().h()) {
z = false;
break;
}
}
if (z) {
this.g = 108;
this.b.b(downloadException);
b();
}
}
@Override // com.baidu.license.download.base.HttpConnectTask.OnConnectListener
public final void a() {
k();
}
@Override // com.baidu.license.download.base.HttpConnectTask.OnConnectListener
public final void a(DownloadException downloadException) {
if (this.i.isCanceled()) {
l();
} else {
if (this.i.i()) {
k();
return;
}
this.g = 108;
this.b.a(downloadException);
b();
}
}
@Override // com.baidu.license.download.base.DownloadTask.OnDownloadListener
public final void a(long j, long j2) {
this.b.a(j, j2, (int) ((100 * j) / j2));
}
@Override // com.baidu.license.download.base.DownloadTask.OnDownloadListener
public final void a(String str) {
boolean z;
Iterator<DownloadTask> it = this.j.iterator();
while (true) {
if (!it.hasNext()) {
z = true;
break;
} else if (!it.next().g()) {
z = false;
break;
}
}
if (z) {
this.g = 105;
this.b.a(str);
b();
}
}
}

View File

@@ -0,0 +1,152 @@
package com.baidu.license.download.a;
import android.os.Process;
import android.text.TextUtils;
import com.baidu.license.download.base.HttpConnectTask;
import com.baidu.license.download.exception.DownloadException;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
/* compiled from: HttpConnectTaskImpl.java */
/* loaded from: classes.dex */
public final class b implements HttpConnectTask {
private final String a;
private final HttpConnectTask.OnConnectListener b;
private volatile int c;
private volatile long d;
public b(String str, HttpConnectTask.OnConnectListener onConnectListener) {
this.a = str;
this.b = onConnectListener;
}
private void a(HttpURLConnection httpURLConnection, boolean z) {
String headerField = httpURLConnection.getHeaderField("Content-Length");
long contentLength = (TextUtils.isEmpty(headerField) || headerField.equals("0") || headerField.equals("-1")) ? httpURLConnection.getContentLength() : Long.parseLong(headerField);
if (contentLength <= 0) {
String headerField2 = httpURLConnection.getHeaderField("Ohc-File-Size");
contentLength = (TextUtils.isEmpty(headerField2) || headerField2.equals("0") || headerField2.equals("-1")) ? httpURLConnection.getContentLength() : Long.parseLong(headerField2);
if (contentLength <= 0) {
throw new DownloadException(108, "length <= 0");
}
}
a();
this.c = 103;
this.b.a(System.currentTimeMillis() - this.d, contentLength, z);
}
@Override // com.baidu.license.download.base.HttpConnectTask
public final void cancel() {
this.c = 107;
}
@Override // com.baidu.license.download.base.HttpConnectTask
public final boolean i() {
return this.c == 106;
}
@Override // com.baidu.license.download.base.HttpConnectTask
public final boolean isCanceled() {
return this.c == 107;
}
@Override // com.baidu.license.download.base.HttpConnectTask
public final void pause() {
this.c = 106;
}
@Override // java.lang.Runnable
public final void run() {
IOException e;
ProtocolException e2;
HttpURLConnection httpURLConnection;
Process.setThreadPriority(10);
this.c = 102;
this.b.i();
try {
this.d = System.currentTimeMillis();
HttpURLConnection httpURLConnection2 = null;
try {
try {
try {
httpURLConnection = (HttpURLConnection) new URL(this.a).openConnection();
} catch (ProtocolException e3) {
e2 = e3;
} catch (IOException e4) {
e = e4;
} catch (Throwable th) {
th = th;
if (0 != 0) {
httpURLConnection2.disconnect();
}
throw th;
}
try {
httpURLConnection.setConnectTimeout(4000);
httpURLConnection.setReadTimeout(4000);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setRequestProperty("Range", "bytes=0-");
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == 200) {
a(httpURLConnection, false);
} else {
if (responseCode != 206) {
throw new DownloadException(108, "UnSupported response code:".concat(String.valueOf(responseCode)));
}
a(httpURLConnection, true);
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
} catch (ProtocolException e5) {
e2 = e5;
throw new DownloadException(108, "Protocol error", e2);
} catch (IOException e6) {
e = e6;
throw new DownloadException(108, "IO error", e);
}
} catch (Throwable th2) {
th = th2;
}
} catch (MalformedURLException e7) {
throw new DownloadException(108, "Bad url.", e7);
}
} catch (DownloadException e8) {
switch (e8.getErrorCode()) {
case 106:
synchronized (this.b) {
this.c = 106;
this.b.a();
return;
}
case 107:
synchronized (this.b) {
this.c = 107;
this.b.l();
return;
}
case 108:
synchronized (this.b) {
this.c = 108;
this.b.a(e8);
return;
}
default:
throw new IllegalArgumentException("Unknown state");
}
}
}
private void a() {
if (!isCanceled()) {
if (i()) {
throw new DownloadException(106, "Connection Paused!");
}
return;
}
throw new DownloadException(107, "Connection Canceled!");
}
}

View File

@@ -0,0 +1,39 @@
package com.baidu.license.download.a;
import com.baidu.license.download.base.DownloadTask;
import java.io.File;
import java.io.RandomAccessFile;
import java.util.HashMap;
import java.util.Map;
/* compiled from: MultiDownloadTask.java */
/* loaded from: classes.dex */
public final class c extends uiw {
public c(oi oiVar, e eVar, DownloadTask.OnDownloadListener onDownloadListener) {
super(oiVar, eVar, onDownloadListener);
}
@Override // com.baidu.license.download.a.uiw
protected final int a() {
return 206;
}
@Override // com.baidu.license.download.a.uiw
protected final Map<String, String> a(e eVar) {
HashMap hashMap = new HashMap();
hashMap.put("Range", "bytes=" + (eVar.b() + eVar.d()) + "-" + eVar.c());
return hashMap;
}
@Override // com.baidu.license.download.a.uiw
protected final String b() {
return c.class.getSimpleName();
}
@Override // com.baidu.license.download.a.uiw
protected final RandomAccessFile a(File file, String str, long j) {
RandomAccessFile randomAccessFile = new RandomAccessFile(new File(file, str), "rwd");
randomAccessFile.seek(j);
return randomAccessFile;
}
}

View File

@@ -0,0 +1,36 @@
package com.baidu.license.download.a;
import com.baidu.license.download.base.DownloadTask;
import java.io.File;
import java.io.RandomAccessFile;
import java.util.Map;
/* compiled from: SingleDownloadTask.java */
/* loaded from: classes.dex */
public final class d extends uiw {
public d(oi oiVar, e eVar, DownloadTask.OnDownloadListener onDownloadListener) {
super(oiVar, eVar, onDownloadListener);
}
@Override // com.baidu.license.download.a.uiw
protected final int a() {
return 200;
}
@Override // com.baidu.license.download.a.uiw
protected final RandomAccessFile a(File file, String str, long j) {
RandomAccessFile randomAccessFile = new RandomAccessFile(new File(file, str), "rwd");
randomAccessFile.seek(0L);
return randomAccessFile;
}
@Override // com.baidu.license.download.a.uiw
protected final Map<String, String> a(e eVar) {
return null;
}
@Override // com.baidu.license.download.a.uiw
protected final String b() {
return d.class.getSimpleName();
}
}

View File

@@ -0,0 +1,44 @@
package com.baidu.license.download.a;
/* compiled from: ThreadRecord.java */
/* loaded from: classes.dex */
public final class e {
private String a;
private long b;
private long c;
private long d;
public e() {
}
public final String a() {
return this.a;
}
public final long b() {
return this.b;
}
public final long c() {
return this.c;
}
public final long d() {
return this.d;
}
public e(String str, String str2) {
this(0, str, str2, 0L, 0L);
}
public final void a(long j) {
this.d = j;
}
public e(int i, String str, String str2, long j, long j2) {
this.a = str2;
this.b = j;
this.c = j2;
this.d = 0L;
}
}

View File

@@ -0,0 +1,19 @@
package com.baidu.license.download.a;
import android.os.Handler;
import java.util.concurrent.Executor;
/* compiled from: DownloadStatusDeliveryImpl.java */
/* loaded from: classes.dex */
final class mas implements Executor {
final /* synthetic */ Handler a;
mas(trw trwVar, Handler handler) {
this.a = handler;
}
@Override // java.util.concurrent.Executor
public final void execute(Runnable runnable) {
this.a.post(runnable);
}
}

View File

@@ -0,0 +1,87 @@
package com.baidu.license.download.a;
import com.baidu.license.download.base.DownloadCallback;
import com.baidu.license.download.base.DownloadResponse;
import com.baidu.license.download.base.DownloadStatus;
import com.baidu.license.download.base.DownloadStatusDelivery;
import com.baidu.license.download.exception.DownloadException;
/* compiled from: DownloadResponseImpl.java */
/* loaded from: classes.dex */
public final class nx implements DownloadResponse {
private DownloadStatusDelivery a;
private DownloadStatus b = new DownloadStatus();
public nx(DownloadStatusDelivery downloadStatusDelivery, DownloadCallback downloadCallback) {
this.a = downloadStatusDelivery;
this.b.a(downloadCallback);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void a(long j, long j2, boolean z) {
this.b.c(j);
this.b.a(z);
this.b.b(103);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void b(DownloadException downloadException) {
this.b.a(downloadException);
this.b.b(108);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void i() {
this.b.b(102);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void j() {
this.b.b(107);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void k() {
this.b.b(106);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void l() {
this.b.b(107);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void m() {
this.b.b(101);
this.b.a().d();
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void a(DownloadException downloadException) {
this.b.a(downloadException);
this.b.b(108);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void a(long j, long j2, int i) {
this.b.a(j);
this.b.b(j2);
this.b.a(i);
this.b.b(104);
this.a.a(this.b);
}
@Override // com.baidu.license.download.base.DownloadResponse
public final void a(String str) {
this.b.b(105);
this.b.a(str);
this.a.a(this.b);
}
}

View File

@@ -0,0 +1,44 @@
package com.baidu.license.download.a;
import java.io.File;
/* compiled from: DownloadInfo.java */
/* loaded from: classes.dex */
public final class oi {
private String a;
private File b;
private long c;
private long d;
public oi(String str, String str2, File file) {
this.a = str;
this.b = file;
}
public final String a() {
return this.a;
}
public final void a(boolean z) {
}
public final File b() {
return this.b;
}
public final long c() {
return this.c;
}
public final long d() {
return this.d;
}
public final void a(long j) {
this.c = j;
}
public final void b(long j) {
this.d = j;
}
}

View File

@@ -0,0 +1,73 @@
package com.baidu.license.download.a;
import android.os.Handler;
import com.baidu.license.download.base.DownloadCallback;
import com.baidu.license.download.base.DownloadStatus;
import com.baidu.license.download.base.DownloadStatusDelivery;
import com.baidu.license.download.exception.DownloadException;
import com.baidu.license.download.utils.LogUtils;
import java.util.concurrent.Executor;
/* compiled from: DownloadStatusDeliveryImpl.java */
/* loaded from: classes.dex */
public final class trw implements DownloadStatusDelivery {
private Executor a;
/* compiled from: DownloadStatusDeliveryImpl.java */
private static class oi implements Runnable {
private final DownloadStatus a;
private final DownloadCallback b;
public oi(DownloadStatus downloadStatus) {
this.a = downloadStatus;
this.b = this.a.a();
}
@Override // java.lang.Runnable
public final void run() {
switch (this.a.h()) {
case 102:
LogUtils.a("DownloadStatusDelivery", "STATUS_CONNECTING");
this.b.a();
break;
case 103:
LogUtils.a("DownloadStatusDelivery", "STATUS_CONNECTED length: " + this.a.e() + " acceptRanges: " + this.a.i());
this.b.a(this.a.e(), this.a.i());
break;
case 104:
LogUtils.a("DownloadStatusDelivery", "STATUS_PROGRESS finished: " + this.a.d() + " length: " + this.a.e() + " percent: " + this.a.f());
this.b.a(this.a.d(), this.a.e(), this.a.f());
break;
case 105:
LogUtils.a("DownloadStatusDelivery", "STATUS_COMPLETED Path:" + this.a.g());
if (!this.a.b()) {
this.a.b(true);
this.b.a(this.a.g());
break;
}
break;
case 106:
LogUtils.a("DownloadStatusDelivery", "STATUS_PAUSED");
this.b.c();
break;
case 107:
LogUtils.a("DownloadStatusDelivery", "STATUS_CANCELED");
this.b.b();
break;
case 108:
LogUtils.b("DownloadStatusDelivery", "STATUS_FAILED error: " + this.a.c().getCause());
this.b.a((DownloadException) this.a.c());
break;
}
}
}
public trw(Handler handler) {
this.a = new mas(this, handler);
}
@Override // com.baidu.license.download.base.DownloadStatusDelivery
public final void a(DownloadStatus downloadStatus) {
this.a.execute(new oi(downloadStatus));
}
}

View File

@@ -0,0 +1,122 @@
package com.baidu.license.download.a;
import android.text.TextUtils;
import com.baidu.license.download.base.DownloadTask;
import com.baidu.license.download.exception.DownloadException;
import com.ubt.jimu.unity.bluetooth.UnityActivity;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.URLConnection;
import java.util.Map;
/* compiled from: DownloadTaskImpl.java */
/* loaded from: classes.dex */
public abstract class uiw implements DownloadTask {
private String a;
private final oi b;
private final e c;
private final DownloadTask.OnDownloadListener d;
private volatile int e;
private volatile int f = 0;
public uiw(oi oiVar, e eVar, DownloadTask.OnDownloadListener onDownloadListener) {
this.b = oiVar;
this.c = eVar;
this.d = onDownloadListener;
this.a = b();
if (TextUtils.isEmpty(this.a)) {
this.a = getClass().getSimpleName();
}
}
private static void a(Map<String, String> map, URLConnection uRLConnection) {
if (map != null) {
for (String str : map.keySet()) {
uRLConnection.setRequestProperty(str, map.get(str));
}
}
}
protected abstract int a();
protected abstract RandomAccessFile a(File file, String str, long j);
protected abstract Map<String, String> a(e eVar);
protected abstract String b();
@Override // com.baidu.license.download.base.DownloadTask
public void cancel() {
this.f = 107;
}
@Override // com.baidu.license.download.base.DownloadTask
public boolean g() {
return this.e == 105;
}
@Override // com.baidu.license.download.base.DownloadTask
public boolean h() {
return this.e == 104;
}
@Override // com.baidu.license.download.base.DownloadTask
public void pause() {
this.f = 106;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:75:0x010f A[Catch: DownloadException -> 0x011c, TRY_ENTER, TryCatch #11 {DownloadException -> 0x011c, blocks: (B:3:0x0009, B:5:0x000b, B:31:0x0077, B:32:0x007a, B:33:0x007c, B:42:0x00ae, B:75:0x010f, B:76:0x0112, B:85:0x0114, B:86:0x011b, B:36:0x007f, B:37:0x00aa), top: B:2:0x0009, inners: #9, #17 }] */
/* JADX WARN: Type inference failed for: r0v10 */
/* JADX WARN: Type inference failed for: r0v15, types: [java.net.HttpURLConnection] */
/* JADX WARN: Type inference failed for: r0v8, types: [java.net.URL] */
@Override // java.lang.Runnable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void run() {
/*
Method dump skipped, instructions count: 360
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.baidu.license.download.a.uiw.run():void");
}
private static void a(Closeable closeable) {
if (closeable != null) {
synchronized (uiw.class) {
closeable.close();
}
}
}
private void a(InputStream inputStream, RandomAccessFile randomAccessFile) {
byte[] bArr = new byte[UnityActivity.BLOCKLY_TYPE_NONE];
while (this.f != 107) {
if (this.f != 106) {
try {
int read = inputStream.read(bArr);
if (read == -1) {
return;
}
randomAccessFile.write(bArr, 0, read);
long j = read;
this.c.a(this.c.d() + j);
synchronized (this.d) {
this.b.b(this.b.d() + j);
this.d.a(this.b.d(), this.b.c());
}
} catch (IOException e) {
throw new DownloadException(108, e);
}
} else {
throw new DownloadException(106, "Download paused!");
}
}
throw new DownloadException(107, "Download canceled!");
}
}

View File

@@ -0,0 +1,25 @@
package com.baidu.license.download.base;
import com.baidu.license.download.exception.DownloadException;
/* loaded from: classes.dex */
public abstract class DownloadCallback {
public void a() {
}
public abstract void a(long j, long j2, int i);
public void a(long j, boolean z) {
}
public abstract void a(DownloadException downloadException);
public abstract void a(String str);
public abstract void b();
public abstract void c();
public void d() {
}
}

View File

@@ -0,0 +1,26 @@
package com.baidu.license.download.base;
import com.baidu.license.download.exception.DownloadException;
/* loaded from: classes.dex */
public interface DownloadResponse {
void a(long j, long j2, int i);
void a(long j, long j2, boolean z);
void a(DownloadException downloadException);
void a(String str);
void b(DownloadException downloadException);
void i();
void j();
void k();
void l();
void m();
}

View File

@@ -0,0 +1,91 @@
package com.baidu.license.download.base;
import com.baidu.license.download.exception.DownloadException;
/* loaded from: classes.dex */
public class DownloadStatus {
private int a;
private long b;
private long c;
private int d;
private boolean e;
private DownloadException f;
private DownloadCallback g;
private String h;
private boolean i;
public void a(long j) {
this.c = j;
}
public void b(int i) {
this.a = i;
}
public Exception c() {
return this.f;
}
public void c(long j) {
}
public long d() {
return this.c;
}
public long e() {
return this.b;
}
public int f() {
return this.d;
}
public String g() {
return this.h;
}
public int h() {
return this.a;
}
public boolean i() {
return this.e;
}
public void a(int i) {
this.d = i;
}
public void b(long j) {
this.b = j;
}
public void a(boolean z) {
this.e = z;
}
public void b(boolean z) {
this.i = z;
}
public void a(DownloadException downloadException) {
this.f = downloadException;
}
public boolean b() {
return this.i;
}
public DownloadCallback a() {
return this.g;
}
public void a(DownloadCallback downloadCallback) {
this.g = downloadCallback;
}
public void a(String str) {
this.h = str;
}
}

View File

@@ -0,0 +1,6 @@
package com.baidu.license.download.base;
/* loaded from: classes.dex */
public interface DownloadStatusDelivery {
void a(DownloadStatus downloadStatus);
}

View File

@@ -0,0 +1,27 @@
package com.baidu.license.download.base;
import com.baidu.license.download.exception.DownloadException;
/* loaded from: classes.dex */
public interface DownloadTask extends Runnable {
public interface OnDownloadListener {
void a(long j, long j2);
void a(String str);
void b(DownloadException downloadException);
void j();
void k();
}
void cancel();
boolean g();
boolean h();
void pause();
}

View File

@@ -0,0 +1,17 @@
package com.baidu.license.download.base;
/* loaded from: classes.dex */
public interface Downloader {
public interface OnDownloaderDestroyedListener {
void a(String str, Downloader downloader);
}
void cancel();
boolean isRunning();
void pause();
void start();
}

View File

@@ -0,0 +1,27 @@
package com.baidu.license.download.base;
import com.baidu.license.download.exception.DownloadException;
/* loaded from: classes.dex */
public interface HttpConnectTask extends Runnable {
public interface OnConnectListener {
void a();
void a(long j, long j2, boolean z);
void a(DownloadException downloadException);
void i();
void l();
}
void cancel();
boolean i();
boolean isCanceled();
void pause();
}

View File

@@ -0,0 +1,62 @@
package com.baidu.license.download.exception;
/* loaded from: classes.dex */
public class DownloadException extends Exception {
private int errorCode;
private String errorMessage;
public DownloadException() {
}
public int getErrorCode() {
return this.errorCode;
}
public String getErrorMessage() {
return this.errorMessage;
}
public void setErrorCode(int i) {
this.errorCode = i;
}
public void setErrorMessage(String str) {
this.errorMessage = str;
}
@Override // java.lang.Throwable
public String toString() {
return super.toString();
}
public DownloadException(String str) {
super(str);
this.errorMessage = str;
}
public DownloadException(int i, String str) {
super(str);
this.errorCode = i;
this.errorMessage = str;
}
public DownloadException(int i, Throwable th) {
super(th);
this.errorCode = i;
}
public DownloadException(String str, Throwable th) {
super(str, th);
this.errorMessage = str;
}
public DownloadException(int i, String str, Throwable th) {
super(str, th);
this.errorCode = i;
this.errorMessage = str;
}
public DownloadException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,78 @@
package com.baidu.license.download;
import android.text.TextUtils;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
import com.unity3d.ads.metadata.MediationMetaData;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: RequestTask.java */
/* loaded from: classes.dex */
public final class nx {
private int e;
private String h;
private String a = "";
private String b = "";
private String c = "";
private String d = "";
private String f = "";
private int g = 0;
public final JSONObject a() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(MediationMetaData.KEY_NAME, this.a);
jSONObject.put(JockstickDataConverter.ID, this.b);
jSONObject.put("image", this.c);
jSONObject.put("url", this.d);
jSONObject.put("progress", this.e);
jSONObject.put("downloadPerSize", this.f);
jSONObject.put(FileDownloadModel.STATUS, this.g);
jSONObject.put("savePath", this.h);
} catch (JSONException e) {
e.printStackTrace();
}
return jSONObject;
}
public final String b() {
return this.d;
}
public final void c(String str) {
this.h = str;
}
public final void b(String str) {
this.f = str;
}
public final void b(int i) {
this.g = i;
}
public final boolean a(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
try {
JSONObject jSONObject = new JSONObject(str);
this.a = jSONObject.optString(MediationMetaData.KEY_NAME);
this.b = jSONObject.optString(JockstickDataConverter.ID);
this.c = jSONObject.optString("image");
this.d = jSONObject.optString("url");
this.e = jSONObject.optInt("progress");
this.f = jSONObject.optString("downloadPerSize");
this.g = jSONObject.optInt(FileDownloadModel.STATUS);
this.h = jSONObject.optString("savePath");
return true;
} catch (JSONException unused) {
return false;
}
}
public final void a(int i) {
this.e = i;
}
}

View File

@@ -0,0 +1,16 @@
package com.baidu.license.download;
/* compiled from: DownloadConfig.java */
/* loaded from: classes.dex */
public final class oi {
private int a = 10;
private int b = 2;
public final int a() {
return this.a;
}
public final int b() {
return this.b;
}
}

View File

@@ -0,0 +1,16 @@
package com.baidu.license.download.utils;
import java.text.DecimalFormat;
/* loaded from: classes.dex */
public class CommonUtils {
private static final DecimalFormat a = new DecimalFormat("0.00");
static {
new String[]{"android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE"};
}
public static String a(long j, long j2) {
return a.format(j / 1048576.0f) + "M/" + a.format(j2 / 1048576.0f) + "M";
}
}

View File

@@ -0,0 +1,8 @@
package com.baidu.license.download.utils;
/* loaded from: classes.dex */
public class FileUtils {
public static final String a(String str) {
return str.substring(str.lastIndexOf("/") + 1, str.length());
}
}

View File

@@ -0,0 +1,17 @@
package com.baidu.license.download.utils;
/* loaded from: classes.dex */
public class LogUtils {
public static void a(String str) {
c("LogUtils", str);
}
public static void a(String str, String str2) {
}
public static void b(String str, String str2) {
}
public static void c(String str, String str2) {
}
}

View File

@@ -0,0 +1,15 @@
package com.baidu.license.filter.bean;
import com.baidu.license.INotProguard;
import java.io.Serializable;
/* loaded from: classes.dex */
public class FilterData implements INotProguard, Serializable {
public String bgurl;
public String file;
public String id;
public String name;
public String param;
public String sk;
public String thumbId;
}

View File

@@ -0,0 +1,31 @@
package com.baidu.license.filter.bean;
import com.baidu.license.sticker.BaseModel;
import com.baidu.license.sticker.BaseResult;
import java.io.Serializable;
import java.util.List;
/* loaded from: classes.dex */
public class FilterListModel extends BaseModel implements Serializable {
private FilterResult result;
public static class FilterResult extends BaseResult implements Serializable {
private List<FilterData> filterDataList;
public List<FilterData> getFilterDataList() {
return this.filterDataList;
}
public void setFilterDataList(List<FilterData> list) {
this.filterDataList = list;
}
}
public FilterResult getResult() {
return this.result;
}
public void setResult(FilterResult filterResult) {
this.result = filterResult;
}
}

View File

@@ -0,0 +1,25 @@
package com.baidu.license.sticker;
import com.baidu.license.INotProguard;
/* loaded from: classes.dex */
public class BaseModel implements INotProguard {
private Object message;
private boolean success;
public Object getMessage() {
return this.message;
}
public boolean isSuccess() {
return this.success;
}
public void setMessage(Object obj) {
this.message = obj;
}
public void setSuccess(boolean z) {
this.success = z;
}
}

View File

@@ -0,0 +1,32 @@
package com.baidu.license.sticker;
import com.baidu.license.INotProguard;
/* loaded from: classes.dex */
public class BaseResult implements INotProguard {
public static final String MSG_PARAMS_ERROR = "参数错误";
public static final String MSG_RESPONSE_ERROR = "获取数据失败";
public static final int RESPONSE_LICENSE_EXPIRED = 5012;
public static final int RESPONSE_NET_ERROR = 9980;
public static final int RESPONSE_PARAMS_ERROR = 4016;
public static final int RESPONSE_RESULT_NULL = 9970;
public static final int RESPONSE_SUCCESS = 3010;
private int code;
private String message;
public int getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
public void setCode(int i) {
this.code = i;
}
public void setMessage(String str) {
this.message = str;
}
}

View File

@@ -0,0 +1,30 @@
package com.baidu.license.template.bean;
import com.baidu.license.INotProguard;
import java.io.Serializable;
/* loaded from: classes.dex */
public class TemplateData implements INotProguard, Serializable {
public static final int MODE_HORIZONTAL = 1;
public static final int MODE_VERTICAL = 0;
public static final int TYPE_DAPIAN = 0;
public static final int TYPE_KADIAN = 1;
public String cover;
public int coverHeight;
public int coverWidth;
public String file;
public String fileSign;
public String icon;
public String id;
public int mode;
public String name;
public int number;
public String playUrl;
public String sign;
public int status;
public int type;
public String getTypeName() {
return this.type == 1 ? "卡点" : "大片";
}
}

View File

@@ -0,0 +1,31 @@
package com.baidu.license.template.bean;
import com.baidu.license.sticker.BaseModel;
import com.baidu.license.sticker.BaseResult;
import java.io.Serializable;
import java.util.List;
/* loaded from: classes.dex */
public class TemplateListModel extends BaseModel implements Serializable {
private TemplateResult result;
public static class TemplateResult extends BaseResult implements Serializable {
private List<TemplateData> templateList;
public List<TemplateData> getTemplateList() {
return this.templateList;
}
public void setTemplateList(List<TemplateData> list) {
this.templateList = list;
}
}
public TemplateResult getResult() {
return this.result;
}
public void setResult(TemplateResult templateResult) {
this.result = templateResult;
}
}

View File

@@ -0,0 +1,75 @@
package com.baidu.license.transitions.bean;
import com.baidu.license.INotProguard;
import java.io.Serializable;
/* loaded from: classes.dex */
public class TransitionsData implements INotProguard, Serializable {
public String big_icon;
public String file;
public String id;
public String name;
public String sign;
public String small_icon;
public String transition_id;
public String getBigicon() {
return this.big_icon;
}
public String getFile() {
return this.file;
}
public String getId() {
return this.id;
}
public String getName() {
return this.name;
}
public String getSign() {
return this.sign;
}
public String getSmallicon() {
return this.small_icon;
}
public String getTransitionid() {
return this.transition_id;
}
public void setBigicon(String str) {
this.big_icon = str;
}
public void setFile(String str) {
this.file = str;
}
public void setId(String str) {
this.id = str;
}
public void setName(String str) {
this.name = str;
}
public void setSign(String str) {
this.sign = str;
}
public void setSmallicon(String str) {
this.small_icon = str;
}
public void setTransitionid(String str) {
this.transition_id = str;
}
public String toString() {
return "TransitionsData{id='" + this.id + "', transition_id='" + this.transition_id + "', file='" + this.file + "', big_icon='" + this.big_icon + "', small_icon='" + this.small_icon + "', name='" + this.name + "', sign='" + this.sign + "'}";
}
}

View File

@@ -0,0 +1,31 @@
package com.baidu.license.transitions.bean;
import com.baidu.license.sticker.BaseModel;
import com.baidu.license.sticker.BaseResult;
import java.io.Serializable;
import java.util.List;
/* loaded from: classes.dex */
public class TransitionsListModel extends BaseModel implements Serializable {
private TransitionResult result;
public static class TransitionResult extends BaseResult implements Serializable {
private List<TransitionsData> transitionList;
public List<TransitionsData> getTransitionsDataList() {
return this.transitionList;
}
public void setTransitionsDataList(List<TransitionsData> list) {
this.transitionList = list;
}
}
public TransitionResult getResult() {
return this.result;
}
public void setResult(TransitionResult transitionResult) {
this.result = transitionResult;
}
}

View File

@@ -0,0 +1,35 @@
package com.baidu.license.util;
import java.nio.charset.StandardCharsets;
/* loaded from: classes.dex */
public class SecretUtil {
static {
System.loadLibrary("license");
}
static String a() {
String concat = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALCwRZyG7UhmHNjqeWmnqBmYG0Q49SRdd2NZgVY+AYOJeUcmR1Drpuh/++30mBV2qu1Db94/fHNfjw".concat("BPqfHGM062hnYQ5NFe84Uj6OAWg3IieuMzwq6HRTROUIH2muGi1glcpjxaZquQOODT0ont1lDamcRvDgnUqByOz6lynbuBAgMBAAECgYEAkmxSE+iBJZlx2JVfrp5BI");
String str = new String(a("Kk%_9fpjP}fSG~Sv\\*Z#QW]B#vYxXJf{C|tTbQ!bV|\u007fHb9JA}Sy]#j$|bP\u007fF`E}+=sU^DAq{FQFVkqYcJ^Ax#Ky`]w^Wu_`%=]Q@9|b[eB|uY\"uvVxP^${~+fJP'=w=eXC&".getBytes()));
String str2 = new String(getSecretByte(""), StandardCharsets.UTF_8);
String str3 = new String(getSecretByte2(), StandardCharsets.UTF_8);
return concat.concat(str.concat(str2).concat(str3).concat(new String(getSecretByte3(), StandardCharsets.UTF_8)));
}
private static native byte[] getSecretByte(String str);
private static native byte[] getSecretByte2();
private static native byte[] getSecretByte3();
private static byte[] a(byte[] bArr) {
if (bArr == null) {
return null;
}
int length = bArr.length;
for (int i = 0; i < length; i++) {
bArr[i] = (byte) (bArr[i] ^ 18);
}
return bArr;
}
}

View File

@@ -0,0 +1,49 @@
package com.baidu.license.util;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.ByteArrayOutputStream;
import java.security.KeyFactory;
import java.security.spec.PKCS8EncodedKeySpec;
import javax.crypto.Cipher;
/* compiled from: RsaUtil.java */
/* loaded from: classes.dex */
public final class mas {
public static String a(String str, String str2) {
byte[] a = nx.a(str);
byte[] a2 = nx.a(str2);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(2, keyFactory.generatePrivate(new PKCS8EncodedKeySpec(a2)));
return new String(a(a, cipher));
}
private static byte[] a(byte[] bArr, Cipher cipher) {
byte[] doFinal;
try {
int length = bArr.length;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int i = 0;
int i2 = 0;
while (true) {
int i3 = length - i;
if (i3 > 0) {
if (i3 > 128) {
doFinal = cipher.doFinal(bArr, i, PeripheralType.SERVO);
} else {
doFinal = cipher.doFinal(bArr, i, i3);
}
byteArrayOutputStream.write(doFinal, 0, doFinal.length);
i2++;
i = i2 << 7;
} else {
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
return byteArray;
}
}
} catch (Exception unused) {
return null;
}
}
}

View File

@@ -0,0 +1,129 @@
package com.baidu.license.util;
/* compiled from: Base64Utils.java */
/* loaded from: classes.dex */
public final class nx {
private static byte[] a = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 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, -1, -1, -1, -1, -1, -1, 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, -1, -1, -1, -1, -1};
/* JADX WARN: Code restructure failed: missing block: B:40:0x0085, code lost:
if (r3 == (-1)) goto L48;
*/
/* JADX WARN: Code restructure failed: missing block: B:41:0x0087, code lost:
r1.append((char) (r3 | ((r7 & 3) << 6)));
r3 = r6;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static byte[] a(java.lang.String r10) {
/*
r0 = 0
java.lang.StringBuffer r1 = new java.lang.StringBuffer // Catch: java.lang.Exception -> L9c
r1.<init>() // Catch: java.lang.Exception -> L9c
java.lang.String r2 = "US-ASCII"
byte[] r10 = r10.getBytes(r2) // Catch: java.lang.Exception -> L9c
int r2 = r10.length // Catch: java.lang.Exception -> L9c
r3 = 0
Le:
java.lang.String r4 = "iso8859-1"
if (r3 >= r2) goto L93
L12:
byte[] r5 = com.baidu.license.util.nx.a // Catch: java.lang.Exception -> L9c
int r6 = r3 + 1
r3 = r10[r3] // Catch: java.lang.Exception -> L9c
r3 = r5[r3] // Catch: java.lang.Exception -> L9c
r5 = -1
if (r6 >= r2) goto L22
if (r3 == r5) goto L20
goto L22
L20:
r3 = r6
goto L12
L22:
if (r3 == r5) goto L93
L24:
byte[] r7 = com.baidu.license.util.nx.a // Catch: java.lang.Exception -> L9c
int r8 = r6 + 1
r6 = r10[r6] // Catch: java.lang.Exception -> L9c
r6 = r7[r6] // Catch: java.lang.Exception -> L9c
if (r8 >= r2) goto L33
if (r6 == r5) goto L31
goto L33
L31:
r6 = r8
goto L24
L33:
if (r6 == r5) goto L93
int r3 = r3 << 2
r7 = r6 & 48
int r7 = r7 >>> 4
r3 = r3 | r7
char r3 = (char) r3 // Catch: java.lang.Exception -> L9c
r1.append(r3) // Catch: java.lang.Exception -> L9c
L40:
int r3 = r8 + 1
r7 = r10[r8] // Catch: java.lang.Exception -> L9c
r8 = 61
if (r7 != r8) goto L51
java.lang.String r10 = r1.toString() // Catch: java.lang.Exception -> L9c
byte[] r10 = r10.getBytes(r4) // Catch: java.lang.Exception -> L9c
return r10
L51:
byte[] r9 = com.baidu.license.util.nx.a // Catch: java.lang.Exception -> L9c
r7 = r9[r7] // Catch: java.lang.Exception -> L9c
if (r3 >= r2) goto L5c
if (r7 == r5) goto L5a
goto L5c
L5a:
r8 = r3
goto L40
L5c:
if (r7 == r5) goto L93
r6 = r6 & 15
int r6 = r6 << 4
r9 = r7 & 60
int r9 = r9 >>> 2
r6 = r6 | r9
char r6 = (char) r6 // Catch: java.lang.Exception -> L9c
r1.append(r6) // Catch: java.lang.Exception -> L9c
L6b:
int r6 = r3 + 1
r3 = r10[r3] // Catch: java.lang.Exception -> L9c
if (r3 != r8) goto L7a
java.lang.String r10 = r1.toString() // Catch: java.lang.Exception -> L9c
byte[] r10 = r10.getBytes(r4) // Catch: java.lang.Exception -> L9c
return r10
L7a:
byte[] r9 = com.baidu.license.util.nx.a // Catch: java.lang.Exception -> L9c
r3 = r9[r3] // Catch: java.lang.Exception -> L9c
if (r6 >= r2) goto L85
if (r3 == r5) goto L83
goto L85
L83:
r3 = r6
goto L6b
L85:
if (r3 == r5) goto L93
r4 = r7 & 3
int r4 = r4 << 6
r3 = r3 | r4
char r3 = (char) r3 // Catch: java.lang.Exception -> L9c
r1.append(r3) // Catch: java.lang.Exception -> L9c
r3 = r6
goto Le
L93:
java.lang.String r10 = r1.toString() // Catch: java.lang.Exception -> L9c
byte[] r10 = r10.getBytes(r4) // Catch: java.lang.Exception -> L9c
return r10
L9c:
r10 = move-exception
r10.printStackTrace()
byte[] r10 = new byte[r0]
return r10
*/
throw new UnsupportedOperationException("Method not decompiled: com.baidu.license.util.nx.a(java.lang.String):byte[]");
}
}

View File

@@ -0,0 +1,189 @@
package com.baidu.license.util;
import android.content.Context;
import android.text.TextUtils;
import com.ubt.jimu.base.entities.Course;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: AuthenticationManager.java */
/* loaded from: classes.dex */
public final class oi {
private static Context a;
private static String b;
private static String c;
private static C0003oi d;
private static oi e;
/* compiled from: AuthenticationManager.java */
/* renamed from: com.baidu.license.util.oi$oi, reason: collision with other inner class name */
public static class C0003oi {
public String a;
public String b;
}
static {
Long.valueOf(0L);
e = null;
}
private oi(String str) {
b = str;
}
public static String a() {
return SecretUtil.a().concat("gihBYYM8rBQUNM9RAYjXdFPdeiwTmww+Mw2gSCXDqexH6B+kfIglVjnAHX9UIgPVtu10e4Ls=");
}
private static void b(String str) {
String str2;
try {
str2 = mas.a(str, a());
} catch (Exception e2) {
e2.printStackTrace();
str2 = null;
}
C0003oi c0003oi = d;
String str3 = c0003oi != null ? c0003oi.a : "";
C0003oi c2 = c(str2);
if (c2 != null) {
d = c2;
c2.a = str3;
try {
Long.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).parse(c2.b).getTime());
} catch (Exception e3) {
e3.printStackTrace();
}
}
}
private static boolean c() {
if (d != null) {
long currentTimeMillis = System.currentTimeMillis();
long j = 0;
try {
j = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).parse(d.b).getTime();
} catch (Exception e2) {
e2.printStackTrace();
}
if (j > currentTimeMillis) {
return true;
}
}
return false;
}
private static String d() {
try {
InputStream open = a.getResources().getAssets().open("player" + a(b) + ".license");
InputStreamReader inputStreamReader = new InputStreamReader(open, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
bufferedReader.close();
inputStreamReader.close();
open.close();
return sb.toString();
}
sb.append(readLine + "\n");
}
} catch (IOException e2) {
e2.printStackTrace();
return "";
}
}
public static synchronized oi a(Context context, String str) {
oi oiVar;
synchronized (oi.class) {
if (e == null) {
e = new oi(str);
if (context != null) {
a = context;
}
if (c == null) {
c = a(a.getPackageName() + a(b));
}
if (d == null) {
try {
C0003oi c2 = c(mas.a(d(), a()));
d = c2;
if (c2 != null) {
Long.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).parse(d.b).getTime());
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
oiVar = e;
}
return oiVar;
}
private static C0003oi c(String str) {
if (TextUtils.isEmpty(str)) {
return d;
}
try {
C0003oi c0003oi = new C0003oi();
JSONObject jSONObject = new JSONObject(str);
jSONObject.optInt(Course.TYPE_BLOCKLY);
c0003oi.a = jSONObject.optString("vc");
jSONObject.optString("ar");
c0003oi.b = jSONObject.optString("expireTime");
jSONObject.optJSONArray("funcCodeList");
return c0003oi;
} catch (JSONException e2) {
e2.printStackTrace();
return null;
}
}
public static boolean b() {
String str;
C0003oi c0003oi = d;
return (c0003oi == null || (str = c0003oi.a) == null || !c.equals(str)) ? false : true;
}
public static void a(Context context) {
if (c()) {
return;
}
String string = context != null ? context.getSharedPreferences("account_sp", 0).getString("license", "") : "";
if (TextUtils.isEmpty(string)) {
return;
}
b(string);
}
public static String a(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
try {
String str2 = "";
for (byte b2 : MessageDigest.getInstance("MD5").digest(str.getBytes())) {
String hexString = Integer.toHexString(b2 & 255);
if (hexString.length() == 1) {
hexString = "0".concat(String.valueOf(hexString));
}
str2 = str2 + hexString;
}
return str2.toLowerCase();
} catch (NoSuchAlgorithmException e2) {
e2.printStackTrace();
return "";
}
}
}