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();
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue