Loading tests/functional/com/android/documentsui/FileCopyUiTest.java +16 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.SystemClock; import android.provider.Settings; import android.support.test.uiautomator.UiObjectNotFoundException; import android.text.TextUtils; import android.util.Log; Loading Loading @@ -172,27 +173,38 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { public void tearDown() throws Exception { // Delete created files deleteDocuments(mDeviceLabel); try { deleteDocuments(mSdCardLabel); } catch (UiObjectNotFoundException e) { Log.d(TAG, "SD Card ejected unexpectedly. ", e); mSdCardRoot = null; mSdCardLabel = null; } for (RootAndFolderPair rootAndFolder : mFoldersToCleanup) { deleteDocuments(rootAndFolder.root, rootAndFolder.folder); } // Eject virtual SD card if (mIsVirtualSdCard) { if (mIsVirtualSdCard && mSdCardRoot != null) { device.executeShellCommand("sm set-virtual-disk false"); while (mSdCardRoot != null) { int attempts = 0; while (mSdCardRoot != null && attempts++ < 15) { List<RootInfo> rootList = mStorageDocsHelper.getRootList(); boolean sdCardRootHidden = true; for (RootInfo info : rootList) { if (info.isSd()) { sdCardRootHidden = false; SystemClock.sleep(1000); break; } } if (sdCardRootHidden) { mSdCardRoot = null; mSdCardLabel = null; } } assertNull("Cannot eject virtual SD Card", mSdCardRoot); } device.executeShellCommand("settings put global stay_on_while_plugged_in " Loading Loading
tests/functional/com/android/documentsui/FileCopyUiTest.java +16 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.SystemClock; import android.provider.Settings; import android.support.test.uiautomator.UiObjectNotFoundException; import android.text.TextUtils; import android.util.Log; Loading Loading @@ -172,27 +173,38 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> { public void tearDown() throws Exception { // Delete created files deleteDocuments(mDeviceLabel); try { deleteDocuments(mSdCardLabel); } catch (UiObjectNotFoundException e) { Log.d(TAG, "SD Card ejected unexpectedly. ", e); mSdCardRoot = null; mSdCardLabel = null; } for (RootAndFolderPair rootAndFolder : mFoldersToCleanup) { deleteDocuments(rootAndFolder.root, rootAndFolder.folder); } // Eject virtual SD card if (mIsVirtualSdCard) { if (mIsVirtualSdCard && mSdCardRoot != null) { device.executeShellCommand("sm set-virtual-disk false"); while (mSdCardRoot != null) { int attempts = 0; while (mSdCardRoot != null && attempts++ < 15) { List<RootInfo> rootList = mStorageDocsHelper.getRootList(); boolean sdCardRootHidden = true; for (RootInfo info : rootList) { if (info.isSd()) { sdCardRootHidden = false; SystemClock.sleep(1000); break; } } if (sdCardRootHidden) { mSdCardRoot = null; mSdCardLabel = null; } } assertNull("Cannot eject virtual SD Card", mSdCardRoot); } device.executeShellCommand("settings put global stay_on_while_plugged_in " Loading