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

Commit e91a57be authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[pm/unarchival] allow error handling dialogs to be started from...

Merge "[pm/unarchival] allow error handling dialogs to be started from background after user confirmation" into main am: 139f9bb9 am: 052eff4f

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3219535



Change-Id: I59416d5256e84506f987220df28b92f5ea452995
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c1086519 052eff4f
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package com.android.packageinstaller;

import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.BroadcastOptions;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.PendingIntent;
@@ -161,25 +163,31 @@ public class UnarchiveErrorFragment extends DialogFragment implements
            return;
        }

        // Allow the error handling actvities to start in the background.
        final BroadcastOptions options = BroadcastOptions.makeBasic();
        options.setPendingIntentBackgroundActivityStartMode(
                MODE_BACKGROUND_ACTIVITY_START_ALLOWED);
        switch (mStatus) {
            case PackageInstaller.UNARCHIVAL_ERROR_USER_ACTION_NEEDED:
                activity.startIntentSender(mExtraIntent.getIntentSender(), /* fillInIntent= */
                        null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0);
                        null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0,
                        options.toBundle());
                break;
            case PackageInstaller.UNARCHIVAL_ERROR_INSUFFICIENT_STORAGE:
                if (mExtraIntent != null) {
                    activity.startIntentSender(mExtraIntent.getIntentSender(), /* fillInIntent= */
                            null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0);
                            null, /* flagsMask= */ 0, FLAG_ACTIVITY_NEW_TASK, /* extraFlags= */ 0,
                            options.toBundle());
                } else {
                    Intent intent = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE");
                    startActivity(intent);
                    startActivity(intent, options.toBundle());
                }
                break;
            case PackageInstaller.UNARCHIVAL_ERROR_INSTALLER_DISABLED:
                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                Uri uri = Uri.fromParts("package", mInstallerPackageName, null);
                intent.setData(uri);
                startActivity(intent);
                startActivity(intent, options.toBundle());
                break;
            default:
                // Do nothing. The rest of the dialogs are purely informational.