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

Commit 51fd45cd authored by Sahana Rao's avatar Sahana Rao
Browse files

Wait for MediaStore idle state to reduce the test flake

Add MediaStore#waitForIdle to wait for the media mount.

Bug: 231531636
Test: atest
DocumentsUIGoogleTests:FileCopyUiTest#testRecursiveCopyDocuments_InternalStorageToDownloadsProvider
--iterations 10

Change-Id: Iebf525bcb77948fe265e23917f4cce53dc93f46d
parent 25750e5d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.text.TextUtils;
@@ -131,6 +132,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
        mPreTestStayAwakeValue = Settings.Global.getInt(context.getContentResolver(),
                Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
        device.executeShellCommand("settings put global stay_on_while_plugged_in 3");
        MediaStore.waitForIdle(context.getContentResolver());

        mDeviceLabel = Settings.Global.getString(context.getContentResolver(),
                Settings.Global.DEVICE_NAME);