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

Commit c6c95108 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I8cd05bdd,Idc0e0b02 into main

* changes:
  Wait for button in UiBot.clickDialog{Ok,Cancel}Button()
  Use the correct operation type in CompressJob's c'tor
parents c61ec2c3 a0366f96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.documentsui.services;

import static android.content.ContentResolver.wrap;

import static com.android.documentsui.services.FileOperationService.OPERATION_MOVE;
import static com.android.documentsui.services.FileOperationService.OPERATION_COMPRESS;
import static com.android.documentsui.util.Material3Config.getRes;

import android.app.Notification;
@@ -59,7 +59,7 @@ final class CompressJob extends CopyJob {
     */
    CompressJob(Context service, Listener listener, String id, DocumentStack destination,
            UrisSupplier srcs, Messenger messenger, Features features) {
        super(service, listener, id, OPERATION_MOVE, destination, srcs, messenger, features);
        super(service, listener, id, OPERATION_COMPRESS, destination, srcs, messenger, features);
    }

    @Override
+13 −6
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ public class UiBot extends Bots.BaseBot {
    }

    /** Clicks the OK button on a dialog. */
    public void clickDialogOkButton(boolean closeSoftKeyboard) {
    public void clickDialogOkButton(boolean closeSoftKeyboard) throws UiObjectNotFoundException {
        // On dialogs with no text input, a soft keyboard doesn't show up at all and attempting to
        // close it causes failures. Let's be intentional about the closure only on dialogs which
        // have text input.
@@ -363,12 +363,16 @@ public class UiBot extends Bots.BaseBot {
            // before trying to click on any dialog button
            Espresso.closeSoftKeyboard();
        }
        UiObject2 okButton = mDevice.findObject(By.res("android:id/button1"));
        okButton.click();

        final UiObject2 button = mDevice.wait(Until.findObject(By.res("android:id/button1")),
                mTimeout);
        if (button == null) throw new UiObjectNotFoundException("Cannot find an 'OK' button");
        button.click();
    }

    /** Clicks the Cancel button on a dialog. */
    public void clickDialogCancelButton(boolean closeSoftKeyboard) {
    public void clickDialogCancelButton(boolean closeSoftKeyboard)
            throws UiObjectNotFoundException {
        // On dialogs with no text input, a soft keyboard doesn't show up at all and attempting to
        // close it causes failures. Let's be intentional about the closure only on dialogs which
        // have text input.
@@ -377,8 +381,11 @@ public class UiBot extends Bots.BaseBot {
            // before trying to click on any dialog button
            Espresso.closeSoftKeyboard();
        }
        UiObject2 okButton = mDevice.findObject(By.res("android:id/button2"));
        okButton.click();

        final UiObject2 button = mDevice.wait(Until.findObject(By.res("android:id/button2")),
                mTimeout);
        if (button == null) throw new UiObjectNotFoundException("Cannot find a 'Cancel' button");
        button.click();
    }

    public UiObject findMenuLabelWithName(String label) {