Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a1b34a7 authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[ADI][54/N] bring back AppNotInstalled dialog

Based on the latest UX design, we still need the AppNotInstalled dialog
to inform the user that the app was not installed after the user
declines in the ADI verification dialog. We also want to disable
clicking outside of the dialog so that the only way to dismiss the
dialog is to click on the button(s).

BUG: 360129657
FLAG: android.content.pm.verification_service
Test: manual

Change-Id: I98a3b849d224c2bba7b8049d65a0de280843f710
parent 1933f823
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -1087,16 +1087,9 @@ class InstallRepository(private val context: Context) {
            // InstallFailed dialog must not be shown only when the user denies ownership update. We
            // must show this dialog for all other install failures.

            // Since API 36.1, InstallFailed dialog must not be shown if the installation failed
            // because of the developer verification failure.
            val developerVerificationFailed = Flags.verificationService()
                    && statusCode == PackageInstaller.STATUS_FAILURE_ABORTED
                    && hasDeveloperVerificationFailure

            val userDenied = developerVerificationFailed ||
                    (statusCode == PackageInstaller.STATUS_FAILURE_ABORTED &&
            val userDenied = statusCode == PackageInstaller.STATUS_FAILURE_ABORTED &&
                            legacyStatus != PackageManager.INSTALL_FAILED_VERIFICATION_TIMEOUT &&
                            legacyStatus != PackageManager.INSTALL_FAILED_VERIFICATION_FAILURE)
                            legacyStatus != PackageManager.INSTALL_FAILED_VERIFICATION_FAILURE

            if (shouldReturnResult) {
                val resultIntent = Intent().putExtra(Intent.EXTRA_INSTALL_RESULT, legacyStatus)
+7 −2
Original line number Diff line number Diff line
@@ -311,13 +311,18 @@ class InstallLaunch : FragmentActivity(), InstallActionListener {
        if (localLogv) {
            Log.d(LOG_TAG, "Negative button clicked. StageCode: $stageCode")
        }
        var resultCode = RESULT_CANCELED
        when (stageCode) {
            InstallStage.STAGE_USER_ACTION_REQUIRED -> installViewModel!!.cleanupInstall()
            InstallStage.STAGE_STAGING -> installViewModel!!.abortStaging()
            InstallStage.STAGE_VERIFICATION_CONFIRMATION_REQUIRED ->
            InstallStage.STAGE_VERIFICATION_CONFIRMATION_REQUIRED -> {
                // Developer verification requested user action and user has declined to continue
                // the installation. Don't abandon the session. Let the installation fail through.
                resultCode = RESULT_OK
                installViewModel!!.onNegativeVerificationUserResponse()
            }
        setResult(RESULT_CANCELED, null, true)
        }
        setResult(resultCode, null, true)
    }

    override fun onNegativeResponse(resultCode: Int, data: Intent?) {
+6 −1
Original line number Diff line number Diff line
@@ -640,6 +640,8 @@ public class InstallationFragment extends DialogFragment {
        mCustomMessageTextView.setVisibility(View.VISIBLE);
        mIndeterminateProgressBar.setVisibility(View.GONE);
        mProgressBar.setVisibility(View.GONE);
        // Disable clicking outside of the dialog
        this.setCancelable(false);

        mAppIcon.setImageDrawable(installStage.getAppIcon());
        mAppLabelTextView.setText(installStage.getAppLabel());
@@ -665,7 +667,10 @@ public class InstallationFragment extends DialogFragment {
            negativeButton.setFilterTouchesWhenObscured(true);
            UiUtil.applyOutlinedButtonStyle(requireContext(), negativeButton);
            negativeButton.setOnClickListener(view -> {
                mInstallActionListener.onNegativeResponse(installStage.getStageCode());
                // Don't use installStage.getStageCode() here because it can be
                // STAGE_USER_ACTION_REQUIRED if the installation is triggered by Pia itself.
                mInstallActionListener.onNegativeResponse(
                        InstallStage.STAGE_VERIFICATION_CONFIRMATION_REQUIRED);
            });
        }
        // Hide positive button