From 980dc5ae12fe8cd3af0e6731bc3e8c686bdcee87 Mon Sep 17 00:00:00 2001 From: Jing Ji Date: Wed, 26 May 2021 13:59:33 -0700 Subject: [PATCH] Don't call onNullBinding when the service host is dead Bug: 189038850 Test: atest CtsAppTestCases Change-Id: I8bcdaf545ee8ca46327fc25c14d9821e288600a4 --- core/java/android/app/LoadedApk.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 0733a3e7c51cf..fde2904a3f376 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -2056,13 +2056,14 @@ public final class LoadedApk { } if (dead) { mConnection.onBindingDied(name); - } - // If there is a new viable service, it is now connected. - if (service != null) { - mConnection.onServiceConnected(name, service); } else { - // The binding machinery worked, but the remote returned null from onBind(). - mConnection.onNullBinding(name); + // If there is a new viable service, it is now connected. + if (service != null) { + mConnection.onServiceConnected(name, service); + } else { + // The binding machinery worked, but the remote returned null from onBind(). + mConnection.onNullBinding(name); + } } }