Crash fix for accessing DocumentInfo.derivedUri when in Recents.

Bug: 33371320
Change-Id: Ib04dfce6073dc03e4a3711f767b52de05174748a
diff --git a/src/com/android/documentsui/TimeoutTask.java b/src/com/android/documentsui/TimeoutTask.java
index 5fb20cf..57b119e 100644
--- a/src/com/android/documentsui/TimeoutTask.java
+++ b/src/com/android/documentsui/TimeoutTask.java
@@ -19,6 +19,7 @@
 import android.annotation.CallSuper;
 import android.os.AsyncTask;
 import android.os.Handler;
+import android.os.Looper;
 
 import com.android.documentsui.base.CheckedTask;
 import com.android.documentsui.base.DocumentInfo;
@@ -48,7 +49,9 @@
             return;
         }
 
-        Handler handler = new Handler();
+        // Need to initialize handler to main Looper so it can initialize correctly in test cases
+        // Instrumentation threads don't have looper initialized
+        Handler handler = new Handler(Looper.getMainLooper());
         handler.postDelayed(() -> {
             if (getStatus() == AsyncTask.Status.RUNNING) {
                 onTimeout();