— a/packages/apps/PackageInstaller/src/com/android/packageinstaller/InstallAppProgress.java
+++ b/packages/apps/PackageInstaller/src/com/android/packageinstaller/InstallAppProgress.java
@@ -58,6 +58,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
+import android.content.ComponentName;
/**
- This activity corresponds to a download progress screen that is displayed
@@ -101,6 +102,29 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
clearCachedApkIfNeededAndFinish();
return;
}
-
if (getIntent().getBooleanExtra("AutoInstall", false) && msg.arg1 == PackageManager.INSTALL_SUCCEEDED) {
-
Intent mIntent = getPackageManager().getLaunchIntentForPackage(
-
mAppInfo.packageName);
-
boolean enabled = false;
-
if(mIntent != null) {
-
List<ResolveInfo> list = getPackageManager().
-
queryIntentActivities(mIntent, 0);
-
if (list != null && list.size() > 0) {
-
enabled = true;
-
}
-
}
-
if (enabled && "com.antutu.benchmark.full".equals(mAppInfo.packageName)) {//如果自动安装的apk是antutufull(3dTest),则>安装完成后自动启动测试
-
Intent intent = new Intent("com.antutu.benchmark.full.MAROONED_RUN");
-
intent.setFlags(335544320);
-
intent.setComponent(new ComponentName("com.antutu.benchmark.full", "com.antutu.benchmark.full.UnityPlayerActivity"));
-
intent.putExtra("uid", "8939");
-
startActivity(intent);
-
//startActivity(mIntent);
-
}
-
finish();
-
return;
-
}
// Update the status text
mProgressBar.setVisibility(View.GONE);
// Show the ok button
diff --git a/packages/apps/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java b/packages/apps/PackageInstaller/src/com/android/packageinstaller/Pack
index de68582…b85b767 100644
— a/packages/apps/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/packages/apps/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -120,6 +120,35 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
private static final int DLG_NOT_SUPPORTED_ON_WEAR = DLG_BASE + 7;
private void startInstallConfirm() {
-
if(mAutoInstall)
-
{
-
Intent newIntent = new Intent();
-
newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO,
-
mPkgInfo.applicationInfo);
-
newIntent.setData(mPackageURI);
-
newIntent.setClass(this, InstallAppProgress.class);
-
String installerPackageName = getIntent().getStringExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME);
-
if (mOriginatingURI != null) {
-
newIntent.putExtra(Intent.EXTRA_ORIGINATING_URI, mOriginatingURI);
-
}
-
if (mReferrerURI != null) {
-
newIntent.putExtra(Intent.EXTRA_REFERRER, mReferrerURI);
-
}
-
if (mOriginatingUid != VerificationParams.NO_UID) {
-
newIntent.putExtra(Intent.EXTRA_ORIGINATING_UID, mOriginatingUid);
-
}
-
if (installerPackageName != null) {
-
newIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME,installerPackageName);
-
}
-
if (getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false)) {
-
newIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
-
newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-
}
-
newIntent.putExtra("AutoInstall", true);
-
if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI);
设计模式学习笔记
设计模式系列学习视频
参考docs.qq.com/doc/DSkNLaERkbnFoS0ZF
模式学习笔记
[外链图片转存中…(img-L6Ik4Bux-1724497248710)]
设计模式系列学习视频
[外链图片转存中…(img-cvPdIDQp-1724497248711)]
参考docs.qq.com/doc/DSkNLaERkbnFoS0ZF