From 3a54effffdb361ccd60169dcce93cf4e87fc6dac Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Mon, 10 Feb 2020 22:12:44 +0000 Subject: [PATCH] Revert "Prevents an NPE when content provider is slow to start" This reverts commit 140fc2e9c9382d5326b72ff28e8782e7bffc493d. Reason for revert: b/149176266 Change-Id: I4015fcc1624ee116c4a013c99816d43ce7b24834 --- .../java/android/content/ContentResolver.java | 23 +------ core/tests/coretests/AndroidManifest.xml | 6 -- .../android/content/ContentResolverTest.java | 9 --- .../src/android/content/SlowProvider.java | 65 ------------------- .../server/am/ActivityManagerService.java | 27 ++++---- 5 files changed, 18 insertions(+), 112 deletions(-) delete mode 100644 core/tests/coretests/src/android/content/SlowProvider.java diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 0e0161ff4e9f6..f32a4ab433575 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -700,27 +700,6 @@ public abstract class ContentResolver implements ContentInterface { /** @hide */ public static final String REMOTE_CALLBACK_RESULT = "result"; - /** - * How long we wait for an attached process to publish its content providers - * before we decide it must be hung. - * @hide - */ - public static final int CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS = 10 * 1000; - - /** - * How long we wait for an provider to be published. Should be longer than - * {@link #CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS}. - * @hide - */ - public static final int CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS = - CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS + 10 * 1000; - - // Should be >= {@link #CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS}, because that's how - // long ActivityManagerService is giving a content provider to get published if a new process - // needs to be started for that. - private static final int GET_TYPE_TIMEOUT_MILLIS = - CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS + 5 * 1000; - public ContentResolver(@Nullable Context context) { this(context, null); } @@ -870,6 +849,8 @@ public abstract class ContentResolver implements ContentInterface { } } + private static final int GET_TYPE_TIMEOUT_MILLIS = 3000; + private static class GetTypeResultListener implements RemoteCallback.OnResultListener { @GuardedBy("this") public boolean done; diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml index d41f2c6835b09..ee93b397bedf3 100644 --- a/core/tests/coretests/AndroidManifest.xml +++ b/core/tests/coretests/AndroidManifest.xml @@ -1326,12 +1326,6 @@ android:process=":FakeProvider"> - - -