From 10800341e6dc7de187836cf2655d0ac65fdec02c Mon Sep 17 00:00:00 2001 From: Alex Salo Date: Tue, 2 Apr 2019 18:45:20 -0700 Subject: Notify caller about cancellation In an event when service disconnected we clear the pending callback. Don't forget to cancel it and notify the caller. Bug: 129348179 Test: manually Change-Id: Iaf3d44df9bbee4b31ae3aa680351f1cdd7f0ef96 --- .../java/com/android/server/attention/AttentionManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/attention/AttentionManagerService.java b/services/core/java/com/android/server/attention/AttentionManagerService.java index 1681c5bc61d3..bc78d1ad751f 100644 --- a/services/core/java/com/android/server/attention/AttentionManagerService.java +++ b/services/core/java/com/android/server/attention/AttentionManagerService.java @@ -19,6 +19,7 @@ package com.android.server.attention; import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE; import static android.provider.Settings.System.ADAPTIVE_SLEEP; import static android.service.attention.AttentionService.ATTENTION_FAILURE_CANCELLED; +import static android.service.attention.AttentionService.ATTENTION_FAILURE_UNKNOWN; import android.Manifest; import android.annotation.NonNull; @@ -249,6 +250,7 @@ public class AttentionManagerService extends SystemService { if (userState.mPendingAttentionCheck != null && userState.mPendingAttentionCheck.mCallbackInternal.equals( callbackInternal)) { + userState.mPendingAttentionCheck.cancel(ATTENTION_FAILURE_UNKNOWN); userState.mPendingAttentionCheck = null; } return; @@ -624,7 +626,7 @@ public class AttentionManagerService extends SystemService { if (userState == null) { return; } - cancel(userState, AttentionService.ATTENTION_FAILURE_UNKNOWN); + cancel(userState, ATTENTION_FAILURE_UNKNOWN); mContext.unbindService(userState.mConnection); userState.mConnection.cleanupService(); -- cgit v1.2.3-59-g8ed1b