summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Eugene Susla <eugenesusla@google.com> 2017-06-16 17:20:41 -0700
committer Eugene Susla <eugenesusla@google.com> 2017-06-16 17:22:04 -0700
commit0435e5e79f842978261331d7725d3e1a0f8c78f1 (patch)
treee35a21faadfa2425fa188cab8d7efab1b9c65eed
parentffd8343ba87c7cdf84287b91972b987ffc41d4fb (diff)
[Companion] Fix NPE in associate
The root cause of the exception was that the activity destroy listener was reacting to any activity being destroyed instead of just the one used with the CompanionDeviceManager Fixes: 62549525 Test: Ensure the attached bug no longer reproduces Change-Id: I2f977e9ac9176247f5be9d08d19b3875f2b4a703
-rw-r--r--core/java/android/companion/CompanionDeviceManager.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/java/android/companion/CompanionDeviceManager.java b/core/java/android/companion/CompanionDeviceManager.java
index dabe608c038f..4400ad3316e3 100644
--- a/core/java/android/companion/CompanionDeviceManager.java
+++ b/core/java/android/companion/CompanionDeviceManager.java
@@ -288,6 +288,7 @@ public final class CompanionDeviceManager {
@Override
public void onActivityDestroyed(Activity activity) {
+ if (activity != getActivity()) return;
try {
mService.stopScan(mRequest, this, getCallingPackage());
} catch (RemoteException e) {