Implement API to have new broadcasts replace existing broadcasts.
Use this in various places where it should serve no purpose to deliver both broadcasts. This is intended to reduce somewhat the flurry of broadcasts that we churn through during boot.
This commit is contained in:
@ -485,6 +485,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
|
||||
Intent intent = new Intent(TelephonyIntents.ACTION_SERVICE_STATE_CHANGED);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
||||
Bundle data = new Bundle();
|
||||
state.fillInNotifierBundle(data);
|
||||
intent.putExtras(data);
|
||||
@ -502,6 +503,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
|
||||
Intent intent = new Intent(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
||||
Bundle data = new Bundle();
|
||||
signalStrength.fillInNotifierBundle(data);
|
||||
intent.putExtras(data);
|
||||
@ -523,6 +525,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
|
||||
Intent intent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
||||
intent.putExtra(Phone.STATE_KEY, DefaultPhoneNotifier.convertCallState(state).toString());
|
||||
if (!TextUtils.isEmpty(incomingNumber)) {
|
||||
intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, incomingNumber);
|
||||
@ -537,6 +540,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
// status bar takes care of that after taking into account all of the
|
||||
// required info.
|
||||
Intent intent = new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
||||
intent.putExtra(Phone.STATE_KEY, DefaultPhoneNotifier.convertDataState(state).toString());
|
||||
if (!isDataConnectivityPossible) {
|
||||
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, true);
|
||||
@ -559,6 +563,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
|
||||
private void broadcastDataConnectionFailed(String reason) {
|
||||
Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
||||
intent.putExtra(Phone.FAILURE_REASON_KEY, reason);
|
||||
mContext.sendStickyBroadcast(intent);
|
||||
}
|
||||
|
Reference in New Issue
Block a user