From bc849d6159c3e0846e79fa534808a7d52fc49daf Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 14 Feb 2020 12:23:31 -0800 Subject: [PATCH] Using unstable client for fetching test info for oop tests Bug: 157661745 Change-Id: Ifbb211f9bbaa444df682145a0a9e82c5d0f24bdf --- .../android/launcher3/tapl/LauncherInstrumentation.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 9c92a26972..9a5b4d72bc 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -28,6 +28,7 @@ import android.app.ActivityManager; import android.app.Instrumentation; import android.app.UiAutomation; import android.content.ComponentName; +import android.content.ContentProviderClient; import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; @@ -39,6 +40,7 @@ import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Parcelable; +import android.os.RemoteException; import android.os.SystemClock; import android.text.TextUtils; import android.util.Log; @@ -260,7 +262,12 @@ public final class LauncherInstrumentation { } Bundle getTestInfo(String request) { - return getContext().getContentResolver().call(mTestProviderUri, request, null, null); + try (ContentProviderClient client = getContext().getContentResolver() + .acquireContentProviderClient(mTestProviderUri)) { + return client.call(request, null, null); + } catch (RemoteException e) { + throw new RuntimeException(e); + } } Insets getTargetInsets() {