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
This commit is contained in:
parent
343245f4e6
commit
81268bd12c
|
@ -92,15 +92,17 @@ public class LiveLockScreenServiceBroker extends SystemService {
|
||||||
LiveLockScreenServiceBroker.this.notifyAll();
|
LiveLockScreenServiceBroker.this.notifyAll();
|
||||||
// If any change listeners are cached, register them with the newly connected
|
// If any change listeners are cached, register them with the newly connected
|
||||||
// service.
|
// service.
|
||||||
int N = mChangeListeners.getRegisteredCallbackCount();
|
try {
|
||||||
if (mService != null && N > 0) {
|
int N = mChangeListeners.beginBroadcast();
|
||||||
for (int i = 0; i < N; i++) {
|
if (mService != null && N > 0) {
|
||||||
try {
|
for (int i = 0; i < N; i++) {
|
||||||
mService.registerChangeListener(mChangeListeners.getBroadcastItem(i));
|
mService.registerChangeListener(mChangeListeners.getBroadcastItem(i));
|
||||||
} catch (RemoteException e) {
|
|
||||||
/* ignore */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
/* ignore */
|
||||||
|
} finally {
|
||||||
|
mChangeListeners.finishBroadcast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue