Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.android.arouter.base;
|
||||
|
||||
import java.util.TreeMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UniqueKeyTreeMap<K, V> extends TreeMap<K, V> {
|
||||
private String tipText;
|
||||
|
||||
public UniqueKeyTreeMap(String str) {
|
||||
this.tipText = str;
|
||||
}
|
||||
|
||||
@Override // java.util.TreeMap, java.util.AbstractMap, java.util.Map
|
||||
public V put(K k, V v) {
|
||||
if (containsKey(k)) {
|
||||
throw new RuntimeException(String.format(this.tipText, k));
|
||||
}
|
||||
return (V) super.put(k, v);
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.alibaba.android.arouter.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.LruCache;
|
||||
import com.alibaba.android.arouter.facade.service.AutowiredService;
|
||||
import com.alibaba.android.arouter.facade.template.ISyringe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AutowiredServiceImpl implements AutowiredService {
|
||||
private LruCache<String, ISyringe> a;
|
||||
private List<String> b;
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.service.AutowiredService
|
||||
public void a(Object obj) {
|
||||
String name = obj.getClass().getName();
|
||||
try {
|
||||
if (this.b.contains(name)) {
|
||||
return;
|
||||
}
|
||||
ISyringe iSyringe = this.a.get(name);
|
||||
if (iSyringe == null) {
|
||||
iSyringe = (ISyringe) Class.forName(obj.getClass().getName() + "$$ARouter$$Autowired").getConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
}
|
||||
iSyringe.inject(obj);
|
||||
this.a.put(name, iSyringe);
|
||||
} catch (Exception unused) {
|
||||
this.b.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.template.IProvider
|
||||
public void init(Context context) {
|
||||
this.a = new LruCache<>(66);
|
||||
this.b = new ArrayList();
|
||||
}
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
package com.alibaba.android.arouter.core;
|
||||
|
||||
import android.content.Context;
|
||||
import com.alibaba.android.arouter.exception.HandlerException;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
|
||||
import com.alibaba.android.arouter.facade.service.InterceptorService;
|
||||
import com.alibaba.android.arouter.facade.template.IInterceptor;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.android.arouter.thread.CancelableCountDownLatch;
|
||||
import com.alibaba.android.arouter.utils.MapUtils;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class InterceptorServiceImpl implements InterceptorService {
|
||||
private static boolean a;
|
||||
private static final Object b = new Object();
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.template.IProvider
|
||||
public void init(final Context context) {
|
||||
LogisticsCenter.b.execute(new Runnable(this) { // from class: com.alibaba.android.arouter.core.InterceptorServiceImpl.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (MapUtils.b(Warehouse.e)) {
|
||||
Iterator<Map.Entry<Integer, Class<? extends IInterceptor>>> it = Warehouse.e.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Class<? extends IInterceptor> value = it.next().getValue();
|
||||
try {
|
||||
IInterceptor newInstance = value.getConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
newInstance.init(context);
|
||||
Warehouse.f.add(newInstance);
|
||||
} catch (Exception e) {
|
||||
throw new HandlerException("ARouter::ARouter init interceptor error! name = [" + value.getName() + "], reason = [" + e.getMessage() + "]");
|
||||
}
|
||||
}
|
||||
boolean unused = InterceptorServiceImpl.a = true;
|
||||
ARouter.c.d("ARouter::", "ARouter interceptors init over.");
|
||||
synchronized (InterceptorServiceImpl.b) {
|
||||
InterceptorServiceImpl.b.notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void b() {
|
||||
synchronized (b) {
|
||||
while (!a) {
|
||||
try {
|
||||
b.wait(10000L);
|
||||
} catch (InterruptedException e) {
|
||||
throw new HandlerException("ARouter::Interceptor init cost too much time error! reason = [" + e.getMessage() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.service.InterceptorService
|
||||
public void a(final Postcard postcard, final InterceptorCallback interceptorCallback) {
|
||||
List<IInterceptor> list = Warehouse.f;
|
||||
if (list != null && list.size() > 0) {
|
||||
b();
|
||||
if (!a) {
|
||||
interceptorCallback.a(new HandlerException("Interceptors initialization takes too much time."));
|
||||
return;
|
||||
} else {
|
||||
LogisticsCenter.b.execute(new Runnable(this) { // from class: com.alibaba.android.arouter.core.InterceptorServiceImpl.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
CancelableCountDownLatch cancelableCountDownLatch = new CancelableCountDownLatch(Warehouse.f.size());
|
||||
try {
|
||||
InterceptorServiceImpl.a(0, cancelableCountDownLatch, postcard);
|
||||
cancelableCountDownLatch.await(postcard.p(), TimeUnit.SECONDS);
|
||||
if (cancelableCountDownLatch.getCount() > 0) {
|
||||
interceptorCallback.a(new HandlerException("The interceptor processing timed out."));
|
||||
} else if (postcard.o() != null) {
|
||||
interceptorCallback.a(new HandlerException(postcard.o().toString()));
|
||||
} else {
|
||||
interceptorCallback.a(postcard);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
interceptorCallback.a(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
interceptorCallback.a(postcard);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static void a(final int i, final CancelableCountDownLatch cancelableCountDownLatch, final Postcard postcard) {
|
||||
if (i < Warehouse.f.size()) {
|
||||
Warehouse.f.get(i).b(postcard, new InterceptorCallback() { // from class: com.alibaba.android.arouter.core.InterceptorServiceImpl.2
|
||||
@Override // com.alibaba.android.arouter.facade.callback.InterceptorCallback
|
||||
public void a(Postcard postcard2) {
|
||||
CancelableCountDownLatch.this.countDown();
|
||||
InterceptorServiceImpl.a(i + 1, CancelableCountDownLatch.this, postcard2);
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.callback.InterceptorCallback
|
||||
public void a(Throwable th) {
|
||||
postcard.a(th == null ? new HandlerException("No message.") : th.getMessage());
|
||||
CancelableCountDownLatch.this.a();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
168
sources/com/alibaba/android/arouter/core/LogisticsCenter.java
Normal file
168
sources/com/alibaba/android/arouter/core/LogisticsCenter.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package com.alibaba.android.arouter.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import com.alibaba.android.arouter.exception.HandlerException;
|
||||
import com.alibaba.android.arouter.exception.NoRouteFoundException;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.enums.TypeKind;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.android.arouter.utils.MapUtils;
|
||||
import com.alibaba.android.arouter.utils.TextUtils;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LogisticsCenter {
|
||||
private static Context a;
|
||||
static ThreadPoolExecutor b;
|
||||
private static boolean c;
|
||||
|
||||
/* renamed from: com.alibaba.android.arouter.core.LogisticsCenter$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[RouteType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[RouteType.PROVIDER.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.FRAGMENT.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void a() {
|
||||
c = false;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:28:0x00b4 A[Catch: Exception -> 0x018f, all -> 0x01b0, TryCatch #1 {Exception -> 0x018f, blocks: (B:6:0x0007, B:8:0x0013, B:9:0x011a, B:11:0x0144, B:12:0x014d, B:14:0x0153, B:19:0x001e, B:21:0x0024, B:24:0x002b, B:25:0x0078, B:26:0x00ae, B:28:0x00b4, B:45:0x00c2, B:31:0x00da, B:42:0x00e2, B:34:0x00fa, B:37:0x0102, B:48:0x004b, B:50:0x0062, B:51:0x0075), top: B:5:0x0007, outer: #0 }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static synchronized void a(android.content.Context r8, java.util.concurrent.ThreadPoolExecutor r9) throws com.alibaba.android.arouter.exception.HandlerException {
|
||||
/*
|
||||
Method dump skipped, instructions count: 435
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.alibaba.android.arouter.core.LogisticsCenter.a(android.content.Context, java.util.concurrent.ThreadPoolExecutor):void");
|
||||
}
|
||||
|
||||
public static Postcard a(String str) {
|
||||
RouteMeta routeMeta = Warehouse.d.get(str);
|
||||
if (routeMeta == null) {
|
||||
return null;
|
||||
}
|
||||
return new Postcard(routeMeta.e(), routeMeta.c());
|
||||
}
|
||||
|
||||
public static synchronized void a(Postcard postcard) {
|
||||
synchronized (LogisticsCenter.class) {
|
||||
if (postcard != null) {
|
||||
RouteMeta routeMeta = Warehouse.b.get(postcard.e());
|
||||
if (routeMeta == null) {
|
||||
Class<? extends IRouteGroup> cls = Warehouse.a.get(postcard.c());
|
||||
if (cls != null) {
|
||||
try {
|
||||
if (ARouter.a()) {
|
||||
ARouter.c.a("ARouter::", String.format(Locale.getDefault(), "The group [%s] starts loading, trigger by [%s]", postcard.c(), postcard.e()));
|
||||
}
|
||||
cls.getConstructor(new Class[0]).newInstance(new Object[0]).loadInto(Warehouse.b);
|
||||
Warehouse.a.remove(postcard.c());
|
||||
if (ARouter.a()) {
|
||||
ARouter.c.a("ARouter::", String.format(Locale.getDefault(), "The group [%s] has already been loaded, trigger by [%s]", postcard.c(), postcard.e()));
|
||||
}
|
||||
a(postcard);
|
||||
} catch (Exception e) {
|
||||
throw new HandlerException("ARouter::Fatal exception when loading group meta. [" + e.getMessage() + "]");
|
||||
}
|
||||
} else {
|
||||
throw new NoRouteFoundException("ARouter::There is no route match the path [" + postcard.e() + "], in group [" + postcard.c() + "]");
|
||||
}
|
||||
} else {
|
||||
postcard.a(routeMeta.a());
|
||||
postcard.a(routeMeta.g());
|
||||
postcard.b(routeMeta.f());
|
||||
postcard.a(routeMeta.b());
|
||||
Uri q = postcard.q();
|
||||
if (q != null) {
|
||||
Map<String, String> a2 = TextUtils.a(q);
|
||||
Map<String, Integer> d = routeMeta.d();
|
||||
if (MapUtils.b(d)) {
|
||||
for (Map.Entry<String, Integer> entry : d.entrySet()) {
|
||||
a(postcard, entry.getValue(), entry.getKey(), a2.get(entry.getKey()));
|
||||
}
|
||||
postcard.k().putStringArray("wmHzgD4lOj5o4241", (String[]) d.keySet().toArray(new String[0]));
|
||||
}
|
||||
postcard.a("NTeRQWvye18AkPd6G", q.toString());
|
||||
}
|
||||
int i = AnonymousClass1.a[routeMeta.g().ordinal()];
|
||||
if (i == 1) {
|
||||
Class<?> a3 = routeMeta.a();
|
||||
IProvider iProvider = Warehouse.c.get(a3);
|
||||
if (iProvider == null) {
|
||||
try {
|
||||
iProvider = (IProvider) a3.getConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
iProvider.init(a);
|
||||
Warehouse.c.put(a3, iProvider);
|
||||
} catch (Exception e2) {
|
||||
throw new HandlerException("Init provider failed! " + e2.getMessage());
|
||||
}
|
||||
}
|
||||
postcard.a(iProvider);
|
||||
postcard.r();
|
||||
} else if (i == 2) {
|
||||
postcard.r();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new NoRouteFoundException("ARouter::No postcard!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(Postcard postcard, Integer num, String str, String str2) {
|
||||
if (TextUtils.a(str) || TextUtils.a(str2)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (num != null) {
|
||||
if (num.intValue() == TypeKind.BOOLEAN.ordinal()) {
|
||||
postcard.a(str, Boolean.parseBoolean(str2));
|
||||
} else if (num.intValue() == TypeKind.BYTE.ordinal()) {
|
||||
postcard.a(str, Byte.valueOf(str2).byteValue());
|
||||
} else if (num.intValue() == TypeKind.SHORT.ordinal()) {
|
||||
postcard.a(str, Short.valueOf(str2).shortValue());
|
||||
} else if (num.intValue() == TypeKind.INT.ordinal()) {
|
||||
postcard.a(str, Integer.valueOf(str2).intValue());
|
||||
} else if (num.intValue() == TypeKind.LONG.ordinal()) {
|
||||
postcard.a(str, Long.valueOf(str2).longValue());
|
||||
} else if (num.intValue() == TypeKind.FLOAT.ordinal()) {
|
||||
postcard.a(str, Float.valueOf(str2).floatValue());
|
||||
} else if (num.intValue() == TypeKind.DOUBLE.ordinal()) {
|
||||
postcard.a(str, Double.valueOf(str2).doubleValue());
|
||||
} else if (num.intValue() == TypeKind.STRING.ordinal()) {
|
||||
postcard.a(str, str2);
|
||||
} else if (num.intValue() != TypeKind.PARCELABLE.ordinal()) {
|
||||
if (num.intValue() == TypeKind.OBJECT.ordinal()) {
|
||||
postcard.a(str, str2);
|
||||
} else {
|
||||
postcard.a(str, str2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
postcard.a(str, str2);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
ARouter.c.c("ARouter::", "LogisticsCenter setValue failed! " + th.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
21
sources/com/alibaba/android/arouter/core/Warehouse.java
Normal file
21
sources/com/alibaba/android/arouter/core/Warehouse.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.android.arouter.core;
|
||||
|
||||
import com.alibaba.android.arouter.base.UniqueKeyTreeMap;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IInterceptor;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class Warehouse {
|
||||
static Map<String, Class<? extends IRouteGroup>> a = new HashMap();
|
||||
static Map<String, RouteMeta> b = new HashMap();
|
||||
static Map<Class, IProvider> c = new HashMap();
|
||||
static Map<String, RouteMeta> d = new HashMap();
|
||||
static Map<Integer, Class<? extends IInterceptor>> e = new UniqueKeyTreeMap("More than one interceptors use same priority [%s]");
|
||||
static List<IInterceptor> f = new ArrayList();
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.exception;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HandlerException extends RuntimeException {
|
||||
public HandlerException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.exception;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class InitException extends RuntimeException {
|
||||
public InitException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.exception;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NoRouteFoundException extends RuntimeException {
|
||||
public NoRouteFoundException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
191
sources/com/alibaba/android/arouter/facade/Postcard.java
Normal file
191
sources/com/alibaba/android/arouter/facade/Postcard.java
Normal file
@@ -0,0 +1,191 @@
|
||||
package com.alibaba.android.arouter.facade;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Postcard extends RouteMeta {
|
||||
private Uri j;
|
||||
private Object k;
|
||||
private Bundle l;
|
||||
private int m;
|
||||
private int n;
|
||||
private IProvider o;
|
||||
private boolean p;
|
||||
private Bundle q;
|
||||
private int r;
|
||||
private int s;
|
||||
private String t;
|
||||
|
||||
public Postcard(String str, String str2) {
|
||||
this(str, str2, null, null);
|
||||
}
|
||||
|
||||
public Postcard a(IProvider iProvider) {
|
||||
this.o = iProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String h() {
|
||||
return this.t;
|
||||
}
|
||||
|
||||
public int i() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public int j() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public Bundle k() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public int l() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public Bundle m() {
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public IProvider n() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public Object o() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public int p() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public Uri q() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public Postcard r() {
|
||||
this.p = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean s() {
|
||||
return this.p;
|
||||
}
|
||||
|
||||
public Object t() {
|
||||
return a((Context) null);
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.model.RouteMeta
|
||||
public String toString() {
|
||||
return "Postcard{uri=" + this.j + ", tag=" + this.k + ", mBundle=" + this.l + ", flags=" + this.m + ", timeout=" + this.n + ", provider=" + this.o + ", greenChannel=" + this.p + ", optionsCompat=" + this.q + ", enterAnim=" + this.r + ", exitAnim=" + this.s + "}\n" + super.toString();
|
||||
}
|
||||
|
||||
public Postcard(String str, String str2, Uri uri, Bundle bundle) {
|
||||
this.m = -1;
|
||||
this.n = 300;
|
||||
this.r = -1;
|
||||
this.s = -1;
|
||||
b(str);
|
||||
a(str2);
|
||||
a(uri);
|
||||
this.l = bundle == null ? new Bundle() : bundle;
|
||||
}
|
||||
|
||||
public Postcard a(Object obj) {
|
||||
this.k = obj;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(Uri uri) {
|
||||
this.j = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object a(Context context) {
|
||||
return a(context, (NavigationCallback) null);
|
||||
}
|
||||
|
||||
public Object a(Context context, NavigationCallback navigationCallback) {
|
||||
return ARouter.b().a(context, this, -1, navigationCallback);
|
||||
}
|
||||
|
||||
public void a(Activity activity, int i) {
|
||||
a(activity, i, null);
|
||||
}
|
||||
|
||||
public void a(Activity activity, int i, NavigationCallback navigationCallback) {
|
||||
ARouter.b().a(activity, this, i, navigationCallback);
|
||||
}
|
||||
|
||||
public Postcard a(String str, String str2) {
|
||||
this.l.putString(str, str2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, boolean z) {
|
||||
this.l.putBoolean(str, z);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, short s) {
|
||||
this.l.putShort(str, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, int i) {
|
||||
this.l.putInt(str, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, long j) {
|
||||
this.l.putLong(str, j);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, double d) {
|
||||
this.l.putDouble(str, d);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, byte b) {
|
||||
this.l.putByte(str, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, float f) {
|
||||
this.l.putFloat(str, f);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, Parcelable parcelable) {
|
||||
this.l.putParcelable(str, parcelable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, Serializable serializable) {
|
||||
this.l.putSerializable(str, serializable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, byte[] bArr) {
|
||||
this.l.putByteArray(str, bArr);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Postcard a(String str, Bundle bundle) {
|
||||
this.l.putBundle(str, bundle);
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.android.arouter.facade.callback;
|
||||
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface InterceptorCallback {
|
||||
void a(Postcard postcard);
|
||||
|
||||
void a(Throwable th);
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.alibaba.android.arouter.facade.callback;
|
||||
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface NavigationCallback {
|
||||
void a(Postcard postcard);
|
||||
|
||||
void b(Postcard postcard);
|
||||
|
||||
void c(Postcard postcard);
|
||||
|
||||
void d(Postcard postcard);
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
package com.alibaba.android.arouter.facade.enums;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum RouteType {
|
||||
ACTIVITY(0, "android.app.Activity"),
|
||||
SERVICE(1, "android.app.Service"),
|
||||
PROVIDER(2, "com.alibaba.android.arouter.facade.template.IProvider"),
|
||||
CONTENT_PROVIDER(-1, "android.app.ContentProvider"),
|
||||
BOARDCAST(-1, ""),
|
||||
METHOD(-1, ""),
|
||||
FRAGMENT(-1, "android.app.Fragment"),
|
||||
UNKNOWN(-1, "Unknown route type");
|
||||
|
||||
String className;
|
||||
int id;
|
||||
|
||||
RouteType(int i, String str) {
|
||||
this.id = i;
|
||||
this.className = str;
|
||||
}
|
||||
|
||||
public static RouteType parse(String str) {
|
||||
for (RouteType routeType : values()) {
|
||||
if (routeType.getClassName().equals(str)) {
|
||||
return routeType;
|
||||
}
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public RouteType setClassName(String str) {
|
||||
this.className = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RouteType setId(int i) {
|
||||
this.id = i;
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.android.arouter.facade.enums;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum TypeKind {
|
||||
BOOLEAN,
|
||||
BYTE,
|
||||
SHORT,
|
||||
INT,
|
||||
LONG,
|
||||
CHAR,
|
||||
FLOAT,
|
||||
DOUBLE,
|
||||
STRING,
|
||||
SERIALIZABLE,
|
||||
PARCELABLE,
|
||||
OBJECT
|
||||
}
|
101
sources/com/alibaba/android/arouter/facade/model/RouteMeta.java
Normal file
101
sources/com/alibaba/android/arouter/facade/model/RouteMeta.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package com.alibaba.android.arouter.facade.model;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import java.util.Map;
|
||||
import javax.lang.model.element.Element;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RouteMeta {
|
||||
private RouteType a;
|
||||
private Element b;
|
||||
private Class<?> c;
|
||||
private String d;
|
||||
private String e;
|
||||
private int f;
|
||||
private int g;
|
||||
private Map<String, Integer> h;
|
||||
private String i;
|
||||
|
||||
public RouteMeta() {
|
||||
this.f = -1;
|
||||
}
|
||||
|
||||
public static RouteMeta a(RouteType routeType, Class<?> cls, String str, String str2, Map<String, Integer> map, int i, int i2) {
|
||||
return new RouteMeta(routeType, null, cls, null, str, str2, map, i, i2);
|
||||
}
|
||||
|
||||
public RouteMeta b(String str) {
|
||||
this.d = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public Map<String, Integer> d() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public String e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public int f() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public RouteType g() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "RouteMeta{type=" + this.a + ", rawType=" + this.b + ", destination=" + this.c + ", path='" + this.d + "', group='" + this.e + "', priority=" + this.f + ", extra=" + this.g + ", paramsType=" + this.h + ", name='" + this.i + "'}";
|
||||
}
|
||||
|
||||
public RouteMeta a(RouteType routeType) {
|
||||
this.a = routeType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RouteMeta b(int i) {
|
||||
this.f = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RouteMeta(RouteType routeType, Element element, Class<?> cls, String str, String str2, String str3, Map<String, Integer> map, int i, int i2) {
|
||||
this.f = -1;
|
||||
this.a = routeType;
|
||||
this.i = str;
|
||||
this.c = cls;
|
||||
this.b = element;
|
||||
this.d = str2;
|
||||
this.e = str3;
|
||||
this.h = map;
|
||||
this.f = i;
|
||||
this.g = i2;
|
||||
}
|
||||
|
||||
public Class<?> a() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public RouteMeta a(Class<?> cls) {
|
||||
this.c = cls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RouteMeta a(String str) {
|
||||
this.e = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RouteMeta a(int i) {
|
||||
this.g = i;
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.facade.service;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface AutowiredService extends IProvider {
|
||||
void a(Object obj);
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.alibaba.android.arouter.facade.service;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ClassLoaderService extends IProvider {
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.android.arouter.facade.service;
|
||||
|
||||
import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DegradeService extends IProvider {
|
||||
void a(Context context, Postcard postcard);
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.android.arouter.facade.service;
|
||||
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface InterceptorService extends IProvider {
|
||||
void a(Postcard postcard, InterceptorCallback interceptorCallback);
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.alibaba.android.arouter.facade.service;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface PathReplaceService extends IProvider {
|
||||
Uri a(Uri uri);
|
||||
|
||||
String a(String str);
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.alibaba.android.arouter.facade.service;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface SerializationService extends IProvider {
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IInterceptor extends IProvider {
|
||||
void b(Postcard postcard, InterceptorCallback interceptorCallback);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IInterceptorGroup {
|
||||
void loadInto(Map<Integer, Class<? extends IInterceptor>> map);
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ILogger {
|
||||
void a(String str, String str2);
|
||||
|
||||
void b(String str, String str2);
|
||||
|
||||
void c(String str, String str2);
|
||||
|
||||
void d(String str, String str2);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IProvider {
|
||||
void init(Context context);
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IProviderGroup {
|
||||
void loadInto(Map<String, RouteMeta> map);
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IRouteGroup {
|
||||
void loadInto(Map<String, RouteMeta> map);
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IRouteRoot {
|
||||
void loadInto(Map<String, Class<? extends IRouteGroup>> map);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.alibaba.android.arouter.facade.template;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ISyringe {
|
||||
void inject(Object obj);
|
||||
}
|
71
sources/com/alibaba/android/arouter/launcher/ARouter.java
Normal file
71
sources/com/alibaba/android/arouter/launcher/ARouter.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.alibaba.android.arouter.launcher;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import com.alibaba.android.arouter.exception.InitException;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
|
||||
import com.alibaba.android.arouter.facade.template.ILogger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ARouter {
|
||||
private static volatile ARouter a = null;
|
||||
private static volatile boolean b = false;
|
||||
public static ILogger c;
|
||||
|
||||
private ARouter() {
|
||||
}
|
||||
|
||||
public static void a(Application application) {
|
||||
if (b) {
|
||||
return;
|
||||
}
|
||||
ILogger iLogger = _ARouter.a;
|
||||
c = iLogger;
|
||||
iLogger.d("ARouter::", "ARouter init start.");
|
||||
b = _ARouter.a(application);
|
||||
if (b) {
|
||||
_ARouter.b();
|
||||
}
|
||||
_ARouter.a.d("ARouter::", "ARouter init over.");
|
||||
}
|
||||
|
||||
public static ARouter b() {
|
||||
if (!b) {
|
||||
throw new InitException("ARouter::Init::Invoke init(context) first!");
|
||||
}
|
||||
if (a == null) {
|
||||
synchronized (ARouter.class) {
|
||||
if (a == null) {
|
||||
a = new ARouter();
|
||||
}
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public static boolean a() {
|
||||
return _ARouter.c();
|
||||
}
|
||||
|
||||
public void a(Object obj) {
|
||||
_ARouter.a(obj);
|
||||
}
|
||||
|
||||
public Postcard a(String str) {
|
||||
return _ARouter.d().a(str);
|
||||
}
|
||||
|
||||
public Postcard a(Uri uri) {
|
||||
return _ARouter.d().a(uri);
|
||||
}
|
||||
|
||||
public <T> T a(Class<? extends T> cls) {
|
||||
return (T) _ARouter.d().a((Class) cls);
|
||||
}
|
||||
|
||||
public Object a(Context context, Postcard postcard, int i, NavigationCallback navigationCallback) {
|
||||
return _ARouter.d().a(context, postcard, i, navigationCallback);
|
||||
}
|
||||
}
|
308
sources/com/alibaba/android/arouter/launcher/_ARouter.java
Normal file
308
sources/com/alibaba/android/arouter/launcher/_ARouter.java
Normal file
@@ -0,0 +1,308 @@
|
||||
package com.alibaba.android.arouter.launcher;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.widget.Toast;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import com.alibaba.android.arouter.core.LogisticsCenter;
|
||||
import com.alibaba.android.arouter.exception.HandlerException;
|
||||
import com.alibaba.android.arouter.exception.InitException;
|
||||
import com.alibaba.android.arouter.exception.NoRouteFoundException;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
|
||||
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.service.AutowiredService;
|
||||
import com.alibaba.android.arouter.facade.service.DegradeService;
|
||||
import com.alibaba.android.arouter.facade.service.InterceptorService;
|
||||
import com.alibaba.android.arouter.facade.service.PathReplaceService;
|
||||
import com.alibaba.android.arouter.facade.template.ILogger;
|
||||
import com.alibaba.android.arouter.thread.DefaultPoolExecutor;
|
||||
import com.alibaba.android.arouter.utils.DefaultLogger;
|
||||
import com.alibaba.android.arouter.utils.TextUtils;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class _ARouter {
|
||||
static ILogger a = new DefaultLogger("ARouter::");
|
||||
private static volatile boolean b = false;
|
||||
private static volatile _ARouter c = null;
|
||||
private static volatile boolean d = false;
|
||||
private static volatile ThreadPoolExecutor e = DefaultPoolExecutor.a();
|
||||
private static Handler f;
|
||||
private static Context g;
|
||||
private static InterceptorService h;
|
||||
|
||||
/* renamed from: com.alibaba.android.arouter.launcher._ARouter$4, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass4 {
|
||||
static final /* synthetic */ int[] a = new int[RouteType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[RouteType.ACTIVITY.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.PROVIDER.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.BOARDCAST.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.CONTENT_PROVIDER.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.FRAGMENT.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.METHOD.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError unused6) {
|
||||
}
|
||||
try {
|
||||
a[RouteType.SERVICE.ordinal()] = 7;
|
||||
} catch (NoSuchFieldError unused7) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _ARouter() {
|
||||
}
|
||||
|
||||
private String b(String str) {
|
||||
if (TextUtils.a(str) || !str.startsWith("/")) {
|
||||
throw new HandlerException("ARouter::Extract the default group failed, the path must be start with '/' and contain more than 2 '/'!");
|
||||
}
|
||||
try {
|
||||
String substring = str.substring(1, str.indexOf("/", 1));
|
||||
if (TextUtils.a(substring)) {
|
||||
throw new HandlerException("ARouter::Extract the default group failed! There's nothing between 2 '/'!");
|
||||
}
|
||||
return substring;
|
||||
} catch (Exception e2) {
|
||||
a.c("ARouter::", "Failed to extract default group! " + e2.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean c() {
|
||||
return b;
|
||||
}
|
||||
|
||||
protected static _ARouter d() {
|
||||
if (!d) {
|
||||
throw new InitException("ARouterCore::Init::Invoke init(context) first!");
|
||||
}
|
||||
if (c == null) {
|
||||
synchronized (_ARouter.class) {
|
||||
if (c == null) {
|
||||
c = new _ARouter();
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
protected static synchronized boolean a(Application application) {
|
||||
synchronized (_ARouter.class) {
|
||||
g = application;
|
||||
LogisticsCenter.a(g, e);
|
||||
a.d("ARouter::", "ARouter init success!");
|
||||
d = true;
|
||||
f = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void b() {
|
||||
h = (InterceptorService) ARouter.b().a("/arouter/service/interceptor").t();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public Object b(Context context, final Postcard postcard, final int i, final NavigationCallback navigationCallback) {
|
||||
if (context == null) {
|
||||
context = g;
|
||||
}
|
||||
final Context context2 = context;
|
||||
int i2 = AnonymousClass4.a[postcard.g().ordinal()];
|
||||
if (i2 == 1) {
|
||||
final Intent intent = new Intent(context2, postcard.a());
|
||||
intent.putExtras(postcard.k());
|
||||
int l = postcard.l();
|
||||
if (-1 != l) {
|
||||
intent.setFlags(l);
|
||||
} else if (!(context2 instanceof Activity)) {
|
||||
intent.setFlags(268435456);
|
||||
}
|
||||
String h2 = postcard.h();
|
||||
if (!TextUtils.a(h2)) {
|
||||
intent.setAction(h2);
|
||||
}
|
||||
a(new Runnable() { // from class: com.alibaba.android.arouter.launcher._ARouter.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
_ARouter.this.a(i, context2, intent, postcard, navigationCallback);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
if (i2 == 2) {
|
||||
return postcard.n();
|
||||
}
|
||||
if (i2 == 3 || i2 == 4 || i2 == 5) {
|
||||
try {
|
||||
Object newInstance = postcard.a().getConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
if (newInstance instanceof Fragment) {
|
||||
((Fragment) newInstance).setArguments(postcard.k());
|
||||
} else if (newInstance instanceof androidx.fragment.app.Fragment) {
|
||||
((androidx.fragment.app.Fragment) newInstance).setArguments(postcard.k());
|
||||
}
|
||||
return newInstance;
|
||||
} catch (Exception e2) {
|
||||
a.b("ARouter::", "Fetch fragment instance error, " + TextUtils.a(e2.getStackTrace()));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static void a(Object obj) {
|
||||
AutowiredService autowiredService = (AutowiredService) ARouter.b().a("/arouter/service/autowired").t();
|
||||
if (autowiredService != null) {
|
||||
autowiredService.a(obj);
|
||||
}
|
||||
}
|
||||
|
||||
protected Postcard a(String str) {
|
||||
if (!TextUtils.a(str)) {
|
||||
PathReplaceService pathReplaceService = (PathReplaceService) ARouter.b().a(PathReplaceService.class);
|
||||
if (pathReplaceService != null) {
|
||||
str = pathReplaceService.a(str);
|
||||
}
|
||||
return a(str, b(str));
|
||||
}
|
||||
throw new HandlerException("ARouter::Parameter is invalid!");
|
||||
}
|
||||
|
||||
protected Postcard a(Uri uri) {
|
||||
if (uri != null && !TextUtils.a(uri.toString())) {
|
||||
PathReplaceService pathReplaceService = (PathReplaceService) ARouter.b().a(PathReplaceService.class);
|
||||
if (pathReplaceService != null) {
|
||||
uri = pathReplaceService.a(uri);
|
||||
}
|
||||
return new Postcard(uri.getPath(), b(uri.getPath()), uri, null);
|
||||
}
|
||||
throw new HandlerException("ARouter::Parameter invalid!");
|
||||
}
|
||||
|
||||
protected Postcard a(String str, String str2) {
|
||||
if (!TextUtils.a(str) && !TextUtils.a(str2)) {
|
||||
PathReplaceService pathReplaceService = (PathReplaceService) ARouter.b().a(PathReplaceService.class);
|
||||
if (pathReplaceService != null) {
|
||||
str = pathReplaceService.a(str);
|
||||
}
|
||||
return new Postcard(str, str2);
|
||||
}
|
||||
throw new HandlerException("ARouter::Parameter is invalid!");
|
||||
}
|
||||
|
||||
protected <T> T a(Class<? extends T> cls) {
|
||||
try {
|
||||
Postcard a2 = LogisticsCenter.a(cls.getName());
|
||||
if (a2 == null) {
|
||||
a2 = LogisticsCenter.a(cls.getSimpleName());
|
||||
}
|
||||
if (a2 == null) {
|
||||
return null;
|
||||
}
|
||||
LogisticsCenter.a(a2);
|
||||
return (T) a2.n();
|
||||
} catch (NoRouteFoundException e2) {
|
||||
a.c("ARouter::", e2.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Object a(final Context context, final Postcard postcard, final int i, final NavigationCallback navigationCallback) {
|
||||
try {
|
||||
LogisticsCenter.a(postcard);
|
||||
if (navigationCallback != null) {
|
||||
navigationCallback.a(postcard);
|
||||
}
|
||||
if (!postcard.s()) {
|
||||
h.a(postcard, new InterceptorCallback() { // from class: com.alibaba.android.arouter.launcher._ARouter.2
|
||||
@Override // com.alibaba.android.arouter.facade.callback.InterceptorCallback
|
||||
public void a(Postcard postcard2) {
|
||||
_ARouter.this.b(context, postcard2, i, navigationCallback);
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.callback.InterceptorCallback
|
||||
public void a(Throwable th) {
|
||||
NavigationCallback navigationCallback2 = navigationCallback;
|
||||
if (navigationCallback2 != null) {
|
||||
navigationCallback2.c(postcard);
|
||||
}
|
||||
_ARouter.a.d("ARouter::", "Navigation failed, termination by interceptor : " + th.getMessage());
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return b(context, postcard, i, navigationCallback);
|
||||
} catch (NoRouteFoundException e2) {
|
||||
a.c("ARouter::", e2.getMessage());
|
||||
if (c()) {
|
||||
a(new Runnable(this) { // from class: com.alibaba.android.arouter.launcher._ARouter.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Toast.makeText(_ARouter.g, "There's no route matched!\n Path = [" + postcard.e() + "]\n Group = [" + postcard.c() + "]", 1).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (navigationCallback != null) {
|
||||
navigationCallback.b(postcard);
|
||||
} else {
|
||||
DegradeService degradeService = (DegradeService) ARouter.b().a(DegradeService.class);
|
||||
if (degradeService != null) {
|
||||
degradeService.a(context, postcard);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Runnable runnable) {
|
||||
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
|
||||
f.post(runnable);
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(int i, Context context, Intent intent, Postcard postcard, NavigationCallback navigationCallback) {
|
||||
if (i >= 0) {
|
||||
if (context instanceof Activity) {
|
||||
ActivityCompat.a((Activity) context, intent, i, postcard.m());
|
||||
} else {
|
||||
a.c("ARouter::", "Must use [navigation(activity, ...)] to support [startActivityForResult]");
|
||||
}
|
||||
} else {
|
||||
ContextCompat.a(context, intent, postcard.m());
|
||||
}
|
||||
if (-1 != postcard.i() && -1 != postcard.j() && (context instanceof Activity)) {
|
||||
((Activity) context).overridePendingTransition(postcard.i(), postcard.j());
|
||||
}
|
||||
if (navigationCallback != null) {
|
||||
navigationCallback.d(postcard);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.user.view.CountryCodeActivity;
|
||||
import com.ubt.jimu.user.view.FindPasswordActivity;
|
||||
import com.ubt.jimu.user.view.LoginActivity;
|
||||
import com.ubt.jimu.user.view.RegisterActivity;
|
||||
import com.ubt.jimu.user.view.VerifyCaptchaActivity;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$account implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/account/captcha", RouteMeta.a(RouteType.ACTIVITY, VerifyCaptchaActivity.class, "/account/captcha", "account", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/account/countrycode", RouteMeta.a(RouteType.ACTIVITY, CountryCodeActivity.class, "/account/countrycode", "account", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/account/findpwd", RouteMeta.a(RouteType.ACTIVITY, FindPasswordActivity.class, "/account/findpwd", "account", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/account/login", RouteMeta.a(RouteType.ACTIVITY, LoginActivity.class, "/account/login", "account", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/account/register", RouteMeta.a(RouteType.ACTIVITY, RegisterActivity.class, "/account/register", "account", new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$account.1
|
||||
{
|
||||
put("loginType", 3);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.widgets.choosePhotos.AlbumActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$album implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/album/chooser", RouteMeta.a(RouteType.ACTIVITY, AlbumActivity.class, "/album/chooser", "album", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.core.AutowiredServiceImpl;
|
||||
import com.alibaba.android.arouter.core.InterceptorServiceImpl;
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$arouter implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/arouter/service/autowired", RouteMeta.a(RouteType.PROVIDER, AutowiredServiceImpl.class, "/arouter/service/autowired", "arouter", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/arouter/service/interceptor", RouteMeta.a(RouteType.PROVIDER, InterceptorServiceImpl.class, "/arouter/service/interceptor", "arouter", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.community.activity.JimuActListActivity;
|
||||
import com.ubt.jimu.community.view.HotLaststActivity;
|
||||
import com.ubt.jimu.community.view.InspireActivity;
|
||||
import com.ubt.jimu.community.view.MyFavouriteActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$community implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/community/activity", RouteMeta.a(RouteType.ACTIVITY, JimuActListActivity.class, "/community/activity", "community", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/community/favorite", RouteMeta.a(RouteType.ACTIVITY, MyFavouriteActivity.class, "/community/favorite", "community", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/community/hot", RouteMeta.a(RouteType.ACTIVITY, HotLaststActivity.class, "/community/hot", "community", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/community/inspire", RouteMeta.a(RouteType.ACTIVITY, InspireActivity.class, "/community/inspire", "community", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.controller.AccumulatorSettingActivity;
|
||||
import com.ubt.jimu.controller.AddDirectionActivity;
|
||||
import com.ubt.jimu.controller.AngleSettingActivity;
|
||||
import com.ubt.jimu.controller.ControllerActivity;
|
||||
import com.ubt.jimu.controller.JockstickSettingActivity;
|
||||
import com.ubt.jimu.controller.ServoModeSettingNewActivity;
|
||||
import com.ubt.jimu.controller.VSliderSetActivity;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$controller implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/controller/accumulatorsettings", RouteMeta.a(RouteType.ACTIVITY, AccumulatorSettingActivity.class, "/controller/accumulatorsettings", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.1
|
||||
{
|
||||
put("robotLite", 10);
|
||||
put("config_id_key", 8);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
map.put("/controller/adddirect", RouteMeta.a(RouteType.ACTIVITY, AddDirectionActivity.class, "/controller/adddirect", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.2
|
||||
{
|
||||
put("robotLite", 10);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
map.put("/controller/anglesettings", RouteMeta.a(RouteType.ACTIVITY, AngleSettingActivity.class, "/controller/anglesettings", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.3
|
||||
{
|
||||
put("robotLite", 10);
|
||||
put("config_id_key", 8);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
map.put("/controller/control", RouteMeta.a(RouteType.ACTIVITY, ControllerActivity.class, "/controller/control", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.4
|
||||
{
|
||||
put("robotLite", 10);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
map.put("/controller/jocksticksettings", RouteMeta.a(RouteType.ACTIVITY, JockstickSettingActivity.class, "/controller/jocksticksettings", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.5
|
||||
{
|
||||
put("jock_type", 3);
|
||||
put("robotLite", 10);
|
||||
put("config_id_key", 8);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
map.put("/controller/servosettings", RouteMeta.a(RouteType.ACTIVITY, ServoModeSettingNewActivity.class, "/controller/servosettings", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.6
|
||||
{
|
||||
put("robotLite", 10);
|
||||
put("isFromUnity", 0);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
map.put("/controller/vslidersettings", RouteMeta.a(RouteType.ACTIVITY, VSliderSetActivity.class, "/controller/vslidersettings", TransportFile.TYPE_CONTROLLER, new HashMap<String, Integer>(this) { // from class: com.alibaba.android.arouter.routes.ARouter$$Group$$controller.7
|
||||
{
|
||||
put("robotLite", 10);
|
||||
put("config_id_key", 8);
|
||||
}
|
||||
}, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.diy.activity.UserDiyActivity;
|
||||
import com.ubt.jimu.diy.view.DiyCommentListActivity;
|
||||
import com.ubt.jimu.diy.view.DiyFanActivity;
|
||||
import com.ubt.jimu.diy.view.OfficialDiyDetailActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$diy implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/diy/commentlist", RouteMeta.a(RouteType.ACTIVITY, DiyCommentListActivity.class, "/diy/commentlist", "diy", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/diy/detail", RouteMeta.a(RouteType.ACTIVITY, OfficialDiyDetailActivity.class, "/diy/detail", "diy", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/diy/fan", RouteMeta.a(RouteType.ACTIVITY, DiyFanActivity.class, "/diy/fan", "diy", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/diy/usercreatives", RouteMeta.a(RouteType.ACTIVITY, UserDiyActivity.class, "/diy/usercreatives", "diy", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.ar.view.GameListActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$game implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/game/list", RouteMeta.a(RouteType.ACTIVITY, GameListActivity.class, "/game/list", "game", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.course.view.JimuTaskListActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$learn implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/learn/lessons", RouteMeta.a(RouteType.ACTIVITY, JimuTaskListActivity.class, "/learn/lessons", "learn", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.pack.view.BarCodeScanActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$package implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/package/scan", RouteMeta.a(RouteType.ACTIVITY, BarCodeScanActivity.class, "/package/scan", "package", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.discover.DiscoveryActivity;
|
||||
import com.ubt.jimu.main.activity.MainActivity;
|
||||
import com.ubt.jimu.message.view.MessageCenterActivity;
|
||||
import com.ubt.jimu.user.view.UserCenterActivity;
|
||||
import com.ubt.jimu.user.view.setting.SettingActivity;
|
||||
import com.ubt.jimu.web.GdprWebActivity;
|
||||
import com.ubt.jimu.web.WebActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$page implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/page/discovery", RouteMeta.a(RouteType.ACTIVITY, DiscoveryActivity.class, "/page/discovery", "page", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/page/gdpr_web", RouteMeta.a(RouteType.ACTIVITY, GdprWebActivity.class, "/page/gdpr_web", "page", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/page/main", RouteMeta.a(RouteType.ACTIVITY, MainActivity.class, "/page/main", "page", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/page/message", RouteMeta.a(RouteType.ACTIVITY, MessageCenterActivity.class, "/page/message", "page", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/page/setting", RouteMeta.a(RouteType.ACTIVITY, SettingActivity.class, "/page/setting", "page", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/page/user", RouteMeta.a(RouteType.ACTIVITY, UserCenterActivity.class, "/page/user", "page", null, -1, Integer.MIN_VALUE));
|
||||
map.put("/page/web", RouteMeta.a(RouteType.ACTIVITY, WebActivity.class, "/page/web", "page", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.pack.view.DownloadRobotActivity;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Group$$robot implements IRouteGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("/robot/download", RouteMeta.a(RouteType.ACTIVITY, DownloadRobotActivity.class, "/robot/download", Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY, null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IProviderGroup;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Providers$$app implements IProviderGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IProviderGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.core.AutowiredServiceImpl;
|
||||
import com.alibaba.android.arouter.core.InterceptorServiceImpl;
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IProviderGroup;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Providers$$arouterapi implements IProviderGroup {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IProviderGroup
|
||||
public void loadInto(Map<String, RouteMeta> map) {
|
||||
map.put("com.alibaba.android.arouter.facade.service.AutowiredService", RouteMeta.a(RouteType.PROVIDER, AutowiredServiceImpl.class, "/arouter/service/autowired", "arouter", null, -1, Integer.MIN_VALUE));
|
||||
map.put("com.alibaba.android.arouter.facade.service.InterceptorService", RouteMeta.a(RouteType.PROVIDER, InterceptorServiceImpl.class, "/arouter/service/interceptor", "arouter", null, -1, Integer.MIN_VALUE));
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteRoot;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Root$$app implements IRouteRoot {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteRoot
|
||||
public void loadInto(Map<String, Class<? extends IRouteGroup>> map) {
|
||||
map.put("account", ARouter$$Group$$account.class);
|
||||
map.put("album", ARouter$$Group$$album.class);
|
||||
map.put("community", ARouter$$Group$$community.class);
|
||||
map.put(TransportFile.TYPE_CONTROLLER, ARouter$$Group$$controller.class);
|
||||
map.put("diy", ARouter$$Group$$diy.class);
|
||||
map.put("game", ARouter$$Group$$game.class);
|
||||
map.put("learn", ARouter$$Group$$learn.class);
|
||||
map.put("package", ARouter$$Group$$package.class);
|
||||
map.put("page", ARouter$$Group$$page.class);
|
||||
map.put(Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY, ARouter$$Group$$robot.class);
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteRoot;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ARouter$$Root$$arouterapi implements IRouteRoot {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IRouteRoot
|
||||
public void loadInto(Map<String, Class<? extends IRouteGroup>> map) {
|
||||
map.put("arouter", ARouter$$Group$$arouter.class);
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.alibaba.android.arouter.thread;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CancelableCountDownLatch extends CountDownLatch {
|
||||
public CancelableCountDownLatch(int i) {
|
||||
super(i);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
while (getCount() > 0) {
|
||||
countDown();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package com.alibaba.android.arouter.thread;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.android.arouter.utils.TextUtils;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultPoolExecutor extends ThreadPoolExecutor {
|
||||
private static final int a = Runtime.getRuntime().availableProcessors();
|
||||
private static final int b = a + 1;
|
||||
private static final int c = b;
|
||||
private static DefaultPoolExecutor d;
|
||||
|
||||
private DefaultPoolExecutor(int i, int i2, long j, TimeUnit timeUnit, BlockingQueue<Runnable> blockingQueue, ThreadFactory threadFactory) {
|
||||
super(i, i2, j, timeUnit, blockingQueue, threadFactory, new RejectedExecutionHandler() { // from class: com.alibaba.android.arouter.thread.DefaultPoolExecutor.1
|
||||
@Override // java.util.concurrent.RejectedExecutionHandler
|
||||
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor) {
|
||||
ARouter.c.b("ARouter::", "Task rejected, too many task!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static DefaultPoolExecutor a() {
|
||||
if (d == null) {
|
||||
synchronized (DefaultPoolExecutor.class) {
|
||||
if (d == null) {
|
||||
d = new DefaultPoolExecutor(b, c, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue(64), new DefaultThreadFactory());
|
||||
}
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.ThreadPoolExecutor
|
||||
protected void afterExecute(Runnable runnable, Throwable th) {
|
||||
super.afterExecute(runnable, th);
|
||||
if (th == null && (runnable instanceof Future)) {
|
||||
try {
|
||||
((Future) runnable).get();
|
||||
} catch (InterruptedException unused) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (CancellationException e) {
|
||||
th = e;
|
||||
} catch (ExecutionException e2) {
|
||||
th = e2.getCause();
|
||||
}
|
||||
}
|
||||
if (th != null) {
|
||||
ARouter.c.c("ARouter::", "Running task appeared exception! Thread [" + Thread.currentThread().getName() + "], because [" + th.getMessage() + "]\n" + TextUtils.a(th.getStackTrace()));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package com.alibaba.android.arouter.thread;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import java.lang.Thread;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultThreadFactory implements ThreadFactory {
|
||||
private static final AtomicInteger d = new AtomicInteger(1);
|
||||
private final AtomicInteger a = new AtomicInteger(1);
|
||||
private final ThreadGroup b;
|
||||
private final String c;
|
||||
|
||||
public DefaultThreadFactory() {
|
||||
SecurityManager securityManager = System.getSecurityManager();
|
||||
this.b = securityManager != null ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
|
||||
this.c = "ARouter task pool No." + d.getAndIncrement() + ", thread No.";
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.ThreadFactory
|
||||
public Thread newThread(Runnable runnable) {
|
||||
String str = this.c + this.a.getAndIncrement();
|
||||
ARouter.c.d("ARouter::", "Thread production, name is [" + str + "]");
|
||||
Thread thread = new Thread(this.b, runnable, str, 0L);
|
||||
if (thread.isDaemon()) {
|
||||
thread.setDaemon(false);
|
||||
}
|
||||
if (thread.getPriority() != 5) {
|
||||
thread.setPriority(5);
|
||||
}
|
||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(this) { // from class: com.alibaba.android.arouter.thread.DefaultThreadFactory.1
|
||||
@Override // java.lang.Thread.UncaughtExceptionHandler
|
||||
public void uncaughtException(Thread thread2, Throwable th) {
|
||||
ARouter.c.d("ARouter::", "Running task appeared exception! Thread [" + thread2.getName() + "], because [" + th.getMessage() + "]");
|
||||
}
|
||||
});
|
||||
return thread;
|
||||
}
|
||||
}
|
249
sources/com/alibaba/android/arouter/utils/ClassUtils.java
Normal file
249
sources/com/alibaba/android/arouter/utils/ClassUtils.java
Normal file
@@ -0,0 +1,249 @@
|
||||
package com.alibaba.android.arouter.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.android.arouter.thread.DefaultPoolExecutor;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ClassUtils {
|
||||
private static final String a = "code_cache" + File.separator + "secondary-dexes";
|
||||
|
||||
private static SharedPreferences a(Context context) {
|
||||
return context.getSharedPreferences("multidex.version", Build.VERSION.SDK_INT < 11 ? 0 : 4);
|
||||
}
|
||||
|
||||
public static List<String> b(Context context) throws PackageManager.NameNotFoundException, IOException {
|
||||
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0);
|
||||
File file = new File(applicationInfo.sourceDir);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(applicationInfo.sourceDir);
|
||||
String str = file.getName() + ".classes";
|
||||
if (!a()) {
|
||||
int i = a(context).getInt("dex.number", 1);
|
||||
File file2 = new File(applicationInfo.dataDir, a);
|
||||
for (int i2 = 2; i2 <= i; i2++) {
|
||||
File file3 = new File(file2, str + i2 + ".zip");
|
||||
if (!file3.isFile()) {
|
||||
throw new IOException("Missing extracted secondary dex file '" + file3.getPath() + "'");
|
||||
}
|
||||
arrayList.add(file3.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
if (ARouter.a()) {
|
||||
arrayList.addAll(a(applicationInfo));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static Set<String> a(Context context, final String str) throws PackageManager.NameNotFoundException, IOException, InterruptedException {
|
||||
final HashSet hashSet = new HashSet();
|
||||
List<String> b = b(context);
|
||||
final CountDownLatch countDownLatch = new CountDownLatch(b.size());
|
||||
for (final String str2 : b) {
|
||||
DefaultPoolExecutor.a().execute(new Runnable() { // from class: com.alibaba.android.arouter.utils.ClassUtils.1
|
||||
/* JADX WARN: Code restructure failed: missing block: B:30:0x0057, code lost:
|
||||
|
||||
if (r0 == null) goto L20;
|
||||
*/
|
||||
@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() {
|
||||
/*
|
||||
r4 = this;
|
||||
r0 = 0
|
||||
java.lang.String r1 = r1 // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r2 = ".zip"
|
||||
boolean r1 = r1.endsWith(r2) // Catch: java.lang.Throwable -> L4f
|
||||
if (r1 == 0) goto L26
|
||||
java.lang.String r1 = r1 // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L4f
|
||||
r2.<init>() // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r3 = r1 // Catch: java.lang.Throwable -> L4f
|
||||
r2.append(r3) // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r3 = ".tmp"
|
||||
r2.append(r3) // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r2 = r2.toString() // Catch: java.lang.Throwable -> L4f
|
||||
r3 = 0
|
||||
dalvik.system.DexFile r0 = dalvik.system.DexFile.loadDex(r1, r2, r3) // Catch: java.lang.Throwable -> L4f
|
||||
goto L2e
|
||||
L26:
|
||||
dalvik.system.DexFile r1 = new dalvik.system.DexFile // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r2 = r1 // Catch: java.lang.Throwable -> L4f
|
||||
r1.<init>(r2) // Catch: java.lang.Throwable -> L4f
|
||||
r0 = r1
|
||||
L2e:
|
||||
java.util.Enumeration r1 = r0.entries() // Catch: java.lang.Throwable -> L4f
|
||||
L32:
|
||||
boolean r2 = r1.hasMoreElements() // Catch: java.lang.Throwable -> L4f
|
||||
if (r2 == 0) goto L4c
|
||||
java.lang.Object r2 = r1.nextElement() // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r2 = (java.lang.String) r2 // Catch: java.lang.Throwable -> L4f
|
||||
java.lang.String r3 = r2 // Catch: java.lang.Throwable -> L4f
|
||||
boolean r3 = r2.startsWith(r3) // Catch: java.lang.Throwable -> L4f
|
||||
if (r3 == 0) goto L32
|
||||
java.util.Set r3 = r3 // Catch: java.lang.Throwable -> L4f
|
||||
r3.add(r2) // Catch: java.lang.Throwable -> L4f
|
||||
goto L32
|
||||
L4c:
|
||||
if (r0 == 0) goto L5c
|
||||
goto L59
|
||||
L4f:
|
||||
r1 = move-exception
|
||||
java.lang.String r2 = "ARouter"
|
||||
java.lang.String r3 = "Scan map file in dex files made error."
|
||||
android.util.Log.e(r2, r3, r1) // Catch: java.lang.Throwable -> L62
|
||||
if (r0 == 0) goto L5c
|
||||
L59:
|
||||
r0.close() // Catch: java.lang.Throwable -> L5c
|
||||
L5c:
|
||||
java.util.concurrent.CountDownLatch r0 = r4
|
||||
r0.countDown()
|
||||
return
|
||||
L62:
|
||||
r1 = move-exception
|
||||
if (r0 == 0) goto L68
|
||||
r0.close() // Catch: java.lang.Throwable -> L68
|
||||
L68:
|
||||
java.util.concurrent.CountDownLatch r0 = r4
|
||||
r0.countDown()
|
||||
throw r1
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.alibaba.android.arouter.utils.ClassUtils.AnonymousClass1.run():void");
|
||||
}
|
||||
});
|
||||
}
|
||||
countDownLatch.await();
|
||||
Log.d("ARouter::", "Filter " + hashSet.size() + " classes by packageName <" + str + ">");
|
||||
return hashSet;
|
||||
}
|
||||
|
||||
private static List<String> a(ApplicationInfo applicationInfo) {
|
||||
String[] strArr;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (Build.VERSION.SDK_INT >= 21 && (strArr = applicationInfo.splitSourceDirs) != null) {
|
||||
arrayList.addAll(Arrays.asList(strArr));
|
||||
Log.d("ARouter::", "Found InstantRun support");
|
||||
} else {
|
||||
try {
|
||||
File file = new File((String) Class.forName("com.android.tools.fd.runtime.Paths").getMethod("getDexFileDirectory", String.class).invoke(null, applicationInfo.packageName));
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
for (File file2 : file.listFiles()) {
|
||||
if (file2 != null && file2.exists() && file2.isFile() && file2.getName().endsWith(".dex")) {
|
||||
arrayList.add(file2.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
Log.d("ARouter::", "Found InstantRun support");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("ARouter::", "InstantRun support error, " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private static boolean b() {
|
||||
try {
|
||||
String property = System.getProperty("ro.yunos.version");
|
||||
String property2 = System.getProperty("java.vm.name");
|
||||
if (property2 == null || !property2.toLowerCase().contains("lemur")) {
|
||||
if (property == null) {
|
||||
return false;
|
||||
}
|
||||
if (property.trim().length() <= 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (Exception unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:24:0x004e, code lost:
|
||||
|
||||
if (r2 < 1) goto L24;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:6:0x001b, code lost:
|
||||
|
||||
if (java.lang.Integer.valueOf(java.lang.System.getProperty("ro.build.version.sdk")).intValue() >= 21) goto L7;
|
||||
*/
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0061 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x0064 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private static boolean a() {
|
||||
/*
|
||||
r0 = 0
|
||||
r1 = 0
|
||||
boolean r2 = b() // Catch: java.lang.Throwable -> L51
|
||||
r3 = 1
|
||||
if (r2 == 0) goto L1f
|
||||
java.lang.String r1 = "'YunOS'"
|
||||
java.lang.String r2 = "ro.build.version.sdk"
|
||||
java.lang.String r2 = java.lang.System.getProperty(r2) // Catch: java.lang.Throwable -> L51
|
||||
java.lang.Integer r2 = java.lang.Integer.valueOf(r2) // Catch: java.lang.Throwable -> L51
|
||||
int r2 = r2.intValue() // Catch: java.lang.Throwable -> L51
|
||||
r4 = 21
|
||||
if (r2 < r4) goto L52
|
||||
L1d:
|
||||
r0 = 1
|
||||
goto L52
|
||||
L1f:
|
||||
java.lang.String r1 = "'Android'"
|
||||
java.lang.String r2 = "java.vm.version"
|
||||
java.lang.String r2 = java.lang.System.getProperty(r2) // Catch: java.lang.Throwable -> L51
|
||||
if (r2 == 0) goto L52
|
||||
java.lang.String r4 = "(\\d+)\\.(\\d+)(\\.\\d+)?"
|
||||
java.util.regex.Pattern r4 = java.util.regex.Pattern.compile(r4) // Catch: java.lang.Throwable -> L51
|
||||
java.util.regex.Matcher r2 = r4.matcher(r2) // Catch: java.lang.Throwable -> L51
|
||||
boolean r4 = r2.matches() // Catch: java.lang.Throwable -> L51
|
||||
if (r4 == 0) goto L52
|
||||
java.lang.String r4 = r2.group(r3) // Catch: java.lang.Throwable -> L51
|
||||
int r4 = java.lang.Integer.parseInt(r4) // Catch: java.lang.Throwable -> L51
|
||||
r5 = 2
|
||||
java.lang.String r2 = r2.group(r5) // Catch: java.lang.Throwable -> L51
|
||||
int r2 = java.lang.Integer.parseInt(r2) // Catch: java.lang.Throwable -> L51
|
||||
if (r4 > r5) goto L1d
|
||||
if (r4 != r5) goto L52
|
||||
if (r2 < r3) goto L52
|
||||
goto L1d
|
||||
L51:
|
||||
L52:
|
||||
java.lang.StringBuilder r2 = new java.lang.StringBuilder
|
||||
r2.<init>()
|
||||
java.lang.String r3 = "VM with name "
|
||||
r2.append(r3)
|
||||
r2.append(r1)
|
||||
if (r0 == 0) goto L64
|
||||
java.lang.String r1 = " has multidex support"
|
||||
goto L66
|
||||
L64:
|
||||
java.lang.String r1 = " does not have multidex support"
|
||||
L66:
|
||||
r2.append(r1)
|
||||
java.lang.String r1 = r2.toString()
|
||||
java.lang.String r2 = "ARouter::"
|
||||
android.util.Log.i(r2, r1)
|
||||
return r0
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.alibaba.android.arouter.utils.ClassUtils.a():boolean");
|
||||
}
|
||||
}
|
95
sources/com/alibaba/android/arouter/utils/DefaultLogger.java
Normal file
95
sources/com/alibaba/android/arouter/utils/DefaultLogger.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.alibaba.android.arouter.utils;
|
||||
|
||||
import android.util.Log;
|
||||
import com.alibaba.android.arouter.facade.template.ILogger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultLogger implements ILogger {
|
||||
private static boolean b = false;
|
||||
private static boolean c = false;
|
||||
private String a;
|
||||
|
||||
public DefaultLogger(String str) {
|
||||
this.a = "ARouter";
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.template.ILogger
|
||||
public void a(String str, String str2) {
|
||||
if (b) {
|
||||
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3];
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
str = a();
|
||||
}
|
||||
Log.d(str, str2 + a(stackTraceElement));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.template.ILogger
|
||||
public void b(String str, String str2) {
|
||||
if (b) {
|
||||
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3];
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
str = a();
|
||||
}
|
||||
Log.e(str, str2 + a(stackTraceElement));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.template.ILogger
|
||||
public void c(String str, String str2) {
|
||||
if (b) {
|
||||
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3];
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
str = a();
|
||||
}
|
||||
Log.w(str, str2 + a(stackTraceElement));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.android.arouter.facade.template.ILogger
|
||||
public void d(String str, String str2) {
|
||||
if (b) {
|
||||
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3];
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
str = a();
|
||||
}
|
||||
Log.i(str, str2 + a(stackTraceElement));
|
||||
}
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public static String a(StackTraceElement stackTraceElement) {
|
||||
StringBuilder sb = new StringBuilder("[");
|
||||
if (c) {
|
||||
String name = Thread.currentThread().getName();
|
||||
String fileName = stackTraceElement.getFileName();
|
||||
String className = stackTraceElement.getClassName();
|
||||
String methodName = stackTraceElement.getMethodName();
|
||||
long id = Thread.currentThread().getId();
|
||||
int lineNumber = stackTraceElement.getLineNumber();
|
||||
sb.append("ThreadId=");
|
||||
sb.append(id);
|
||||
sb.append(" & ");
|
||||
sb.append("ThreadName=");
|
||||
sb.append(name);
|
||||
sb.append(" & ");
|
||||
sb.append("FileName=");
|
||||
sb.append(fileName);
|
||||
sb.append(" & ");
|
||||
sb.append("ClassName=");
|
||||
sb.append(className);
|
||||
sb.append(" & ");
|
||||
sb.append("MethodName=");
|
||||
sb.append(methodName);
|
||||
sb.append(" & ");
|
||||
sb.append("LineNumber=");
|
||||
sb.append(lineNumber);
|
||||
}
|
||||
sb.append(" ] ");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
14
sources/com/alibaba/android/arouter/utils/MapUtils.java
Normal file
14
sources/com/alibaba/android/arouter/utils/MapUtils.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.alibaba.android.arouter.utils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MapUtils {
|
||||
public static boolean a(Map<?, ?> map) {
|
||||
return map == null || map.isEmpty();
|
||||
}
|
||||
|
||||
public static boolean b(Map<?, ?> map) {
|
||||
return !a(map);
|
||||
}
|
||||
}
|
43
sources/com/alibaba/android/arouter/utils/PackageUtils.java
Normal file
43
sources/com/alibaba/android/arouter/utils/PackageUtils.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.alibaba.android.arouter.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PackageUtils {
|
||||
private static String a;
|
||||
private static int b;
|
||||
|
||||
private static PackageInfo a(Context context) {
|
||||
try {
|
||||
return context.getPackageManager().getPackageInfo(context.getPackageName(), 16384);
|
||||
} catch (Exception unused) {
|
||||
ARouter.c.b("ARouter::", "Get package info error.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean b(Context context) {
|
||||
PackageInfo a2 = a(context);
|
||||
if (a2 != null) {
|
||||
String str = a2.versionName;
|
||||
int i = a2.versionCode;
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("SP_AROUTER_CACHE", 0);
|
||||
if (str.equals(sharedPreferences.getString("LAST_VERSION_NAME", null)) && i == sharedPreferences.getInt("LAST_VERSION_CODE", -1)) {
|
||||
return false;
|
||||
}
|
||||
a = str;
|
||||
b = i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void c(Context context) {
|
||||
if (android.text.TextUtils.isEmpty(a) || b == 0) {
|
||||
return;
|
||||
}
|
||||
context.getSharedPreferences("SP_AROUTER_CACHE", 0).edit().putString("LAST_VERSION_NAME", a).putInt("LAST_VERSION_CODE", b).apply();
|
||||
}
|
||||
}
|
48
sources/com/alibaba/android/arouter/utils/TextUtils.java
Normal file
48
sources/com/alibaba/android/arouter/utils/TextUtils.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.alibaba.android.arouter.utils;
|
||||
|
||||
import android.net.Uri;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TextUtils {
|
||||
public static boolean a(CharSequence charSequence) {
|
||||
return charSequence == null || charSequence.length() == 0;
|
||||
}
|
||||
|
||||
public static String a(StackTraceElement[] stackTraceElementArr) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (StackTraceElement stackTraceElement : stackTraceElementArr) {
|
||||
sb.append(" at ");
|
||||
sb.append(stackTraceElement.toString());
|
||||
sb.append("\n");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static Map<String, String> a(Uri uri) {
|
||||
String encodedQuery = uri.getEncodedQuery();
|
||||
if (encodedQuery == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||||
int i = 0;
|
||||
do {
|
||||
int indexOf = encodedQuery.indexOf(38, i);
|
||||
if (indexOf == -1) {
|
||||
indexOf = encodedQuery.length();
|
||||
}
|
||||
int indexOf2 = encodedQuery.indexOf(61, i);
|
||||
if (indexOf2 > indexOf || indexOf2 == -1) {
|
||||
indexOf2 = indexOf;
|
||||
}
|
||||
String substring = encodedQuery.substring(i, indexOf2);
|
||||
if (!android.text.TextUtils.isEmpty(substring)) {
|
||||
linkedHashMap.put(Uri.decode(substring), Uri.decode(indexOf2 == indexOf ? "" : encodedQuery.substring(indexOf2 + 1, indexOf)));
|
||||
}
|
||||
i = indexOf + 1;
|
||||
} while (i < encodedQuery.length());
|
||||
return Collections.unmodifiableMap(linkedHashMap);
|
||||
}
|
||||
}
|
99
sources/com/alibaba/sdk/android/oss/ClientConfiguration.java
Normal file
99
sources/com/alibaba/sdk/android/oss/ClientConfiguration.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ClientConfiguration {
|
||||
private String g;
|
||||
private int h;
|
||||
private String i;
|
||||
private String l;
|
||||
private int a = 5;
|
||||
private int b = 60000;
|
||||
private int c = 60000;
|
||||
private long d = 5242880;
|
||||
private int e = 2;
|
||||
private List<String> f = new ArrayList();
|
||||
private boolean j = true;
|
||||
private boolean k = false;
|
||||
private boolean m = false;
|
||||
private boolean n = false;
|
||||
|
||||
public static ClientConfiguration o() {
|
||||
return new ClientConfiguration();
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
this.e = i;
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int f() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public long g() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public String h() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public int i() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public int j() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean k() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public boolean n() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.c = i;
|
||||
}
|
||||
|
||||
public List<String> b() {
|
||||
return Collections.unmodifiableList(this.f);
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public String d() {
|
||||
return this.l;
|
||||
}
|
||||
}
|
46
sources/com/alibaba/sdk/android/oss/ClientException.java
Normal file
46
sources/com/alibaba/sdk/android/oss/ClientException.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ClientException extends Exception {
|
||||
private Boolean canceled;
|
||||
|
||||
public ClientException() {
|
||||
this.canceled = false;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
String message = super.getMessage();
|
||||
if (getCause() == null) {
|
||||
return message;
|
||||
}
|
||||
return getCause().getMessage() + "\n" + message;
|
||||
}
|
||||
|
||||
public Boolean isCanceledException() {
|
||||
return this.canceled;
|
||||
}
|
||||
|
||||
public ClientException(String str) {
|
||||
super("[ErrorMessage]: " + str);
|
||||
this.canceled = false;
|
||||
}
|
||||
|
||||
public ClientException(Throwable th) {
|
||||
super(th);
|
||||
this.canceled = false;
|
||||
}
|
||||
|
||||
public ClientException(String str, Throwable th) {
|
||||
this(str, th, false);
|
||||
}
|
||||
|
||||
public ClientException(String str, Throwable th, Boolean bool) {
|
||||
super("[ErrorMessage]: " + str, th);
|
||||
this.canceled = false;
|
||||
this.canceled = bool;
|
||||
OSSLog.a(this);
|
||||
}
|
||||
}
|
11
sources/com/alibaba/sdk/android/oss/OSS.java
Normal file
11
sources/com/alibaba/sdk/android/oss/OSS.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
|
||||
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OSS {
|
||||
OSSAsyncTask<PutObjectResult> a(PutObjectRequest putObjectRequest, OSSCompletedCallback<PutObjectRequest, PutObjectResult> oSSCompletedCallback);
|
||||
}
|
22
sources/com/alibaba/sdk/android/oss/OSSClient.java
Normal file
22
sources/com/alibaba/sdk/android/oss/OSSClient.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
import android.content.Context;
|
||||
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSClient implements OSS {
|
||||
private OSS a;
|
||||
|
||||
public OSSClient(Context context, String str, OSSCredentialProvider oSSCredentialProvider, ClientConfiguration clientConfiguration) {
|
||||
this.a = new OSSImpl(context, str, oSSCredentialProvider, clientConfiguration);
|
||||
}
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.OSS
|
||||
public OSSAsyncTask<PutObjectResult> a(PutObjectRequest putObjectRequest, OSSCompletedCallback<PutObjectRequest, PutObjectResult> oSSCompletedCallback) {
|
||||
return this.a.a(putObjectRequest, oSSCompletedCallback);
|
||||
}
|
||||
}
|
54
sources/com/alibaba/sdk/android/oss/OSSImpl.java
Normal file
54
sources/com/alibaba/sdk/android/oss/OSSImpl.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
import android.content.Context;
|
||||
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLogToFileUtils;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.utils.OSSUtils;
|
||||
import com.alibaba.sdk.android.oss.internal.ExtensionRequestOperation;
|
||||
import com.alibaba.sdk.android.oss.internal.InternalRequestOperation;
|
||||
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectResult;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class OSSImpl implements OSS {
|
||||
private URI a;
|
||||
private InternalRequestOperation b;
|
||||
private ClientConfiguration c;
|
||||
|
||||
public OSSImpl(Context context, String str, OSSCredentialProvider oSSCredentialProvider, ClientConfiguration clientConfiguration) {
|
||||
OSSLogToFileUtils.a(context.getApplicationContext(), clientConfiguration);
|
||||
try {
|
||||
String trim = str.trim();
|
||||
if (!trim.startsWith("http")) {
|
||||
trim = "http://" + trim;
|
||||
}
|
||||
this.a = new URI(trim);
|
||||
if (oSSCredentialProvider == null) {
|
||||
throw new IllegalArgumentException("CredentialProvider can't be null.");
|
||||
}
|
||||
Boolean bool = false;
|
||||
try {
|
||||
bool = Boolean.valueOf(OSSUtils.e(this.a.getHost()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (this.a.getScheme().equals("https") && bool.booleanValue()) {
|
||||
throw new IllegalArgumentException("endpoint should not be format with https://ip.");
|
||||
}
|
||||
this.c = clientConfiguration == null ? ClientConfiguration.o() : clientConfiguration;
|
||||
this.b = new InternalRequestOperation(context.getApplicationContext(), this.a, oSSCredentialProvider, this.c);
|
||||
new ExtensionRequestOperation(this.b);
|
||||
} catch (URISyntaxException unused) {
|
||||
throw new IllegalArgumentException("Endpoint must be a string like 'http://oss-cn-****.aliyuncs.com',or your cname like 'http://image.cnamedomain.com'!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.OSS
|
||||
public OSSAsyncTask<PutObjectResult> a(PutObjectRequest putObjectRequest, OSSCompletedCallback<PutObjectRequest, PutObjectResult> oSSCompletedCallback) {
|
||||
return this.b.a(putObjectRequest, oSSCompletedCallback);
|
||||
}
|
||||
}
|
66
sources/com/alibaba/sdk/android/oss/ServiceException.java
Normal file
66
sources/com/alibaba/sdk/android/oss/ServiceException.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ServiceException extends Exception {
|
||||
private static final long serialVersionUID = 430933593095358673L;
|
||||
private String errorCode;
|
||||
private String hostId;
|
||||
private String partEtag;
|
||||
private String partNumber;
|
||||
private String rawMessage;
|
||||
private String requestId;
|
||||
private int statusCode;
|
||||
|
||||
public ServiceException(int i, String str, String str2, String str3, String str4, String str5) {
|
||||
super(str);
|
||||
this.statusCode = i;
|
||||
this.errorCode = str2;
|
||||
this.requestId = str3;
|
||||
this.hostId = str4;
|
||||
this.rawMessage = str5;
|
||||
OSSLog.a(this);
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
public String getHostId() {
|
||||
return this.hostId;
|
||||
}
|
||||
|
||||
public String getPartEtag() {
|
||||
return this.partEtag;
|
||||
}
|
||||
|
||||
public String getPartNumber() {
|
||||
return this.partNumber;
|
||||
}
|
||||
|
||||
public String getRawMessage() {
|
||||
return this.rawMessage;
|
||||
}
|
||||
|
||||
public String getRequestId() {
|
||||
return this.requestId;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return this.statusCode;
|
||||
}
|
||||
|
||||
public void setPartEtag(String str) {
|
||||
this.partEtag = str;
|
||||
}
|
||||
|
||||
public void setPartNumber(String str) {
|
||||
this.partNumber = str;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String toString() {
|
||||
return "[StatusCode]: " + this.statusCode + ", [Code]: " + getErrorCode() + ", [Message]: " + getMessage() + ", [Requestid]: " + getRequestId() + ", [HostId]: " + getHostId() + ", [RawMessage]: " + getRawMessage();
|
||||
}
|
||||
}
|
15
sources/com/alibaba/sdk/android/oss/TaskCancelException.java
Normal file
15
sources/com/alibaba/sdk/android/oss/TaskCancelException.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.sdk.android.oss;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TaskCancelException extends Exception {
|
||||
public TaskCancelException() {
|
||||
}
|
||||
|
||||
public TaskCancelException(String str) {
|
||||
super("[ErrorMessage]: " + str);
|
||||
}
|
||||
|
||||
public TaskCancelException(Throwable th) {
|
||||
super(th);
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.alibaba.sdk.android.oss.callback;
|
||||
|
||||
import com.alibaba.sdk.android.oss.ClientException;
|
||||
import com.alibaba.sdk.android.oss.ServiceException;
|
||||
import com.alibaba.sdk.android.oss.model.OSSRequest;
|
||||
import com.alibaba.sdk.android.oss.model.OSSResult;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OSSCompletedCallback<T1 extends OSSRequest, T2 extends OSSResult> {
|
||||
void a(T1 t1, ClientException clientException, ServiceException serviceException);
|
||||
|
||||
void a(T1 t1, T2 t2);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.alibaba.sdk.android.oss.callback;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OSSProgressCallback<T> {
|
||||
void a(T t, long j, long j2);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.alibaba.sdk.android.oss.callback;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OSSRetryCallback {
|
||||
void a();
|
||||
}
|
11
sources/com/alibaba/sdk/android/oss/common/HttpMethod.java
Normal file
11
sources/com/alibaba/sdk/android/oss/common/HttpMethod.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.alibaba.sdk.android.oss.common;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum HttpMethod {
|
||||
DELETE,
|
||||
GET,
|
||||
HEAD,
|
||||
POST,
|
||||
PUT,
|
||||
OPTIONS
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package com.alibaba.sdk.android.oss.common;
|
||||
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LogThreadPoolManager {
|
||||
private static LogThreadPoolManager f = new LogThreadPoolManager();
|
||||
private final Queue<Runnable> a = new LinkedList();
|
||||
private final RejectedExecutionHandler b = new RejectedExecutionHandler() { // from class: com.alibaba.sdk.android.oss.common.LogThreadPoolManager.1
|
||||
@Override // java.util.concurrent.RejectedExecutionHandler
|
||||
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor) {
|
||||
if (LogThreadPoolManager.this.a.size() >= 200) {
|
||||
LogThreadPoolManager.this.a.poll();
|
||||
}
|
||||
LogThreadPoolManager.this.a.offer(runnable);
|
||||
}
|
||||
};
|
||||
private final ScheduledExecutorService c = Executors.newScheduledThreadPool(1);
|
||||
private final ThreadPoolExecutor d = new ThreadPoolExecutor(1, 1, 5000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(SingleClickListener.FAST_CLICK_DELAY_TIME), new ThreadFactory(this) { // from class: com.alibaba.sdk.android.oss.common.LogThreadPoolManager.2
|
||||
@Override // java.util.concurrent.ThreadFactory
|
||||
public Thread newThread(Runnable runnable) {
|
||||
return new Thread(runnable, "oss-android-log-thread");
|
||||
}
|
||||
}, this.b);
|
||||
private final Runnable e = new Runnable() { // from class: com.alibaba.sdk.android.oss.common.LogThreadPoolManager.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (LogThreadPoolManager.this.a()) {
|
||||
LogThreadPoolManager.this.d.execute((Runnable) LogThreadPoolManager.this.a.poll());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private LogThreadPoolManager() {
|
||||
this.c.scheduleAtFixedRate(this.e, 0L, 1000L, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public boolean a() {
|
||||
return !this.a.isEmpty();
|
||||
}
|
||||
|
||||
public static LogThreadPoolManager b() {
|
||||
if (f == null) {
|
||||
f = new LogThreadPoolManager();
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public void a(Runnable runnable) {
|
||||
if (runnable != null) {
|
||||
this.d.execute(runnable);
|
||||
}
|
||||
}
|
||||
}
|
10
sources/com/alibaba/sdk/android/oss/common/OSSConstants.java
Normal file
10
sources/com/alibaba/sdk/android/oss/common/OSSConstants.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.sdk.android.oss.common;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class OSSConstants {
|
||||
public static final String[] a = {"aliyuncs.com", "aliyun-inc.com", "aliyun.com"};
|
||||
|
||||
static {
|
||||
new String[]{"aliyuncs.com", "aliyun-inc.com", "aliyun.com"};
|
||||
}
|
||||
}
|
77
sources/com/alibaba/sdk/android/oss/common/OSSLog.java
Normal file
77
sources/com/alibaba/sdk/android/oss/common/OSSLog.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.alibaba.sdk.android.oss.common;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSLog {
|
||||
private static boolean a = false;
|
||||
|
||||
public static void a() {
|
||||
a = true;
|
||||
}
|
||||
|
||||
public static boolean b() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public static void c(String str) {
|
||||
d(str, true);
|
||||
}
|
||||
|
||||
public static void d(String str, boolean z) {
|
||||
if (a) {
|
||||
Log.i("OSS-Android-SDK", "[INFO]: ".concat(str));
|
||||
a(str, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(String str) {
|
||||
a("OSS-Android-SDK", str);
|
||||
}
|
||||
|
||||
public static void b(String str, boolean z) {
|
||||
a("OSS-Android-SDK", str, z);
|
||||
}
|
||||
|
||||
public static void c(String str, boolean z) {
|
||||
b("OSS-Android-SDK", str, z);
|
||||
}
|
||||
|
||||
public static void a(String str, String str2) {
|
||||
a(str, str2, true);
|
||||
}
|
||||
|
||||
public static void b(String str) {
|
||||
b("OSS-Android-SDK", str);
|
||||
}
|
||||
|
||||
public static void a(String str, String str2, boolean z) {
|
||||
if (a) {
|
||||
Log.d(str, "[Debug]: ".concat(str2));
|
||||
a(str2, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(String str, String str2) {
|
||||
a(str, str2, true);
|
||||
}
|
||||
|
||||
public static void b(String str, String str2, boolean z) {
|
||||
if (a) {
|
||||
Log.d(str, "[Error]: ".concat(str2));
|
||||
a(str2, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Throwable th) {
|
||||
if (a) {
|
||||
OSSLogToFileUtils.f().a(th);
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(String str, boolean z) {
|
||||
if (z) {
|
||||
OSSLogToFileUtils.f().a(str);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,207 @@
|
||||
package com.alibaba.sdk.android.oss.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.StatFs;
|
||||
import com.alibaba.sdk.android.oss.ClientConfiguration;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSLogToFileUtils {
|
||||
private static Context c;
|
||||
private static OSSLogToFileUtils d;
|
||||
private static File e;
|
||||
private boolean a = true;
|
||||
private static LogThreadPoolManager b = LogThreadPoolManager.b();
|
||||
private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static long g = 5242880;
|
||||
|
||||
private static class WriteCall implements Runnable {
|
||||
private Object a;
|
||||
|
||||
public WriteCall(Object obj) {
|
||||
this.a = obj;
|
||||
}
|
||||
|
||||
private PrintWriter a(PrintWriter printWriter) {
|
||||
printWriter.println("crash_time:" + OSSLogToFileUtils.f.format(new Date()));
|
||||
((Throwable) this.a).printStackTrace(printWriter);
|
||||
return printWriter;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (OSSLogToFileUtils.e != null) {
|
||||
OSSLogToFileUtils.f();
|
||||
if (OSSLogToFileUtils.c(OSSLogToFileUtils.e) > OSSLogToFileUtils.g) {
|
||||
OSSLogToFileUtils.f().a();
|
||||
}
|
||||
try {
|
||||
PrintWriter printWriter = new PrintWriter((Writer) new FileWriter(OSSLogToFileUtils.e, true), true);
|
||||
if (this.a instanceof Throwable) {
|
||||
a(printWriter);
|
||||
} else {
|
||||
printWriter.println(OSSLogToFileUtils.f().a((StackTraceElement[]) null) + " - " + this.a.toString());
|
||||
}
|
||||
printWriter.println("------>end of log");
|
||||
printWriter.println();
|
||||
printWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OSSLogToFileUtils() {
|
||||
}
|
||||
|
||||
public static OSSLogToFileUtils f() {
|
||||
if (d == null) {
|
||||
synchronized (OSSLogToFileUtils.class) {
|
||||
if (d == null) {
|
||||
d = new OSSLogToFileUtils();
|
||||
}
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public File g() {
|
||||
File file;
|
||||
File file2 = null;
|
||||
boolean z = false;
|
||||
try {
|
||||
boolean z2 = true;
|
||||
if (this.a && Environment.getExternalStorageState().equals("mounted") && Build.VERSION.SDK_INT < 29) {
|
||||
if (h() <= g / 1024) {
|
||||
z2 = false;
|
||||
}
|
||||
file = new File(Environment.getExternalStorageDirectory().getPath() + File.separator + "OSSLog");
|
||||
} else {
|
||||
if (i() <= g / 1024) {
|
||||
z2 = false;
|
||||
}
|
||||
file = new File(c.getFilesDir().getPath() + File.separator + "OSSLog");
|
||||
}
|
||||
z = z2;
|
||||
} catch (Exception unused) {
|
||||
file = null;
|
||||
}
|
||||
if (z) {
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
file2 = new File(file.getPath() + "/logs.csv");
|
||||
if (!file2.exists()) {
|
||||
a(file2);
|
||||
}
|
||||
}
|
||||
return file2;
|
||||
}
|
||||
|
||||
private long h() {
|
||||
long j = 0;
|
||||
if ("mounted".equals(Environment.getExternalStorageState())) {
|
||||
try {
|
||||
j = (Build.VERSION.SDK_INT >= 18 ? new StatFs(Environment.getExternalStorageDirectory().getPath()).getAvailableBlocksLong() : r3.getAvailableBlocks()) * r3.getBlockSize();
|
||||
} catch (Exception unused) {
|
||||
}
|
||||
}
|
||||
OSSLog.b("sd卡存储空间:" + String.valueOf(j) + "kb", false);
|
||||
return j;
|
||||
}
|
||||
|
||||
private long i() {
|
||||
long j;
|
||||
try {
|
||||
j = ((Build.VERSION.SDK_INT >= 18 ? new StatFs(Environment.getDataDirectory().getPath()).getAvailableBlocksLong() : r1.getAvailableBlocks()) * r1.getBlockSize()) / 1024;
|
||||
} catch (Exception unused) {
|
||||
j = 0;
|
||||
}
|
||||
OSSLog.b("内部存储空间:" + String.valueOf(j) + "kb", false);
|
||||
return j;
|
||||
}
|
||||
|
||||
public static long c(File file) {
|
||||
if (file == null || !file.exists()) {
|
||||
return 0L;
|
||||
}
|
||||
return file.length();
|
||||
}
|
||||
|
||||
public static void a(Context context, ClientConfiguration clientConfiguration) {
|
||||
File file;
|
||||
OSSLog.b("init ...", false);
|
||||
if (clientConfiguration != null) {
|
||||
g = clientConfiguration.g();
|
||||
}
|
||||
if (c != null && d != null && (file = e) != null && file.exists()) {
|
||||
OSSLog.b("LogToFileUtils has been init ...", false);
|
||||
return;
|
||||
}
|
||||
c = context.getApplicationContext();
|
||||
d = f();
|
||||
b.a(new Runnable() { // from class: com.alibaba.sdk.android.oss.common.OSSLogToFileUtils.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
File unused = OSSLogToFileUtils.e = OSSLogToFileUtils.d.g();
|
||||
if (OSSLogToFileUtils.e != null) {
|
||||
OSSLog.d("LogFilePath is: " + OSSLogToFileUtils.e.getPath(), false);
|
||||
if (OSSLogToFileUtils.g < OSSLogToFileUtils.c(OSSLogToFileUtils.e)) {
|
||||
OSSLog.d("init reset log file", false);
|
||||
OSSLogToFileUtils.d.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a() {
|
||||
OSSLog.b("Reset Log File ... ", false);
|
||||
if (!e.getParentFile().exists()) {
|
||||
OSSLog.b("Reset Log make File dir ... ", false);
|
||||
e.getParentFile().mkdir();
|
||||
}
|
||||
File file = new File(e.getParent() + "/logs.csv");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
a(file);
|
||||
}
|
||||
|
||||
public void a(File file) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (Exception e2) {
|
||||
OSSLog.c("Create log file failure !!! " + e2.toString(), false);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public String a(StackTraceElement[] stackTraceElementArr) {
|
||||
if (stackTraceElementArr != null) {
|
||||
return null;
|
||||
}
|
||||
return "[" + f.format(new Date()) + "]";
|
||||
}
|
||||
|
||||
public synchronized void a(Object obj) {
|
||||
if (OSSLog.b()) {
|
||||
if (c != null && d != null && e != null) {
|
||||
if (!e.exists()) {
|
||||
a();
|
||||
}
|
||||
b.a(new WriteCall(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.common.utils.BinaryUtil;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HmacSHA1Signature {
|
||||
private static final Object a = new Object();
|
||||
private static Mac b;
|
||||
|
||||
public String a() {
|
||||
return "HmacSHA1";
|
||||
}
|
||||
|
||||
public String a(String str, String str2) {
|
||||
OSSLog.b(a(), false);
|
||||
OSSLog.b(b(), false);
|
||||
try {
|
||||
OSSLog.a("sign start");
|
||||
byte[] a2 = a(str.getBytes("UTF-8"), str2.getBytes("UTF-8"));
|
||||
OSSLog.a("base64 start");
|
||||
return BinaryUtil.a(a2);
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
throw new RuntimeException("Unsupported algorithm: UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
private byte[] a(byte[] bArr, byte[] bArr2) {
|
||||
Mac mac;
|
||||
try {
|
||||
if (b == null) {
|
||||
synchronized (a) {
|
||||
if (b == null) {
|
||||
b = Mac.getInstance(a());
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
mac = (Mac) b.clone();
|
||||
} catch (CloneNotSupportedException unused) {
|
||||
mac = Mac.getInstance(a());
|
||||
}
|
||||
mac.init(new SecretKeySpec(bArr, a()));
|
||||
return mac.doFinal(bArr2);
|
||||
} catch (InvalidKeyException unused2) {
|
||||
throw new RuntimeException("key must not be null");
|
||||
} catch (NoSuchAlgorithmException unused3) {
|
||||
throw new RuntimeException("Unsupported algorithm: HmacSHA1");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
import com.alibaba.sdk.android.oss.ClientException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface OSSCredentialProvider {
|
||||
OSSFederationToken a() throws ClientException;
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class OSSCustomSignerCredentialProvider implements OSSCredentialProvider {
|
||||
@Override // com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider
|
||||
public OSSFederationToken a() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract String a(String str);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
import com.alibaba.sdk.android.oss.ClientException;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.common.utils.DateUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class OSSFederationCredentialProvider implements OSSCredentialProvider {
|
||||
private volatile OSSFederationToken a;
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider
|
||||
public abstract OSSFederationToken a() throws ClientException;
|
||||
|
||||
public synchronized OSSFederationToken b() throws ClientException {
|
||||
if (this.a == null || DateUtil.b() / 1000 > this.a.a() - 300) {
|
||||
if (this.a != null) {
|
||||
OSSLog.a("token expired! current time: " + (DateUtil.b() / 1000) + " token expired: " + this.a.a());
|
||||
}
|
||||
this.a = a();
|
||||
}
|
||||
return this.a;
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSFederationToken {
|
||||
private String a;
|
||||
private String b;
|
||||
private String c;
|
||||
private long d;
|
||||
|
||||
public OSSFederationToken(String str, String str2, String str3, long j) {
|
||||
b(str);
|
||||
c(str2);
|
||||
a(str3);
|
||||
a(j);
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "OSSFederationToken [tempAk=" + this.a + ", tempSk=" + this.b + ", securityToken=" + this.c + ", expiration=" + this.d + "]";
|
||||
}
|
||||
|
||||
public long a() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.d = j;
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSPlainTextAKSKCredentialProvider implements OSSCredentialProvider {
|
||||
private String a;
|
||||
private String b;
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider
|
||||
public OSSFederationToken a() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package com.alibaba.sdk.android.oss.common.auth;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSStsTokenCredentialProvider implements OSSCredentialProvider {
|
||||
private String a;
|
||||
private String b;
|
||||
private String c;
|
||||
|
||||
public OSSStsTokenCredentialProvider(String str, String str2, String str3) {
|
||||
a(str.trim());
|
||||
b(str2.trim());
|
||||
c(str3.trim());
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider
|
||||
public OSSFederationToken a() {
|
||||
return new OSSFederationToken(this.a, this.b, this.c, Long.MAX_VALUE);
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BinaryUtil {
|
||||
public static String a(byte[] bArr) {
|
||||
return new String(Base64.encode(bArr, 0)).trim();
|
||||
}
|
||||
}
|
72
sources/com/alibaba/sdk/android/oss/common/utils/CRC64.java
Normal file
72
sources/com/alibaba/sdk/android/oss/common/utils/CRC64.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.zip.Checksum;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CRC64 implements Checksum {
|
||||
private static final long[][] b = (long[][]) Array.newInstance((Class<?>) long.class, 8, DataDecryptTool.DECRYPT_ALL_FILE);
|
||||
private long a = 0;
|
||||
|
||||
static {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
long j = i;
|
||||
for (int i2 = 0; i2 < 8; i2++) {
|
||||
j = (j & 1) == 1 ? (j >>> 1) ^ (-3932672073523589310L) : j >>> 1;
|
||||
}
|
||||
b[0][i] = j;
|
||||
}
|
||||
for (int i3 = 0; i3 < 256; i3++) {
|
||||
long j2 = b[0][i3];
|
||||
for (int i4 = 1; i4 < 8; i4++) {
|
||||
long[][] jArr = b;
|
||||
j2 = (j2 >>> 8) ^ jArr[0][(int) (255 & j2)];
|
||||
jArr[i4][i3] = j2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(byte[] bArr, int i) {
|
||||
update(bArr, 0, i);
|
||||
}
|
||||
|
||||
@Override // java.util.zip.Checksum
|
||||
public long getValue() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // java.util.zip.Checksum
|
||||
public void reset() {
|
||||
this.a = 0L;
|
||||
}
|
||||
|
||||
@Override // java.util.zip.Checksum
|
||||
public void update(int i) {
|
||||
byte[] bArr = {(byte) (i & 255)};
|
||||
a(bArr, bArr.length);
|
||||
}
|
||||
|
||||
@Override // java.util.zip.Checksum
|
||||
public void update(byte[] bArr, int i, int i2) {
|
||||
this.a = ~this.a;
|
||||
int i3 = i;
|
||||
int i4 = i2;
|
||||
while (i4 >= 8) {
|
||||
long[][] jArr = b;
|
||||
long[] jArr2 = jArr[7];
|
||||
long j = this.a;
|
||||
this.a = ((((((jArr[6][(int) ((bArr[i3 + 1] & 255) ^ ((j >>> 8) & 255))] ^ jArr2[(int) ((j & 255) ^ (bArr[i3] & 255))]) ^ jArr[5][(int) (((j >>> 16) & 255) ^ (bArr[i3 + 2] & 255))]) ^ jArr[4][(int) (((j >>> 24) & 255) ^ (bArr[i3 + 3] & 255))]) ^ jArr[3][(int) (((j >>> 32) & 255) ^ (bArr[i3 + 4] & 255))]) ^ jArr[2][(int) (((j >>> 40) & 255) ^ (bArr[i3 + 5] & 255))]) ^ jArr[1][(int) ((255 & (j >>> 48)) ^ (bArr[i3 + 6] & 255))]) ^ jArr[0][(int) ((j >>> 56) ^ (bArr[i3 + 7] & 255))];
|
||||
i3 += 8;
|
||||
i4 -= 8;
|
||||
}
|
||||
while (i4 > 0) {
|
||||
long[] jArr3 = b[0];
|
||||
long j2 = this.a;
|
||||
this.a = (j2 >>> 8) ^ jArr3[(int) ((bArr[i3] ^ j2) & 255)];
|
||||
i3++;
|
||||
i4--;
|
||||
}
|
||||
this.a = ~this.a;
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CaseInsensitiveHashMap<k, v> extends HashMap<k, v> {
|
||||
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
|
||||
public v get(Object obj) {
|
||||
if (obj == null || containsKey(obj) || !(obj instanceof String)) {
|
||||
return (v) super.get(obj);
|
||||
}
|
||||
String lowerCase = ((String) obj).toLowerCase();
|
||||
if (containsKey(lowerCase)) {
|
||||
return get(lowerCase);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.SimpleTimeZone;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DateUtil {
|
||||
private static volatile long a;
|
||||
|
||||
public static String a(Date date) {
|
||||
return c().format(date);
|
||||
}
|
||||
|
||||
public static long b() {
|
||||
return System.currentTimeMillis() + a;
|
||||
}
|
||||
|
||||
private static DateFormat c() {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
|
||||
simpleDateFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
|
||||
return simpleDateFormat;
|
||||
}
|
||||
|
||||
public static Date a(String str) throws ParseException {
|
||||
return c().parse(str);
|
||||
}
|
||||
|
||||
public static synchronized String a() {
|
||||
String a2;
|
||||
synchronized (DateUtil.class) {
|
||||
a2 = a(new Date(b()));
|
||||
}
|
||||
return a2;
|
||||
}
|
||||
|
||||
public static synchronized void a(long j) {
|
||||
synchronized (DateUtil.class) {
|
||||
a = j - System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HttpUtil {
|
||||
public static String a(String str, String str2) {
|
||||
if (str == null) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return URLEncoder.encode(str, str2).replace("+", "%20").replace("*", "%2A").replace("%7E", "~").replace("%2F", "/");
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("failed to encode url!", e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,120 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HttpdnsMini {
|
||||
private static HttpdnsMini c;
|
||||
private ConcurrentMap<String, HostObject> a = new ConcurrentHashMap();
|
||||
private ExecutorService b = Executors.newFixedThreadPool(5);
|
||||
|
||||
class HostObject {
|
||||
private String a;
|
||||
private String b;
|
||||
private long c;
|
||||
private long d;
|
||||
|
||||
HostObject(HttpdnsMini httpdnsMini) {
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public long c() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public long d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
return c() + this.c < System.currentTimeMillis() / 1000;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
return (c() + this.c) + 600 > System.currentTimeMillis() / 1000;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[hostName=" + a() + ", ip=" + this.b + ", ttl=" + d() + ", queryTime=" + this.d + "]";
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.d = j;
|
||||
}
|
||||
|
||||
public void b(long j) {
|
||||
this.c = j;
|
||||
}
|
||||
}
|
||||
|
||||
class QueryHostTask implements Callable<String> {
|
||||
private String a;
|
||||
private boolean b = false;
|
||||
|
||||
public QueryHostTask(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:12:0x015f */
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x0167 A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:56:0x016b A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
@Override // java.util.concurrent.Callable
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public java.lang.String call() {
|
||||
/*
|
||||
Method dump skipped, instructions count: 372
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.alibaba.sdk.android.oss.common.utils.HttpdnsMini.QueryHostTask.call():java.lang.String");
|
||||
}
|
||||
}
|
||||
|
||||
private HttpdnsMini() {
|
||||
}
|
||||
|
||||
public static HttpdnsMini a() {
|
||||
if (c == null) {
|
||||
synchronized (HttpdnsMini.class) {
|
||||
if (c == null) {
|
||||
c = new HttpdnsMini();
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public String a(String str) {
|
||||
HostObject hostObject = this.a.get(str);
|
||||
if (hostObject == null || hostObject.e()) {
|
||||
OSSLog.a("[httpdnsmini] - refresh host: " + str);
|
||||
this.b.submit(new QueryHostTask(str));
|
||||
}
|
||||
if (hostObject == null || !hostObject.f()) {
|
||||
return null;
|
||||
}
|
||||
return hostObject.b();
|
||||
}
|
||||
}
|
321
sources/com/alibaba/sdk/android/oss/common/utils/OSSUtils.java
Normal file
321
sources/com/alibaba/sdk/android/oss/common/utils/OSSUtils.java
Normal file
@@ -0,0 +1,321 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.InetAddresses;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import com.alibaba.sdk.android.oss.common.OSSConstants;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.common.auth.HmacSHA1Signature;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSCustomSignerCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSFederationCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSFederationToken;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSStsTokenCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.exception.InconsistentException;
|
||||
import com.alibaba.sdk.android.oss.internal.RequestMessage;
|
||||
import com.alibaba.sdk.android.oss.model.CopyObjectRequest;
|
||||
import com.alibaba.sdk.android.oss.model.OSSRequest;
|
||||
import com.alibaba.sdk.android.oss.model.ObjectMetadata;
|
||||
import com.ubt.jimu.course.view.fragment.JimuMissionListFragment;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSUtils {
|
||||
private static final List<String> a = Arrays.asList("bucketInfo", "acl", "uploads", "location", "cors", "logging", "website", "referer", "lifecycle", "delete", "append", "uploadId", "partNumber", "security-token", JimuMissionListFragment.POSITION, "response-cache-control", "response-content-disposition", "response-content-encoding", "response-content-language", "response-content-type", "response-expires", "x-oss-process", "sequential", "symlink", "restore");
|
||||
|
||||
public static void a(Map<String, String> map, ObjectMetadata objectMetadata) {
|
||||
if (objectMetadata == null) {
|
||||
return;
|
||||
}
|
||||
objectMetadata.a();
|
||||
throw null;
|
||||
}
|
||||
|
||||
public static boolean a(OSSRequest oSSRequest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String b(String str, String str2, String str3) {
|
||||
try {
|
||||
return "OSS " + str + ":" + new HmacSHA1Signature().a(str2, str3).trim();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Compute signature failed!", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean b(OSSRequest oSSRequest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean c(String str) {
|
||||
return TextUtils.isEmpty(str);
|
||||
}
|
||||
|
||||
public static boolean d(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
for (String str2 : OSSConstants.a) {
|
||||
if (str.toLowerCase().endsWith(str2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean e(String str) throws Exception {
|
||||
if (str == null) {
|
||||
throw new Exception("host is null");
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
return InetAddresses.isNumericAddress(str);
|
||||
}
|
||||
try {
|
||||
return ((Boolean) Class.forName("java.net.InetAddress").getMethod("isNumeric", String.class).invoke(null, str)).booleanValue();
|
||||
} catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | InvocationTargetException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean f(String str) {
|
||||
if (str == null) {
|
||||
return false;
|
||||
}
|
||||
return str.matches("^[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]$");
|
||||
}
|
||||
|
||||
public static boolean g(String str) {
|
||||
if (str != null && str.length() > 0 && str.length() <= 1023) {
|
||||
try {
|
||||
str.getBytes("utf-8");
|
||||
char[] charArray = str.toCharArray();
|
||||
char c = charArray[0];
|
||||
if (c != '/' && c != '\\') {
|
||||
for (char c2 : charArray) {
|
||||
if (c2 != '\t' && c2 < ' ') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String a(RequestMessage requestMessage) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(requestMessage.j().toString() + "\n");
|
||||
Map<String, String> d = requestMessage.d();
|
||||
TreeMap treeMap = new TreeMap();
|
||||
if (d != null) {
|
||||
for (Map.Entry<String, String> entry : d.entrySet()) {
|
||||
if (entry.getKey() != null) {
|
||||
String lowerCase = entry.getKey().toLowerCase();
|
||||
if (lowerCase.equals("Content-Type".toLowerCase()) || lowerCase.equals("Content-MD5".toLowerCase()) || lowerCase.equals("Date".toLowerCase()) || lowerCase.startsWith("x-oss-")) {
|
||||
treeMap.put(lowerCase, entry.getValue().trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!treeMap.containsKey("Content-Type".toLowerCase())) {
|
||||
treeMap.put("Content-Type".toLowerCase(), "");
|
||||
}
|
||||
if (!treeMap.containsKey("Content-MD5".toLowerCase())) {
|
||||
treeMap.put("Content-MD5".toLowerCase(), "");
|
||||
}
|
||||
for (Map.Entry entry2 : treeMap.entrySet()) {
|
||||
String str = (String) entry2.getKey();
|
||||
Object value = entry2.getValue();
|
||||
if (str.startsWith("x-oss-")) {
|
||||
sb.append(str);
|
||||
sb.append(':');
|
||||
sb.append(value);
|
||||
} else {
|
||||
sb.append(value);
|
||||
}
|
||||
sb.append("\n");
|
||||
}
|
||||
sb.append(a(requestMessage.g(), requestMessage.k(), requestMessage.l()));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void b(String str) {
|
||||
if (!g(str)) {
|
||||
throw new IllegalArgumentException("The object key is invalid. \nAn object name should be: \n1) between 1 - 1023 bytes long when encoded as UTF-8 \n2) cannot contain LF or CR or unsupported chars in XML1.0, \n3) cannot begin with \"/\" or \"\\\".");
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(RequestMessage requestMessage) throws Exception {
|
||||
String b;
|
||||
OSSLog.a("signRequest start");
|
||||
if (requestMessage.p()) {
|
||||
if (requestMessage.h() != null) {
|
||||
OSSCredentialProvider h = requestMessage.h();
|
||||
OSSFederationToken oSSFederationToken = null;
|
||||
boolean z = h instanceof OSSFederationCredentialProvider;
|
||||
if (z) {
|
||||
oSSFederationToken = ((OSSFederationCredentialProvider) h).b();
|
||||
if (oSSFederationToken != null) {
|
||||
requestMessage.d().put("x-oss-security-token", oSSFederationToken.b());
|
||||
} else {
|
||||
OSSLog.b("Can't get a federation token");
|
||||
throw new IOException("Can't get a federation token");
|
||||
}
|
||||
} else if (h instanceof OSSStsTokenCredentialProvider) {
|
||||
oSSFederationToken = h.a();
|
||||
requestMessage.d().put("x-oss-security-token", oSSFederationToken.b());
|
||||
}
|
||||
String a2 = a(requestMessage);
|
||||
OSSLog.a("get contentToSign");
|
||||
if (!z && !(h instanceof OSSStsTokenCredentialProvider)) {
|
||||
if (h instanceof OSSPlainTextAKSKCredentialProvider) {
|
||||
OSSPlainTextAKSKCredentialProvider oSSPlainTextAKSKCredentialProvider = (OSSPlainTextAKSKCredentialProvider) h;
|
||||
b = b(oSSPlainTextAKSKCredentialProvider.b(), oSSPlainTextAKSKCredentialProvider.c(), a2);
|
||||
} else {
|
||||
b = h instanceof OSSCustomSignerCredentialProvider ? ((OSSCustomSignerCredentialProvider) h).a(a2) : "---initValue---";
|
||||
}
|
||||
} else {
|
||||
b = b(oSSFederationToken.c(), oSSFederationToken.d(), a2);
|
||||
}
|
||||
OSSLog.b("signed content: " + a2 + " \n --------- signature: " + b, false);
|
||||
OSSLog.a("get signature");
|
||||
requestMessage.d().put("Authorization", b);
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("当前CredentialProvider为空!!!\n1. 请检查您是否在初始化OSSService时设置CredentialProvider;\n2. 如果您bucket为公共权限,请确认获取到Bucket后已经调用Bucket中接口声明ACL;");
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(String str, String str2, Map<String, String> map) {
|
||||
String str3 = "/";
|
||||
if (str != null || str2 != null) {
|
||||
if (str2 == null) {
|
||||
str3 = "/" + str + "/";
|
||||
} else {
|
||||
str3 = "/" + str + "/" + str2;
|
||||
}
|
||||
}
|
||||
return a(str3, map);
|
||||
}
|
||||
|
||||
public static String a(String str, Map<String, String> map) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str);
|
||||
if (map != null) {
|
||||
String[] strArr = (String[]) map.keySet().toArray(new String[map.size()]);
|
||||
Arrays.sort(strArr);
|
||||
char c = '?';
|
||||
for (String str2 : strArr) {
|
||||
if (a.contains(str2)) {
|
||||
sb.append(c);
|
||||
sb.append(str2);
|
||||
String str3 = map.get(str2);
|
||||
if (!c(str3)) {
|
||||
sb.append("=");
|
||||
sb.append(str3);
|
||||
}
|
||||
c = '&';
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String a(Map<String, String> map, String str) {
|
||||
if (map == null || map.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean z = true;
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
if (!z) {
|
||||
sb.append("&");
|
||||
}
|
||||
sb.append(HttpUtil.a(key, str));
|
||||
if (!c(value)) {
|
||||
sb.append("=");
|
||||
sb.append(HttpUtil.a(value, str));
|
||||
}
|
||||
z = false;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String a(Map<String, String> map) {
|
||||
return Base64.encodeToString(new JSONObject(map).toString().getBytes(), 2);
|
||||
}
|
||||
|
||||
public static boolean a(String str, List<String> list) {
|
||||
Iterator<String> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (str.endsWith(it.next().toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void a(boolean z, String str) {
|
||||
if (!z) {
|
||||
throw new IllegalArgumentException(str);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(String str) {
|
||||
if (!f(str)) {
|
||||
throw new IllegalArgumentException("The bucket name is invalid. \nA bucket name must: \n1) be comprised of lower-case characters, numbers or dash(-); \n2) start with lower case or numbers; \n3) be between 3-63 characters long. ");
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(OSSRequest oSSRequest, RequestMessage requestMessage) {
|
||||
if (a(oSSRequest)) {
|
||||
a(requestMessage.g());
|
||||
}
|
||||
if (b(oSSRequest)) {
|
||||
b(requestMessage.k());
|
||||
}
|
||||
if (oSSRequest instanceof CopyObjectRequest) {
|
||||
b(((CopyObjectRequest) oSSRequest).c());
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(String str, String str2, String str3) {
|
||||
String mimeTypeFromExtension;
|
||||
String mimeTypeFromExtension2;
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
MimeTypeMap singleton = MimeTypeMap.getSingleton();
|
||||
return (str2 == null || (mimeTypeFromExtension2 = singleton.getMimeTypeFromExtension(str2.substring(str2.lastIndexOf(46) + 1))) == null) ? (str3 == null || (mimeTypeFromExtension = singleton.getMimeTypeFromExtension(str3.substring(str3.lastIndexOf(46) + 1))) == null) ? "application/octet-stream" : mimeTypeFromExtension : mimeTypeFromExtension2;
|
||||
}
|
||||
|
||||
public static String a(Context context) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("=====[device info]=====\n");
|
||||
sb.append("[INFO]: android_version:" + Build.VERSION.RELEASE + "\n");
|
||||
sb.append("[INFO]: mobile_model:" + Build.MODEL + "\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void a(Long l, Long l2, String str) throws InconsistentException {
|
||||
if (l != null && l2 != null && !l.equals(l2)) {
|
||||
throw new InconsistentException(l, l2, str);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.alibaba.sdk.android.oss.common.utils;
|
||||
|
||||
import android.os.Build;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class VersionInfoUtils {
|
||||
private static String a;
|
||||
|
||||
public static String a(String str) {
|
||||
if (OSSUtils.c(a)) {
|
||||
a = "aliyun-sdk-android/" + b() + a();
|
||||
}
|
||||
if (OSSUtils.c(str)) {
|
||||
return a;
|
||||
}
|
||||
return a + "/" + str;
|
||||
}
|
||||
|
||||
public static String b() {
|
||||
return "2.9.9";
|
||||
}
|
||||
|
||||
private static String a() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("(");
|
||||
sb.append(System.getProperty("os.name"));
|
||||
sb.append("/Android " + Build.VERSION.RELEASE);
|
||||
sb.append("/");
|
||||
sb.append(HttpUtil.a(Build.MODEL, "utf-8") + ";" + HttpUtil.a(Build.ID, "utf-8"));
|
||||
sb.append(")");
|
||||
String sb2 = sb.toString();
|
||||
OSSLog.a("user agent : " + sb2);
|
||||
return OSSUtils.c(sb2) ? System.getProperty("http.agent").replaceAll("[^\\p{ASCII}]", "?") : sb2;
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.sdk.android.oss.exception;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class InconsistentException extends IOException {
|
||||
private Long clientChecksum;
|
||||
private String requestId;
|
||||
private Long serverChecksum;
|
||||
|
||||
public InconsistentException(Long l, Long l2, String str) {
|
||||
this.clientChecksum = l;
|
||||
this.serverChecksum = l2;
|
||||
this.requestId = str;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
return "InconsistentException: inconsistent object\n[RequestId]: " + this.requestId + "\n[ClientChecksum]: " + this.clientChecksum + "\n[ServerChecksum]: " + this.serverChecksum;
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.common.utils.CaseInsensitiveHashMap;
|
||||
import com.alibaba.sdk.android.oss.model.OSSResult;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.math.BigInteger;
|
||||
import java.util.zip.CheckedInputStream;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractResponseParser<T extends OSSResult> implements ResponseParser {
|
||||
public static void b(ResponseMessage responseMessage) {
|
||||
try {
|
||||
responseMessage.a();
|
||||
} catch (Exception unused) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.internal.ResponseParser
|
||||
public T a(ResponseMessage responseMessage) throws IOException {
|
||||
try {
|
||||
try {
|
||||
T t = (T) ((Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]).newInstance();
|
||||
if (t != null) {
|
||||
t.a(responseMessage.d().get("x-oss-request-id"));
|
||||
t.a(responseMessage.h());
|
||||
t.a(a(responseMessage.g()));
|
||||
a((AbstractResponseParser<T>) t, responseMessage);
|
||||
t = a(responseMessage, (ResponseMessage) t);
|
||||
}
|
||||
return t;
|
||||
} catch (Exception e) {
|
||||
IOException iOException = new IOException(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
OSSLog.a(e);
|
||||
throw iOException;
|
||||
}
|
||||
} finally {
|
||||
if (a()) {
|
||||
b(responseMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract T a(ResponseMessage responseMessage, T t) throws Exception;
|
||||
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private CaseInsensitiveHashMap<String, String> a(Response response) {
|
||||
CaseInsensitiveHashMap<String, String> caseInsensitiveHashMap = new CaseInsensitiveHashMap<>();
|
||||
Headers headers = response.headers();
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
caseInsensitiveHashMap.put(headers.name(i), headers.value(i));
|
||||
}
|
||||
return caseInsensitiveHashMap;
|
||||
}
|
||||
|
||||
public <Result extends OSSResult> void a(Result result, ResponseMessage responseMessage) {
|
||||
InputStream b = responseMessage.f().b();
|
||||
if (b != null && (b instanceof CheckedInputStream)) {
|
||||
result.a(Long.valueOf(((CheckedInputStream) b).getChecksum().getValue()));
|
||||
}
|
||||
String str = responseMessage.d().get("x-oss-hash-crc64ecma");
|
||||
if (str != null) {
|
||||
result.b(Long.valueOf(new BigInteger(str).longValue()));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ExtensionRequestOperation {
|
||||
static {
|
||||
Executors.newFixedThreadPool(5, new ThreadFactory() { // from class: com.alibaba.sdk.android.oss.internal.ExtensionRequestOperation.1
|
||||
@Override // java.util.concurrent.ThreadFactory
|
||||
public Thread newThread(Runnable runnable) {
|
||||
return new Thread(runnable, "oss-android-extensionapi-thread");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ExtensionRequestOperation(InternalRequestOperation internalRequestOperation) {
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import com.alibaba.sdk.android.oss.common.utils.CaseInsensitiveHashMap;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class HttpMessage {
|
||||
private Map<String, String> a = new CaseInsensitiveHashMap();
|
||||
private InputStream b;
|
||||
private long c;
|
||||
private String d;
|
||||
|
||||
HttpMessage() {
|
||||
}
|
||||
|
||||
public void a(Map<String, String> map) {
|
||||
if (this.a == null) {
|
||||
this.a = new CaseInsensitiveHashMap();
|
||||
}
|
||||
Map<String, String> map2 = this.a;
|
||||
if (map2 != null && map2.size() > 0) {
|
||||
this.a.clear();
|
||||
}
|
||||
this.a.putAll(map);
|
||||
}
|
||||
|
||||
public InputStream b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public long c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public Map<String, String> d() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public void a(String str, String str2) {
|
||||
this.a.put(str, str2);
|
||||
}
|
||||
|
||||
public void a(InputStream inputStream) {
|
||||
this.b = inputStream;
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.c = j;
|
||||
}
|
||||
|
||||
public void a() throws IOException {
|
||||
InputStream inputStream = this.b;
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,200 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import com.alibaba.sdk.android.oss.ClientConfiguration;
|
||||
import com.alibaba.sdk.android.oss.ClientException;
|
||||
import com.alibaba.sdk.android.oss.ServiceException;
|
||||
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
|
||||
import com.alibaba.sdk.android.oss.common.HttpMethod;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.utils.DateUtil;
|
||||
import com.alibaba.sdk.android.oss.common.utils.OSSUtils;
|
||||
import com.alibaba.sdk.android.oss.common.utils.VersionInfoUtils;
|
||||
import com.alibaba.sdk.android.oss.exception.InconsistentException;
|
||||
import com.alibaba.sdk.android.oss.internal.ResponseParsers;
|
||||
import com.alibaba.sdk.android.oss.model.OSSRequest;
|
||||
import com.alibaba.sdk.android.oss.model.OSSResult;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectResult;
|
||||
import com.alibaba.sdk.android.oss.network.ExecutionContext;
|
||||
import com.alibaba.sdk.android.oss.network.OSSRequestTask;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import okhttp3.Dispatcher;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class InternalRequestOperation {
|
||||
private static ExecutorService g = Executors.newFixedThreadPool(5, new ThreadFactory() { // from class: com.alibaba.sdk.android.oss.internal.InternalRequestOperation.1
|
||||
@Override // java.util.concurrent.ThreadFactory
|
||||
public Thread newThread(Runnable runnable) {
|
||||
return new Thread(runnable, "oss-android-api-thread");
|
||||
}
|
||||
});
|
||||
private volatile URI a;
|
||||
private OkHttpClient b;
|
||||
private Context c;
|
||||
private OSSCredentialProvider d;
|
||||
private int e;
|
||||
private ClientConfiguration f;
|
||||
|
||||
public InternalRequestOperation(Context context, final URI uri, OSSCredentialProvider oSSCredentialProvider, ClientConfiguration clientConfiguration) {
|
||||
this.e = 2;
|
||||
this.c = context;
|
||||
this.a = uri;
|
||||
this.d = oSSCredentialProvider;
|
||||
this.f = clientConfiguration;
|
||||
OkHttpClient.Builder hostnameVerifier = new OkHttpClient.Builder().followRedirects(false).followSslRedirects(false).retryOnConnectionFailure(false).cache(null).hostnameVerifier(new HostnameVerifier(this) { // from class: com.alibaba.sdk.android.oss.internal.InternalRequestOperation.2
|
||||
@Override // javax.net.ssl.HostnameVerifier
|
||||
public boolean verify(String str, SSLSession sSLSession) {
|
||||
return HttpsURLConnection.getDefaultHostnameVerifier().verify(uri.getHost(), sSLSession);
|
||||
}
|
||||
});
|
||||
if (clientConfiguration != null) {
|
||||
Dispatcher dispatcher = new Dispatcher();
|
||||
dispatcher.setMaxRequests(clientConfiguration.e());
|
||||
hostnameVerifier.connectTimeout(clientConfiguration.a(), TimeUnit.MILLISECONDS).readTimeout(clientConfiguration.j(), TimeUnit.MILLISECONDS).writeTimeout(clientConfiguration.j(), TimeUnit.MILLISECONDS).dispatcher(dispatcher);
|
||||
if (clientConfiguration.h() != null && clientConfiguration.i() != 0) {
|
||||
hostnameVerifier.proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(clientConfiguration.h(), clientConfiguration.i())));
|
||||
}
|
||||
this.e = clientConfiguration.f();
|
||||
}
|
||||
this.b = hostnameVerifier.build();
|
||||
}
|
||||
|
||||
public OSSAsyncTask<PutObjectResult> a(PutObjectRequest putObjectRequest, final OSSCompletedCallback<PutObjectRequest, PutObjectResult> oSSCompletedCallback) {
|
||||
OSSLog.a(" Internal putObject Start ");
|
||||
RequestMessage requestMessage = new RequestMessage();
|
||||
requestMessage.d(putObjectRequest.b());
|
||||
requestMessage.a(this.a);
|
||||
requestMessage.a(HttpMethod.PUT);
|
||||
requestMessage.a(putObjectRequest.c());
|
||||
requestMessage.c(putObjectRequest.g());
|
||||
if (putObjectRequest.j() != null) {
|
||||
requestMessage.a(putObjectRequest.j());
|
||||
}
|
||||
if (putObjectRequest.k() != null) {
|
||||
requestMessage.d(putObjectRequest.k());
|
||||
}
|
||||
if (putObjectRequest.l() != null) {
|
||||
requestMessage.a(putObjectRequest.l());
|
||||
}
|
||||
if (putObjectRequest.d() != null) {
|
||||
requestMessage.d().put("x-oss-callback", OSSUtils.a(putObjectRequest.d()));
|
||||
}
|
||||
if (putObjectRequest.e() != null) {
|
||||
requestMessage.d().put("x-oss-callback-var", OSSUtils.a(putObjectRequest.e()));
|
||||
}
|
||||
OSSLog.a(" populateRequestMetadata ");
|
||||
OSSUtils.a(requestMessage.d(), putObjectRequest.f());
|
||||
OSSLog.a(" canonicalizeRequestMessage ");
|
||||
a(requestMessage, putObjectRequest);
|
||||
OSSLog.a(" ExecutionContext ");
|
||||
ExecutionContext executionContext = new ExecutionContext(a(), putObjectRequest, this.c);
|
||||
if (oSSCompletedCallback != null) {
|
||||
executionContext.a(new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() { // from class: com.alibaba.sdk.android.oss.internal.InternalRequestOperation.4
|
||||
@Override // com.alibaba.sdk.android.oss.callback.OSSCompletedCallback
|
||||
public void a(PutObjectRequest putObjectRequest2, PutObjectResult putObjectResult) {
|
||||
InternalRequestOperation.this.a(putObjectRequest2, putObjectResult, oSSCompletedCallback);
|
||||
}
|
||||
|
||||
@Override // com.alibaba.sdk.android.oss.callback.OSSCompletedCallback
|
||||
public void a(PutObjectRequest putObjectRequest2, ClientException clientException, ServiceException serviceException) {
|
||||
oSSCompletedCallback.a(putObjectRequest2, clientException, serviceException);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (putObjectRequest.i() != null) {
|
||||
executionContext.a(putObjectRequest.i());
|
||||
}
|
||||
executionContext.a(putObjectRequest.h());
|
||||
OSSRequestTask oSSRequestTask = new OSSRequestTask(requestMessage, new ResponseParsers.PutObjectResponseParser(), executionContext, this.e);
|
||||
OSSLog.a(" call OSSRequestTask ");
|
||||
return OSSAsyncTask.a(g.submit(oSSRequestTask), executionContext);
|
||||
}
|
||||
|
||||
private boolean a(boolean z) {
|
||||
String host;
|
||||
if (!z || this.c == null) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
host = System.getProperty("http.proxyHost");
|
||||
} else {
|
||||
host = android.net.Proxy.getHost(this.c);
|
||||
}
|
||||
String h = this.f.h();
|
||||
if (!TextUtils.isEmpty(h)) {
|
||||
host = h;
|
||||
}
|
||||
return TextUtils.isEmpty(host);
|
||||
}
|
||||
|
||||
public OkHttpClient a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
private void a(RequestMessage requestMessage, OSSRequest oSSRequest) {
|
||||
Map<String, String> d = requestMessage.d();
|
||||
if (d.get("Date") == null) {
|
||||
d.put("Date", DateUtil.a());
|
||||
}
|
||||
if ((requestMessage.j() == HttpMethod.POST || requestMessage.j() == HttpMethod.PUT) && OSSUtils.c(d.get("Content-Type"))) {
|
||||
d.put("Content-Type", OSSUtils.a((String) null, requestMessage.n(), requestMessage.k()));
|
||||
}
|
||||
requestMessage.c(a(this.f.m()));
|
||||
requestMessage.a(this.d);
|
||||
requestMessage.f(this.f.n());
|
||||
requestMessage.b(this.f.l());
|
||||
requestMessage.b(this.f.d());
|
||||
requestMessage.d().put("User-Agent", VersionInfoUtils.a(this.f.c()));
|
||||
boolean z = false;
|
||||
if (requestMessage.d().containsKey("Range") || requestMessage.l().containsKey("x-oss-process")) {
|
||||
requestMessage.a(false);
|
||||
}
|
||||
requestMessage.e(OSSUtils.a(this.a.getHost(), this.f.b()));
|
||||
if (oSSRequest.a() == OSSRequest.CRC64Config.NULL) {
|
||||
z = this.f.k();
|
||||
} else if (oSSRequest.a() == OSSRequest.CRC64Config.YES) {
|
||||
z = true;
|
||||
}
|
||||
requestMessage.a(z);
|
||||
oSSRequest.a(z ? OSSRequest.CRC64Config.YES : OSSRequest.CRC64Config.NO);
|
||||
}
|
||||
|
||||
private <Request extends OSSRequest, Result extends OSSResult> void a(Request request, Result result) throws ClientException {
|
||||
if (request.a() == OSSRequest.CRC64Config.YES) {
|
||||
try {
|
||||
OSSUtils.a(result.a(), result.c(), result.b());
|
||||
} catch (InconsistentException e) {
|
||||
throw new ClientException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public <Request extends OSSRequest, Result extends OSSResult> void a(Request request, Result result, OSSCompletedCallback<Request, Result> oSSCompletedCallback) {
|
||||
try {
|
||||
a((InternalRequestOperation) request, (Request) result);
|
||||
if (oSSCompletedCallback != null) {
|
||||
oSSCompletedCallback.a(request, result);
|
||||
}
|
||||
} catch (ClientException e) {
|
||||
if (oSSCompletedCallback != null) {
|
||||
oSSCompletedCallback.a(request, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import com.alibaba.sdk.android.oss.model.OSSResult;
|
||||
import com.alibaba.sdk.android.oss.network.ExecutionContext;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSAsyncTask<T extends OSSResult> {
|
||||
private ExecutionContext a;
|
||||
private volatile boolean b;
|
||||
|
||||
public static OSSAsyncTask a(Future future, ExecutionContext executionContext) {
|
||||
OSSAsyncTask oSSAsyncTask = new OSSAsyncTask();
|
||||
oSSAsyncTask.a = executionContext;
|
||||
return oSSAsyncTask;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.b = true;
|
||||
ExecutionContext executionContext = this.a;
|
||||
if (executionContext != null) {
|
||||
executionContext.b().a();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import com.alibaba.sdk.android.oss.ClientException;
|
||||
import com.alibaba.sdk.android.oss.ServiceException;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSRetryHandler {
|
||||
private int a = 2;
|
||||
|
||||
/* renamed from: com.alibaba.sdk.android.oss.internal.OSSRetryHandler$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[OSSRetryType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[OSSRetryType.OSSRetryTypeShouldRetry.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OSSRetryHandler(int i) {
|
||||
a(i);
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
public OSSRetryType a(Exception exc, int i) {
|
||||
if (i >= this.a) {
|
||||
return OSSRetryType.OSSRetryTypeShouldNotRetry;
|
||||
}
|
||||
if (!(exc instanceof ClientException)) {
|
||||
if (!(exc instanceof ServiceException)) {
|
||||
return OSSRetryType.OSSRetryTypeShouldNotRetry;
|
||||
}
|
||||
ServiceException serviceException = (ServiceException) exc;
|
||||
return (serviceException.getErrorCode() == null || !serviceException.getErrorCode().equalsIgnoreCase("RequestTimeTooSkewed")) ? serviceException.getStatusCode() >= 500 ? OSSRetryType.OSSRetryTypeShouldRetry : OSSRetryType.OSSRetryTypeShouldNotRetry : OSSRetryType.OSSRetryTypeShouldFixedTimeSkewedAndRetry;
|
||||
}
|
||||
if (((ClientException) exc).isCanceledException().booleanValue()) {
|
||||
return OSSRetryType.OSSRetryTypeShouldNotRetry;
|
||||
}
|
||||
Exception exc2 = (Exception) exc.getCause();
|
||||
if ((exc2 instanceof InterruptedIOException) && !(exc2 instanceof SocketTimeoutException)) {
|
||||
OSSLog.b("[shouldRetry] - is interrupted!");
|
||||
return OSSRetryType.OSSRetryTypeShouldNotRetry;
|
||||
}
|
||||
if (exc2 instanceof IllegalArgumentException) {
|
||||
return OSSRetryType.OSSRetryTypeShouldNotRetry;
|
||||
}
|
||||
OSSLog.a("shouldRetry - " + exc.toString());
|
||||
exc.getCause().printStackTrace();
|
||||
return OSSRetryType.OSSRetryTypeShouldRetry;
|
||||
}
|
||||
|
||||
public long a(int i, OSSRetryType oSSRetryType) {
|
||||
if (AnonymousClass1.a[oSSRetryType.ordinal()] != 1) {
|
||||
return 0L;
|
||||
}
|
||||
return ((long) Math.pow(2.0d, i)) * 200;
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum OSSRetryType {
|
||||
OSSRetryTypeShouldNotRetry,
|
||||
OSSRetryTypeShouldRetry,
|
||||
OSSRetryTypeShouldFixedTimeSkewedAndRetry
|
||||
}
|
210
sources/com/alibaba/sdk/android/oss/internal/RequestMessage.java
Normal file
210
sources/com/alibaba/sdk/android/oss/internal/RequestMessage.java
Normal file
@@ -0,0 +1,210 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import com.alibaba.sdk.android.oss.common.HttpMethod;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
|
||||
import com.alibaba.sdk.android.oss.common.utils.HttpUtil;
|
||||
import com.alibaba.sdk.android.oss.common.utils.HttpdnsMini;
|
||||
import com.alibaba.sdk.android.oss.common.utils.OSSUtils;
|
||||
import java.net.URI;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RequestMessage extends HttpMessage {
|
||||
private URI e;
|
||||
private String f;
|
||||
private String g;
|
||||
private HttpMethod h;
|
||||
private boolean k;
|
||||
private OSSCredentialProvider l;
|
||||
private String p;
|
||||
private String r;
|
||||
private byte[] s;
|
||||
private Uri t;
|
||||
private boolean i = true;
|
||||
private Map<String, String> j = new LinkedHashMap();
|
||||
private boolean m = false;
|
||||
private boolean n = false;
|
||||
private boolean o = false;
|
||||
private boolean q = false;
|
||||
|
||||
public void f(boolean z) {
|
||||
this.n = z;
|
||||
}
|
||||
|
||||
public String g() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public OSSCredentialProvider h() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public String i() {
|
||||
return this.p;
|
||||
}
|
||||
|
||||
public HttpMethod j() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public String k() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public Map<String, String> l() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public byte[] m() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public String n() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public Uri o() {
|
||||
return this.t;
|
||||
}
|
||||
|
||||
public boolean p() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public boolean q() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public boolean r() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
this.p = str;
|
||||
}
|
||||
|
||||
public void c(boolean z) {
|
||||
this.m = z;
|
||||
}
|
||||
|
||||
public void d(String str) {
|
||||
this.r = str;
|
||||
}
|
||||
|
||||
public void e(boolean z) {
|
||||
this.q = z;
|
||||
}
|
||||
|
||||
public String f() throws Exception {
|
||||
boolean z = false;
|
||||
OSSUtils.a(this.e != null, "Endpoint haven't been set!");
|
||||
String scheme = this.e.getScheme();
|
||||
String host = this.e.getHost();
|
||||
String path = this.e.getPath();
|
||||
int port = this.e.getPort();
|
||||
String str = null;
|
||||
String valueOf = port != -1 ? String.valueOf(port) : null;
|
||||
if (TextUtils.isEmpty(host)) {
|
||||
OSSLog.a("endpoint url : " + this.e.toString());
|
||||
}
|
||||
OSSLog.a(" scheme : " + scheme);
|
||||
OSSLog.a(" originHost : " + host);
|
||||
OSSLog.a(" port : " + valueOf);
|
||||
String str2 = scheme + "://" + host;
|
||||
if (!TextUtils.isEmpty(valueOf)) {
|
||||
str2 = str2 + ":" + valueOf;
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.f)) {
|
||||
if (OSSUtils.d(host)) {
|
||||
String str3 = this.f + "." + host;
|
||||
if (r()) {
|
||||
str = HttpdnsMini.a().a(str3);
|
||||
} else {
|
||||
OSSLog.a("[buildCannonicalURL], disable httpdns");
|
||||
}
|
||||
a("Host", str3);
|
||||
str2 = TextUtils.isEmpty(str) ? scheme + "://" + str3 : scheme + "://" + str;
|
||||
} else if (this.q) {
|
||||
if (!this.n) {
|
||||
str2 = scheme + "://" + this.f + "." + host;
|
||||
}
|
||||
z = true;
|
||||
} else if (OSSUtils.e(host)) {
|
||||
if (!OSSUtils.c(this.p)) {
|
||||
a("Host", i());
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (this.o && path != null) {
|
||||
str2 = str2 + path;
|
||||
}
|
||||
if (z) {
|
||||
str2 = str2 + "/" + this.f;
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.g)) {
|
||||
str2 = str2 + "/" + HttpUtil.a(this.g, "utf-8");
|
||||
}
|
||||
String a = OSSUtils.a(this.j, "utf-8");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("request---------------------\n");
|
||||
sb.append("request url=" + str2 + "\n");
|
||||
sb.append("request params=" + a + "\n");
|
||||
for (String str4 : d().keySet()) {
|
||||
sb.append("requestHeader [" + str4 + "]: ");
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
sb2.append(d().get(str4));
|
||||
sb2.append("\n");
|
||||
sb.append(sb2.toString());
|
||||
}
|
||||
OSSLog.a(sb.toString());
|
||||
if (OSSUtils.c(a)) {
|
||||
return str2;
|
||||
}
|
||||
return str2 + "?" + a;
|
||||
}
|
||||
|
||||
public void b(boolean z) {
|
||||
this.o = z;
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
this.g = str;
|
||||
}
|
||||
|
||||
public void d(boolean z) {
|
||||
this.i = z;
|
||||
}
|
||||
|
||||
public void a(HttpMethod httpMethod) {
|
||||
this.h = httpMethod;
|
||||
}
|
||||
|
||||
public void a(OSSCredentialProvider oSSCredentialProvider) {
|
||||
this.l = oSSCredentialProvider;
|
||||
}
|
||||
|
||||
public void a(URI uri) {
|
||||
this.e = uri;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.f = str;
|
||||
}
|
||||
|
||||
public void a(byte[] bArr) {
|
||||
this.s = bArr;
|
||||
}
|
||||
|
||||
public void a(Uri uri) {
|
||||
this.t = uri;
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
this.k = z;
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import okhttp3.Response;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ResponseMessage extends HttpMessage {
|
||||
private Response e;
|
||||
private RequestMessage f;
|
||||
private int g;
|
||||
|
||||
public RequestMessage f() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public Response g() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public int h() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.g = i;
|
||||
}
|
||||
|
||||
public void a(Response response) {
|
||||
this.e = response;
|
||||
}
|
||||
|
||||
public void a(RequestMessage requestMessage) {
|
||||
this.f = requestMessage;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import com.alibaba.sdk.android.oss.model.OSSResult;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ResponseParser<T extends OSSResult> {
|
||||
T a(ResponseMessage responseMessage) throws IOException;
|
||||
}
|
@@ -0,0 +1,118 @@
|
||||
package com.alibaba.sdk.android.oss.internal;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Xml;
|
||||
import com.alibaba.sdk.android.oss.ClientException;
|
||||
import com.alibaba.sdk.android.oss.ServiceException;
|
||||
import com.alibaba.sdk.android.oss.common.OSSLog;
|
||||
import com.alibaba.sdk.android.oss.model.PutObjectResult;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ResponseParsers {
|
||||
|
||||
public static final class PutObjectResponseParser extends AbstractResponseParser<PutObjectResult> {
|
||||
@Override // com.alibaba.sdk.android.oss.internal.AbstractResponseParser
|
||||
public /* bridge */ /* synthetic */ PutObjectResult a(ResponseMessage responseMessage, PutObjectResult putObjectResult) throws Exception {
|
||||
PutObjectResult putObjectResult2 = putObjectResult;
|
||||
a2(responseMessage, putObjectResult2);
|
||||
return putObjectResult2;
|
||||
}
|
||||
|
||||
/* renamed from: a, reason: avoid collision after fix types in other method */
|
||||
public PutObjectResult a2(ResponseMessage responseMessage, PutObjectResult putObjectResult) throws IOException {
|
||||
putObjectResult.b(ResponseParsers.a(responseMessage.d().get("ETag")));
|
||||
String string = responseMessage.g().body().string();
|
||||
if (!TextUtils.isEmpty(string)) {
|
||||
putObjectResult.c(string);
|
||||
}
|
||||
return putObjectResult;
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
String trim = str.trim();
|
||||
if (trim.startsWith("\"")) {
|
||||
trim = trim.substring(1);
|
||||
}
|
||||
return trim.endsWith("\"") ? trim.substring(0, trim.length() - 1) : trim;
|
||||
}
|
||||
|
||||
public static ServiceException a(ResponseMessage responseMessage, boolean z) throws ClientException {
|
||||
String str;
|
||||
String str2;
|
||||
String str3;
|
||||
String str4;
|
||||
String str5;
|
||||
String str6;
|
||||
int h = responseMessage.h();
|
||||
String header = responseMessage.g().header("x-oss-request-id");
|
||||
String str7 = null;
|
||||
if (z) {
|
||||
str4 = header;
|
||||
str6 = null;
|
||||
str3 = null;
|
||||
str = null;
|
||||
str5 = null;
|
||||
str2 = null;
|
||||
} else {
|
||||
try {
|
||||
String string = responseMessage.g().body().string();
|
||||
OSSLog.a("errorMessage : \n " + string);
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(string.getBytes());
|
||||
XmlPullParser newPullParser = Xml.newPullParser();
|
||||
newPullParser.setInput(byteArrayInputStream, "utf-8");
|
||||
int eventType = newPullParser.getEventType();
|
||||
String str8 = null;
|
||||
str = null;
|
||||
String str9 = null;
|
||||
str2 = null;
|
||||
while (eventType != 1) {
|
||||
if (eventType == 2) {
|
||||
if ("Code".equals(newPullParser.getName())) {
|
||||
str7 = newPullParser.nextText();
|
||||
} else if ("Message".equals(newPullParser.getName())) {
|
||||
str8 = newPullParser.nextText();
|
||||
} else if ("RequestId".equals(newPullParser.getName())) {
|
||||
header = newPullParser.nextText();
|
||||
} else if ("HostId".equals(newPullParser.getName())) {
|
||||
str = newPullParser.nextText();
|
||||
} else if ("PartNumber".equals(newPullParser.getName())) {
|
||||
str9 = newPullParser.nextText();
|
||||
} else if ("PartEtag".equals(newPullParser.getName())) {
|
||||
str2 = newPullParser.nextText();
|
||||
}
|
||||
}
|
||||
eventType = newPullParser.next();
|
||||
if (eventType == 4) {
|
||||
eventType = newPullParser.next();
|
||||
}
|
||||
}
|
||||
str3 = str7;
|
||||
str7 = str8;
|
||||
str4 = header;
|
||||
String str10 = str9;
|
||||
str5 = string;
|
||||
str6 = str10;
|
||||
} catch (IOException e) {
|
||||
throw new ClientException(e);
|
||||
} catch (XmlPullParserException e2) {
|
||||
throw new ClientException(e2);
|
||||
}
|
||||
}
|
||||
ServiceException serviceException = new ServiceException(h, str7, str3, str4, str, str5);
|
||||
if (!TextUtils.isEmpty(str2)) {
|
||||
serviceException.setPartEtag(str2);
|
||||
}
|
||||
if (!TextUtils.isEmpty(str6)) {
|
||||
serviceException.setPartNumber(str6);
|
||||
}
|
||||
return serviceException;
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.alibaba.sdk.android.oss.model;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum CannedAccessControlList {
|
||||
Private("private"),
|
||||
PublicRead("public-read"),
|
||||
PublicReadWrite("public-read-write"),
|
||||
Default("default");
|
||||
|
||||
private String ACLString;
|
||||
|
||||
CannedAccessControlList(String str) {
|
||||
this.ACLString = str;
|
||||
}
|
||||
|
||||
public static CannedAccessControlList parseACL(String str) {
|
||||
for (CannedAccessControlList cannedAccessControlList : values()) {
|
||||
if (cannedAccessControlList.toString().equals(str)) {
|
||||
return cannedAccessControlList;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // java.lang.Enum
|
||||
public String toString() {
|
||||
return this.ACLString;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.sdk.android.oss.model;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CopyObjectRequest extends OSSRequest {
|
||||
private String c;
|
||||
|
||||
public String c() {
|
||||
return this.c;
|
||||
}
|
||||
}
|
25
sources/com/alibaba/sdk/android/oss/model/OSSRequest.java
Normal file
25
sources/com/alibaba/sdk/android/oss/model/OSSRequest.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.alibaba.sdk.android.oss.model;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSRequest {
|
||||
private boolean a = true;
|
||||
private Enum b = CRC64Config.NULL;
|
||||
|
||||
public enum CRC64Config {
|
||||
NULL,
|
||||
YES,
|
||||
NO
|
||||
}
|
||||
|
||||
public Enum a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(Enum r1) {
|
||||
this.b = r1;
|
||||
}
|
||||
}
|
54
sources/com/alibaba/sdk/android/oss/model/OSSResult.java
Normal file
54
sources/com/alibaba/sdk/android/oss/model/OSSResult.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.alibaba.sdk.android.oss.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OSSResult {
|
||||
private int a;
|
||||
private Map<String, String> b;
|
||||
private String c;
|
||||
private Long d;
|
||||
private Long e;
|
||||
|
||||
public void a(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public Long c() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("OSSResult<%s>: \nstatusCode:%d,\nresponseHeader:%s,\nrequestId:%s", super.toString(), Integer.valueOf(this.a), this.b.toString(), this.c);
|
||||
}
|
||||
|
||||
public void a(Map<String, String> map) {
|
||||
this.b = map;
|
||||
}
|
||||
|
||||
public void b(Long l) {
|
||||
if (l == null || l.longValue() == 0) {
|
||||
return;
|
||||
}
|
||||
this.e = l;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
public Long a() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public void a(Long l) {
|
||||
if (l == null || l.longValue() == 0) {
|
||||
return;
|
||||
}
|
||||
this.d = l;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.alibaba.sdk.android.oss.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ObjectMetadata {
|
||||
public Map<String, Object> a() {
|
||||
throw null;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user