Merge "Remove the resolved path of session's APK from user confirmation intent" into udc-dev
This commit is contained in:
@@ -3553,6 +3553,18 @@ public class PackageInstaller {
|
||||
return referrerUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the path to the validated base APK for this session, which may point at an
|
||||
* APK inside the session (when the session defines the base), or it may
|
||||
* point at the existing base APK (when adding splits to an existing app).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.READ_INSTALLED_SESSION_PATHS)
|
||||
public @Nullable String getResolvedBaseApkPath() {
|
||||
return resolvedBaseCodePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value set in {@link SessionParams#setGrantedRuntimePermissions(String[])}.
|
||||
*
|
||||
|
||||
@@ -5418,6 +5418,15 @@
|
||||
<permission android:name="android.permission.INSTALL_DPC_PACKAGES"
|
||||
android:protectionLevel="signature|role" />
|
||||
|
||||
<!-- Allows an application to read resolved paths to the APKs (Base and any splits)
|
||||
of a session based install.
|
||||
<p>Not for use by third-party applications.
|
||||
@hide
|
||||
-->
|
||||
<permission android:name="android.permission.READ_INSTALLED_SESSION_PATHS"
|
||||
android:protectionLevel="signature|installer" />
|
||||
<uses-permission android:name="android.permission.READ_INSTALLED_SESSION_PATHS" />
|
||||
|
||||
<!-- Allows an application to use System Data Loaders.
|
||||
<p>Not for use by third-party applications.
|
||||
@hide
|
||||
|
||||
@@ -39,8 +39,7 @@ android_app {
|
||||
|
||||
certificate: "platform",
|
||||
privileged: true,
|
||||
platform_apis: false,
|
||||
sdk_version: "system_current",
|
||||
platform_apis: true,
|
||||
rename_resources_package: false,
|
||||
static_libs: [
|
||||
"xz-java",
|
||||
@@ -57,8 +56,7 @@ android_app {
|
||||
|
||||
certificate: "platform",
|
||||
privileged: true,
|
||||
platform_apis: false,
|
||||
sdk_version: "system_current",
|
||||
platform_apis: true,
|
||||
rename_resources_package: false,
|
||||
overrides: ["PackageInstaller"],
|
||||
|
||||
@@ -77,8 +75,7 @@ android_app {
|
||||
|
||||
certificate: "platform",
|
||||
privileged: true,
|
||||
platform_apis: false,
|
||||
sdk_version: "system_current",
|
||||
platform_apis: true,
|
||||
rename_resources_package: false,
|
||||
overrides: ["PackageInstaller"],
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_INSTALL_SESSIONS" />
|
||||
<uses-permission android:name="android.permission.READ_INSTALLED_SESSION_PATHS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
|
||||
<uses-permission android:name="android.permission.USE_RESERVED_DISK" />
|
||||
|
||||
@@ -375,16 +375,15 @@ public class PackageInstallerActivity extends AlertActivity {
|
||||
final int sessionId = intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID,
|
||||
-1 /* defaultValue */);
|
||||
final SessionInfo info = mInstaller.getSessionInfo(sessionId);
|
||||
final String resolvedBaseCodePath = intent.getStringExtra(
|
||||
PackageInstaller.EXTRA_RESOLVED_BASE_PATH);
|
||||
if (info == null || !info.isSealed() || resolvedBaseCodePath == null) {
|
||||
String resolvedPath = info.getResolvedBaseApkPath();
|
||||
if (info == null || !info.isSealed() || resolvedPath == null) {
|
||||
Log.w(TAG, "Session " + mSessionId + " in funky state; ignoring");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
mSessionId = sessionId;
|
||||
packageSource = Uri.fromFile(new File(resolvedBaseCodePath));
|
||||
packageSource = Uri.fromFile(new File(resolvedPath));
|
||||
mOriginatingURI = null;
|
||||
mReferrerURI = null;
|
||||
mPendingUserActionReason = info.getPendingUserActionReason();
|
||||
|
||||
@@ -1148,8 +1148,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
info.userId = userId;
|
||||
info.installerPackageName = mInstallSource.mInstallerPackageName;
|
||||
info.installerAttributionTag = mInstallSource.mInstallerAttributionTag;
|
||||
info.resolvedBaseCodePath = (mResolvedBaseFile != null) ?
|
||||
mResolvedBaseFile.getAbsolutePath() : null;
|
||||
if (mContext.checkCallingOrSelfPermission(
|
||||
Manifest.permission.READ_INSTALLED_SESSION_PATHS)
|
||||
== PackageManager.PERMISSION_GRANTED && mResolvedBaseFile != null) {
|
||||
info.resolvedBaseCodePath = mResolvedBaseFile.getAbsolutePath();
|
||||
} else {
|
||||
info.resolvedBaseCodePath = null;
|
||||
}
|
||||
info.progress = progress;
|
||||
info.sealed = mSealed;
|
||||
info.isCommitted = isCommitted();
|
||||
@@ -2754,11 +2759,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
: PackageInstaller.ACTION_CONFIRM_INSTALL);
|
||||
intent.setPackage(mPm.getPackageInstallerPackageName());
|
||||
intent.putExtra(PackageInstaller.EXTRA_SESSION_ID, sessionId);
|
||||
synchronized (mLock) {
|
||||
intent.putExtra(PackageInstaller.EXTRA_RESOLVED_BASE_PATH,
|
||||
mResolvedBaseFile != null ? mResolvedBaseFile.getAbsolutePath() : null);
|
||||
}
|
||||
|
||||
sendOnUserActionRequired(mContext, target, sessionId, intent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user