aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2016-04-08 17:36:51 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-04-08 10:36:34 -0700
commit81268bd12cb8c320b01e80ee64fe944e1311d232 (patch)
treed7b8e62c07034d521f14cd751a938cf897eb8b4c
parent343245f4e6331b1059240150e62e0c9a9d8d3a54 (diff)
downloadvendor_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.java14
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();
}
}
}