QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 BrowserStateManager.java 源代码,内容仅作参考
package com.tencent.mtt.boot.browser;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.Signature;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.Window;
import com.huawei.hms.support.api.entity.core.CommonCode;
import com.tencent.common.boot.BootChainEvent;
import com.tencent.common.boot.BootFeatureToggle;
import com.tencent.common.boot.BootTraceEvent;
import com.tencent.common.boot.BootTracer;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.task.RoutineDaemon;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.Md5Utils;
import com.tencent.common.utils.ThreadUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mm.ui.widget.dialog.MMTipsBar;
import com.tencent.mtt.AppInfoHolder;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.MainActivity;
import com.tencent.mtt.PushBootStrategy;
import com.tencent.mtt.QBShutState;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.R;
import com.tencent.mtt.SplashActivity;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.functionwindow.AppWindowController;
import com.tencent.mtt.base.hometab.ICustomTabService;
import com.tencent.mtt.base.stat.BeaconStatManager;
import com.tencent.mtt.base.stat.CommStatData;
import com.tencent.mtt.base.stat.StatDataUploader;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.utils.CommonUtils;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.GetTask;
import com.tencent.mtt.base.utils.PackageUtils;
import com.tencent.mtt.base.utils.QBLbsStateManager;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.base.wup.facade.IWUPBusiness;
import com.tencent.mtt.blade.alpha.BlockTask;
import com.tencent.mtt.blade.ext.BladeUtils;
import com.tencent.mtt.blade.ext.FeedsSnapshotSplashProxy;
import com.tencent.mtt.blade.flow.BladeAttributes;
import com.tencent.mtt.blade.flow.BladeFactory;
import com.tencent.mtt.boot.base.IBoot;
import com.tencent.mtt.boot.browser.completeproxy.BootCompleteProxy;
import com.tencent.mtt.boot.browser.splash.SplashManager;
import com.tencent.mtt.boot.browser.splash.facade.SplashViewListener;
import com.tencent.mtt.boot.browser.x5load.X5DelayLoad;
import com.tencent.mtt.boot.browser.x5load.X5LoadLog;
import com.tencent.mtt.browser.BrowserFragment;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.download.core.impl.DownloadServiceManager;
import com.tencent.mtt.browser.engine.AppBroadcastReceiver;
import com.tencent.mtt.browser.engine.clipboard.ClipboardManager;
import com.tencent.mtt.browser.engine.recover.RecoverHelper;
import com.tencent.mtt.browser.engine.recover.RecoverManager;
import com.tencent.mtt.browser.engine.recover.facade.IRecover;
import com.tencent.mtt.browser.homepage.appdata.facade.AppItem;
import com.tencent.mtt.browser.homepage.view.FirstEventCallbackSingleHolder;
import com.tencent.mtt.browser.homepage.xhome.logo.doodle.utils.DoodleBootOptStat;
import com.tencent.mtt.browser.inputmethod.facade.IClipboardManager;
import com.tencent.mtt.browser.push.facade.IServiceManager;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.share.facade.IShareTokenService;
import com.tencent.mtt.browser.video.facade.IQBVideoService;
import com.tencent.mtt.browser.window.BrowserWindow;
import com.tencent.mtt.browser.window.FloatViewManager;
import com.tencent.mtt.browser.window.FullScreenManager;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.browser.window.home.IHome;
import com.tencent.mtt.browser.window.home.ITabPage;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.businesscenter.facade.IntentInfoUtils;
import com.tencent.mtt.businesscenter.intent.QBModuleDispather;
import com.tencent.mtt.businesscenter.preload.QbPreloadProcessManager;
import com.tencent.mtt.businesscenter.window.BrowserFragmentBusiness;
import com.tencent.mtt.businesscenter.wup.WUPArranger;
import com.tencent.mtt.coldboot.oas.ColdBootOasHandler;
import com.tencent.mtt.compliance.MethodDelegate;
import com.tencent.mtt.costtimelite.CostTimeLite;
import com.tencent.mtt.debug.SimpleCostTime;
import com.tencent.mtt.external.beacon.BeaconUploader;
import com.tencent.mtt.external.qrcode.common.ActionConstants2;
import com.tencent.mtt.external.setting.base.RotateScreenManager;
import com.tencent.mtt.external.setting.inhost.SettingDefines;
import com.tencent.mtt.hippy.qb.QBHippyEngineManager;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.qbinfo.IQConfigure;
import com.tencent.mtt.qbinfo.QBInfoUtils;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.search.facade.ISearchEngineService;
import com.tencent.mtt.search.facade.ISearchService;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.setting.BootFlagManager;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.smtt.export.external.LibraryLoader;
import java.util.ArrayList;
import java.util.HashSet;
import qb.a.f;
import qb.homepage.BuildConfig;
public class BrowserStateManager {
public static long f33875c;
public static long f33876d;
public static long e;
public static long f;
public static long g;
private static volatile BrowserStateManager x;
private boolean t = false;
@Deprecated
public BootStatus f33877a = new BootStatus();
boolean f33878b = false;
public int h = -1;
boolean i = false;
public boolean j = false;
boolean k = false;
public BrowserEvent l = new BrowserBusiness();
boolean m = false;
Object n = new Object();
ArrayList<IBoot.IBootStateListener> o = null;
public Handler p = new Handler(Looper.getMainLooper());
BootCompleteProxy q = null;
private boolean u = false;
private boolean v = false;
private boolean w = false;
public final FirstEventCallbackSingleHolder<Integer> r = new FirstEventCallbackSingleHolder<>();
private int y = -1;
private boolean z = false;
final HashSet<IBoot.IMainStateListener> s = new HashSet<>();
@Deprecated
public static class BootStatus {
public QbActivityBase f33893a = null;
public Intent f33894b = null;
public Intent f33895c = null;
public int f33896d = 9;
public boolean e = false;
public boolean f = false;
public int g = 1;
public boolean h = true;
public AppItem i = null;
public boolean j = false;
public boolean k = true;
public boolean l = false;
public byte m = 1;
}
public class BrowserWindowListener implements BrowserWindow.OnBrowserWindowDrawLisener {
BrowserWindowListener() {
}
@Override
public void a() {
if (BrowserStateManager.e == 0) {
BrowserStateManager.e = SystemClock.elapsedRealtime();
CostTimeLite.b("Boot", "main");
CostTimeLite.a("Boot");
X5LoadLog.a("onBrowserWindowDraw");
}
BrowserStateManager.this.p.postAtFrontOfQueue(new Runnable() {
@Override
public void run() {
BootChainEvent.c("BSM.onBrowserWindowDraw.run");
BrowserStateManager.this.n();
BladeFactory.a().b().o();
}
});
FeedsSnapshotSplashProxy.a().c();
}
}
public class SplashListener implements SplashViewListener {
SplashListener() {
}
@Override
public void onSplashViewRemove(final int i, final int i2) {
BrowserStateManager.this.p.post(new Runnable() {
@Override
public void run() {
BrowserStateManager.B();
if (BrowserStateManager.f == 0) {
BrowserStateManager.f = SystemClock.elapsedRealtime();
}
if (i2 != 2) {
BrowserStateManager.this.b(i);
} else {
BrowserStateManager.this.C();
}
}
});
}
@Override
public void onSplashViewShow(final int i, final int i2) {
SimpleCostTime.a("BOOTING", ">>> show splash", "BOOTING");
if (BrowserStateManager.g == 0) {
BrowserStateManager.g = SystemClock.elapsedRealtime();
CostTimeLite.b("Boot", "main");
CostTimeLite.a("Boot");
}
BrowserStateManager.this.p.post(new Runnable() {
@Override
public void run() {
if (i2 != 2) {
BrowserStateManager.this.a(i);
}
}
});
}
}
private BrowserStateManager() {
}
public static void B() {
BootChainEvent.c("BSM.initQBLbsStateManager");
N();
}
private void K() {
if (this.h > -1) {
return;
}
Logs.c("BrowserStateManager", "startBoot...");
this.h = 0;
BootChainEvent.c("BSM.startBoot");
k();
}
private void L() {
BootChainEvent.c("BSM.doInitThingsAndPrepare");
if (f()) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
BootChainEvent.c("BSM.BootEvent.onFirstBoot");
try {
BrowserStateManager.this.l.a();
} catch (Throwable unused) {
}
}
}, "first_boot_init");
thread.setPriority(10);
thread.start();
}
FeedsSnapshotSplashProxy.a().a(new Runnable() {
@Override
public void run() {
BrowserStateManager.this.l();
}
});
}
public void M() {
String str;
if (this.h == 1) {
return;
}
SimpleCostTime.a("doAfterBoot");
this.h = 1;
Logs.c("BrowserStateManager", "mState = STATE_BOOT_COMPLETE\n" + Log.getStackTraceString(new Throwable()));
Logs.c("BrowserStateManager", "doAfterBoot... 0");
PublicSettingManager a2 = PublicSettingManager.a();
AppBroadcastReceiver.a().a(ContextHolder.getAppContext());
if (this.f33877a.e) {
a2.setLong("key_first_boot_time", System.currentTimeMillis());
a2.setBoolean("key_has_report_launcher_pkg_name", false);
a2.setString("key_report_launcher_pkg_name", "");
int i = a().f33877a.g >= 1 ? 0 : 1;
if (i != BaseSettings.a().getInt("splash", -1)) {
BaseSettings.a().setInt("splash", i);
}
}
Logs.c("BrowserStateManager", "doAfterBoot... 1");
FirstStartManager.a();
BootFlagManager.a();
BaseSettings.a().o();
BaseSettings.a().commitAll();
if (BootFeatureToggle.f()) {
PublicSettingManager.a().commitAll();
}
ActivityHandler.b().c(ActivityHandler.b().n());
Logs.c("BrowserStateManager", "doAfterBoot... 2");
SplashManager.getInstance().j();
if (BootFeatureToggle.i()) {
BladeUtils.a("TASK_DO_AFTER_BOOT");
}
DoodleBootOptStat.a("DoAfterBoot");
BladeAttributes b2 = BladeFactory.a().b();
if (!BootFeatureToggle.e() || !b2.o()) {
if (!BootFeatureToggle.g() || !b2.p()) {
p();
Logs.c("BrowserStateManager", "doAfterBoot... 3");
if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_DOODLE_BOOT_OPT_868412641)) {
BootCompleteProxy bootCompleteProxy = this.q;
if (bootCompleteProxy != null) {
bootCompleteProxy.a(new Runnable() {
@Override
public void run() {
BrowserStateManager.this.F();
}
});
SimpleCostTime.a("BrowserStateManager", "doAfterBoot", "doAfterBoot");
}
str = "ProxyIsNull";
} else {
str = "FeatureOff";
}
DoodleBootOptStat.a(str);
F();
SimpleCostTime.a("BrowserStateManager", "doAfterBoot", "doAfterBoot");
}
}
p();
DoodleBootOptStat.a("IsXHomeSchedule");
SimpleCostTime.a("BrowserStateManager", "doAfterBoot", "doAfterBoot");
}
private static void N() {
BootChainEvent.c("BSM.initQBLbsStateManager0");
QBLbsStateManager.a().c();
QBLbsStateManager.a().d();
}
private static String O() {
return "3082023f308201a8a00302010202044c46914a300d06092a864886f70d01010505003064310b30090603550406130238363110300e060355040813074265696a696e673110300e060355040713074265696a696e673110300e060355040a130754656e63656e74310c300a060355040b13035753443111300f0603550403130873616d75656c6d6f301e170d3130303732313036313835305a170d3430303731333036313835305a3064310b30090603550406130238363110300e060355040813074265696a696e673110300e060355040713074265696a696e673110300e060355040a130754656e63656e74310c300a060355040b13035753443111300f0603550403130873616d75656c6d6f30819f300d06092a864886f70d010101050003818d0030818902818100c209077044bd0d63ea00ede5b839914cabcc912a87f0f8b390877e0f7a2583f0d5933443c40431c35a4433bc4c965800141961adc44c9625b1d321385221fd097e5bdc2f44a1840d643ab59dc070cf6c4b4b4d98bed5cbb8046e0a7078ae134da107cdf2bfc9b440fe5cb2f7549b44b73202cc6f7c2c55b8cfb0d333a021f01f0203010001300d06092a864886f70d010105050003818100b007db9922774ef4ccfee81ba514a8d57c410257e7a2eba64bfa17c9e690da08106d32f637ac41fbc9f205176c71bde238c872c3ee2f8313502bee44c80288ea4ef377a6f2cdfe4d3653c145c4acfedbfbadea23b559d41980cc3cdd35d79a68240693739aabf5c5ed26148756cf88264226de394c8a24ac35b712b120d4d23a";
}
private View a(Context context) {
CostTimeLite.a("Boot", "createContentView");
WindowManager a2 = WindowManager.a(ActivityHandler.b().n());
a2.b(context);
Intent intent = this.f33877a.f33894b;
boolean b2 = BrowserStateUtils.b(intent);
boolean a3 = BrowserStateUtils.a(intent);
Logs.c("BrowserStateManager", " [createContentView] hasValidData:" + a3 + ", isBackFromHistory:" + b2);
if (f33875c == 0) {
f33875c = SystemClock.elapsedRealtime();
}
BootTracer.b("SPLASH_START", BootTraceEvent.Type.FRAMEWORK);
BladeAttributes b3 = BladeFactory.a().b();
boolean z = false;
boolean z2 = (BootFeatureToggle.e() && b3.o()) ? false : true;
FeedsSnapshotSplashProxy.a().b();
SplashManager.getInstance().a(this.f33877a.f33893a, intent, a3, b2, new SplashListener(), z2);
BootTracer.b("SPLASH_START");
BootChainEvent.d("BSM.createContentView").a("isBackFromHistory", String.valueOf(b2)).a("hasValidData", String.valueOf(a3)).g();
L();
if (BootFeatureToggle.i() && (b3.o() || b3.p())) {
z = true;
}
if (!z) {
N();
}
CostTimeLite.b("Boot", "createContentView");
return a2.d();
}
public static BrowserStateManager a() {
if (x == null) {
synchronized (BrowserStateManager.class) {
if (x == null) {
x = new BrowserStateManager();
}
}
}
return x;
}
static void a(Context context, String str) {
CostTimeLite.a("Boot", "BSM.loadLibraryIgnoreError." + str);
try {
LibraryLoader.loadLibrary(context, str);
} catch (Throwable unused) {
Logs.e("libraryload", "loadLibraryIgnoreError libName = " + str);
}
CostTimeLite.b("Boot", "BSM.loadLibraryIgnoreError." + str);
}
private static boolean a(StringBuffer stringBuffer) {
PackageInfo a2;
Signature[] signatureArr;
try {
Context appContext = ContextHolder.getAppContext();
if (appContext != null && (a2 = PackageUtils.a(appContext.getPackageName(), appContext, 64)) != null && (signatureArr = a2.signatures) != null && signatureArr.length > 0) {
String charsString = signatureArr[0].toCharsString();
if (stringBuffer != null) {
stringBuffer.append(charsString);
}
Logs.c("BrowserStateManager", "[checkSignatureValid] signStr:");
if (charsString != null) {
if (charsString.equalsIgnoreCase(O())) {
return true;
}
}
return false;
}
} catch (Exception unused) {
}
return true;
}
public static void g(Activity activity) {
DeviceUtils.a(activity);
if (MethodDelegate.getModel().equalsIgnoreCase("LT18i") || MethodDelegate.getModel().equalsIgnoreCase("MT15i")) {
Logs.c("performance test", "MainActivity.onCreatePrepare load so for LT18i...");
a(activity, "QrcodeDecoder");
a(activity, "lbs");
a(activity, "Bugly-rqd");
a(activity, "webp");
a(activity, "mttcpuinfo");
}
DeviceUtils.a(Math.round(activity.getResources().getDimension(f.A)));
}
private void g(Intent intent) {
BootChainEvent.c("BSM.initRecoverManager");
CostTimeLite.a("Boot", "Recover.init");
RecoverManager.getInstance().init(intent, (((IBoot) SDKContext.getInstance().getService(IBoot.class)).hasValidData(intent) && !((IBoot) SDKContext.getInstance().getService(IBoot.class)).isBackFromHistory(intent)) || FirstStartManager.a(33554432) || !TextUtils.isEmpty(QBModuleDispather.b(intent)) || !TextUtils.isEmpty(QBModuleDispather.c(intent)));
CostTimeLite.b("Boot", "Recover.init");
}
public static void h(Activity activity) {
CostTimeLite.a("Boot", "BSM.doSignCheckAndFileDownload");
Logs.c("performance test", "doSignCheckAndFileDownload start");
StringBuffer stringBuffer = new StringBuffer();
if (!a(stringBuffer)) {
String str = "https://mdc.html5.qq.com/mh?from=juggled";
try {
String stringBuffer2 = stringBuffer.toString();
str = "https://mdc.html5.qq.com/mh?from=juggled&version=" + IQConfigure.f69589b + "&buildid=" + IQConfigure.f + "&channel=" + AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_CURRENT_CHANNEL_ID) + "&devicename=" + MethodDelegate.getModel().trim().toLowerCase() + "&sdkversion=" + DeviceUtils.K() + "&lc=" + QBInfoUtils.a() + "&keymd5=" + (!TextUtils.isEmpty(stringBuffer2) ? Md5Utils.a(stringBuffer2) : "") + "&imei=";
Uri parse = Uri.parse(str);
Intent intent = new Intent();
if (parse != null && !TextUtils.isEmpty("android.intent.action.VIEW")) {
intent.setAction("android.intent.action.VIEW");
intent.setData(parse);
intent.setClassName(ThreadUtils.SYSTEM_BROWSER_PROCESS_NAME, "com.android.browser.BrowserActivity");
activity.startActivity(intent);
activity.finish();
Logs.c("performance test", "MainActivity oncreate 2");
CommonUtils.c();
}
} catch (Exception unused) {
Logs.c("performance test", "MainActivity oncreate 2");
try {
Uri parse2 = Uri.parse(str);
if (parse2 != null && !TextUtils.isEmpty("android.intent.action.VIEW")) {
Intent intent2 = new Intent();
intent2.setAction("android.intent.action.VIEW");
intent2.setData(parse2);
activity.startActivity(intent2);
activity.finish();
CommonUtils.c();
}
} catch (Exception unused2) {
}
}
}
Logs.c("performance test", "doSignCheckAndFileDownload end");
CostTimeLite.b("Boot", "BSM.doSignCheckAndFileDownload");
}
private void h(Intent intent) {
if (ActivityHandler.b().c() == ActivityHandler.State.foreground && !intent.hasExtra("internal_back")) {
intent.putExtra("internal_back", true);
}
if (ActivityHandler.b().c() == ActivityHandler.State.foreground) {
FloatViewManager.getInstance().i();
FloatViewManager.getInstance().h();
}
CostTimeLite.a("Boot", "HostService.initCallStatus.true");
QBModuleDispather.a(intent, true);
CostTimeLite.b("Boot", "HostService.initCallStatus.true");
}
private void i(Activity activity) {
}
private void i(Intent intent) {
intent.putExtra("SearchConst_Intent_Param_Referrer", (Build.VERSION.SDK_INT < 22 || this.f33877a.f33893a == null || this.f33877a.f33893a.getReferrer() == null) ? "" : this.f33877a.f33893a.getReferrer().toString());
}
public static void m() {
if (DeviceUtils.n()) {
if (Settings.Global.getInt(ContextHolder.getAppContext().getContentResolver(), "flymelab_flyme_night_mode", 0) == 1) {
SkinManager.s().a("night_mode", (Bitmap) null, false, false);
}
}
}
public boolean A() {
return this.t;
}
public void C() {
ITabPage currentPage;
IWebView webPage;
if (E()) {
c(false);
PageFrame s = WindowManager.a().s();
if (s == null || !(s.getCurrentWebView() instanceof IHome) || (currentPage = ((IHome) s.getCurrentWebView()).getCurrentPage()) == null || (webPage = currentPage.getWebPage()) == null || !webPage.isPage(IWebView.TYPE.HOME)) {
return;
}
webPage.preActive();
webPage.active();
}
}
public void D() {
if (d()) {
this.l.c();
}
}
public boolean E() {
return this.v;
}
public void F() {
Logs.c("BrowserStateManager", "onBootComplete");
this.l.a(this.f33877a.e);
G();
}
void G() {
synchronized (this.n) {
if (this.o != null) {
for (int i = 0; i < this.o.size(); i++) {
this.o.get(i).a(this.f33877a.f33894b, this.f33877a.e);
}
}
}
}
public void H() {
if (this.m) {
return;
}
this.m = true;
synchronized (this.n) {
if (this.o != null) {
for (int i = 0; i < this.o.size(); i++) {
this.o.get(i).b(this.f33877a.f33894b, this.f33877a.e);
}
this.o.clear();
this.o = null;
}
}
}
public int I() {
return this.y;
}
public void J() {
BootStatus bootStatus;
int i = 0;
if (BaseSettings.a().c() < 1500 || DeviceUtils.K() <= 18) {
bootStatus = this.f33877a;
} else if (DeviceUtils.K() <= 22) {
bootStatus = this.f33877a;
i = 1;
} else {
bootStatus = this.f33877a;
i = 2;
}
bootStatus.g = i;
}
void a(int i) {
Logs.c("BrowserStateManager", "doAfterSplashShow...");
((ICustomTabService) QBContext.getInstance().getService(ICustomTabService.class)).checkNovelChannel();
if (i == 7) {
this.f33877a.j = true;
} else {
this.l.a(i);
}
}
public void a(Activity activity) {
Logs.c("BrowserStateManager", "onMainActivityDestroy...");
if (ShutManager.a(ShutBusiness.e)) {
Logs.c("BrowserStateManager", ">>> onMainActivityDestroy cancel!!!");
return;
}
Logs.c("BrowserStateManager", "do onMainActivityDestroy...");
ShutManager.b(ShutBusiness.e);
ShutManager.f33931b = 1;
QBShutState.f30682a = ShutManager.f33931b;
if (ShutManager.g != 1) {
ShutManager.g = 2;
}
SplashManager.getInstance().p();
ShutManager.c(ShutBusiness.e);
this.l.j();
}
public void a(Intent intent) {
String str;
BootTraceEvent b2 = BootTracer.b("INIT_RECOVER", BootTraceEvent.Type.FRAMEWORK);
if (RecoverHelper.c()) {
g(intent);
str = "v2";
} else {
boolean b3 = BrowserStateUtils.b(intent);
if (!BrowserStateUtils.a(intent) || b3) {
g(intent);
} else {
BootChainEvent.c("BSM.cancelRecover");
RecoverManager.getInstance().cancelRecover();
}
str = "v1";
}
b2.a("type", str).a();
}
void a(Intent intent, boolean z) {
IQBVideoService iQBVideoService;
StringBuilder sb = new StringBuilder();
sb.append("startBrowser, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append((intent == null || intent.getExtras() == null) ? "NULL" : intent.getExtras().toString());
Logs.c("BrowserStateManager", sb.toString());
Logs.c("BrowserStateManager", "startBrowser, level: " + this.f33877a.f33896d);
BootChainEvent.d("BSM.startBrowser").a("startLevel", String.valueOf(this.f33877a.f33896d)).g();
int i = this.f33877a.f33896d;
if (i == 0) {
BootChainEvent.c("BSM.startBrowser.NORMAL");
Logs.c("BrowserStateManager", "StartLevel.NORMAL");
if (intent != null) {
String m = QBModuleDispather.m(intent);
String l = QBModuleDispather.l(intent);
if (!TextUtils.isEmpty(m) && !TextUtils.isEmpty(l)) {
try {
int parseInt = Integer.parseInt(l);
((IWUPBusiness) QBContext.getInstance().getService(IWUPBusiness.class)).setNeedStatLogin(intent.getBooleanExtra("MTT_NEED_STAT_LOGIN", true));
StatManager.b().a(m, parseInt, GetTask.ICustomForegroundPredication.QB);
return;
} catch (Exception unused) {
}
}
}
((IWUPBusiness) QBContext.getInstance().getService(IWUPBusiness.class)).setLoginType((byte) 0);
return;
}
if (i == 1) {
Logs.c("BrowserStateManager", "StartLevel.DOWNLOAD_ONCREATE");
BootChainEvent.c("BSM.startBrowser.DOWNLOAD");
if (DownloadServiceManager.a().hasInitCompleted()) {
Logs.c("BrowserStateManager", "StartLevel.DOWNLOAD_ONCREATE... 1");
if (TextUtils.isEmpty(intent != null ? intent.getStringExtra("method") : null)) {
Logs.c("BrowserStateManager", "StartLevel.DOWNLOAD_ONCREATE... 1.2");
AppWindowController.getInstance().a();
UrlParams urlParams = new UrlParams("qb://pagedownload/downloadhomepage");
urlParams.d(true);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
return;
}
Logs.c("BrowserStateManager", "StartLevel.DOWNLOAD_ONCREATE... 1.1");
} else {
Logs.c("BrowserStateManager", "StartLevel.DOWNLOAD_ONCREATE... 2");
DownloadServiceManager.a().init();
}
DownloadServiceManager.a().handleThrdDownloadRequest(intent);
return;
}
if (i == 2) {
Logs.c("BrowserStateManager", "StartLevel.VIDEO_DOWNLOAD_ONCREATE");
BootChainEvent.c("BSM.startBrowser.VIDEO_DOWNLOAD");
if (!DownloadServiceManager.a().hasInitCompleted() || (iQBVideoService = (IQBVideoService) QBContext.getInstance().getService(IQBVideoService.class)) == null) {
return;
}
if (!iQBVideoService.hasVideoManager()) {
MttToaster.show(R.string.pq, 0);
return;
}
Bundle bundle = new Bundle();
bundle.putByte("PAGE_TYPE", (byte) 2);
UrlParams urlParams2 = new UrlParams(UrlUtils.addParamsToUrl("qb://pagedownload/downloadhomepage", "type=video"));
urlParams2.a(bundle);
urlParams2.d(true);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams2);
return;
}
if (i == 3) {
Logs.c("BrowserStateManager", "StartLevel.QQSERVICE");
BootChainEvent.c("BSM.startBrowser.QQSERVICE");
QBModuleDispather.a(ActivityHandler.b().n(), intent, this.k ? 6 : 1);
} else {
if (i != 4) {
BootChainEvent.c(i != 14 ? "BSM.startBrowser.DEFAULT" : "BSM.startBrowser.DEFAULT_BROWSER");
return;
}
Logs.c("BrowserStateManager", "StartLevel.TRD_PARTY");
BootChainEvent.c("BSM.startBrowser.TRD_PARTY");
if (intent == null) {
return;
}
String c2 = QBModuleDispather.c(intent);
if (BrowserStateUtils.a(c2)) {
intent.setData(Uri.parse("qb://home"));
c(0);
BootChainEvent.c("BSM.startBrowser.TRD_PARTY.isDigitalCompanyUrl");
}
if (intent.getBooleanExtra("internal_back", false)) {
c(0);
BootChainEvent.c("BSM.startBrowser.TRD_PARTY.INTERNAL_BACK");
}
int a2 = this.k ? 6 : QBModuleDispather.a(intent);
BootChainEvent.c("BSM.startBrowser.TRD_PARTY.callType." + a2);
QBModuleDispather.a(ActivityHandler.b().n(), intent, a2);
try {
IWebView t = WindowManager.t();
if (t != null) {
ISearchEngineService iSearchEngineService = (ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class);
if ("sogou-page".equalsIgnoreCase(iSearchEngineService != null ? iSearchEngineService.getSearchRecogNameByUrl(c2) : null) && !TextUtils.isEmpty(((ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class)).getSearchWord(c2))) {
CommStatData commStatData = new CommStatData();
commStatData.sAppKey = "sogou_inputmethod_thrd_call";
ISearchService iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class);
if (iSearchService == null || !iSearchService.isShowing()) {
t.getUrl();
String searchRecogNameByUrl = iSearchEngineService != null ? iSearchEngineService.getSearchRecogNameByUrl(c2) : null;
if (ISearchEngineService.BAIDU_ENGINE_NAME.equalsIgnoreCase(searchRecogNameByUrl)) {
r2 = 2;
} else if (!"sogou-page".equalsIgnoreCase(searchRecogNameByUrl)) {
r2 = 3;
}
} else {
r2 = 0;
}
commStatData.put("current_page", r2 + "");
commStatData.put("current_searchengine", ((ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class)).getSearchEngineRecogName());
StatManager.b().a(commStatData);
}
}
} catch (Exception unused2) {
}
}
a(false);
}
public void a(QbActivityBase qbActivityBase) {
BootChainEvent.c("BSM.onMainActivityCreate");
Intent intent = qbActivityBase.getIntent();
StringBuilder sb = new StringBuilder();
sb.append("onMainActivityCreate, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
if (!BladeFactory.a().b().o()) {
f(qbActivityBase);
}
BootStatus bootStatus = this.f33877a;
bootStatus.f33893a = qbActivityBase;
bootStatus.f33894b = intent;
bootStatus.h = BrowserStateUtils.a(qbActivityBase);
this.t = c(intent);
CostTimeLite.a("Boot", "BSM.setBrowserFragment");
BrowserFragment browserFragment = new BrowserFragment();
browserFragment.a(new BrowserFragmentBusiness());
browserFragment.b(qbActivityBase.getIntent());
qbActivityBase.setBrowserFragment(browserFragment);
CostTimeLite.b("Boot", "BSM.setBrowserFragment");
}
public void a(IBoot.IBootStateListener iBootStateListener) {
if (iBootStateListener == null) {
return;
}
int i = 0;
if (d()) {
iBootStateListener.a(this.f33877a.f33894b, this.f33877a.e);
i = 1;
}
if (this.m) {
iBootStateListener.b(this.f33877a.f33894b, this.f33877a.e);
i++;
}
if (i < 2) {
synchronized (this.n) {
if (this.o == null) {
this.o = new ArrayList<>();
}
if (!this.o.contains(iBootStateListener)) {
this.o.add(iBootStateListener);
}
}
}
}
public void a(IBoot.IMainStateListener iMainStateListener) {
if (iMainStateListener != null) {
synchronized (this.s) {
this.s.add(iMainStateListener);
}
}
}
public void a(boolean z) {
this.k = z;
}
public boolean a(Activity activity, Intent intent, String str) {
String str2;
BootChainEvent.d("BSM.handleBootIntent").a(CommonCode.Resolution.HAS_RESOLUTION_FROM_APK, intent.getDataString()).a("data", str).g();
CostTimeLite.a("Boot", "handleBootIntent");
if (TextUtils.isEmpty(str)) {
Intent intent2 = new Intent(activity, (Class<?>) MainActivity.class);
intent2.setFlags(65536);
if (intent != null) {
intent2.setSourceBounds(intent.getSourceBounds());
}
intent = intent2;
} else {
Logs.c("BrowserStateManager", "MttLoader");
if (134217728 != (intent.getFlags() & 134217728) || e()) {
intent.setFlags(65536);
str2 = "com.tencent.mtt.MainActivity";
} else {
intent.setFlags(268500992);
str2 = "com.tencent.mtt.JumpActivity";
}
intent.setClassName("com.tencent.mtt", str2);
}
try {
activity.startActivity(intent);
} catch (Exception unused) {
}
if (BootFeatureToggle.h() && (activity instanceof SplashActivity)) {
activity.finish();
}
CostTimeLite.b("Boot", "handleBootIntent");
return true;
}
public void b() {
String str;
if (this.f33878b) {
return;
}
BootTraceEvent b2 = BootTracer.b("INIT_STATUS", BootTraceEvent.Type.FRAMEWORK);
CostTimeLite.a("Boot", "BSM.initStatus");
BootChainEvent.c("BSM.initStatus");
this.f33878b = true;
WUPArranger.f47454b = true;
Intent intent = this.f33877a.f33894b;
StringBuilder sb = new StringBuilder();
sb.append("initStatus, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
BaseSettings.a().enableBreakCommit();
BrowserExecutorSupplier.getInstance().setNormalAttributesDelay(true);
this.f33877a.e = FirstStartManager.a(4);
if (this.f33877a.e) {
BaseSettings.a().setLong("key_boot_firstboot_time", System.currentTimeMillis());
}
BootStatus bootStatus = this.f33877a;
bootStatus.f = bootStatus.e && TextUtils.isEmpty(BaseSettings.a().b());
if (!BootFeatureToggle.h()) {
J();
}
BootTracer.a(this.f33877a.f);
a(intent);
boolean needRecover = RecoverManager.getInstance().needRecover();
boolean isHomeRecover = RecoverManager.getInstance().isHomeRecover();
boolean z = needRecover && !isHomeRecover;
if (RecoverHelper.c()) {
c(BrowserStateUtils.c(intent));
str = "BSM.initStatus.isUserRecoverType2";
} else if (z) {
str = "BSM.initStatus.needRecover";
} else {
c(BrowserStateUtils.c(intent));
str = "BSM.initStatus.no_needRecover";
}
BootChainEvent.c(str);
BootStatus bootStatus2 = this.f33877a;
bootStatus2.l = BrowserStateUtils.a(bootStatus2.f33896d, this.f33877a.f33894b);
BootStatus bootStatus3 = this.f33877a;
bootStatus3.m = BrowserStateUtils.b(bootStatus3.f33896d, this.f33877a.f33894b);
BootChainEvent.d("BSM.PageFrameInit").a("rNeedRecover", String.valueOf(needRecover)).a("hNeedRecover", String.valueOf(isHomeRecover)).a("needRecover", String.valueOf(z)).a("startLevel", String.valueOf(s())).a("needPageFrame", String.valueOf(this.f33877a.l)).a("homePageOption", String.valueOf((int) this.f33877a.m)).g();
b2.b(IntentInfoUtils.a(intent)).a("isFirstBoot", this.f33877a.e).a("needPageFrame", this.f33877a.l).a("homePageOption", this.f33877a.m).a("needRecover", z).a("startLevel", this.f33877a.f33896d);
CostTimeLite.a("Boot", "HostService.initCallStatus.false");
QBModuleDispather.a(intent, false);
CostTimeLite.b("Boot", "HostService.initCallStatus.false");
Logs.c("BrowserStateManager", "initStatus, start level: " + this.f33877a.f33896d);
CostTimeLite.b("Boot", "BSM.initStatus");
BootTracer.b("INIT_STATUS");
}
void b(int i) {
Logs.c("BrowserStateManager", "doAfterSplashRemove...");
if (i != 7) {
this.l.b(i);
}
r();
}
public void b(Activity activity) {
CostTimeLite.a("Boot", "BSM.onSplashCreate");
Intent intent = activity.getIntent();
StringBuilder sb = new StringBuilder();
sb.append("onSplashActivityCreate, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
if (this.u) {
CostTimeLite.b("Boot", "BSM.onSplashCreate");
return;
}
this.u = true;
this.f33877a.f33894b = intent;
b();
try {
BladeAttributes b2 = BladeFactory.a().b();
boolean z = BootFeatureToggle.i() && (b2.o() || b2.p());
if (!z) {
i(activity);
}
if (!this.f33877a.e && !z && a().f33877a.g >= 1 && this.f33877a.l && this.f33877a.m == 1) {
BaseSettings a2 = BaseSettings.a();
long j = IQConfigure.g.equals(a2.getString("key_elapse_record_prepare_rn_version", "")) ? a2.getLong("key_elapse_record_prepare_rn_value", 0L) : 0L;
if (j < 2500) {
long elapsedRealtime = SystemClock.elapsedRealtime();
BrowserExecutorSupplier.postForBackgroundTasks(new BrowserExecutorSupplier.BackgroundRunable() {
@Override
public void doRun() {
BrowserStateManager.this.z();
}
});
long elapsedRealtime2 = SystemClock.elapsedRealtime() - elapsedRealtime;
if (elapsedRealtime2 >= 1000) {
a2.setLong("key_elapse_record_prepare_rn_value", j + elapsedRealtime2);
a2.setString("key_elapse_record_prepare_rn_version", IQConfigure.g);
} else {
a2.remove("key_elapse_record_prepare_rn_value");
a2.remove("key_elapse_record_prepare_rn_version");
}
}
}
} catch (Throwable unused) {
}
CostTimeLite.b("Boot", "BSM.onSplashCreate");
}
public void b(Intent intent) {
a(intent, false);
}
public void b(IBoot.IMainStateListener iMainStateListener) {
synchronized (this.s) {
this.s.remove(iMainStateListener);
}
}
public void b(boolean z) {
if (d()) {
if (z && ActivityHandler.b().n() != null) {
WindowManager a2 = WindowManager.a();
if (a2.x() != null) {
a2.x().invalidate();
}
}
this.l.b(z);
}
SplashManager.getInstance().onWindowFocusChanged(z);
}
public void c(int i) {
Logs.c("BrowserStateManager", "setStartLevel: " + i);
BootChainEvent.d("BSM.setStartLevel").a("startLevel", String.valueOf(i)).g();
this.f33877a.f33896d = i;
}
public void c(final Activity activity) {
CostTimeLite.a("Boot", "BSM.onMainResume");
BootChainEvent.c("BSM.onMainActivityResume");
this.w = false;
Intent intent = activity.getIntent();
StringBuilder sb = new StringBuilder();
sb.append("onMainActivityResume, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
if (!c()) {
b();
K();
} else if (d()) {
this.p.post(new Runnable() {
@Override
public void run() {
BootChainEvent.c("BSM.BootEvent.onActivityResume");
BrowserStateManager.this.l.b(activity);
}
});
}
SplashManager.getInstance().n();
CostTimeLite.b("Boot", "BSM.onMainResume");
}
public void c(boolean z) {
this.v = z;
}
public boolean c() {
return this.h > -1;
}
public boolean c(Intent intent) {
if (intent == null || TextUtils.isEmpty(intent.getDataString())) {
return false;
}
return QBUrlUtils.ab(QBModuleDispather.c(intent));
}
public void d(int i) {
IBoot.IMainStateListener[] iMainStateListenerArr;
ISearchEngineService iSearchEngineService;
Logs.c("BrowserStateManager", "setMainState: " + i);
if (this.y == i) {
return;
}
this.y = i;
ActivityHandler.b().a();
Logs.c("BrowserStateManager", "setMainState: " + i);
if (ActivityHandler.b().n() != null) {
((IServiceManager) QBContext.getInstance().getService(IServiceManager.class)).setBrowserState(i);
int i2 = this.y;
if (i2 == 0) {
if (this.z) {
((IWUPBusiness) QBContext.getInstance().getService(IWUPBusiness.class)).refreshAccountCenterToken(3);
}
} else if (i2 == 1) {
if (((IWUPBusiness) QBContext.getInstance().getService(IWUPBusiness.class)).getIsFirstStart() && !this.z) {
RoutineDaemon.a().a(new Runnable() {
@Override
public void run() {
StatDataUploader.getInstance().a(false, true);
}
}, 5000L);
BeaconStatManager.a().b();
}
this.z = true;
((IWUPBusiness) QBContext.getInstance().getService(IWUPBusiness.class)).doWUPAction(3);
}
if (this.y == 1 && (iSearchEngineService = (ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class)) != null) {
iSearchEngineService.onShutdown();
}
synchronized (this.s) {
iMainStateListenerArr = (IBoot.IMainStateListener[]) this.s.toArray(new IBoot.IMainStateListener[this.s.size()]);
}
for (IBoot.IMainStateListener iMainStateListener : iMainStateListenerArr) {
iMainStateListener.a(this.y);
}
}
}
public void d(Activity activity) {
Intent intent = activity.getIntent();
StringBuilder sb = new StringBuilder();
sb.append("onMainActivityPause, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
if (d()) {
this.l.a(activity);
}
SplashManager.getInstance().o();
}
public void d(final Intent intent) {
if (intent == null) {
Logs.c("BrowserStateManager", "onMainActivityNewIntent, intent: NULL");
return;
}
i(intent);
BootChainEvent.c("BSM.NewIntent");
StringBuilder sb = new StringBuilder();
sb.append("onMainActivityNewIntent, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
boolean a2 = BrowserStateUtils.a(intent);
if (!c()) {
BootChainEvent.c("BSM.NewIntent.isNotStarted");
if (a2) {
BootChainEvent.c("BSM.NewIntent.cancelSplash");
SplashManager.getInstance().cancelSplash();
}
if (BrowserStateUtils.b(intent)) {
BootChainEvent.c("BSM.NewIntent.isBackFromHistory");
return;
} else {
if (a2) {
BootChainEvent.c("BSM.NewIntent.hasValidData");
RecoverManager.getInstance().cancelRecover();
this.f33877a.f33894b = intent;
return;
}
return;
}
}
if (!d()) {
BootChainEvent.c("BSM.NewIntent.isNotRunning");
if (a2 && h()) {
BootChainEvent.c("BSM.NewIntent.removeSplashNow");
SplashManager.getInstance().removeSplashNow();
}
Logs.c("BrowserStateManager", "onMainActivityNewIntent... is not running!!!! cancel!!!");
this.f33877a.f33895c = intent;
return;
}
String c2 = QBModuleDispather.c(intent);
BootChainEvent.d("BSM.NewIntent.GetUrl").a("url", c2).g();
if (QBModuleDispather.a(c2)) {
BootChainEvent.c("BSM.NewIntent.isFunctionActivity");
QBModuleDispather.a(ActivityHandler.b().n(), intent, 2);
return;
}
if (ActivityHandler.b().n() != null) {
BootChainEvent.c("BSM.NewIntent.initCallStatus");
h(intent);
}
this.f33877a.f33895c = intent;
this.p.post(new Runnable() {
@Override
public void run() {
BrowserStateManager.this.e(intent);
BrowserStateManager.this.f33877a.f33895c = null;
}
});
this.l.a(intent);
}
public boolean d() {
return this.h == 1;
}
public void e(Activity activity) {
Intent intent = activity.getIntent();
StringBuilder sb = new StringBuilder();
sb.append("onMainActivityStop, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
SplashManager.getInstance().onActivityBackground(true);
}
void e(Intent intent) {
String str;
StringBuilder sb = new StringBuilder();
sb.append("startbyNewIntent, intent: ");
sb.append(intent);
sb.append(", extras: ");
sb.append(intent.getExtras() != null ? intent.getExtras().toString() : "NULL");
Logs.c("BrowserStateManager", sb.toString());
BootChainEvent.c("BSM.startbyNewIntent");
if (BrowserStateUtils.a(intent)) {
if (f(intent)) {
c(14);
str = "BSM.startbyNewIntent.DEFAULT_BROWSER";
} else if (ActionConstants2.m.equalsIgnoreCase(intent.getAction())) {
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).getAppEngineHandler().sendEmptyMessage(55);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).handleMttMessage(7, 0, 0, null, 0L);
str = "BSM.startbyNewIntent.ACTION_PLUGIN_REFRESH";
}
BootChainEvent.c(str);
return;
}
int c2 = BrowserStateUtils.c(intent);
c(c2);
BootChainEvent.d("BSM.startbyNewIntent.setStartLevel").a("startLevel", String.valueOf(c2)).g();
if ("com.tencent.QQBrowser.action.NETPACKETCAPTURE".equals(intent.getAction())) {
Logs.c("BrowserStateManager", "ACTION_NETPACKETCAPTURE");
BootChainEvent.c("BSM.startbyNewIntent.ACTION_NETPACKETCAPTURE");
WebEngine.e().y();
}
b(intent);
}
public boolean e() {
return this.h == -1;
}
void f(Activity activity) {
Logs.c("BrowserStateManager", "onCreatePrepare:" + activity.getIntent());
h(activity);
g(activity);
}
public boolean f() {
return this.f33877a.e;
}
boolean f(Intent intent) {
if (intent == null) {
return false;
}
if (intent.getBooleanExtra("set_default_browser", false)) {
SettingDefines.f59708a = false;
RotateScreenManager.a().b(null, 5, 2);
FullScreenManager.a().b(null, 128);
MttToaster.show(WebEngine.e().J() ? R.string.po : !WebEngine.e().K() ? R.string.pn : R.string.pp, 0);
return true;
}
if (SettingDefines.f59708a) {
SettingDefines.f59708a = false;
RotateScreenManager.a().b(null, 5, 2);
FullScreenManager.a().b(null, 128);
}
return false;
}
public boolean g() {
return this.f33877a.f;
}
public boolean h() {
return SplashManager.getInstance().checkSplashViewStatus(1);
}
public boolean i() {
return this.j;
}
public boolean j() {
return this.f33877a.l && this.f33877a.m == 1;
}
public void k() {
CostTimeLite.a("Boot", "setContentView");
QbActivityBase qbActivityBase = this.f33877a.f33893a;
View a2 = a((Context) qbActivityBase);
CostTimeLite.a("Boot", "BSM.addFragment");
BrowserFragment browserFragment = ActivityHandler.b().n() == null ? null : ActivityHandler.b().n().getBrowserFragment();
browserFragment.a(a2);
browserFragment.a("browserwindow");
qbActivityBase.addFragment(browserFragment, false);
CostTimeLite.b("Boot", "BSM.addFragment");
CostTimeLite.b("Boot", "setContentView");
((IShareTokenService) QBContext.getInstance().getService(IShareTokenService.class)).startProcessShareToken(1);
ColdBootOasHandler.getInstance().a();
}
public void l() {
if (this.i) {
return;
}
this.i = true;
if (f33876d == 0) {
f33876d = SystemClock.elapsedRealtime();
}
BootChainEvent.c("BSM.prepareBrowserWindow");
BootTracer.b("PREPARE_WINDOW", BootTraceEvent.Type.FRAMEWORK);
Logs.c("BrowserStateManager", "prepareBrowserWindow...");
Logs.c("BrowserStateManager", "prepareBrowserWindow......01");
Logs.c("BrowserStateManager", "prepareBrowserWindow......02");
Logs.c("BrowserStateManager", "prepareBrowserWindow......03");
m();
SkinManager.s();
Logs.c("BrowserStateManager", "prepareBrowserWindow......04");
RotateScreenManager.a().b(false);
if (!BladeFactory.a().b().o()) {
Logs.c("BrowserStateManager", "prepareBrowserWindow......05");
int splashType = SplashManager.getInstance().getSplashType();
if (splashType == 7 || splashType == 1) {
BeaconUploader.a().a(true);
}
}
if (!this.f33877a.l) {
Logs.c("BrowserStateManager", "prepareBrowserWindow: start with empty pageframe");
}
Logs.c("BrowserStateManager", "prepareBrowserWindow......06");
Logs.c("BrowserStateManager", "prepareBrowserWindow: need pageframe: " + this.f33877a.l + ", option: " + ((int) this.f33877a.m));
WindowManager a2 = WindowManager.a(ActivityHandler.b().n());
a2.a(this.f33877a.l, this.f33877a.m, new BrowserWindowListener(), ((IRecover) QBContext.getInstance().getService(IRecover.class)).getSuitableWindowId());
BootTracer.b("PREPARE_WINDOW");
BootChainEvent.c("BSM.prepareBrowserWindow.checkRecover");
q();
QbPreloadProcessManager.getInstance().a(this.f33877a.f33894b);
QbPreloadProcessManager.getInstance().a(this.f33877a.f33894b, 1);
Logs.c("BrowserStateManager", "prepareBrowserWindow......08");
if (!this.f33877a.l) {
BootChainEvent.c("BSM.addTempProgressView");
a2.x().a(this.f33877a.f33894b, RecoverManager.getInstance().needRecover());
}
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).initAppEngineHandler();
Logs.c("BrowserStateManager", "prepareBrowserWindow end");
if (BootFeatureToggle.i()) {
BlockTask.a(BladeFactory.a().a((Application) ContextHolder.getAppContext()), "TASK_AFTER_PREPARE_BROWSERWINDOW");
} else if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_DOODLE_BOOT_OPT_868412641)) {
this.q = new BootCompleteProxy();
}
}
void n() {
this.j = true;
Logs.c("BrowserStateManager", "doAfterBrowserWindowDraw... is running: " + d());
if (d()) {
return;
}
BootChainEvent.c("BSM.doAfterBrowserWindowDraw");
WindowManager.a(ActivityHandler.b().n()).c();
o();
if (h()) {
SplashManager.getInstance().doAfterBrowerWindowDraw();
} else {
r();
}
PushBootStrategy.getInstance().d();
}
void o() {
if (d()) {
return;
}
BootChainEvent.c("BSM.onBrowserWindowShowToUser.startBrowser");
a(this.f33877a.f33894b, false);
if (this.f33877a.e) {
PublicSettingManager.a().setBoolean("key_is_new_version", false);
}
this.l.b();
this.p.post(new Runnable() {
@Override
public void run() {
BrowserStateManager.this.M();
}
});
}
public void p() {
BootChainEvent.c("BSM.startPendingIntent");
Intent intent = this.f33877a.f33895c;
if (intent != null) {
BootChainEvent.c("BSM.startPendingIntent.intent");
this.f33877a.f33895c = null;
c(BrowserStateUtils.c(intent));
b(intent);
}
}
@Deprecated
public void q() {
BootTraceEvent b2 = BootTracer.b("DO_RECOVER", BootTraceEvent.Type.FRAMEWORK);
if (RecoverHelper.c()) {
RecoverManager.getInstance().recover(a().s() == 0 ? (byte) 1 : (byte) 2);
}
if (RecoverManager.getInstance().needRecover()) {
BootChainEvent.c("BSM.doRecover");
if (!RecoverHelper.c()) {
RecoverManager.getInstance().recover((byte) 1);
}
StatManager.b().c("H128");
}
X5DelayLoad.getInstance().c();
RoutineDaemon.a().a(!RecoverManager.getInstance().wasAbnormal() ? new Runnable() {
@Override
public void run() {
IClipboardManager iClipboardManager = (IClipboardManager) QBContext.getInstance().getService(IClipboardManager.class);
ClipboardManager.getInstance();
if (iClipboardManager != null) {
iClipboardManager.showClipboardDraftTipsIfNeed();
}
}
} : new Runnable() {
@Override
public void run() {
ClipboardManager.getInstance();
}
});
b2.a();
}
public void r() {
QbActivityBase n = ActivityHandler.b().n();
if (n != null) {
FullScreenManager a2 = FullScreenManager.a();
Window window = n.getWindow();
if (BaseSettings.a().l()) {
a2.a(window, 16);
} else {
a2.b(window, 16);
}
}
RotateScreenManager.a().b();
}
public int s() {
return this.f33877a.f33896d;
}
public void t() {
BootChainEvent.c("BSM.resetStartLevel");
c(0);
}
public boolean u() {
return this.h == 2;
}
public void v() {
if (ShutManager.i()) {
w();
return;
}
if (u()) {
return;
}
Logs.c("BrowserStateManager", "shutDown...");
this.h = 2;
QbActivityBase n = ActivityHandler.b().n();
if (n != null) {
try {
n.moveTaskToBack(true);
} catch (Exception unused) {
}
}
ActivityHandler.b().g();
this.p.postDelayed(new Runnable() {
@Override
public void run() {
BrowserStateManager.this.x();
}
}, 0L);
}
void w() {
QbActivityBase n;
if (this.w || (n = ActivityHandler.b().n()) == null) {
return;
}
this.w = true;
try {
n.moveTaskToBack(true);
} catch (Exception unused) {
}
}
void x() {
Logs.c("BrowserStateManager", "doShutDown..");
if (ShutManager.g == 1) {
ShutManager.f33931b = 0;
QBShutState.f30682a = ShutManager.f33931b;
}
Logs.c("BrowserStateManager", "RecoverManager.getInstance().onExitApp..");
RecoverManager.getInstance().onExitApp();
Logs.c("BrowserStateManager", "mBootEvent.beforeShutDown..");
this.l.i();
QbActivityBase n = ActivityHandler.b().n();
if (n != null) {
Logs.c("BrowserStateManager", "finish MainActivity...");
n.finish();
}
y();
ShutManager.c();
Logs.c("BrowserStateManager", "ShutingState excute end");
}
void y() {
Logs.c("BrowserStateManager", "checkDestory...");
this.p.postDelayed(new Runnable() {
@Override
public void run() {
Logs.c("BrowserStateManager", "*** Exit application. Force Close");
QbActivityBase n = ActivityHandler.b().n();
if (n != null) {
BrowserStateManager.this.a((Activity) n);
}
}
}, MMTipsBar.DURATION_SHORT);
}
void z() {
CostTimeLite.a("Boot", "prepare-rn");
BeaconUploader.a().a(true);
QBHippyEngineManager.getInstance().preloadFeedsEngineByBoot();
CostTimeLite.b("Boot", "prepare-rn");
}
}