summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrich cannings <richc@google.com>2012-08-20 15:02:01 -0700
committerrich cannings <richc@google.com>2012-08-20 15:02:01 -0700
commit916ad007619e025218665298ef9793c152ced070 (patch)
treef1cf714a7b244a41f13ded7fd0a20d07a87868a8
parent319efc1c099a0c0c516d3a0d3d110c8608c9eee9 (diff)
downloadandroid_packages_apps_PackageInstaller-916ad007619e025218665298ef9793c152ced070.zip
android_packages_apps_PackageInstaller-916ad007619e025218665298ef9793c152ced070.tar.gz
android_packages_apps_PackageInstaller-916ad007619e025218665298ef9793c152ced070.tar.bz2
Accept and pass URLs to PackageManagerService
This change passes the originating URI and referrer of an apk, when available, to the package manager. Bug: 6544677 Change-Id: I1431b0e02eb779d9699e282ae59aaab485a00626
-rwxr-xr-xsrc/com/android/packageinstaller/InstallAppProgress.java9
-rw-r--r--src/com/android/packageinstaller/PackageInstallerActivity.java10
2 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/packageinstaller/InstallAppProgress.java b/src/com/android/packageinstaller/InstallAppProgress.java
index 8bfcd4f..a2feacf 100755
--- a/src/com/android/packageinstaller/InstallAppProgress.java
+++ b/src/com/android/packageinstaller/InstallAppProgress.java
@@ -28,6 +28,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
+import android.content.pm.VerificationParams;
import android.graphics.drawable.LevelListDrawable;
import android.net.Uri;
import android.os.Bundle;
@@ -243,8 +244,14 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
String installerPackageName = getIntent().getStringExtra(
Intent.EXTRA_INSTALLER_PACKAGE_NAME);
+ Uri originatingURI = getIntent().getParcelableExtra(Intent.EXTRA_ORIGINATING_URI);
+ Uri referrer = getIntent().getParcelableExtra(Intent.EXTRA_REFERRER);
+ VerificationParams verificationParams = new VerificationParams(null, originatingURI,
+ referrer, null);
PackageInstallObserver observer = new PackageInstallObserver();
- pm.installPackage(mPackageURI, observer, installFlags, installerPackageName);
+
+ pm.installPackageWithVerificationAndEncryption(mPackageURI, observer, installFlags,
+ installerPackageName, verificationParams, null);
}
@Override
diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java
index 9963103..6069748 100644
--- a/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -61,6 +61,8 @@ import java.util.ArrayList;
public class PackageInstallerActivity extends Activity implements OnCancelListener, OnClickListener {
private static final String TAG = "PackageInstaller";
private Uri mPackageURI;
+ private Uri mOriginatingURI;
+ private Uri mReferrerURI;
private boolean localLOGV = false;
PackageManager mPm;
PackageParser.Package mPkgInfo;
@@ -284,6 +286,8 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
// get intent information
final Intent intent = getIntent();
mPackageURI = intent.getData();
+ mOriginatingURI = intent.getParcelableExtra(Intent.EXTRA_ORIGINATING_URI);
+ mReferrerURI = intent.getParcelableExtra(Intent.EXTRA_REFERRER);
mPm = getPackageManager();
final String scheme = mPackageURI.getScheme();
@@ -364,6 +368,12 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
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 (installerPackageName != null) {
newIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, installerPackageName);
}