summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tommy Webb <tommy@calyxinstitute.org> 2024-02-23 03:45:50 +0000
committer Song Chun Fan <schfan@google.com> 2024-02-23 18:14:40 +0000
commitcf4e62bce4856ce3dbec35c5dc4c1bf3cebbf711 (patch)
tree788f831b9b3931c5839d02728cd3195c62ca1abc
parentea0c498c63b10c0e13cb47dd4f5d243018216474 (diff)
Fix unknown sources app install confirmation
Allow the package install confirmation dialog to appear properly after the user turns on unknown sources. Also fix an incorrect session ID of -1 being shown in related log warnings. "Finish PIA if UnknownSourcesListener would like to start a PIA again" is a change that caused this feature to fail for third-party app stores. This change resolves that issue. Issue: calyxos#2081 Test: atest CtsPackageInstallTestCases Test: Manual: Install a third-party app store e.g. F-Droid. Try to install an app. Tap Settings on the prompt to configure unknown sources. Tap to turn on unknown sources. The install confirmation dialog appears. BUG: 326612529 Change-Id: Idd6667cbd79945d849b74a62122162ae72d99210
-rw-r--r--packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
index 8cb25dc637d4..bb05a75d8306 100644
--- a/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/packages/PackageInstaller/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -368,7 +368,7 @@ public class PackageInstallerActivity extends AlertActivity {
final SessionInfo info = mInstaller.getSessionInfo(sessionId);
String resolvedPath = info != null ? info.getResolvedBaseApkPath() : null;
if (info == null || !info.isSealed() || resolvedPath == null) {
- Log.w(TAG, "Session " + mSessionId + " in funky state; ignoring");
+ Log.w(TAG, "Session " + sessionId + " in funky state; ignoring");
finish();
return;
}
@@ -383,7 +383,7 @@ public class PackageInstallerActivity extends AlertActivity {
-1 /* defaultValue */);
final SessionInfo info = mInstaller.getSessionInfo(sessionId);
if (info == null || !info.isPreApprovalRequested()) {
- Log.w(TAG, "Session " + mSessionId + " in funky state; ignoring");
+ Log.w(TAG, "Session " + sessionId + " in funky state; ignoring");
finish();
return;
}
@@ -797,7 +797,9 @@ public class PackageInstallerActivity extends AlertActivity {
// work for the multiple user case, i.e. the caller task user and started
// Activity user are not the same. To avoid having multiple PIAs in the task,
// finish the current PackageInstallerActivity
- finish();
+ // Because finish() is overridden to set the installation result, we must use
+ // the original finish() method, or the confirmation dialog fails to appear.
+ PackageInstallerActivity.super.finish();
}
}, 500);