summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorZimuzo Ezeozue <zezeozue@google.com>2021-03-01 17:28:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-03-01 17:28:34 +0000
commitcebc56614505e9cd40ef240171b8f2553dc23be8 (patch)
treeeeac3f07b16ecc5ff81517dcd0b71ce8911af087 /core/java
parentf765ca788384547e15ef479010a83e2d4b362310 (diff)
parentaff757666ae299ba1814ea1d11297318e64e4888 (diff)
Merge "Rename onGetAnrDelayMillis to onAnrDelayStarted" into sc-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/service/storage/ExternalStorageService.java37
-rw-r--r--core/java/android/service/storage/IExternalStorageService.aidl3
2 files changed, 11 insertions, 29 deletions
diff --git a/core/java/android/service/storage/ExternalStorageService.java b/core/java/android/service/storage/ExternalStorageService.java
index 87add57f383d..1e07a8748af9 100644
--- a/core/java/android/service/storage/ExternalStorageService.java
+++ b/core/java/android/service/storage/ExternalStorageService.java
@@ -102,14 +102,6 @@ public abstract class ExternalStorageService extends Service {
*/
public static final String EXTRA_PACKAGE_NAME = "android.service.storage.extra.package_name";
- /**
- * {@link Bundle} key for a {@link Long} value.
- *
- * {@hide}
- */
- public static final String EXTRA_ANR_TIMEOUT_MS =
- "android.service.storage.extra.anr_timeout_ms";
-
/** @hide */
@IntDef(flag = true, prefix = {"FLAG_SESSION_"},
value = {FLAG_SESSION_TYPE_FUSE, FLAG_SESSION_ATTRIBUTE_INDEXABLE})
@@ -178,12 +170,12 @@ public abstract class ExternalStorageService extends Service {
}
/**
- * Called when {@code packageName} is about to ANR
+ * Called when {@code packageName} is about to ANR. The {@link ExternalStorageService} can
+ * show a progress dialog for the {@code reason}.
*
- * @return ANR dialog delay in milliseconds
*/
- public long onGetAnrDelayMillis(@NonNull String packageName, int uid) {
- throw new UnsupportedOperationException("onGetAnrDelayMillis not implemented");
+ public void onAnrDelayStarted(@NonNull String packageName, int uid, int tid, int reason) {
+ throw new UnsupportedOperationException("onAnrDelayStarted not implemented");
}
@Override
@@ -247,14 +239,14 @@ public abstract class ExternalStorageService extends Service {
}
@Override
- public void getAnrDelayMillis(String packageName, int uid, RemoteCallback callback)
- throws RemoteException {
+ public void notifyAnrDelayStarted(String packageName, int uid, int tid, int reason,
+ RemoteCallback callback) throws RemoteException {
mHandler.post(() -> {
try {
- long timeoutMs = onGetAnrDelayMillis(packageName, uid);
- sendTimeoutResult(packageName, timeoutMs, null /* throwable */, callback);
+ onAnrDelayStarted(packageName, uid, tid, reason);
+ sendResult(packageName, null /* throwable */, callback);
} catch (Throwable t) {
- sendTimeoutResult(packageName, 0 /* timeoutMs */, t, callback);
+ sendResult(packageName, t, callback);
}
});
}
@@ -267,16 +259,5 @@ public abstract class ExternalStorageService extends Service {
}
callback.sendResult(bundle);
}
-
- private void sendTimeoutResult(String packageName, long timeoutMs, Throwable throwable,
- RemoteCallback callback) {
- Bundle bundle = new Bundle();
- bundle.putString(EXTRA_PACKAGE_NAME, packageName);
- bundle.putLong(EXTRA_ANR_TIMEOUT_MS, timeoutMs);
- if (throwable != null) {
- bundle.putParcelable(EXTRA_ERROR, new ParcelableException(throwable));
- }
- callback.sendResult(bundle);
- }
}
}
diff --git a/core/java/android/service/storage/IExternalStorageService.aidl b/core/java/android/service/storage/IExternalStorageService.aidl
index 2e0bd86c3d7d..ba98efa58f7c 100644
--- a/core/java/android/service/storage/IExternalStorageService.aidl
+++ b/core/java/android/service/storage/IExternalStorageService.aidl
@@ -32,5 +32,6 @@ oneway interface IExternalStorageService
in RemoteCallback callback);
void freeCache(@utf8InCpp String sessionId, in String volumeUuid, long bytes,
in RemoteCallback callback);
- void getAnrDelayMillis(String packageName, int uid, in RemoteCallback callback);
+ void notifyAnrDelayStarted(String packageName, int uid, int tid, int reason,
+ in RemoteCallback callback);
} \ No newline at end of file