QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 PrivacyDialogManager.java 源代码,内容仅作参考
package com.tencent.mtt.businesscenter;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.manifest.annotation.CreateMethod;
import com.tencent.common.manifest.annotation.ServiceImpl;
import com.tencent.common.utils.ExternalDataDir;
import com.tencent.common.utils.PrivacyAPI;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.utils.permission.PermissionManager;
import com.tencent.mtt.base.utils.permission.PermissionRequest;
import com.tencent.mtt.base.utils.permission.PermissionUtils;
import com.tencent.mtt.boot.browser.FirstStartManager;
import com.tencent.mtt.browser.window.SoftwareLicenseView;
import com.tencent.mtt.commercial.shadow.PluginHelper;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.operation.event.EventLog;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.builder.api.base.IDialogBuilder;
import com.tencent.mtt.view.dialog.newui.builder.api.base.IDialogWithButtonBuilder;
import com.tencent.mtt.view.dialog.newui.builder.impl.ContentViewDialogBuilder;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.dialog.newui.view.ViewOnClickListener;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class PrivacyDialogManager implements View.OnClickListener {
private DialogBase f46760c;
private DialogBase f46761d;
private Handler e;
private Context f;
private DialogInterface.OnDismissListener g;
private final List<DialogInterface.OnDismissListener> h;
private final Set<Runnable> i;
private final Set<Runnable> j;
private SoftwareLicenseView k;
private PrivacyContentDialog l;
private static final String f46759b = ExternalDataDir.f10215a + "/hippy";
static boolean f46758a = false;
public static class AgreementInfo {
private String f46771a;
private String f46772b;
private String f46773c;
public AgreementInfo(String str, String str2, String str3) {
this.f46771a = str;
this.f46772b = str2;
this.f46773c = str3;
}
public static AgreementInfo a(String str) {
return new AgreementInfo(str, "许可协议", "https://rule.tencent.com/rule/preview/60870208-c9ff-42b8-af61-e4469d722d0b");
}
public static AgreementInfo b(String str) {
return new AgreementInfo(str, "QQ浏览器隐私保护指引", PrivacyDialogManager.j());
}
public String a() {
return this.f46771a;
}
public String b() {
return this.f46772b;
}
public String c() {
return this.f46773c;
}
}
public static class PrivacyDialogManagerHolder {
public static final PrivacyDialogManager f46774a = new PrivacyDialogManager();
}
@ServiceImpl(createMethod = CreateMethod.NEW, service = PrivacyAPI.IPrivacyAPIImpl.class)
public static class QBPrivacyAPIProxy implements PrivacyAPI.IPrivacyAPIImpl {
@Override
public boolean isPrivacyGranted() {
return PrivacyDialogManager.a().h();
}
}
private PrivacyDialogManager() {
this.e = null;
this.f = null;
this.h = new ArrayList();
this.i = Collections.newSetFromMap(new ConcurrentHashMap());
this.j = Collections.newSetFromMap(new ConcurrentHashMap());
this.e = new Handler(Looper.getMainLooper());
this.g = new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
PrivacyDialogManager.this.a(dialogInterface);
}
};
}
private SpannableStringBuilder a(SpannableStringBuilder spannableStringBuilder) {
if (PrivacyDialogScene.a().c()) {
spannableStringBuilder.append("\n");
a(spannableStringBuilder, MttResources.l(R.string.azb), MttResources.c(R.color.theme_common_color_a1));
}
return spannableStringBuilder;
}
private SpannableStringBuilder a(String str, List<AgreementInfo> list) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
a(spannableStringBuilder, str);
a(spannableStringBuilder, str, list);
return spannableStringBuilder;
}
private SpannableStringBuilder a(String str, List<AgreementInfo> list, String... strArr) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
b(spannableStringBuilder, str);
a(spannableStringBuilder, str, list);
spannableStringBuilder.append("\n");
for (String str2 : strArr) {
a(spannableStringBuilder, str2, MttResources.c(R.color.theme_common_color_a3));
}
return spannableStringBuilder;
}
public static PrivacyDialogManager a() {
return PrivacyDialogManagerHolder.f46774a;
}
private List<AgreementInfo> a(AgreementInfo agreementInfo, AgreementInfo agreementInfo2) {
ArrayList arrayList = new ArrayList();
arrayList.add(agreementInfo);
arrayList.add(agreementInfo2);
arrayList.add(new AgreementInfo("《儿童隐私保护声明》", "儿童隐私保护声明", "https://privacy.qq.com/policy/kids-privacypolicy"));
arrayList.add(new AgreementInfo("《第三方SDK目录》", "第三方SDK目录", "https://privacy.qq.com/document/priview/d61b79b64e224a169b9e587ae6ce60c7"));
arrayList.add(new AgreementInfo("《第三方信息共享清单》", "第三方信息共享清单", "http://rule.tencent.com/rule/preview/1ea71f24-cf54-4c31-aace-b55f12c62a68"));
return arrayList;
}
public void a(DialogInterface dialogInterface) {
ArrayList<DialogInterface.OnDismissListener> arrayList;
synchronized (this.h) {
arrayList = new ArrayList(this.h);
}
for (DialogInterface.OnDismissListener onDismissListener : arrayList) {
if (onDismissListener != null) {
onDismissListener.onDismiss(dialogInterface);
}
}
PrivacyDialogReport.a();
}
private void a(SpannableStringBuilder spannableStringBuilder, String str) {
spannableStringBuilder.append((CharSequence) str);
}
private void a(SpannableStringBuilder spannableStringBuilder, String str, int i) {
int length = spannableStringBuilder.length();
spannableStringBuilder.append(" \n");
spannableStringBuilder.setSpan(new AbsoluteSizeSpan(MttResources.h(R.dimen.a61)), length, spannableStringBuilder.length(), 33);
int length2 = spannableStringBuilder.length();
spannableStringBuilder.append((CharSequence) str);
ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(i);
AbsoluteSizeSpan absoluteSizeSpan = new AbsoluteSizeSpan(MttResources.h(R.dimen.a5o));
spannableStringBuilder.setSpan(foregroundColorSpan, length2, spannableStringBuilder.length(), 33);
spannableStringBuilder.setSpan(absoluteSizeSpan, length2, spannableStringBuilder.length(), 33);
}
private void a(SpannableStringBuilder spannableStringBuilder, String str, String str2, final String str3, final String str4) {
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View view) {
PrivacyDialogManager.this.a(str3, str4);
}
};
int indexOf = str.indexOf(str2);
spannableStringBuilder.setSpan(clickableSpan, indexOf, str2.length() + indexOf, 33);
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#4c9afa")), indexOf, str2.length() + indexOf, 33);
}
private void a(SpannableStringBuilder spannableStringBuilder, String str, List<AgreementInfo> list) {
for (AgreementInfo agreementInfo : list) {
a(spannableStringBuilder, str, agreementInfo.a(), agreementInfo.b(), agreementInfo.c());
}
}
static <T extends IDialogBuilder> void a(IDialogBuilder<T> iDialogBuilder) {
iDialogBuilder.b(false).a(new IDialogBuilder.BackListener() {
@Override
public boolean handleBack(DialogBase dialogBase) {
return true;
}
});
}
public void a(String str, String str2) {
this.l = new PrivacyContentDialog(ActivityHandler.b().a());
this.l.setCanceledOnTouchOutside(false);
this.k = new SoftwareLicenseView(this.f, str, str2);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
this.k.setPadding(0, BaseSettings.a().m(), 0, 0);
this.k.setLayoutParams(layoutParams);
this.k.setBackgroundColor(-1);
this.k.consumeTouchEvent();
this.k.setCloseButtonOnClickListener(this);
this.l.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
PrivacyDialogManager privacyDialogManager = PrivacyDialogManager.this;
privacyDialogManager.a(privacyDialogManager.f, false);
if (PrivacyDialogManager.this.k == null || PrivacyDialogManager.this.k.getParent() == null) {
return;
}
((ViewGroup) PrivacyDialogManager.this.k.getParent()).removeView(PrivacyDialogManager.this.k);
}
});
this.l.setContentView(this.k);
this.l.show();
}
private void b(SpannableStringBuilder spannableStringBuilder, String str) {
spannableStringBuilder.append((CharSequence) str);
spannableStringBuilder.setSpan(new ForegroundColorSpan(MttResources.c(R.color.theme_common_color_a3)), 0, spannableStringBuilder.length(), 33);
spannableStringBuilder.setSpan(new AbsoluteSizeSpan(MttResources.h(R.dimen.a5o)), 0, spannableStringBuilder.length(), 33);
}
static void b(IDialogWithButtonBuilder<?> iDialogWithButtonBuilder) {
iDialogWithButtonBuilder.a(MttResources.l(R.string.ayv));
iDialogWithButtonBuilder.c(MttResources.l(R.string.az7));
}
public static void b(boolean z) {
Context appContext = ContextHolder.getAppContext();
int myPid = Process.myPid();
if (appContext != null && myPid > 0) {
try {
ActivityManager activityManager = (ActivityManager) appContext.getSystemService("activity");
String packageName = appContext.getPackageName();
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : activityManager.getRunningAppProcesses()) {
if (runningAppProcessInfo.processName != null && runningAppProcessInfo.processName.contains(packageName) && runningAppProcessInfo.pid != myPid) {
Process.killProcess(runningAppProcessInfo.pid);
}
}
if (z) {
Process.killProcess(myPid);
}
} catch (Exception unused) {
}
}
}
static void c(IDialogWithButtonBuilder<?> iDialogWithButtonBuilder) {
iDialogWithButtonBuilder.a_(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
StatManager.b().c("ED00114_1");
PrivacyDialogReport.a("agree", 2);
PublicSettingManager.a().setInt("msg_center_privacy_dialog_state", 1);
PublicSettingManager.a().setInt("new_user_privacy_dialog_state", 2);
EventEmiter.getDefault().emit(new EventMessage("com.tencent.mtt.businesscenter.PrivacyDialogManager.onClick"));
PrivacyDialogManager.i();
EventLog.a("PrivacyDialogManager", "点击隐私弹窗,我知道了");
dialogBase.dismiss();
}
});
iDialogWithButtonBuilder.c(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
StatManager.b().c("ED00114_2");
PrivacyDialogReport.a("refuse", 2);
dialogBase.dismiss();
PrivacyDialogManager.b(true);
}
});
}
static void i() {
String str;
PlatformStatUtils.a("PrivacyDialog_SkipSdStmt_Entry");
Activity a2 = ActivityHandler.b().a();
if (a2 instanceof QbActivityBase) {
PermissionManager permissionManager = ((QbActivityBase) a2).getPermissionManager();
if (permissionManager == null) {
EventLog.a("PrivacyDialogManager", "skipSdcardStatementDialog: permissionManager=null");
str = "PrivacyDialog_SkipSdStmt_NullPermissionManager";
} else {
if (!permissionManager.b(PermissionUtils.a(4))) {
boolean a3 = permissionManager.a(4);
PlatformStatUtils.a("PrivacyDialog_SkipSdStmt_DoFirst");
PlatformStatUtils.a("PrivacyDialog_SkipSdStmt_DoFirst_" + a3);
if (!a3 && Build.VERSION.SDK_INT >= 23 && PrivacyDialogScene.a().c()) {
permissionManager.a(PermissionUtils.a(4), (PermissionRequest.Callback) null);
a3 = permissionManager.a(4);
PlatformStatUtils.a("PrivacyDialog_SkipSdStmt_DoSecond");
PlatformStatUtils.a("PrivacyDialog_SkipSdStmt_DoSecond_" + a3);
}
EventLog.a("PrivacyDialogManager", "skipSdcardStatementDialog: result=" + a3);
return;
}
EventLog.a("PrivacyDialogManager", "skipSdcardStatementDialog: 本机型没有SD卡权限或已授权");
str = "PrivacyDialog_SkipSdStmt_PERMISSION_GRANTED";
}
} else {
EventLog.a("PrivacyDialogManager", "skipSdcardStatementDialog: activity=" + a2);
str = "PrivacyDialog_SkipSdStmt_NotQBActivityBase";
}
PlatformStatUtils.a(str);
}
protected static String j() {
return l() ? "https://rule.tencent.com/rule/preview/d92fcbbb-98fb-42c5-a360-012bdab56d60" : "https://privacy.qq.com/document/priview/2491347092a64d7fa00cbc2bf68fbbbb";
}
public void k() {
IDialogBuilder<?> f = f();
IDialogWithButtonBuilder iDialogWithButtonBuilder = (IDialogWithButtonBuilder) f;
b((IDialogWithButtonBuilder<?>) iDialogWithButtonBuilder);
c((IDialogWithButtonBuilder<?>) iDialogWithButtonBuilder);
a(f);
f.a(this.g);
this.f46761d = f.d();
b(this.f46761d, f);
this.f46761d.show();
}
private static boolean l() {
try {
return ContextHolder.getAppContext().getAssets().open(PluginHelper.YLH_AD_PLUGIN_ZIP) != null;
} catch (Exception unused) {
Logs.e("PrivacyDialogManager", "sPluginZip not exist");
return false;
}
}
public void a(DialogInterface.OnDismissListener onDismissListener) {
synchronized (this.h) {
if (onDismissListener != null) {
if (!this.h.contains(onDismissListener)) {
this.h.add(onDismissListener);
}
}
}
}
void a(IDialogWithButtonBuilder<?> iDialogWithButtonBuilder) {
iDialogWithButtonBuilder.a(MttResources.l(R.string.ayv));
iDialogWithButtonBuilder.a_(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
StatManager.b().c("ED00113_1");
PrivacyDialogReport.a("agree", 1);
PublicSettingManager.a().setInt("msg_center_privacy_dialog_state", 1);
PublicSettingManager.a().setInt("new_user_privacy_dialog_state", 2);
EventEmiter.getDefault().emit(new EventMessage("com.tencent.mtt.businesscenter.PrivacyDialogManager.onClick"));
PrivacyDialogManager.i();
EventLog.a("PrivacyDialogManager", "点击隐私弹窗,我知道了");
dialogBase.setOnDismissListener(PrivacyDialogManager.this.g);
dialogBase.dismiss();
}
});
iDialogWithButtonBuilder.c(MttResources.l(R.string.az2));
iDialogWithButtonBuilder.c(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
StatManager.b().c("ED00112_2");
PrivacyDialogReport.a("refuse", 1);
PrivacyDialogManager.this.k();
dialogBase.dismiss();
}
});
}
void a(DialogBase dialogBase, IDialogBuilder<?> iDialogBuilder) {
if (PrivacyDialogScene.a().b()) {
c(dialogBase, iDialogBuilder);
}
}
public void a(Runnable runnable) {
this.i.add(runnable);
}
public boolean a(final Context context, boolean z) {
String str;
this.f = context;
DialogBase dialogBase = this.f46760c;
if (dialogBase != null && dialogBase.isShowing()) {
str = "正在展示弹窗,不重复展示了";
} else if (f46758a) {
str = "刚才已经走了展示弹窗,不连续调用了";
} else {
if (!h()) {
EventLog.a("PrivacyDialogManager", "准备展示隐私弹窗吧");
f46758a = true;
this.e.post(new Runnable() {
@Override
public void run() {
Context context2 = context;
if (context2 == null || !(context2 instanceof Activity)) {
return;
}
PrivacyDialogScene.a().a(((Activity) context).getIntent());
StatManager.b().c("ED00112_1");
IDialogBuilder<?> c2 = PrivacyDialogManager.this.c();
PrivacyDialogManager.this.a((IDialogWithButtonBuilder<?>) c2);
PrivacyDialogManager.a(c2);
PrivacyDialogManager.this.f46760c = c2.d();
PrivacyDialogManager privacyDialogManager = PrivacyDialogManager.this;
privacyDialogManager.a(privacyDialogManager.f46760c, c2);
if (PrivacyDialogManager.this.f46760c == null) {
return;
}
PrivacyDialogManager.this.f46760c.show();
}
});
return true;
}
str = "已经授权过,不展示弹窗了";
}
EventLog.a("PrivacyDialogManager", str);
return false;
}
public void b(DialogInterface.OnDismissListener onDismissListener) {
synchronized (this.h) {
this.h.remove(onDismissListener);
}
}
void b(DialogBase dialogBase, IDialogBuilder<?> iDialogBuilder) {
}
public void b(Runnable runnable) {
this.j.add(runnable);
}
public boolean b() {
DialogBase dialogBase;
DialogBase dialogBase2 = this.f46760c;
return (dialogBase2 != null && dialogBase2.isShowing()) || ((dialogBase = this.f46761d) != null && dialogBase.isShowing());
}
IDialogBuilder<?> c() {
if (PrivacyDialogScene.a().b()) {
PrivacyDialogReport.a("show", 1, 1);
return e();
}
PrivacyDialogReport.a("show", 1, 2);
return d();
}
void c(DialogBase dialogBase, IDialogBuilder<?> iDialogBuilder) {
View d2 = iDialogBuilder.c().d();
((TextView) d2.findViewById(R.id.privacyDialogContentSubTitleText)).setText(MttResources.l(R.string.az3));
int[] iArr = {R.id.privacyDialogContentIconStub0, R.id.privacyDialogContentIconStub1, R.id.privacyDialogContentIconStub2, R.id.privacyDialogContentIconStub3};
int[] iArr2 = {R.drawable.b0_, R.drawable.b0a, R.drawable.b0b, R.drawable.b0c};
int[] iArr3 = {R.string.ayx, R.string.ayy, R.string.ayz, R.string.az0};
for (int i = 0; i < iArr.length; i++) {
ViewStub viewStub = (ViewStub) d2.findViewById(iArr[i]);
viewStub.setLayoutResource(R.layout.km);
View inflate = viewStub.inflate();
((ImageView) inflate.findViewById(R.id.privacy_dialog_content_wxfile_icon_image)).setImageDrawable(MttResources.i(iArr2[i]));
((TextView) inflate.findViewById(R.id.privacy_dialog_content_wxfile_icon_text)).setText(MttResources.l(iArr3[i]));
}
ViewStub viewStub2 = (ViewStub) d2.findViewById(R.id.privacyDialogContentTextViewStub);
viewStub2.setLayoutResource(R.layout.uq);
viewStub2.inflate();
QBTextView qBTextView = (QBTextView) d2.findViewById(R.id.contentTextView);
qBTextView.setGravity(3);
qBTextView.setMovementMethod(LinkMovementMethod.getInstance());
qBTextView.setText(a(MttResources.l(R.string.az1), a(AgreementInfo.a("《许可协议》"), AgreementInfo.b("《隐私保护指引》")), MttResources.l(R.string.azc)));
}
IDialogBuilder<?> d() {
return SimpleDialogBuilder.e().d(MttResources.l(R.string.az4)).b(a(a(MttResources.l(R.string.ayw), a(AgreementInfo.a("《许可协议》"), AgreementInfo.b("《QQ浏览器隐私保护指引》")))), LinkMovementMethod.getInstance()).b(3);
}
IDialogBuilder<?> e() {
ContentViewDialogBuilder contentViewDialogBuilder = new ContentViewDialogBuilder();
contentViewDialogBuilder.b();
contentViewDialogBuilder.d(MttResources.l(R.string.az5));
contentViewDialogBuilder.d(R.layout.kl);
return contentViewDialogBuilder;
}
IDialogBuilder<?> f() {
PrivacyDialogReport.a("show", 2, 2);
return g();
}
IDialogBuilder<?> g() {
return SimpleDialogBuilder.e().d(MttResources.l(R.string.az9)).b(a(a(MttResources.l(R.string.az6), a(AgreementInfo.a("《许可协议》"), AgreementInfo.b("《隐私指引》")))), LinkMovementMethod.getInstance()).b(3);
}
public boolean h() {
if ((FirstStartManager.a(4) && TextUtils.isEmpty(BaseSettings.a().b())) && PublicSettingManager.a().getInt("new_user_privacy_dialog_state", 0) == 0) {
PublicSettingManager.a().setInt("new_user_privacy_dialog_state", 1);
}
return PublicSettingManager.a().getInt("new_user_privacy_dialog_state", 0) != 1;
}
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
PrivacyContentDialog privacyContentDialog = this.l;
if (privacyContentDialog != null) {
privacyContentDialog.dismiss();
}
EventCollector.getInstance().onViewClicked(view);
}
}