Lines Matching defs:record

331             for (ListenerRecord record : mRecordMap.values()) {
332 record.taskQueue.add(task);
333 processListenerQueue(record);
338 ListenerRecord record = mRecordMap.get(componentName);
339 if (record != null) {
340 record.service = INotificationSideChannel.Stub.asInterface(iBinder);
341 record.retryCount = 0;
342 processListenerQueue(record);
347 ListenerRecord record = mRecordMap.get(componentName);
348 if (record != null) {
349 ensureServiceUnbound(record);
354 ListenerRecord record = mRecordMap.get(componentName);
355 if (record != null) {
356 processListenerQueue(record);
400 + ", not adding listener record.");
405 // Ensure all enabled components have a record in the listener map.
409 Log.d(TAG, "Adding listener record for " + componentName);
421 Log.d(TAG, "Removing listener record for " + entry.getKey());
433 private boolean ensureServiceBound(ListenerRecord record) {
434 if (record.bound) {
437 Intent intent = new Intent(ACTION_BIND_SIDE_CHANNEL).setComponent(record.componentName);
438 record.bound = mContext.bindService(intent, this, SIDE_CHANNEL_BIND_FLAGS);
439 if (record.bound) {
440 record.retryCount = 0;
442 Log.w(TAG, "Unable to bind to listener " + record.componentName);
445 return record.bound;
451 private void ensureServiceUnbound(ListenerRecord record) {
452 if (record.bound) {
454 record.bound = false;
456 record.service = null;
464 private void scheduleListenerRetry(ListenerRecord record) {
465 if (mHandler.hasMessages(MSG_RETRY_LISTENER_QUEUE, record.componentName)) {
468 record.retryCount++;
469 if (record.retryCount > SIDE_CHANNEL_RETRY_MAX_COUNT) {
470 Log.w(TAG, "Giving up on delivering " + record.taskQueue.size() + " tasks to "
471 + record.componentName + " after " + record.retryCount + " retries");
472 record.taskQueue.clear();
475 int delayMs = SIDE_CHANNEL_RETRY_BASE_INTERVAL_MS * (1 << (record.retryCount - 1));
479 Message msg = mHandler.obtainMessage(MSG_RETRY_LISTENER_QUEUE, record.componentName);
487 private void processListenerQueue(ListenerRecord record) {
489 Log.d(TAG, "Processing component " + record.componentName + ", "
490 + record.taskQueue.size() + " queued tasks");
492 if (record.taskQueue.isEmpty()) {
495 if (!ensureServiceBound(record) || record.service == null) {
497 scheduleListenerRetry(record);
502 Task task = record.taskQueue.peek();
510 task.send(record.service);
511 record.taskQueue.remove();
514 Log.d(TAG, "Remote service has died: " + record.componentName);
518 Log.w(TAG, "RemoteException communicating with " + record.componentName, e);
522 if (!record.taskQueue.isEmpty()) {
524 scheduleListenerRetry(record);
528 /** A per-side-channel-service listener state record */