public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) { Hashtable var3 = this.mReceivers; lock (this.mReceivers) { ReceiverRecord entry = new ReceiverRecord(filter, receiver); var filters = this.mReceivers[receiver]; if (filters == null) { filters = new List <IntentFilter>(); this.mReceivers[receiver] = filters; } filters.Add(filter); for (int i = 0; i < filter.CountActions(); ++i) { string action = filter.GetAction(i); var entries = this.mActions[action]; if (entries == null) { entries = new List <ReceiverRecord>(); this.mActions[action] = entries; } entries.Add(entry); } } }
public void unregisterReceiver(BroadcastReceiver receiver) { Hashtable var2 = this.mReceivers; lock (this.mReceivers) { var filters = this.mReceivers.Remove(receiver); if (filters != null) { for (int i = 0; i < filters.Count; ++i) { IntentFilter filter = (IntentFilter)filters[i]; for (int j = 0; j < filter.CountActions(); ++j) { string action = filter.GetAction(j); var receivers = this.mActions[action]; if (receivers != null) { for (int k = 0; k < receivers.Count; ++k) { if (((ReceiverRecord)receivers[k]).receiver == receiver) { receivers.RemoveAt(k); --k; } } if (receivers.Count <= 0) { this.mActions.Remove(action); } } } } } } }