从oncreate开始分析
protected void onCreate(Bundle icicle) {
443 super.onCreate(icicle);
444 这个是用来管理已经安装的app包
445 mPm = getPackageManager();
446 mInstaller = mPm.getPackageInstaller();
447 mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
448
449 final Intent intent = getIntent();
450 ……
设置了mPackageURI mOriginatingURI mReferrerURI 三个重要参数
463 } else {
464 mSessionId = -1;
465 mPackageURI = intent.getData();
466 mOriginatingURI = intent.getParcelableExtra(Intent.EXTRA_ORIGINATING_URI);
467 mReferrerURI = intent.getParcelableExtra(Intent.EXTRA_REFERRER);
468 }
469
470 final boolean unknownSourcesAllowedByAdmin = isUnknownSourcesAllowedByAdmin();
471 final boolean unknownSourcesAllowedByUser = isUnknownSourcesEnabled();
472
473 boolean requestFromUnknownSource = isInstallRequestFromUnknownSource(intent);
474 mInstallFlowAnalytics = new InstallFlowAnalytics();
475 mInstallFlowAnalytics.setContext(this);
476 mInstallFlowAnalytics.setStartTimestampMillis(SystemClock.elapsedRealtime());
477 mInstallFlowAnalytics.setInstallsFromUnknownSourcesPermitted(unknownSourcesAllowedByAdmin
478 && unknownSourcesAllowedByUser);
479 mInstallFlowAnalytics.setInstallRequestFromUnknownSource(requestFromUnknownSource);
480 mInstallFlowAnalytics.setVerifyAppsEnabled(isVerifyAppsEnabled());
481 mInstallFlowAnalytics.setAppVerifierInstalled(isAppVerifierInstalled());
482 mInstallFlowAnalytics.setPackageUri(mPackageURI.toString());
483
484 final String scheme = mPackageURI.getScheme();
485 ……
493
494 final PackageUtil.AppSnippet as;
495 if ("package".equals(mPackageURI.getScheme())) {
496 mInstallFlowAnalytics.setFileUri(false);
PackageInstallerActivity 分析
最新推荐文章于 2024-05-08 05:36:24 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)