diff options
author | Michael W <baddaemon87@gmail.com> | 2016-04-08 17:36:51 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-04-08 10:36:34 -0700 |
commit | 81268bd12cb8c320b01e80ee64fe944e1311d232 (patch) | |
tree | d7b8e62c07034d521f14cd751a938cf897eb8b4c | |
parent | 343245f4e6331b1059240150e62e0c9a9d8d3a54 (diff) | |
download | vendor_cmsdk-81268bd12cb8c320b01e80ee64fe944e1311d232.zip vendor_cmsdk-81268bd12cb8c320b01e80ee64fe944e1311d232.tar.gz vendor_cmsdk-81268bd12cb8c320b01e80ee64fe944e1311d232.tar.bz2 |
LLS: Fix (possible) NPE
getBroadcastItem is only valid if beginBroadcast is called
RemoteCallbackList.java:
"Retrieve an item in the active broadcast that was previously started
* with {@link #beginBroadcast}"
Fix logic to do so
TICKET: CYNGNOS-2397
Change-Id: Iec787a088ae3999e5024776ad50143249c434084
-rw-r--r-- | cm/lib/main/java/org/cyanogenmod/platform/internal/LiveLockScreenServiceBroker.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/LiveLockScreenServiceBroker.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/LiveLockScreenServiceBroker.java index d14e2b9..c7c6bd2 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/LiveLockScreenServiceBroker.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/LiveLockScreenServiceBroker.java @@ -92,15 +92,17 @@ public class LiveLockScreenServiceBroker extends SystemService { LiveLockScreenServiceBroker.this.notifyAll(); // If any change listeners are cached, register them with the newly connected // service. - int N = mChangeListeners.getRegisteredCallbackCount(); - if (mService != null && N > 0) { - for (int i = 0; i < N; i++) { - try { + try { + int N = mChangeListeners.beginBroadcast(); + if (mService != null && N > 0) { + for (int i = 0; i < N; i++) { mService.registerChangeListener(mChangeListeners.getBroadcastItem(i)); - } catch (RemoteException e) { - /* ignore */ } } + } catch (RemoteException e) { + /* ignore */ + } finally { + mChangeListeners.finishBroadcast(); } } } |