summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-11 23:45:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-11-11 23:45:01 +0000
commit4cb149c2d47dfac382769ead24c96a1521b57b09 (patch)
treefdf7469caf34b3e9ef9ae8aa9d6136e3e1126f1b
parentec7ea5ab186a3a74bbc74db3fda26ab25755dec8 (diff)
parentb246d74057cd44b618ccc21784cbd9f397c7e115 (diff)
Merge "Add fallback to FROZEN_CALLEE_POLICY_UNSET" into main
-rw-r--r--core/java/android/os/RemoteCallbackList.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/core/java/android/os/RemoteCallbackList.java b/core/java/android/os/RemoteCallbackList.java
index 01b1e5e11332..91c482faf7d7 100644
--- a/core/java/android/os/RemoteCallbackList.java
+++ b/core/java/android/os/RemoteCallbackList.java
@@ -194,15 +194,27 @@ public class RemoteCallbackList<E extends IInterface> {
}
}
- public void maybeSubscribeToFrozenCallback() throws RemoteException {
+ void maybeSubscribeToFrozenCallback() throws RemoteException {
if (mFrozenCalleePolicy != FROZEN_CALLEE_POLICY_UNSET) {
- mBinder.addFrozenStateChangeCallback(this);
+ try {
+ mBinder.addFrozenStateChangeCallback(this);
+ } catch (UnsupportedOperationException e) {
+ // The kernel does not support frozen notifications. In this case we want to
+ // silently fall back to FROZEN_CALLEE_POLICY_UNSET. This is done by simply
+ // ignoring the error and moving on. mCurrentState would always be
+ // STATE_UNFROZEN and all callbacks are invoked immediately.
+ }
}
}
- public void maybeUnsubscribeFromFrozenCallback() {
+ void maybeUnsubscribeFromFrozenCallback() {
if (mFrozenCalleePolicy != FROZEN_CALLEE_POLICY_UNSET) {
- mBinder.removeFrozenStateChangeCallback(this);
+ try {
+ mBinder.removeFrozenStateChangeCallback(this);
+ } catch (UnsupportedOperationException e) {
+ // The kernel does not support frozen notifications. Ignore the error and move
+ // on.
+ }
}
}