summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2024-09-28 17:50:38 +0900
committer Yi Kong <yikong@google.com> 2024-09-28 17:50:38 +0900
commit52f8abc2f399ff4eac9f7951aca1f46e929d03cb (patch)
treeeca2a4b22f124b83076d9382c95e2ee013238336 /services
parent0d42cb57bda690810f0dedadc9840446013b0237 (diff)
profcollect: gracefully handle ServiceSpecificException
We should not crash the service when there is a transient error in the native backend. Test: presubmit Bug: 369526161 Change-Id: I81698c11ed5aba98421a833a0be53db77fa3a7d8
Diffstat (limited to 'services')
-rw-r--r--services/profcollect/src/com/android/server/profcollect/Utils.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/services/profcollect/src/com/android/server/profcollect/Utils.java b/services/profcollect/src/com/android/server/profcollect/Utils.java
index 850880256cfa..b4e254442a19 100644
--- a/services/profcollect/src/com/android/server/profcollect/Utils.java
+++ b/services/profcollect/src/com/android/server/profcollect/Utils.java
@@ -19,6 +19,7 @@ package com.android.server.profcollect;
import static com.android.server.profcollect.ProfcollectForwardingService.LOG_TAG;
import android.os.RemoteException;
+import android.os.ServiceSpecificException;
import android.provider.DeviceConfig;
import android.util.Log;
@@ -42,7 +43,7 @@ public final class Utils {
BackgroundThread.get().getThreadHandler().post(() -> {
try {
mIProfcollect.trace_system(eventName);
- } catch (RemoteException e) {
+ } catch (RemoteException | ServiceSpecificException e) {
Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
}
});
@@ -56,7 +57,7 @@ public final class Utils {
BackgroundThread.get().getThreadHandler().postDelayed(() -> {
try {
mIProfcollect.trace_system(eventName);
- } catch (RemoteException e) {
+ } catch (RemoteException | ServiceSpecificException e) {
Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
}
}, delayMs);
@@ -73,10 +74,10 @@ public final class Utils {
mIProfcollect.trace_process(eventName,
processName,
durationMs);
- } catch (RemoteException e) {
+ } catch (RemoteException | ServiceSpecificException e) {
Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
}
});
return true;
}
-} \ No newline at end of file
+}