Skip to content
Snippets Groups Projects
Commit cf4e62bc authored by Tommy Webb's avatar Tommy Webb Committed by Song Chun Fan
Browse files

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
parent ea0c498c
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment