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

Commit 7b67cfb2 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30801113',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30801113', 'googleplex-android-review.googlesource.com/31084350', 'googleplex-android-review.googlesource.com/31015354', 'googleplex-android-review.googlesource.com/31144159', 'googleplex-android-review.googlesource.com/30873794', 'googleplex-android-review.googlesource.com/31234540'] into 25Q1-release.

Change-Id: I1f4f86beb4513d2529b1cc5289e981ee36fe003b
parents bae20314 ab157667
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -107,8 +107,11 @@ public class DragUtils {
    /**
     * Returns a list of the mime types provided in the clip description.
     */
    public static String getMimeTypesConcatenated(ClipDescription description) {
    public static String getMimeTypesConcatenated(@Nullable ClipDescription description) {
        String mimeTypes = "";
        if (description == null) {
            return mimeTypes;
        }
        for (int i = 0; i < description.getMimeTypeCount(); i++) {
            if (i > 0) {
                mimeTypes += ", ";
+2 −3
Original line number Diff line number Diff line
@@ -152,17 +152,16 @@ public class DragAndDropControllerTest extends ShellTestCase {
    }

    @Test
    public void testOnDragStarted_withNoClipData() {
    public void testOnDragStarted_withNoClipDataOrDescription() {
        final View dragLayout = mock(View.class);
        final Display display = mock(Display.class);
        doReturn(display).when(dragLayout).getDisplay();
        doReturn(DEFAULT_DISPLAY).when(display).getDisplayId();

        final ClipData clipData = createAppClipData(MIMETYPE_APPLICATION_SHORTCUT);
        final DragEvent event = mock(DragEvent.class);
        doReturn(ACTION_DRAG_STARTED).when(event).getAction();
        doReturn(null).when(event).getClipData();
        doReturn(clipData.getDescription()).when(event).getClipDescription();
        doReturn(null).when(event).getClipDescription();

        // Ensure there's a target so that onDrag will execute
        mController.addDisplayDropTarget(0, mContext, mock(WindowManager.class),
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.packageinstaller;
import static android.Manifest.permission;
import static android.content.pm.PackageManager.GET_PERMISSIONS;
import static android.content.pm.PackageManager.MATCH_ARCHIVED_PACKAGES;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import android.app.Activity;
import android.app.DialogFragment;
@@ -53,6 +54,8 @@ public class UnarchiveActivity extends Activity {

    @Override
    public void onCreate(Bundle icicle) {
        getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);

        super.onCreate(null);

        int callingUid = getLaunchedFromUid();
+30 −1
Original line number Diff line number Diff line
@@ -21,10 +21,14 @@ import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.Button;

public class UnarchiveFragment extends DialogFragment implements
        DialogInterface.OnClickListener {

    private Dialog mDialog;
    private Button mRestoreButton;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        String appTitle = getArguments().getString(UnarchiveActivity.APP_TITLE);
@@ -40,7 +44,32 @@ public class UnarchiveFragment extends DialogFragment implements
        dialogBuilder.setPositiveButton(R.string.restore, this);
        dialogBuilder.setNegativeButton(android.R.string.cancel, this);

        return dialogBuilder.create();
        mDialog = dialogBuilder.create();
        return mDialog;
    }

    @Override
    public void onStart() {
        super.onStart();
        if (mDialog != null) {
            mRestoreButton = ((AlertDialog) mDialog).getButton(DialogInterface.BUTTON_POSITIVE);
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if (mRestoreButton != null) {
            mRestoreButton.setEnabled(false);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (mRestoreButton != null) {
            mRestoreButton.setEnabled(true);
        }
    }

    @Override
+13 −10
Original line number Diff line number Diff line
@@ -47,19 +47,19 @@ import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.StringRes;

import com.android.packageinstaller.common.EventResultPersister;
import com.android.packageinstaller.common.UninstallEventReceiver;
import com.android.packageinstaller.handheld.ErrorDialogFragment;
import com.android.packageinstaller.handheld.UninstallAlertDialogFragment;
import com.android.packageinstaller.television.ErrorFragment;
import com.android.packageinstaller.television.UninstallAlertFragment;
import com.android.packageinstaller.television.UninstallAppProgress;
import com.android.packageinstaller.common.EventResultPersister;
import com.android.packageinstaller.common.UninstallEventReceiver;
import com.android.packageinstaller.v2.ui.UninstallLaunch;

import java.util.List;

/*
 * This activity presents UI to uninstall an application. Usually launched with intent
 * Intent.ACTION_UNINSTALL_PKG_COMMAND and attribute
@@ -181,14 +181,17 @@ public class UninstallerActivity extends Activity {
        if (mDialogInfo.user == null) {
            mDialogInfo.user = Process.myUserHandle();
        } else {
            List<UserHandle> profiles = userManager.getUserProfiles();
            if (!profiles.contains(mDialogInfo.user)) {
            if (mDialogInfo.user != Process.myUserHandle()) {
                final boolean isCurrentUserProfileOwner =
                        (Process.myUserHandle() == userManager.getProfileParent(mDialogInfo.user));
                if (!isCurrentUserProfileOwner) {
                    Log.e(TAG, "User " + Process.myUserHandle() + " can't request uninstall "
                            + "for user " + mDialogInfo.user);
                    showUserIsNotAllowed();
                    return;
                }
            }
        }

        mDialogInfo.callback = intent.getParcelableExtra(PackageInstaller.EXTRA_CALLBACK,
                                            PackageManager.UninstallCompleteCallback.class);
Loading