Initial commit

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

View File

@@ -0,0 +1,20 @@
package com.tencent.connect;
import android.content.Context;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.common.BaseApi;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.d;
import com.tencent.tauth.IUiListener;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class UserInfo extends BaseApi {
public UserInfo(Context context, QQToken qQToken) {
super(qQToken);
}
public void a(IUiListener iUiListener) {
HttpUtils.requestAsync(this.b, d.a(), "user/get_simple_userinfo", a(), "GET", new BaseApi.TempRequestListener(this, iUiListener));
}
}

View File

@@ -0,0 +1,85 @@
package com.tencent.connect.a;
import android.content.Context;
import com.tencent.connect.auth.QQToken;
import com.tencent.open.utils.e;
import java.lang.reflect.Method;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a {
private static Class<?> a = null;
private static Class<?> b = null;
private static Method c = null;
private static Method d = null;
private static Method e = null;
private static boolean f = false;
public static boolean a(Context context, QQToken qQToken) {
return e.a(context, qQToken.b()).b("Common_ta_enable");
}
public static void b(Context context, QQToken qQToken) {
try {
if (a(context, qQToken)) {
e.invoke(a, true);
} else {
e.invoke(a, false);
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
public static void c(Context context, QQToken qQToken) {
String str = "Aqc" + qQToken.b();
try {
a = Class.forName("com.tencent.stat.StatConfig");
b = Class.forName("com.tencent.stat.StatService");
c = b.getMethod("reportQQ", Context.class, String.class);
d = b.getMethod("trackCustomEvent", Context.class, String.class, String[].class);
b.getMethod("commitEvents", Context.class, Integer.TYPE);
e = a.getMethod("setEnableStatService", Boolean.TYPE);
b(context, qQToken);
a.getMethod("setAutoExceptionCaught", Boolean.TYPE).invoke(a, false);
a.getMethod("setEnableSmartReporting", Boolean.TYPE).invoke(a, true);
a.getMethod("setSendPeriodMinutes", Integer.TYPE).invoke(a, 1440);
Class<?> cls = Class.forName("com.tencent.stat.StatReportStrategy");
a.getMethod("setStatSendStrategy", cls).invoke(a, cls.getField("PERIOD").get(null));
Method method = b.getMethod("startStatService", Context.class, String.class, String.class);
Class<?> cls2 = b;
Object[] objArr = new Object[3];
objArr[0] = context;
objArr[1] = str;
objArr[2] = Class.forName("com.tencent.stat.common.StatConstants").getField("VERSION").get(null);
method.invoke(cls2, objArr);
f = true;
} catch (Exception e2) {
e2.printStackTrace();
}
}
public static void d(Context context, QQToken qQToken) {
if (f) {
b(context, qQToken);
if (qQToken.c() != null) {
try {
c.invoke(b, context, qQToken.c());
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
public static void a(Context context, QQToken qQToken, String str, String... strArr) {
if (f) {
b(context, qQToken);
try {
d.invoke(b, context, str, strArr);
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,531 @@
package com.tencent.connect.auth;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.CookieSyncManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.tencent.connect.common.BaseApi;
import com.tencent.connect.common.UIListenerManager;
import com.tencent.open.SocialConstants;
import com.tencent.open.TDialog;
import com.tencent.open.a.f;
import com.tencent.open.b.d;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.e;
import com.tencent.open.utils.g;
import com.tencent.open.utils.h;
import com.tencent.open.utils.i;
import com.tencent.open.web.security.JniInterface;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.net.URLDecoder;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class AuthAgent extends BaseApi {
public static String f = "libwbsafeedit";
public static String g;
private IUiListener c;
private String d;
private WeakReference<Activity> e;
/* compiled from: ProGuard */
private class c implements IUiListener {
private final IUiListener a;
private final boolean b;
private final Context c;
public c(Context context, IUiListener iUiListener, boolean z, boolean z2) {
this.c = context;
this.a = iUiListener;
this.b = z;
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener()");
}
@Override // com.tencent.tauth.IUiListener
public void onCancel() {
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onCancel");
this.a.onCancel();
f.b();
}
@Override // com.tencent.tauth.IUiListener
public void onComplete(Object obj) {
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete");
JSONObject jSONObject = (JSONObject) obj;
try {
String string = jSONObject.getString(AccessToken.ACCESS_TOKEN_KEY);
String string2 = jSONObject.getString(AccessToken.EXPIRES_IN_KEY);
String string3 = jSONObject.getString(SocialConstants.PARAM_OPEN_ID);
if (string != null && ((BaseApi) AuthAgent.this).b != null && string3 != null) {
((BaseApi) AuthAgent.this).b.a(string, string2);
((BaseApi) AuthAgent.this).b.a(string3);
com.tencent.connect.a.a.d(this.c, ((BaseApi) AuthAgent.this).b);
}
String string4 = jSONObject.getString("pf");
if (string4 != null) {
try {
this.c.getSharedPreferences("pfStore", 0).edit().putString("pf", string4).commit();
} catch (Exception e) {
e.printStackTrace();
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e);
}
}
if (this.b) {
CookieSyncManager.getInstance().sync();
}
} catch (JSONException e2) {
e2.printStackTrace();
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e2);
}
this.a.onComplete(jSONObject);
AuthAgent.this.releaseResource();
f.b();
}
@Override // com.tencent.tauth.IUiListener
public void onError(UiError uiError) {
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onError");
this.a.onError(uiError);
f.b();
}
}
static {
g = f + ".so";
String str = Build.CPU_ABI;
if (str == null || str.equals("")) {
f = "libwbsafeedit";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is arm(default) architecture");
return;
}
if (str.equalsIgnoreCase("arm64-v8a")) {
f = "libwbsafeedit_64";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is arm64-v8a architecture");
return;
}
if (str.equalsIgnoreCase("x86")) {
f = "libwbsafeedit_x86";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is x86 architecture");
return;
}
if (str.equalsIgnoreCase("x86_64")) {
f = "libwbsafeedit_x86_64";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is x86_64 architecture");
return;
}
f = "libwbsafeedit";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is arm(default) architecture");
}
public AuthAgent(QQToken qQToken) {
super(qQToken);
}
@Override // com.tencent.connect.common.BaseApi
public void releaseResource() {
this.c = null;
}
public int a(Activity activity, String str, IUiListener iUiListener) {
return a(activity, str, iUiListener, false, null);
}
public int a(Activity activity, String str, IUiListener iUiListener, boolean z, Fragment fragment) {
this.d = str;
this.e = new WeakReference<>(activity);
this.c = iUiListener;
if (!e.a(activity, this.b.b()).b("C_LoginWeb") && a(activity, fragment, z)) {
f.c("openSDK_LOG.AuthAgent", "OpenUi, showUi, return Constants.UI_ACTIVITY");
d.a().a(this.b.c(), this.b.b(), "2", "1", "5", "0", "0", "0");
return 1;
}
d.a().a(this.b.c(), this.b.b(), "2", "1", "5", "1", "0", "0");
f.d("openSDK_LOG.AuthAgent", "doLogin startActivity fail show dialog.");
this.c = new b(this.c);
return a(z, this.c);
}
private int a(boolean z, IUiListener iUiListener) {
f.c("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- start");
CookieSyncManager.createInstance(com.tencent.open.utils.d.a());
Bundle a = a();
if (z) {
a.putString("isadd", "1");
}
a.putString("scope", this.d);
a.putString("client_id", this.b.b());
if (BaseApi.isOEM) {
a.putString("pf", "desktop_m_qq-" + BaseApi.installChannel + "-android-" + BaseApi.registerChannel + "-" + BaseApi.businessId);
} else {
a.putString("pf", "openmobile_android");
}
String str = (System.currentTimeMillis() / 1000) + "";
a.putString("sign", g.b(com.tencent.open.utils.d.a(), str));
a.putString("time", str);
a.putString("display", "mobile");
a.putString("response_type", "token");
a.putString("redirect_uri", "auth://tauth.qq.com/");
a.putString("cancel_display", "1");
a.putString("switch", "1");
a.putString("status_userip", i.a());
final String str2 = com.tencent.open.utils.f.a().a(com.tencent.open.utils.d.a(), "https://openmobile.qq.com/oauth2.0/m_authorize?") + HttpUtils.encodeUrl(a);
final c cVar = new c(com.tencent.open.utils.d.a(), iUiListener, true, false);
f.b("openSDK_LOG.AuthAgent", "OpenUi, showDialog TDialog");
h.a(new Runnable() { // from class: com.tencent.connect.auth.AuthAgent.1
@Override // java.lang.Runnable
public void run() {
final Activity activity;
g.a(AuthAgent.f, AuthAgent.g, 3);
JniInterface.loadSo();
if (AuthAgent.this.e == null || (activity = (Activity) AuthAgent.this.e.get()) == null) {
return;
}
activity.runOnUiThread(new Runnable() { // from class: com.tencent.connect.auth.AuthAgent.1.1
@Override // java.lang.Runnable
public void run() {
if (!JniInterface.isJniOk) {
f.d("openSDK_LOG.AuthAgent", "OpenUi, secure so load failed, goto download QQ.");
TDialog tDialog = new TDialog(activity, "", AuthAgent.this.a(""), null, ((BaseApi) AuthAgent.this).b);
if (activity.isFinishing()) {
return;
}
tDialog.show();
return;
}
Activity activity2 = activity;
AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
a aVar = new a(activity2, "action_login", str2, cVar, ((BaseApi) AuthAgent.this).b);
if (activity.isFinishing()) {
return;
}
aVar.show();
}
});
}
});
f.c("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- end");
return 2;
}
/* compiled from: ProGuard */
private class b implements IUiListener {
IUiListener a;
/* compiled from: ProGuard */
private abstract class a implements View.OnClickListener {
Dialog a;
a(b bVar, Dialog dialog) {
this.a = dialog;
}
}
public b(IUiListener iUiListener) {
this.a = iUiListener;
}
private void a(String str, final IUiListener iUiListener, final Object obj) {
Activity activity;
PackageInfo packageInfo;
if (AuthAgent.this.e == null || (activity = (Activity) AuthAgent.this.e.get()) == null) {
return;
}
Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(1);
PackageManager packageManager = activity.getPackageManager();
try {
packageInfo = packageManager.getPackageInfo(activity.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
packageInfo = null;
}
Drawable loadIcon = packageInfo != null ? packageInfo.applicationInfo.loadIcon(packageManager) : null;
View.OnClickListener onClickListener = new a(dialog) { // from class: com.tencent.connect.auth.AuthAgent.b.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
b.this.a();
Dialog dialog2 = this.a;
if (dialog2 != null && dialog2.isShowing()) {
this.a.dismiss();
}
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onComplete(obj);
}
}
};
View.OnClickListener onClickListener2 = new a(this, dialog) { // from class: com.tencent.connect.auth.AuthAgent.b.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Dialog dialog2 = this.a;
if (dialog2 != null && dialog2.isShowing()) {
this.a.dismiss();
}
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onComplete(obj);
}
}
};
ColorDrawable colorDrawable = new ColorDrawable();
colorDrawable.setAlpha(0);
dialog.getWindow().setBackgroundDrawable(colorDrawable);
dialog.setContentView(a(activity, loadIcon, str, onClickListener, onClickListener2));
dialog.setOnCancelListener(new DialogInterface.OnCancelListener(this) { // from class: com.tencent.connect.auth.AuthAgent.b.3
@Override // android.content.DialogInterface.OnCancelListener
public void onCancel(DialogInterface dialogInterface) {
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onComplete(obj);
}
}
});
if (activity == null || activity.isFinishing()) {
return;
}
dialog.show();
}
@Override // com.tencent.tauth.IUiListener
public void onCancel() {
IUiListener iUiListener = this.a;
if (iUiListener != null) {
iUiListener.onCancel();
}
}
@Override // com.tencent.tauth.IUiListener
public void onComplete(Object obj) {
JSONObject jSONObject;
String str;
if (obj == null || (jSONObject = (JSONObject) obj) == null) {
return;
}
try {
r2 = jSONObject.getInt("sendinstall") == 1;
str = jSONObject.getString("installwording");
} catch (JSONException unused) {
f.d("openSDK_LOG.AuthAgent", "FeedConfirmListener onComplete There is no value for sendinstall.");
str = "";
}
String decode = URLDecoder.decode(str);
f.a("openSDK_LOG.AuthAgent", " WORDING = " + decode + "xx");
if (r2 && !TextUtils.isEmpty(decode)) {
a(decode, this.a, obj);
return;
}
IUiListener iUiListener = this.a;
if (iUiListener != null) {
iUiListener.onComplete(obj);
}
}
@Override // com.tencent.tauth.IUiListener
public void onError(UiError uiError) {
IUiListener iUiListener = this.a;
if (iUiListener != null) {
iUiListener.onError(uiError);
}
}
private Drawable a(String str, Context context) {
Bitmap bitmap;
try {
InputStream open = context.getApplicationContext().getAssets().open(str);
if (open == null) {
return null;
}
if (str.endsWith(".9.png")) {
try {
bitmap = BitmapFactory.decodeStream(open);
} catch (OutOfMemoryError e) {
e.printStackTrace();
bitmap = null;
}
if (bitmap == null) {
return null;
}
byte[] ninePatchChunk = bitmap.getNinePatchChunk();
NinePatch.isNinePatchChunk(ninePatchChunk);
return new NinePatchDrawable(bitmap, ninePatchChunk, new Rect(), null);
}
Drawable createFromStream = Drawable.createFromStream(open, str);
open.close();
return createFromStream;
} catch (IOException e2) {
e2.printStackTrace();
return null;
}
}
private View a(Context context, Drawable drawable, String str, View.OnClickListener onClickListener, View.OnClickListener onClickListener2) {
DisplayMetrics displayMetrics = new DisplayMetrics();
((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
float f = displayMetrics.density;
RelativeLayout relativeLayout = new RelativeLayout(context);
ImageView imageView = new ImageView(context);
imageView.setImageDrawable(drawable);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setId(1);
int i = (int) (60.0f * f);
int i2 = (int) (f * 14.0f);
int i3 = (int) (18.0f * f);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i, i);
layoutParams.addRule(9);
layoutParams.setMargins(0, i3, (int) (6.0f * f), i3);
relativeLayout.addView(imageView, layoutParams);
TextView textView = new TextView(context);
textView.setText(str);
textView.setTextSize(14.0f);
textView.setGravity(3);
textView.setIncludeFontPadding(false);
textView.setPadding(0, 0, 0, 0);
textView.setLines(2);
textView.setId(5);
textView.setMinWidth((int) (185.0f * f));
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams2.addRule(1, 1);
layoutParams2.addRule(6, 1);
float f2 = 5.0f * f;
layoutParams2.setMargins(0, 0, (int) f2, 0);
relativeLayout.addView(textView, layoutParams2);
View view = new View(context);
view.setBackgroundColor(Color.rgb(214, 214, 214));
view.setId(3);
RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, 2);
layoutParams3.addRule(3, 1);
layoutParams3.addRule(5, 1);
layoutParams3.addRule(7, 5);
int i4 = (int) (12.0f * f);
layoutParams3.setMargins(0, 0, 0, i4);
relativeLayout.addView(view, layoutParams3);
LinearLayout linearLayout = new LinearLayout(context);
RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams4.addRule(5, 1);
layoutParams4.addRule(7, 5);
layoutParams4.addRule(3, 3);
Button button = new Button(context);
button.setText("跳过");
button.setBackgroundDrawable(a("buttonNegt.png", context));
button.setTextColor(Color.rgb(36, 97, 131));
button.setTextSize(20.0f);
button.setOnClickListener(onClickListener2);
button.setId(4);
int i5 = (int) (45.0f * f);
LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(0, i5);
layoutParams5.rightMargin = i2;
int i6 = (int) (4.0f * f);
layoutParams5.leftMargin = i6;
layoutParams5.weight = 1.0f;
linearLayout.addView(button, layoutParams5);
Button button2 = new Button(context);
button2.setText("确定");
button2.setTextSize(20.0f);
button2.setTextColor(Color.rgb(255, 255, 255));
button2.setBackgroundDrawable(a("buttonPost.png", context));
button2.setOnClickListener(onClickListener);
LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(0, i5);
layoutParams6.weight = 1.0f;
layoutParams6.rightMargin = i6;
linearLayout.addView(button2, layoutParams6);
relativeLayout.addView(linearLayout, layoutParams4);
ViewGroup.LayoutParams layoutParams7 = new FrameLayout.LayoutParams((int) (279.0f * f), (int) (f * 163.0f));
relativeLayout.setPadding(i2, 0, i4, i4);
relativeLayout.setLayoutParams(layoutParams7);
relativeLayout.setBackgroundColor(Color.rgb(247, 251, 247));
PaintDrawable paintDrawable = new PaintDrawable(Color.rgb(247, 251, 247));
paintDrawable.setCornerRadius(f2);
relativeLayout.setBackgroundDrawable(paintDrawable);
return relativeLayout;
}
protected void a() {
Activity activity;
Bundle b = AuthAgent.this.b();
if (AuthAgent.this.e == null || (activity = (Activity) AuthAgent.this.e.get()) == null) {
return;
}
HttpUtils.requestAsync(((BaseApi) AuthAgent.this).b, activity, "http://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi", b, "POST", null);
}
}
private boolean a(Activity activity, Fragment fragment, boolean z) {
f.c("openSDK_LOG.AuthAgent", "startActionActivity() -- start");
Intent b2 = b("com.tencent.open.agent.AgentActivity");
if (b2 != null) {
Bundle a = a();
if (z) {
a.putString("isadd", "1");
}
a.putString("scope", this.d);
a.putString("client_id", this.b.b());
if (BaseApi.isOEM) {
a.putString("pf", "desktop_m_qq-" + BaseApi.installChannel + "-android-" + BaseApi.registerChannel + "-" + BaseApi.businessId);
} else {
a.putString("pf", "openmobile_android");
}
a.putString("need_pay", "1");
a.putString("oauth_app_name", g.a(com.tencent.open.utils.d.a()));
b2.putExtra("key_action", "action_login");
b2.putExtra("key_params", a);
b2.putExtra(SocialConstants.PARAM_APP_ID, this.b.b());
if (a(b2)) {
this.c = new b(this.c);
UIListenerManager.a().a(11101, this.c);
if (fragment != null) {
f.b("openSDK_LOG.AuthAgent", "startAssitActivity fragment");
a(fragment, b2, 11101);
} else {
f.b("openSDK_LOG.AuthAgent", "startAssitActivity activity");
a(activity, b2, 11101);
}
f.c("openSDK_LOG.AuthAgent", "startActionActivity() -- end, found activity for loginIntent");
d.a().a(0, "LOGIN_CHECK_SDK", "1000", this.b.b(), "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "");
return true;
}
}
d.a().a(1, "LOGIN_CHECK_SDK", "1000", this.b.b(), "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "startActionActivity fail");
f.c("openSDK_LOG.AuthAgent", "startActionActivity() -- end, no target activity for loginIntent");
return false;
}
}

View File

@@ -0,0 +1,42 @@
package com.tencent.connect.auth;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class QQToken {
private String a;
private String b;
private String c;
private long d = -1;
public QQToken(String str) {
this.a = str;
}
public String a() {
return this.b;
}
public String b() {
return this.a;
}
public String c() {
return this.c;
}
public boolean d() {
return this.b != null && System.currentTimeMillis() < this.d;
}
public void a(String str, String str2) throws NumberFormatException {
this.b = str;
this.d = 0L;
if (str2 != null) {
this.d = System.currentTimeMillis() + (Long.parseLong(str2) * 1000);
}
}
public void a(String str) {
this.c = str;
}
}

View File

@@ -0,0 +1,557 @@
package com.tencent.connect.auth;
import android.R;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.connect.auth.b;
import com.tencent.open.SocialConstants;
import com.tencent.open.a.f;
import com.tencent.open.b.g;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.i;
import com.tencent.open.web.security.JniInterface;
import com.tencent.open.web.security.SecureJsInterface;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a extends Dialog {
private String a;
private b b;
private IUiListener c;
private Handler d;
private FrameLayout e;
private LinearLayout f;
private FrameLayout g;
private ProgressBar h;
private String i;
private com.tencent.open.c.c j;
private Context k;
private com.tencent.open.web.security.b l;
private boolean m;
private int n;
private String o;
private String p;
private long q;
private long r;
private HashMap<String, Runnable> s;
/* compiled from: ProGuard */
/* renamed from: com.tencent.connect.auth.a$a, reason: collision with other inner class name */
private class C0014a extends WebViewClient {
private C0014a() {
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
f.a("openSDK_LOG.AuthDialog", "-->onPageFinished, url: " + str);
a.this.g.setVisibility(8);
if (a.this.j != null) {
a.this.j.setVisibility(0);
}
if (TextUtils.isEmpty(str)) {
return;
}
a.this.d.removeCallbacks((Runnable) a.this.s.remove(str));
}
@Override // android.webkit.WebViewClient
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
f.a("openSDK_LOG.AuthDialog", "-->onPageStarted, url: " + str);
super.onPageStarted(webView, str, bitmap);
a.this.g.setVisibility(0);
a.this.q = SystemClock.elapsedRealtime();
if (!TextUtils.isEmpty(a.this.o)) {
a.this.d.removeCallbacks((Runnable) a.this.s.remove(a.this.o));
}
a.this.o = str;
a aVar = a.this;
d dVar = aVar.new d(aVar.o);
a.this.s.put(str, dVar);
a.this.d.postDelayed(dVar, 120000L);
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
f.c("openSDK_LOG.AuthDialog", "-->onReceivedError, errorCode: " + i + " | description: " + str);
if (!i.b(a.this.k)) {
a.this.b.onError(new UiError(9001, "当前网络不可用,请稍后重试!", str2));
a.this.dismiss();
return;
}
if (a.this.o.startsWith("http://qzs.qq.com/open/mobile/login/qzsjump.html?")) {
a.this.b.onError(new UiError(i, str, str2));
a.this.dismiss();
return;
}
long elapsedRealtime = SystemClock.elapsedRealtime() - a.this.q;
if (a.this.n >= 1 || elapsedRealtime >= a.this.r) {
a.this.j.loadUrl(a.this.a());
} else {
a.m(a.this);
a.this.d.postDelayed(new Runnable() { // from class: com.tencent.connect.auth.a.a.1
@Override // java.lang.Runnable
public void run() {
a.this.j.loadUrl(a.this.o);
}
}, 500L);
}
}
@Override // android.webkit.WebViewClient
@TargetApi(8)
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
f.e("openSDK_LOG.AuthDialog", "-->onReceivedSslError " + sslError.getPrimaryError() + "请求不合法,请检查手机安全设置,如系统时间、代理等");
sslErrorHandler.cancel();
a.this.b.onError(new UiError(sslError.getPrimaryError(), "请求不合法,请检查手机安全设置,如系统时间、代理等。", "ssl error"));
a.this.dismiss();
}
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
List<String> pathSegments;
f.a("openSDK_LOG.AuthDialog", "-->Redirect URL: " + str);
if (str.startsWith("auth://browser")) {
JSONObject c = i.c(str);
a aVar = a.this;
aVar.m = aVar.e();
if (!a.this.m) {
if (c.optString("fail_cb", null) != null) {
a.this.a(c.optString("fail_cb"), "");
} else if (c.optInt("fall_to_wv") == 1) {
a aVar2 = a.this;
a.a(aVar2, (Object) (aVar2.a.indexOf("?") > -1 ? "&" : "?"));
a.a(a.this, (Object) "browser_error=1");
a.this.j.loadUrl(a.this.a);
} else {
String optString = c.optString("redir", null);
if (optString != null) {
a.this.j.loadUrl(optString);
}
}
}
return true;
}
if (str.startsWith("auth://tauth.qq.com/")) {
a.this.b.onComplete(i.c(str));
a.this.dismiss();
return true;
}
if (str.startsWith("auth://cancel")) {
a.this.b.onCancel();
a.this.dismiss();
return true;
}
if (str.startsWith("auth://close")) {
a.this.dismiss();
return true;
}
if (str.startsWith("download://")) {
try {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(Uri.decode(str.substring(11))));
intent.addFlags(268435456);
a.this.k.startActivity(intent);
} catch (Exception e) {
f.b("openSDK_LOG.AuthDialog", "-->start download activity exception, e: ", e);
}
return true;
}
if (!str.startsWith("auth://progress")) {
if (str.startsWith("auth://onLoginSubmit")) {
try {
List<String> pathSegments2 = Uri.parse(str).getPathSegments();
if (!pathSegments2.isEmpty()) {
a.this.p = pathSegments2.get(0);
}
} catch (Exception unused) {
}
return true;
}
if (a.this.l.a(a.this.j, str)) {
return true;
}
f.c("openSDK_LOG.AuthDialog", "-->Redirect URL: return false");
return false;
}
try {
pathSegments = Uri.parse(str).getPathSegments();
} catch (Exception unused2) {
}
if (pathSegments.isEmpty()) {
return true;
}
int intValue = Integer.valueOf(pathSegments.get(0)).intValue();
if (intValue == 0) {
a.this.g.setVisibility(8);
a.this.j.setVisibility(0);
} else if (intValue == 1) {
a.this.g.setVisibility(0);
}
return true;
}
}
/* compiled from: ProGuard */
private class b implements IUiListener {
private String a;
String b;
private IUiListener c;
public b(String str, String str2, String str3, IUiListener iUiListener) {
this.a = str;
this.b = str2;
this.c = iUiListener;
}
@Override // com.tencent.tauth.IUiListener
public void onCancel() {
IUiListener iUiListener = this.c;
if (iUiListener != null) {
iUiListener.onCancel();
this.c = null;
}
}
@Override // com.tencent.tauth.IUiListener
public void onComplete(Object obj) {
JSONObject jSONObject = (JSONObject) obj;
g.a().a(this.a + "_H5", SystemClock.elapsedRealtime(), 0L, 0L, jSONObject.optInt("ret", -6), this.b, false);
IUiListener iUiListener = this.c;
if (iUiListener != null) {
iUiListener.onComplete(jSONObject);
this.c = null;
}
}
@Override // com.tencent.tauth.IUiListener
public void onError(UiError uiError) {
String str;
if (uiError.b != null) {
str = uiError.b + this.b;
} else {
str = this.b;
}
g.a().a(this.a + "_H5", SystemClock.elapsedRealtime(), 0L, 0L, uiError.a, str, false);
a.this.a(str);
IUiListener iUiListener = this.c;
if (iUiListener != null) {
iUiListener.onError(uiError);
this.c = null;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(String str) {
try {
onComplete(i.d(str));
} catch (JSONException e) {
e.printStackTrace();
onError(new UiError(-4, "服务器返回数据格式有误!", str));
}
}
}
/* compiled from: ProGuard */
private class c extends Handler {
private b a;
public c(b bVar, Looper looper) {
super(looper);
this.a = bVar;
}
@Override // android.os.Handler
public void handleMessage(Message message) {
int i = message.what;
if (i == 1) {
this.a.a((String) message.obj);
} else if (i == 2) {
this.a.onCancel();
} else {
if (i != 3) {
return;
}
a.b(a.this.k, (String) message.obj);
}
}
}
/* compiled from: ProGuard */
class d implements Runnable {
String a;
public d(String str) {
this.a = "";
this.a = str;
}
@Override // java.lang.Runnable
public void run() {
f.a("openSDK_LOG.AuthDialog", "-->timeoutUrl: " + this.a + " | mRetryUrl: " + a.this.o);
if (this.a.equals(a.this.o)) {
a.this.b.onError(new UiError(9002, "请求页面超时,请稍后重试!", a.this.o));
a.this.dismiss();
}
}
}
public a(Context context, String str, String str2, IUiListener iUiListener, QQToken qQToken) {
super(context, R.style.Theme.Translucent.NoTitleBar);
this.m = false;
this.q = 0L;
this.r = 30000L;
this.k = context;
this.a = str2;
this.b = new b(str, str2, qQToken.b(), iUiListener);
this.d = new c(this.b, context.getMainLooper());
this.c = iUiListener;
this.i = str;
this.l = new com.tencent.open.web.security.b();
getWindow().setSoftInputMode(32);
}
static /* synthetic */ int m(a aVar) {
int i = aVar.n;
aVar.n = i + 1;
return i;
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
this.s.clear();
this.d.removeCallbacksAndMessages(null);
if (isShowing()) {
super.dismiss();
}
com.tencent.open.c.c cVar = this.j;
if (cVar != null) {
cVar.destroy();
this.j = null;
}
}
@Override // android.app.Dialog
public void onBackPressed() {
if (!this.m) {
this.b.onCancel();
}
super.onBackPressed();
}
@Override // android.app.Dialog
protected void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
b();
d();
this.s = new HashMap<>();
}
@Override // android.app.Dialog
protected void onStop() {
super.onStop();
}
@SuppressLint({"SetJavaScriptEnabled"})
private void d() {
this.j.setVerticalScrollBarEnabled(false);
this.j.setHorizontalScrollBarEnabled(false);
this.j.setWebViewClient(new C0014a());
this.j.setWebChromeClient(new WebChromeClient());
this.j.clearFormData();
this.j.clearSslPreferences();
this.j.setOnLongClickListener(new View.OnLongClickListener(this) { // from class: com.tencent.connect.auth.a.1
@Override // android.view.View.OnLongClickListener
public boolean onLongClick(View view) {
return true;
}
});
this.j.setOnTouchListener(new View.OnTouchListener(this) { // from class: com.tencent.connect.auth.a.2
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
int action = motionEvent.getAction();
if ((action != 0 && action != 1) || view.hasFocus()) {
return false;
}
view.requestFocus();
return false;
}
});
WebSettings settings = this.j.getSettings();
settings.setSavePassword(false);
settings.setSaveFormData(false);
settings.setCacheMode(-1);
settings.setNeedInitialFocus(false);
settings.setBuiltInZoomControls(true);
settings.setSupportZoom(true);
settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
settings.setJavaScriptEnabled(true);
settings.setDatabaseEnabled(true);
settings.setDatabasePath(this.k.getDir("databases", 0).getPath());
settings.setDomStorageEnabled(true);
f.a("openSDK_LOG.AuthDialog", "-->mUrl : " + this.a);
String str = this.a;
this.o = str;
this.j.loadUrl(str);
this.j.setVisibility(4);
this.j.getSettings().setSavePassword(false);
this.l.a(new SecureJsInterface(), "SecureJsInterface");
SecureJsInterface.isPWDEdit = false;
super.setOnDismissListener(new DialogInterface.OnDismissListener(this) { // from class: com.tencent.connect.auth.a.3
@Override // android.content.DialogInterface.OnDismissListener
public void onDismiss(DialogInterface dialogInterface) {
try {
JniInterface.clearAllPWD();
} catch (Exception unused) {
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public boolean e() {
com.tencent.connect.auth.b b2 = com.tencent.connect.auth.b.b();
String a = b2.a();
String a2 = b2.a(new b.a());
String str = this.a;
String substring = str.substring(0, str.indexOf("?"));
Bundle b3 = i.b(this.a);
b3.putString("token_key", a);
b3.putString("serial", a2);
b3.putString("browser", "1");
this.a = substring + "?" + HttpUtils.encodeUrl(b3);
return i.a(this.k, this.a);
}
static /* synthetic */ String a(a aVar, Object obj) {
String str = aVar.a + obj;
aVar.a = str;
return str;
}
private void b() {
c();
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
this.j = new com.tencent.open.c.c(this.k);
if (Build.VERSION.SDK_INT >= 11) {
this.j.setLayerType(1, null);
}
this.j.setLayoutParams(layoutParams);
this.e = new FrameLayout(this.k);
layoutParams.gravity = 17;
this.e.setLayoutParams(layoutParams);
this.e.addView(this.j);
this.e.addView(this.g);
setContentView(this.e);
}
private void c() {
TextView textView;
this.h = new ProgressBar(this.k);
this.h.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
this.f = new LinearLayout(this.k);
if (this.i.equals("action_login")) {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.gravity = 16;
layoutParams.leftMargin = 5;
textView = new TextView(this.k);
if (Locale.getDefault().getLanguage().equals("zh")) {
textView.setText("登录中...");
} else {
textView.setText("Logging in...");
}
textView.setTextColor(Color.rgb(255, 255, 255));
textView.setTextSize(18.0f);
textView.setLayoutParams(layoutParams);
} else {
textView = null;
}
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
layoutParams2.gravity = 17;
this.f.setLayoutParams(layoutParams2);
this.f.addView(this.h);
if (textView != null) {
this.f.addView(textView);
}
this.g = new FrameLayout(this.k);
FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-1, -2);
layoutParams3.leftMargin = 80;
layoutParams3.rightMargin = 80;
layoutParams3.topMargin = 40;
layoutParams3.bottomMargin = 40;
layoutParams3.gravity = 17;
this.g.setLayoutParams(layoutParams3);
this.g.setBackgroundResource(R.drawable.alert_dark_frame);
this.g.addView(this.f);
}
/* JADX INFO: Access modifiers changed from: private */
public String a(String str) {
StringBuilder sb = new StringBuilder(str);
if (!TextUtils.isEmpty(this.p) && this.p.length() >= 4) {
String str2 = this.p;
String substring = str2.substring(str2.length() - 4);
sb.append("_u_");
sb.append(substring);
}
return sb.toString();
}
/* JADX INFO: Access modifiers changed from: private */
public String a() {
String str = this.a;
String str2 = "http://qzs.qq.com/open/mobile/login/qzsjump.html?" + str.substring(str.indexOf("?") + 1);
f.c("openSDK_LOG.AuthDialog", "-->generateDownloadUrl, url: http://qzs.qq.com/open/mobile/login/qzsjump.html?");
return str2;
}
/* JADX INFO: Access modifiers changed from: private */
public static void b(Context context, String str) {
try {
JSONObject d2 = i.d(str);
int i = d2.getInt("type");
Toast.makeText(context.getApplicationContext(), d2.getString(SocialConstants.PARAM_SEND_MSG), i).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
public void a(String str, String str2) {
this.j.loadUrl("javascript:" + str + "(" + str2 + ");void(" + System.currentTimeMillis() + ");");
}
}

View File

@@ -0,0 +1,55 @@
package com.tencent.connect.auth;
import com.ubt.jimu.base.http.interceptor.CommonParamsInterceptor;
import java.util.HashMap;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class b {
private static int b;
public static b c;
public HashMap<String, a> a = new HashMap<>();
/* compiled from: ProGuard */
public static class a {
}
static {
b.class.desiredAssertionStatus();
b = 0;
}
public static b b() {
if (c == null) {
c = new b();
}
return c;
}
public static int c() {
int i = b + 1;
b = i;
return i;
}
public String a(a aVar) {
int c2 = c();
try {
this.a.put("" + c2, aVar);
} catch (Throwable th) {
th.printStackTrace();
}
return "" + c2;
}
public String a() {
int ceil = (int) Math.ceil((Math.random() * 20.0d) + 3.0d);
char[] charArray = CommonParamsInterceptor.CHARACTER.toCharArray();
int length = charArray.length;
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < ceil; i++) {
stringBuffer.append(charArray[(int) (Math.random() * length)]);
}
return stringBuffer.toString();
}
}

View File

@@ -0,0 +1,113 @@
package com.tencent.connect.auth;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.tencent.connect.common.BaseApi;
import com.tencent.open.a.f;
import com.tencent.open.utils.d;
import com.tencent.tauth.IUiListener;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.File;
import java.util.Iterator;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class c {
private AuthAgent a;
private QQToken b;
private c(String str, Context context) {
f.c("openSDK_LOG.QQAuth", "new QQAuth() --start");
this.b = new QQToken(str);
this.a = new AuthAgent(this.b);
com.tencent.connect.a.a.c(context, this.b);
f.c("openSDK_LOG.QQAuth", "new QQAuth() --end");
}
public static c a(String str, Context context) {
d.a(context.getApplicationContext());
f.c("openSDK_LOG.QQAuth", "QQAuth -- createInstance() --start");
try {
PackageManager packageManager = context.getPackageManager();
packageManager.getActivityInfo(new ComponentName(context.getPackageName(), "com.tencent.tauth.AuthActivity"), 0);
packageManager.getActivityInfo(new ComponentName(context.getPackageName(), "com.tencent.connect.common.AssistActivity"), 0);
c cVar = new c(str, context);
f.c("openSDK_LOG.QQAuth", "QQAuth -- createInstance() --end");
return cVar;
} catch (PackageManager.NameNotFoundException e) {
f.b("openSDK_LOG.QQAuth", "createInstance() error --end", e);
Toast.makeText(context.getApplicationContext(), "请参照文档在Androidmanifest.xml加上AuthActivity和AssitActivity的定义 ", 1).show();
return null;
}
}
public int a(Activity activity, String str, IUiListener iUiListener) {
f.c("openSDK_LOG.QQAuth", "login()");
return a(activity, str, iUiListener, "");
}
public int a(Activity activity, String str, IUiListener iUiListener, String str2) {
f.c("openSDK_LOG.QQAuth", "-->login activity: " + activity);
return a(activity, null, str, iUiListener, str2);
}
private int a(Activity activity, Fragment fragment, String str, IUiListener iUiListener, String str2) {
String packageName = activity.getApplicationContext().getPackageName();
String str3 = null;
try {
Iterator<ApplicationInfo> it = activity.getPackageManager().getInstalledApplications(PeripheralType.SERVO).iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ApplicationInfo next = it.next();
if (packageName.equals(next.packageName)) {
str3 = next.sourceDir;
break;
}
}
if (str3 != null) {
String a = com.tencent.open.utils.a.a(new File(str3));
if (!TextUtils.isEmpty(a)) {
f.a("openSDK_LOG.QQAuth", "-->login channelId: " + a);
return a(activity, str, iUiListener, a, a, "");
}
}
} catch (Throwable th) {
f.b("openSDK_LOG.QQAuth", "-->login get channel id exception.", th);
th.printStackTrace();
}
f.b("openSDK_LOG.QQAuth", "-->login channelId is null ");
BaseApi.isOEM = false;
return this.a.a(activity, str, iUiListener, false, fragment);
}
@Deprecated
public int a(Activity activity, String str, IUiListener iUiListener, String str2, String str3, String str4) {
f.c("openSDK_LOG.QQAuth", "loginWithOEM");
BaseApi.isOEM = true;
if (str2.equals("")) {
str2 = "null";
}
if (str3.equals("")) {
str3 = "null";
}
if (str4.equals("")) {
str4 = "null";
}
BaseApi.installChannel = str3;
BaseApi.registerChannel = str2;
BaseApi.businessId = str4;
return this.a.a(activity, str, iUiListener);
}
public QQToken a() {
return this.b;
}
}

View File

@@ -0,0 +1,264 @@
package com.tencent.connect.common;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.facebook.AccessToken;
import com.tencent.open.SocialConstants;
import com.tencent.open.a.f;
import com.tencent.open.b.d;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class AssistActivity extends Activity {
private String c;
private boolean a = false;
protected boolean b = false;
protected Handler d = new Handler() { // from class: com.tencent.connect.common.AssistActivity.1
@Override // android.os.Handler
public void handleMessage(Message message) {
if (message.what == 0 && !AssistActivity.this.isFinishing()) {
f.d("openSDK_LOG.AssistActivity", "-->finish by timeout");
AssistActivity.this.finish();
}
}
};
public void a(int i, Intent intent) {
if (intent == null) {
f.d("openSDK_LOG.AssistActivity", "--setResultData--intent is null, setResult ACTIVITY_CANCEL");
setResult(0);
if (i == 11101) {
d.a().a("", this.c, "2", "1", "7", "2");
return;
}
return;
}
try {
String stringExtra = intent.getStringExtra("key_response");
f.b("openSDK_LOG.AssistActivity", "--setResultDataForLogin-- " + stringExtra);
if (TextUtils.isEmpty(stringExtra)) {
f.d("openSDK_LOG.AssistActivity", "--setResultData--response is empty, setResult ACTIVITY_OK");
setResult(-1, intent);
} else {
JSONObject jSONObject = new JSONObject(stringExtra);
String optString = jSONObject.optString(SocialConstants.PARAM_OPEN_ID);
String optString2 = jSONObject.optString(AccessToken.ACCESS_TOKEN_KEY);
if (TextUtils.isEmpty(optString) || TextUtils.isEmpty(optString2)) {
f.d("openSDK_LOG.AssistActivity", "--setResultData--openid or token is empty, setResult ACTIVITY_CANCEL");
setResult(0, intent);
d.a().a("", this.c, "2", "1", "7", "1");
} else {
f.c("openSDK_LOG.AssistActivity", "--setResultData--openid and token not empty, setResult ACTIVITY_OK");
setResult(-1, intent);
d.a().a(optString, this.c, "2", "1", "7", "0");
}
}
} catch (Exception e) {
f.e("openSDK_LOG.AssistActivity", "--setResultData--parse response failed");
e.printStackTrace();
}
}
@Override // android.app.Activity
protected void onActivityResult(int i, int i2, Intent intent) {
StringBuilder sb = new StringBuilder();
sb.append("--onActivityResult--requestCode: ");
sb.append(i);
sb.append(" | resultCode: ");
sb.append(i2);
sb.append("data = null ? ");
sb.append(intent == null);
f.c("openSDK_LOG.AssistActivity", sb.toString());
super.onActivityResult(i, i2, intent);
if (i == 0) {
return;
}
if (intent != null) {
intent.putExtra("key_action", "action_login");
}
a(i, intent);
finish();
}
@Override // android.app.Activity
protected void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
setRequestedOrientation(3);
f.b("openSDK_LOG.AssistActivity", "--onCreate--");
if (getIntent() == null) {
f.e("openSDK_LOG.AssistActivity", "-->onCreate--getIntent() returns null");
finish();
}
Intent intent = (Intent) getIntent().getParcelableExtra("openSDK_LOG.AssistActivity.ExtraIntent");
int intExtra = intent == null ? 0 : intent.getIntExtra("key_request_code", 0);
this.c = intent == null ? "" : intent.getStringExtra(SocialConstants.PARAM_APP_ID);
Bundle bundleExtra = getIntent().getBundleExtra("h5_share_data");
if (bundle != null) {
this.a = bundle.getBoolean("RESTART_FLAG");
this.b = bundle.getBoolean("RESUME_FLAG", false);
}
if (this.a) {
f.b("openSDK_LOG.AssistActivity", "is restart");
return;
}
if (bundleExtra != null) {
f.d("openSDK_LOG.AssistActivity", "--onCreate--h5 bundle not null, will open browser");
a(bundleExtra);
} else {
if (intent == null) {
f.e("openSDK_LOG.AssistActivity", "--onCreate--activityIntent is null");
finish();
return;
}
f.c("openSDK_LOG.AssistActivity", "--onCreate--activityIntent not null, will start activity, reqcode = " + intExtra);
startActivityForResult(intent, intExtra);
}
}
@Override // android.app.Activity
protected void onDestroy() {
f.b("openSDK_LOG.AssistActivity", "-->onDestroy");
super.onDestroy();
}
@Override // android.app.Activity
protected void onNewIntent(Intent intent) {
f.c("openSDK_LOG.AssistActivity", "--onNewIntent");
super.onNewIntent(intent);
intent.putExtra("key_action", "action_share");
setResult(-1, intent);
if (isFinishing()) {
return;
}
f.c("openSDK_LOG.AssistActivity", "--onNewIntent--activity not finished, finish now");
finish();
}
@Override // android.app.Activity
protected void onPause() {
f.b("openSDK_LOG.AssistActivity", "-->onPause");
this.d.removeMessages(0);
super.onPause();
}
@Override // android.app.Activity
protected void onResume() {
f.b("openSDK_LOG.AssistActivity", "-->onResume");
super.onResume();
Intent intent = getIntent();
if (intent.getBooleanExtra("is_login", false)) {
return;
}
if (!intent.getBooleanExtra("is_qq_mobile_share", false) && this.a && !isFinishing()) {
finish();
}
if (!this.b) {
this.b = true;
} else {
this.d.sendMessage(this.d.obtainMessage(0));
}
}
@Override // android.app.Activity
protected void onSaveInstanceState(Bundle bundle) {
f.b("openSDK_LOG.AssistActivity", "--onSaveInstanceState--");
bundle.putBoolean("RESTART_FLAG", true);
bundle.putBoolean("RESUME_FLAG", this.b);
super.onSaveInstanceState(bundle);
}
@Override // android.app.Activity
protected void onStart() {
f.b("openSDK_LOG.AssistActivity", "-->onStart");
super.onStart();
}
@Override // android.app.Activity
protected void onStop() {
f.b("openSDK_LOG.AssistActivity", "-->onStop");
super.onStop();
}
/* JADX WARN: Removed duplicated region for block: B:14:0x006e */
/* JADX WARN: Removed duplicated region for block: B:7:0x0043 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void a(android.os.Bundle r13) {
/*
r12 = this;
java.lang.String r0 = "viaShareType"
java.lang.String r8 = r13.getString(r0)
java.lang.String r0 = "callbackAction"
java.lang.String r0 = r13.getString(r0)
java.lang.String r1 = "url"
java.lang.String r1 = r13.getString(r1)
java.lang.String r2 = "openId"
java.lang.String r2 = r13.getString(r2)
java.lang.String r3 = "appId"
java.lang.String r3 = r13.getString(r3)
java.lang.String r13 = "shareToQQ"
boolean r13 = r13.equals(r0)
java.lang.String r4 = ""
if (r13 == 0) goto L2f
java.lang.String r13 = "ANDROIDQQ.SHARETOQQ.XX"
java.lang.String r4 = "10"
L2c:
r5 = r4
r4 = r13
goto L3d
L2f:
java.lang.String r13 = "shareToQzone"
boolean r13 = r13.equals(r0)
if (r13 == 0) goto L3c
java.lang.String r13 = "ANDROIDQQ.SHARETOQZ.XX"
java.lang.String r4 = "11"
goto L2c
L3c:
r5 = r4
L3d:
boolean r13 = com.tencent.open.utils.i.a(r12, r1)
if (r13 != 0) goto L6e
com.tencent.connect.common.UIListenerManager r13 = com.tencent.connect.common.UIListenerManager.a()
com.tencent.tauth.IUiListener r13 = r13.a(r0)
if (r13 == 0) goto L59
com.tencent.tauth.UiError r0 = new com.tencent.tauth.UiError
r1 = -6
r6 = 0
java.lang.String r7 = "打开浏览器失败!"
r0.<init>(r1, r7, r6)
r13.onError(r0)
L59:
com.tencent.open.b.d r1 = com.tencent.open.b.d.a()
java.lang.String r6 = "3"
java.lang.String r7 = "1"
java.lang.String r9 = "0"
java.lang.String r10 = "2"
java.lang.String r11 = "0"
r1.a(r2, r3, r4, r5, r6, r7, r8, r9, r10, r11)
r12.finish()
goto L7f
L6e:
com.tencent.open.b.d r1 = com.tencent.open.b.d.a()
java.lang.String r6 = "3"
java.lang.String r7 = "0"
java.lang.String r9 = "0"
java.lang.String r10 = "2"
java.lang.String r11 = "0"
r1.a(r2, r3, r4, r5, r6, r7, r8, r9, r10, r11)
L7f:
android.content.Intent r13 = r12.getIntent()
java.lang.String r0 = "shareH5"
r13.removeExtra(r0)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.connect.common.AssistActivity.a(android.os.Bundle):void");
}
}

View File

@@ -0,0 +1,275 @@
package com.tencent.connect.common;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.auth.c;
import com.tencent.open.SocialConstants;
import com.tencent.open.TDialog;
import com.tencent.open.a.f;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.d;
import com.tencent.open.utils.g;
import com.tencent.open.utils.i;
import com.tencent.tauth.IRequestListener;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import org.apache.http.conn.ConnectTimeoutException;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public abstract class BaseApi {
public static String businessId = null;
public static String installChannel = null;
public static boolean isOEM = false;
public static String registerChannel;
protected c a;
protected QQToken b;
/* compiled from: ProGuard */
public class TempRequestListener implements IRequestListener {
private final IUiListener a;
private final Handler b;
public TempRequestListener(BaseApi baseApi, IUiListener iUiListener) {
this.a = iUiListener;
this.b = new Handler(d.a().getMainLooper(), baseApi) { // from class: com.tencent.connect.common.BaseApi.TempRequestListener.1
@Override // android.os.Handler
public void handleMessage(Message message) {
if (message.what == 0) {
TempRequestListener.this.a.onComplete(message.obj);
} else {
TempRequestListener.this.a.onError(new UiError(message.what, (String) message.obj, null));
}
}
};
}
@Override // com.tencent.tauth.IRequestListener
public void a(JSONObject jSONObject) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = jSONObject;
obtainMessage.what = 0;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(IOException iOException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = iOException.getMessage();
obtainMessage.what = -2;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(MalformedURLException malformedURLException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = malformedURLException.getMessage();
obtainMessage.what = -3;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(JSONException jSONException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = jSONException.getMessage();
obtainMessage.what = -4;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(ConnectTimeoutException connectTimeoutException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = connectTimeoutException.getMessage();
obtainMessage.what = -7;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(SocketTimeoutException socketTimeoutException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = socketTimeoutException.getMessage();
obtainMessage.what = -8;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(HttpUtils.NetworkUnavailableException networkUnavailableException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = networkUnavailableException.getMessage();
obtainMessage.what = -10;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(HttpUtils.HttpStatusException httpStatusException) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = httpStatusException.getMessage();
obtainMessage.what = -9;
this.b.sendMessage(obtainMessage);
}
@Override // com.tencent.tauth.IRequestListener
public void a(Exception exc) {
Message obtainMessage = this.b.obtainMessage();
obtainMessage.obj = exc.getMessage();
obtainMessage.what = -6;
this.b.sendMessage(obtainMessage);
}
}
public BaseApi(c cVar, QQToken qQToken) {
this.a = cVar;
this.b = qQToken;
}
protected Bundle a() {
Bundle bundle = new Bundle();
bundle.putString("format", "json");
bundle.putString("status_os", Build.VERSION.RELEASE);
bundle.putString("status_machine", Build.MODEL);
bundle.putString("status_version", Build.VERSION.SDK);
bundle.putString("sdkv", "3.3.0.lite");
bundle.putString("sdkp", "a");
QQToken qQToken = this.b;
if (qQToken != null && qQToken.d()) {
bundle.putString(AccessToken.ACCESS_TOKEN_KEY, this.b.a());
bundle.putString(SocialConstants.PARAM_CONSUMER_KEY, this.b.b());
bundle.putString(SocialConstants.PARAM_OPEN_ID, this.b.c());
bundle.putString("appid_for_getting_config", this.b.b());
}
SharedPreferences sharedPreferences = d.a().getSharedPreferences("pfStore", 0);
if (isOEM) {
bundle.putString("pf", "desktop_m_qq-" + installChannel + "-android-" + registerChannel + "-" + businessId);
} else {
bundle.putString("pf", sharedPreferences.getString("pf", "openmobile_android"));
}
return bundle;
}
protected Bundle b() {
Bundle bundle = new Bundle();
bundle.putString(SocialConstants.PARAM_APP_ID, this.b.b());
if (this.b.d()) {
bundle.putString("keystr", this.b.a());
bundle.putString("keytype", "0x80");
}
String c = this.b.c();
if (c != null) {
bundle.putString(SocialConstants.PARAM_HOPEN_ID, c);
}
bundle.putString("platform", "androidqz");
SharedPreferences sharedPreferences = d.a().getSharedPreferences("pfStore", 0);
if (isOEM) {
bundle.putString("pf", "desktop_m_qq-" + installChannel + "-android-" + registerChannel + "-" + businessId);
} else {
bundle.putString("pf", sharedPreferences.getString("pf", "openmobile_android"));
bundle.putString("pf", "openmobile_android");
}
bundle.putString("sdkv", "3.3.0.lite");
bundle.putString("sdkp", "a");
return bundle;
}
protected Intent c(String str) {
Intent intent = new Intent();
Intent b = b(str);
if (b == null || b.getComponent() == null) {
return null;
}
intent.setClassName(b.getComponent().getPackageName(), "com.tencent.open.agent.AgentActivity");
return intent;
}
public void releaseResource() {
}
public BaseApi(QQToken qQToken) {
this(null, qQToken);
}
protected Intent b(String str) {
Intent intent = new Intent();
if (i.d(d.a())) {
intent.setClassName("com.tencent.minihd.qq", str);
if (g.a(d.a(), intent)) {
return intent;
}
}
intent.setClassName("com.tencent.mobileqq", str);
if (g.a(d.a(), intent)) {
return intent;
}
intent.setClassName("com.tencent.tim", str);
if (g.a(d.a(), intent)) {
return intent;
}
intent.setClassName("com.tencent.qim", str);
if (g.a(d.a(), intent)) {
return intent;
}
return null;
}
protected String a(String str) {
Bundle a = a();
StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(str)) {
a.putString("need_version", str);
}
sb.append("http://openmobile.qq.com/oauth2.0/m_jump_by_version?");
sb.append(HttpUtils.encodeUrl(a));
return sb.toString();
}
private Intent a(Activity activity, Intent intent) {
Intent intent2 = new Intent(activity.getApplicationContext(), (Class<?>) AssistActivity.class);
intent2.putExtra("is_login", true);
intent2.putExtra("openSDK_LOG.AssistActivity.ExtraIntent", intent);
return intent2;
}
protected void a(Activity activity, int i, Intent intent, boolean z) {
Intent intent2 = new Intent(activity.getApplicationContext(), (Class<?>) AssistActivity.class);
if (z) {
intent2.putExtra("is_qq_mobile_share", true);
}
intent2.putExtra("openSDK_LOG.AssistActivity.ExtraIntent", intent);
activity.startActivityForResult(intent2, i);
}
protected void a(Activity activity, Intent intent, int i) {
intent.putExtra("key_request_code", i);
activity.startActivityForResult(a(activity, intent), i);
}
protected void a(Fragment fragment, Intent intent, int i) {
intent.putExtra("key_request_code", i);
fragment.startActivityForResult(a(fragment.getActivity(), intent), i);
}
protected boolean a(Intent intent) {
if (intent != null) {
return g.a(d.a(), intent);
}
return false;
}
protected void a(Activity activity, Bundle bundle, IUiListener iUiListener) {
f.c("openSDK_LOG.BaseApi", "--handleDownloadLastestQQ");
new TDialog(activity, "", "http://qzs.qq.com/open/mobile/login/qzsjump.html?" + HttpUtils.encodeUrl(bundle), null, this.b).show();
}
}

View File

@@ -0,0 +1,239 @@
package com.tencent.connect.common;
import android.content.Intent;
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
import com.tencent.open.a.f;
import com.tencent.open.utils.g;
import com.tencent.open.utils.i;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import com.ubt.jimu.base.dialog.SimpleQuestionDialog;
import com.ubt.jimu.unity.bluetooth.UnityActivity;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class UIListenerManager {
private static UIListenerManager b;
private Map<String, ApiTask> a;
/* compiled from: ProGuard */
public class ApiTask {
public IUiListener a;
public ApiTask(UIListenerManager uIListenerManager, int i, IUiListener iUiListener) {
this.a = iUiListener;
}
}
private UIListenerManager() {
this.a = Collections.synchronizedMap(new HashMap());
if (this.a == null) {
this.a = Collections.synchronizedMap(new HashMap());
}
}
public static UIListenerManager a() {
if (b == null) {
b = new UIListenerManager();
}
return b;
}
private IUiListener b(int i, IUiListener iUiListener) {
if (i == 11101) {
f.e("openSDK_LOG.UIListenerManager", "登录的接口回调不能重新构建,暂时无法提供,先记录下来这种情况是否存在");
} else if (i == 11105) {
f.e("openSDK_LOG.UIListenerManager", "Social Api 的接口回调需要使用param来重新构建暂时无法提供先记录下来这种情况是否存在");
} else if (i == 11106) {
f.e("openSDK_LOG.UIListenerManager", "Social Api 的H5接口回调需要使用param来重新构建暂时无法提供先记录下来这种情况是否存在");
}
return iUiListener;
}
public Object a(int i, IUiListener iUiListener) {
ApiTask put;
String a = g.a(i);
if (a == null) {
f.e("openSDK_LOG.UIListenerManager", "setListener action is null! rquestCode=" + i);
return null;
}
synchronized (this.a) {
put = this.a.put(a, new ApiTask(this, i, iUiListener));
}
if (put == null) {
return null;
}
return put.a;
}
public Object a(String str, IUiListener iUiListener) {
ApiTask put;
int a = g.a(str);
if (a == -1) {
f.e("openSDK_LOG.UIListenerManager", "setListnerWithAction fail, action = " + str);
return null;
}
synchronized (this.a) {
put = this.a.put(str, new ApiTask(this, a, iUiListener));
}
if (put == null) {
return null;
}
return put.a;
}
public IUiListener a(int i) {
String a = g.a(i);
if (a == null) {
f.e("openSDK_LOG.UIListenerManager", "getListner action is null! rquestCode=" + i);
return null;
}
return a(a);
}
public IUiListener a(String str) {
ApiTask apiTask;
if (str == null) {
f.e("openSDK_LOG.UIListenerManager", "getListnerWithAction action is null!");
return null;
}
synchronized (this.a) {
apiTask = this.a.get(str);
this.a.remove(str);
}
if (apiTask == null) {
return null;
}
return apiTask.a;
}
public void a(Intent intent, IUiListener iUiListener) {
f.c("openSDK_LOG.UIListenerManager", "handleDataToListener");
if (intent == null) {
iUiListener.onCancel();
return;
}
String stringExtra = intent.getStringExtra("key_action");
if ("action_login".equals(stringExtra)) {
int intExtra = intent.getIntExtra("key_error_code", 0);
if (intExtra == 0) {
String stringExtra2 = intent.getStringExtra("key_response");
if (stringExtra2 != null) {
try {
iUiListener.onComplete(i.d(stringExtra2));
return;
} catch (JSONException e) {
iUiListener.onError(new UiError(-4, "服务器返回数据格式有误!", stringExtra2));
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, json error", e);
return;
}
}
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onComplete");
iUiListener.onComplete(new JSONObject());
return;
}
f.e("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onError = " + intExtra + "");
iUiListener.onError(new UiError(intExtra, intent.getStringExtra("key_error_msg"), intent.getStringExtra("key_error_detail")));
return;
}
if ("action_share".equals(stringExtra)) {
String stringExtra3 = intent.getStringExtra(UnityActivity.RESULT);
String stringExtra4 = intent.getStringExtra("response");
if (SimpleQuestionDialog.KEY_CANCELBUTTON.equals(stringExtra3)) {
iUiListener.onCancel();
return;
}
if (BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR.equals(stringExtra3)) {
iUiListener.onError(new UiError(-6, "unknown error", stringExtra4 + ""));
return;
}
if ("complete".equals(stringExtra3)) {
try {
iUiListener.onComplete(new JSONObject(stringExtra4 == null ? "{\"ret\": 0}" : stringExtra4));
} catch (JSONException e2) {
e2.printStackTrace();
iUiListener.onError(new UiError(-4, "json error", stringExtra4 + ""));
}
}
}
}
public boolean a(int i, int i2, Intent intent, IUiListener iUiListener) {
f.c("openSDK_LOG.UIListenerManager", "onActivityResult req=" + i + " res=" + i2);
IUiListener a = a(i);
if (a != null) {
iUiListener = a;
} else if (iUiListener != null) {
b(i, iUiListener);
} else {
f.e("openSDK_LOG.UIListenerManager", "onActivityResult can't find the listener");
return false;
}
if (i2 != -1) {
iUiListener.onCancel();
} else {
if (intent == null) {
iUiListener.onError(new UiError(-6, "onActivityResult intent data is null.", "onActivityResult intent data is null."));
return true;
}
String stringExtra = intent.getStringExtra("key_action");
if ("action_login".equals(stringExtra)) {
int intExtra = intent.getIntExtra("key_error_code", 0);
if (intExtra == 0) {
String stringExtra2 = intent.getStringExtra("key_response");
if (stringExtra2 != null) {
try {
iUiListener.onComplete(i.d(stringExtra2));
} catch (JSONException e) {
iUiListener.onError(new UiError(-4, "服务器返回数据格式有误!", stringExtra2));
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, json error", e);
}
} else {
f.b("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onComplete");
iUiListener.onComplete(new JSONObject());
}
} else {
f.e("openSDK_LOG.UIListenerManager", "OpenUi, onActivityResult, onError = " + intExtra + "");
iUiListener.onError(new UiError(intExtra, intent.getStringExtra("key_error_msg"), intent.getStringExtra("key_error_detail")));
}
} else if ("action_share".equals(stringExtra)) {
String stringExtra3 = intent.getStringExtra(UnityActivity.RESULT);
String stringExtra4 = intent.getStringExtra("response");
if (SimpleQuestionDialog.KEY_CANCELBUTTON.equals(stringExtra3)) {
iUiListener.onCancel();
} else if (BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR.equals(stringExtra3)) {
iUiListener.onError(new UiError(-6, "unknown error", stringExtra4 + ""));
} else if ("complete".equals(stringExtra3)) {
try {
iUiListener.onComplete(new JSONObject(stringExtra4 == null ? "{\"ret\": 0}" : stringExtra4));
} catch (JSONException e2) {
e2.printStackTrace();
iUiListener.onError(new UiError(-4, "json error", stringExtra4 + ""));
}
}
} else {
int intExtra2 = intent.getIntExtra("key_error_code", 0);
if (intExtra2 == 0) {
String stringExtra5 = intent.getStringExtra("key_response");
if (stringExtra5 != null) {
try {
iUiListener.onComplete(i.d(stringExtra5));
} catch (JSONException unused) {
iUiListener.onError(new UiError(-4, "服务器返回数据格式有误!", stringExtra5));
}
} else {
iUiListener.onComplete(new JSONObject());
}
} else {
iUiListener.onError(new UiError(intExtra2, intent.getStringExtra("key_error_msg"), intent.getStringExtra("key_error_detail")));
}
}
}
return true;
}
}

View File

@@ -0,0 +1,307 @@
package com.tencent.connect.share;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.common.BaseApi;
import com.tencent.connect.common.UIListenerManager;
import com.tencent.open.SocialConstants;
import com.tencent.open.TDialog;
import com.tencent.open.a.f;
import com.tencent.open.b.d;
import com.tencent.open.utils.b;
import com.tencent.open.utils.c;
import com.tencent.open.utils.i;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.File;
import java.util.ArrayList;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class QQShare extends BaseApi {
public String c;
public QQShare(Context context, QQToken qQToken) {
super(qQToken);
this.c = "";
}
private void c(final Activity activity, final Bundle bundle, final IUiListener iUiListener) {
f.c("openSDK_LOG.QQShare", "shareToMobileQQ() -- start.");
String string = bundle.getString(SocialConstants.PARAM_IMAGE_URL);
final String string2 = bundle.getString("title");
final String string3 = bundle.getString(SocialConstants.PARAM_SUMMARY);
f.a("openSDK_LOG.QQShare", "shareToMobileQQ -- imageUrl: " + string);
if (TextUtils.isEmpty(string)) {
d(activity, bundle, iUiListener);
} else if (!i.g(string)) {
bundle.putString(SocialConstants.PARAM_IMAGE_URL, null);
if (i.f(activity, "4.3.0")) {
f.b("openSDK_LOG.QQShare", "shareToMobileQQ -- QQ Version is < 4.3.0 ");
d(activity, bundle, iUiListener);
} else {
f.b("openSDK_LOG.QQShare", "shareToMobileQQ -- QQ Version is > 4.3.0 ");
a.a(activity, string, new c() { // from class: com.tencent.connect.share.QQShare.2
@Override // com.tencent.open.utils.c
public void a(int i, String str) {
if (i == 0) {
bundle.putString("imageLocalUrl", str);
} else if (TextUtils.isEmpty(string2) && TextUtils.isEmpty(string3)) {
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onError(new UiError(-6, "获取分享图片失败!", null));
f.e("openSDK_LOG.QQShare", "shareToMobileQQ -- error: 获取分享图片失败!");
}
d.a().a(1, "SHARE_CHECK_SDK", "1000", ((BaseApi) QQShare.this).b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "获取分享图片失败!");
return;
}
QQShare.this.d(activity, bundle, iUiListener);
}
@Override // com.tencent.open.utils.c
public void a(int i, ArrayList<String> arrayList) {
}
});
}
} else {
if (TextUtils.isEmpty(string2) && TextUtils.isEmpty(string3)) {
if (iUiListener != null) {
iUiListener.onError(new UiError(-6, "分享图片失败检测不到SD卡!", null));
f.e("openSDK_LOG.QQShare", "分享图片失败检测不到SD卡!");
}
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "分享图片失败检测不到SD卡!");
return;
}
if (i.f(activity, "4.3.0")) {
new b(activity).a(string, new c() { // from class: com.tencent.connect.share.QQShare.1
@Override // com.tencent.open.utils.c
public void a(int i, String str) {
if (i == 0) {
bundle.putString("imageLocalUrl", str);
} else if (TextUtils.isEmpty(string2) && TextUtils.isEmpty(string3)) {
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onError(new UiError(-6, "获取分享图片失败!", null));
f.e("openSDK_LOG.QQShare", "shareToMobileQQ -- error: 获取分享图片失败!");
}
d.a().a(1, "SHARE_CHECK_SDK", "1000", ((BaseApi) QQShare.this).b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "获取分享图片失败!");
return;
}
QQShare.this.d(activity, bundle, iUiListener);
}
@Override // com.tencent.open.utils.c
public void a(int i, ArrayList<String> arrayList) {
}
});
} else {
d(activity, bundle, iUiListener);
}
}
f.c("openSDK_LOG.QQShare", "shareToMobileQQ() -- end");
}
/* JADX INFO: Access modifiers changed from: private */
public void d(Activity activity, Bundle bundle, IUiListener iUiListener) {
int i;
int i2;
f.c("openSDK_LOG.QQShare", "doShareToQQ() -- start");
StringBuffer stringBuffer = new StringBuffer("mqqapi://share/to_fri?src_type=app&version=1&file_type=news");
String string = bundle.getString(SocialConstants.PARAM_IMAGE_URL);
String string2 = bundle.getString("title");
String string3 = bundle.getString(SocialConstants.PARAM_SUMMARY);
String string4 = bundle.getString(SocialConstants.PARAM_TARGET_URL);
String string5 = bundle.getString("audio_url");
int i3 = bundle.getInt("req_type", 1);
String string6 = bundle.getString("share_to_qq_ark_info");
int i4 = bundle.getInt("cflag", 0);
String string7 = bundle.getString("share_qq_ext_str");
String a = i.a(activity);
if (a == null) {
a = bundle.getString(SocialConstants.PARAM_APPNAME);
}
String str = a;
String string8 = bundle.getString("imageLocalUrl");
String b = this.b.b();
String c = this.b.c();
f.a("openSDK_LOG.QQShare", "doShareToQQ -- openid: " + c);
if (!TextUtils.isEmpty(string)) {
stringBuffer.append("&image_url=" + Base64.encodeToString(i.i(string), 2));
}
if (!TextUtils.isEmpty(string8)) {
stringBuffer.append("&file_data=" + Base64.encodeToString(i.i(string8), 2));
}
if (!TextUtils.isEmpty(string2)) {
stringBuffer.append("&title=" + Base64.encodeToString(i.i(string2), 2));
}
if (!TextUtils.isEmpty(string3)) {
stringBuffer.append("&description=" + Base64.encodeToString(i.i(string3), 2));
}
if (!TextUtils.isEmpty(b)) {
stringBuffer.append("&share_id=" + b);
}
if (!TextUtils.isEmpty(string4)) {
stringBuffer.append("&url=" + Base64.encodeToString(i.i(string4), 2));
}
if (!TextUtils.isEmpty(str)) {
if (str.length() > 20) {
str = str.substring(0, 20) + "...";
}
stringBuffer.append("&app_name=" + Base64.encodeToString(i.i(str), 2));
}
if (!TextUtils.isEmpty(c)) {
stringBuffer.append("&open_id=" + Base64.encodeToString(i.i(c), 2));
}
if (!TextUtils.isEmpty(string5)) {
stringBuffer.append("&audioUrl=" + Base64.encodeToString(i.i(string5), 2));
}
stringBuffer.append("&req_type=" + Base64.encodeToString(i.i(String.valueOf(i3)), 2));
if (!TextUtils.isEmpty(string6)) {
stringBuffer.append("&share_to_qq_ark_info=" + Base64.encodeToString(i.i(string6), 2));
}
if (!TextUtils.isEmpty(string7)) {
stringBuffer.append("&share_qq_ext_str=" + Base64.encodeToString(i.i(string7), 2));
}
stringBuffer.append("&cflag=" + Base64.encodeToString(i.i(String.valueOf(i4)), 2));
f.a("openSDK_LOG.QQShare", "doShareToQQ -- url: " + stringBuffer.toString());
com.tencent.connect.a.a.a(com.tencent.open.utils.d.a(), this.b, "requireApi", "shareToNativeQQ");
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(stringBuffer.toString()));
intent.putExtra("pkg_name", activity.getPackageName());
if (i.f(activity, "4.6.0")) {
f.c("openSDK_LOG.QQShare", "doShareToQQ, qqver below 4.6.");
if (a(intent)) {
UIListenerManager.a().a(11103, iUiListener);
a(activity, intent, 11103);
}
i2 = i4;
i = 1;
} else {
f.c("openSDK_LOG.QQShare", "doShareToQQ, qqver greater than 4.6.");
if (UIListenerManager.a().a("shareToQQ", iUiListener) != null) {
f.c("openSDK_LOG.QQShare", "doShareToQQ, last listener is not null, cancel it.");
}
if (a(intent)) {
i = 1;
a(activity, 10103, intent, true);
} else {
i = 1;
}
i2 = i4;
}
String str2 = i2 == i ? "11" : "10";
if (a(intent)) {
d.a().a(this.b.c(), this.b.b(), "ANDROIDQQ.SHARETOQQ.XX", str2, "3", "0", this.c, "0", "1", "0");
d.a().a(0, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "");
} else {
d.a().a(this.b.c(), this.b.b(), "ANDROIDQQ.SHARETOQQ.XX", str2, "3", "1", this.c, "0", "1", "0");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "hasActivityForIntent fail");
}
f.c("openSDK_LOG.QQShare", "doShareToQQ() --end");
}
@Override // com.tencent.connect.common.BaseApi
public void releaseResource() {
}
public void b(Activity activity, Bundle bundle, IUiListener iUiListener) {
String str;
f.c("openSDK_LOG.QQShare", "shareToQQ() -- start.");
String string = bundle.getString(SocialConstants.PARAM_IMAGE_URL);
String string2 = bundle.getString("title");
String string3 = bundle.getString(SocialConstants.PARAM_SUMMARY);
String string4 = bundle.getString(SocialConstants.PARAM_TARGET_URL);
String string5 = bundle.getString("imageLocalUrl");
int i = bundle.getInt("req_type", 1);
f.c("openSDK_LOG.QQShare", "shareToQQ -- type: " + i);
if (i == 1) {
this.c = "1";
} else if (i == 2) {
this.c = "3";
} else if (i == 5) {
this.c = "2";
} else if (i == 6) {
this.c = "4";
}
if (i == 6) {
if (i.f(activity, "5.0.0")) {
iUiListener.onError(new UiError(-15, "手Q版本过低应用分享只支持手Q5.0及其以上版本", null));
f.e("openSDK_LOG.QQShare", "shareToQQ, app share is not support below qq5.0.");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, app share is not support below qq5.0.");
return;
}
string4 = String.format("http://fusion.qq.com/cgi-bin/qzapps/unified_jump?appid=%1$s&from=%2$s&isOpenAppID=1", this.b.b(), "mqq");
bundle.putString(SocialConstants.PARAM_TARGET_URL, string4);
}
if (!i.b() && i.f(activity, "4.5.0")) {
iUiListener.onError(new UiError(-6, "分享图片失败检测不到SD卡!", null));
f.e("openSDK_LOG.QQShare", "shareToQQ sdcard is null--end");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ sdcard is null");
return;
}
if (i == 5) {
if (i.f(activity, "4.3.0")) {
iUiListener.onError(new UiError(-6, "低版本手Q不支持该项功能!", null));
f.e("openSDK_LOG.QQShare", "shareToQQ, version below 4.3 is not support.");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, version below 4.3 is not support.");
return;
} else if (!i.h(string5)) {
iUiListener.onError(new UiError(-6, "非法的图片地址!", null));
f.e("openSDK_LOG.QQShare", "shareToQQ -- error: 非法的图片地址!");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "非法的图片地址!");
return;
}
}
if (i != 5) {
if (TextUtils.isEmpty(string4) || !(string4.startsWith("http://") || string4.startsWith("https://"))) {
iUiListener.onError(new UiError(-6, "传入参数有误!", null));
f.e("openSDK_LOG.QQShare", "shareToQQ, targetUrl is empty or illegal..");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, targetUrl is empty or illegal..");
return;
} else if (TextUtils.isEmpty(string2)) {
iUiListener.onError(new UiError(-6, "title不能为空!", null));
f.e("openSDK_LOG.QQShare", "shareToQQ, title is empty.");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, title is empty.");
return;
}
}
if (!TextUtils.isEmpty(string) && !string.startsWith("http://") && !string.startsWith("https://") && !new File(string).exists()) {
iUiListener.onError(new UiError(-6, "非法的图片地址!", null));
f.e("openSDK_LOG.QQShare", "shareToQQ, image url is emprty or illegal.");
d.a().a(1, "SHARE_CHECK_SDK", "1000", this.b.b(), String.valueOf(0), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "shareToQQ, image url is emprty or illegal.");
return;
}
if (TextUtils.isEmpty(string2) || string2.length() <= 128) {
str = null;
} else {
str = null;
bundle.putString("title", i.a(string2, PeripheralType.SERVO, (String) null, (String) null));
}
if (!TextUtils.isEmpty(string3) && string3.length() > 512) {
bundle.putString(SocialConstants.PARAM_SUMMARY, i.a(string3, DataDecryptTool.DECRYPT_DB_FILE, str, str));
}
if (i.a(activity, bundle.getInt("cflag", 0) == 1)) {
f.c("openSDK_LOG.QQShare", "shareToQQ, support share");
c(activity, bundle, iUiListener);
} else {
try {
f.d("openSDK_LOG.QQShare", "shareToQQ, don't support share, will show download dialog");
new TDialog(activity, "", a(""), null, this.b).show();
} catch (RuntimeException e) {
f.b("openSDK_LOG.QQShare", " shareToQQ, TDialog.show not in main thread", e);
e.printStackTrace();
iUiListener.onError(new UiError(-6, "没有在主线程调用!", null));
}
}
f.c("openSDK_LOG.QQShare", "shareToQQ() -- end.");
}
}

View File

@@ -0,0 +1,78 @@
package com.tencent.connect.share;
import android.content.Context;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.common.BaseApi;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class QzoneShare extends BaseApi {
public String c;
private boolean d;
private boolean e;
private boolean f;
private boolean g;
public QzoneShare(Context context, QQToken qQToken) {
super(qQToken);
this.c = "";
this.d = true;
this.e = false;
this.f = false;
this.g = false;
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:16:0x00bd */
/* JADX WARN: Removed duplicated region for block: B:31:0x0116 */
/* JADX WARN: Removed duplicated region for block: B:34:0x0139 */
/* JADX WARN: Removed duplicated region for block: B:37:0x015c */
/* JADX WARN: Removed duplicated region for block: B:40:0x0176 */
/* JADX WARN: Removed duplicated region for block: B:43:0x0199 */
/* JADX WARN: Removed duplicated region for block: B:46:0x01bc */
/* JADX WARN: Removed duplicated region for block: B:49:0x01df */
/* JADX WARN: Removed duplicated region for block: B:52:0x0223 */
/* JADX WARN: Removed duplicated region for block: B:55:0x0245 */
/* JADX WARN: Removed duplicated region for block: B:58:0x02d1 */
/* JADX WARN: Removed duplicated region for block: B:64:0x0316 */
/* JADX WARN: Removed duplicated region for block: B:68:0x035e */
/* JADX WARN: Removed duplicated region for block: B:69:0x02eb */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void c(android.app.Activity r25, android.os.Bundle r26, com.tencent.tauth.IUiListener r27) {
/*
Method dump skipped, instructions count: 941
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.connect.share.QzoneShare.c(android.app.Activity, android.os.Bundle, com.tencent.tauth.IUiListener):void");
}
/* JADX WARN: Removed duplicated region for block: B:101:0x035e */
/* JADX WARN: Removed duplicated region for block: B:103:0x026e */
/* JADX WARN: Removed duplicated region for block: B:129:0x0191 */
/* JADX WARN: Removed duplicated region for block: B:12:0x009d */
/* JADX WARN: Removed duplicated region for block: B:132:0x00b1 */
/* JADX WARN: Removed duplicated region for block: B:17:0x00b7 */
/* JADX WARN: Removed duplicated region for block: B:38:0x01e5 */
/* JADX WARN: Removed duplicated region for block: B:48:0x0267 */
/* JADX WARN: Removed duplicated region for block: B:51:0x02e7 */
/* JADX WARN: Removed duplicated region for block: B:76:0x039e */
/* JADX WARN: Removed duplicated region for block: B:79:0x03ad */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void b(final android.app.Activity r29, final android.os.Bundle r30, final com.tencent.tauth.IUiListener r31) {
/*
Method dump skipped, instructions count: 1103
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.connect.share.QzoneShare.b(android.app.Activity, android.os.Bundle, com.tencent.tauth.IUiListener):void");
}
@Override // com.tencent.connect.common.BaseApi
public void releaseResource() {
}
}

View File

@@ -0,0 +1,266 @@
package com.tencent.connect.share;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import com.tencent.open.a.f;
import com.tencent.open.utils.c;
import com.tencent.open.utils.i;
import com.thoughtworks.xstream.XStream;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.ubt.jimu.base.cache.Constants;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a {
/* JADX INFO: Access modifiers changed from: private */
public static final boolean b(String str, int i, int i2) {
if (TextUtils.isEmpty(str)) {
return false;
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
try {
BitmapFactory.decodeFile(str, options);
} catch (OutOfMemoryError e) {
e.printStackTrace();
}
int i3 = options.outWidth;
int i4 = options.outHeight;
if (options.mCancel || i3 == -1 || i4 == -1) {
return false;
}
int i5 = i3 > i4 ? i3 : i4;
if (i3 >= i4) {
i3 = i4;
}
f.b("openSDK_LOG.AsynScaleCompressImage", "longSide=" + i5 + "shortSide=" + i3);
options.inPreferredConfig = Bitmap.Config.RGB_565;
return i5 > i2 || i3 > i;
}
public static final void a(Context context, final String str, final c cVar) {
f.b("openSDK_LOG.AsynScaleCompressImage", "scaleCompressImage");
if (TextUtils.isEmpty(str)) {
cVar.a(1, (String) null);
} else if (!i.b()) {
cVar.a(2, (String) null);
} else {
final Handler handler = new Handler(context.getMainLooper()) { // from class: com.tencent.connect.share.a.1
@Override // android.os.Handler
public void handleMessage(Message message) {
int i = message.what;
if (i == 101) {
cVar.a(0, (String) message.obj);
} else if (i != 102) {
super.handleMessage(message);
} else {
cVar.a(message.arg1, (String) null);
}
}
};
new Thread(new Runnable() { // from class: com.tencent.connect.share.a.2
@Override // java.lang.Runnable
public void run() {
String a;
Bitmap a2 = a.a(str, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE);
if (a2 != null) {
String str2 = Environment.getExternalStorageDirectory() + "/tmp/";
String str3 = "share2qq_temp" + i.f(str) + ".jpg";
if (a.b(str, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE)) {
f.b("openSDK_LOG.AsynScaleCompressImage", "out of bound,compress!");
a = a.a(a2, str2, str3);
} else {
f.b("openSDK_LOG.AsynScaleCompressImage", "not out of bound,not compress!");
a = str;
}
f.b("openSDK_LOG.AsynScaleCompressImage", "-->destFilePath: " + a);
if (a != null) {
Message obtainMessage = handler.obtainMessage(101);
obtainMessage.obj = a;
handler.sendMessage(obtainMessage);
return;
}
}
Message obtainMessage2 = handler.obtainMessage(102);
obtainMessage2.arg1 = 3;
handler.sendMessage(obtainMessage2);
}
}).start();
}
}
public static final void a(Context context, final ArrayList<String> arrayList, final c cVar) {
f.b("openSDK_LOG.AsynScaleCompressImage", "batchScaleCompressImage");
if (arrayList == null) {
cVar.a(1, (String) null);
} else {
final Handler handler = new Handler(context.getMainLooper()) { // from class: com.tencent.connect.share.a.3
@Override // android.os.Handler
public void handleMessage(Message message) {
if (message.what != 101) {
super.handleMessage(message);
} else {
cVar.a(0, message.getData().getStringArrayList(Constants.IMAGE_PATH));
}
}
};
new Thread(new Runnable() { // from class: com.tencent.connect.share.a.4
@Override // java.lang.Runnable
public void run() {
Bitmap a;
for (int i = 0; i < arrayList.size(); i++) {
String str = (String) arrayList.get(i);
if (!i.g(str) && i.h(str) && (a = a.a(str, XStream.PRIORITY_VERY_HIGH)) != null) {
String str2 = Environment.getExternalStorageDirectory() + "/tmp/";
String str3 = "share2qzone_temp" + i.f(str) + ".jpg";
if (a.b(str, 640, XStream.PRIORITY_VERY_HIGH)) {
f.b("openSDK_LOG.AsynScaleCompressImage", "out of bound, compress!");
str = a.a(a, str2, str3);
} else {
f.b("openSDK_LOG.AsynScaleCompressImage", "not out of bound,not compress!");
}
if (str != null) {
arrayList.set(i, str);
}
}
}
Message obtainMessage = handler.obtainMessage(101);
Bundle bundle = new Bundle();
bundle.putStringArrayList(Constants.IMAGE_PATH, arrayList);
obtainMessage.setData(bundle);
handler.sendMessage(obtainMessage);
}
}).start();
}
}
private static int b(BitmapFactory.Options options, int i, int i2) {
int min;
double d = options.outWidth;
double d2 = options.outHeight;
int ceil = i2 == -1 ? 1 : (int) Math.ceil(Math.sqrt((d * d2) / i2));
if (i == -1) {
min = PeripheralType.SERVO;
} else {
double d3 = i;
min = (int) Math.min(Math.floor(d / d3), Math.floor(d2 / d3));
}
if (min < ceil) {
return ceil;
}
if (i2 == -1 && i == -1) {
return 1;
}
return i == -1 ? ceil : min;
}
private static Bitmap a(Bitmap bitmap, int i) {
Matrix matrix = new Matrix();
int width = bitmap.getWidth();
int height = bitmap.getHeight();
if (width <= height) {
width = height;
}
float f = i / width;
matrix.postScale(f, f);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
protected static final String a(Bitmap bitmap, String str, String str2) {
File file = new File(str);
if (!file.exists()) {
file.mkdirs();
}
StringBuffer stringBuffer = new StringBuffer(str);
stringBuffer.append(str2);
String stringBuffer2 = stringBuffer.toString();
File file2 = new File(stringBuffer2);
if (file2.exists()) {
file2.delete();
}
if (bitmap == null) {
return null;
}
try {
FileOutputStream fileOutputStream = new FileOutputStream(file2);
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
bitmap.recycle();
return stringBuffer2;
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
} catch (IOException e2) {
e2.printStackTrace();
return null;
}
}
public static final Bitmap a(String str, int i) {
Bitmap bitmap;
if (TextUtils.isEmpty(str)) {
return null;
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
try {
BitmapFactory.decodeFile(str, options);
} catch (OutOfMemoryError e) {
e.printStackTrace();
}
int i2 = options.outWidth;
int i3 = options.outHeight;
if (options.mCancel || i2 == -1 || i3 == -1) {
return null;
}
if (i2 <= i3) {
i2 = i3;
}
options.inPreferredConfig = Bitmap.Config.RGB_565;
if (i2 > i) {
options.inSampleSize = a(options, -1, i * i);
}
options.inJustDecodeBounds = false;
try {
bitmap = BitmapFactory.decodeFile(str, options);
} catch (OutOfMemoryError e2) {
e2.printStackTrace();
bitmap = null;
}
if (bitmap == null) {
return null;
}
int i4 = options.outWidth;
int i5 = options.outHeight;
if (i4 > i5) {
i5 = i4;
}
return i5 > i ? a(bitmap, i) : bitmap;
}
public static final int a(BitmapFactory.Options options, int i, int i2) {
int b = b(options, i, i2);
if (b > 8) {
return ((b + 7) / 8) * 8;
}
int i3 = 1;
while (i3 < b) {
i3 <<= 1;
}
return i3;
}
}