Loading api/current.xml +11 −0 Original line number Diff line number Diff line Loading @@ -37304,6 +37304,17 @@ visibility="public" > </field> <field name="FLAG_RECEIVER_REPLACE_PENDING" type="int" transient="false" volatile="false" value="536870912" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="METADATA_DOCK_HOME" type="java.lang.String" transient="false" core/java/android/content/Intent.java +17 −3 Original line number Diff line number Diff line Loading @@ -2398,6 +2398,20 @@ public class Intent implements Parcelable { * called -- no BroadcastReceiver components will be launched. */ public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000; /** * If set, when sending a broadcast the new broadcast will replace * any existing pending broadcast that matches it. Matching is defined * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning * true for the intents of the two broadcasts. When a match is found, * the new broadcast (and receivers associated with it) will replace the * existing one in the pending broadcast list, remaining at the same * position in the list. * * <p>This flag is most typically used with sticky broadcasts, which * only care about delivering the most recent values of the broadcast * to their receivers. */ public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000; /** * If set, when sending a broadcast <i>before boot has completed</i> only * registered receivers will be called -- no BroadcastReceiver components Loading @@ -2411,14 +2425,14 @@ public class Intent implements Parcelable { * * @hide */ public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x20000000; public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x10000000; /** * Set when this broadcast is for a boot upgrade, a special mode that * allows the broadcast to be sent before the system is ready and launches * the app process with no providers running in it. * @hide */ public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x10000000; public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x08000000; /** * @hide Flags that can't be changed with PendingIntent. Loading core/java/android/server/search/SearchManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -150,8 +150,9 @@ public class SearchManagerService extends ISearchManager.Stub { * Informs all listeners that the list of searchables has been updated. */ void broadcastSearchablesChanged() { mContext.sendBroadcast( new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED)); Intent intent = new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); mContext.sendBroadcast(intent); } // Loading media/java/android/media/AudioService.java +7 −7 Original line number Diff line number Diff line Loading @@ -892,14 +892,14 @@ public class AudioService extends IAudioService.Stub { private void broadcastRingerMode() { // Send sticky broadcast if (ActivityManagerNative.isSystemReady()) { Intent broadcast = new Intent(AudioManager.RINGER_MODE_CHANGED_ACTION); broadcast.putExtra(AudioManager.EXTRA_RINGER_MODE, mRingerMode); broadcast.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_REPLACE_PENDING); long origCallerIdentityToken = Binder.clearCallingIdentity(); mContext.sendStickyBroadcast(broadcast); Binder.restoreCallingIdentity(origCallerIdentityToken); } } private void broadcastVibrateSetting(int vibrateType) { // Send broadcast Loading services/java/com/android/server/AlarmManagerService.java +7 −3 Original line number Diff line number Diff line Loading @@ -127,8 +127,9 @@ class AlarmManagerService extends IAlarmManager.Stub { mTimeTickSender = PendingIntent.getBroadcast(context, 0, new Intent(Intent.ACTION_TIME_TICK).addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY), 0); mDateChangeSender = PendingIntent.getBroadcast(context, 0, new Intent(Intent.ACTION_DATE_CHANGED), 0); Intent intent = new Intent(Intent.ACTION_DATE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); mDateChangeSender = PendingIntent.getBroadcast(context, 0, intent, 0); // now that we have initied the driver schedule the alarm mClockReceiver= new ClockReceiver(); Loading Loading @@ -272,6 +273,7 @@ class AlarmManagerService extends IAlarmManager.Stub { if (timeZoneWasChanged) { Intent intent = new Intent(Intent.ACTION_TIMEZONE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); intent.putExtra("time-zone", zone.getID()); mContext.sendBroadcast(intent); } Loading Loading @@ -609,7 +611,9 @@ class AlarmManagerService extends IAlarmManager.Stub { if ((result & TIME_CHANGED_MASK) != 0) { remove(mTimeTickSender); mClockReceiver.scheduleTimeTickEvent(); mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED)); Intent intent = new Intent(Intent.ACTION_TIME_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); mContext.sendBroadcast(intent); } synchronized (mLock) { Loading Loading
api/current.xml +11 −0 Original line number Diff line number Diff line Loading @@ -37304,6 +37304,17 @@ visibility="public" > </field> <field name="FLAG_RECEIVER_REPLACE_PENDING" type="int" transient="false" volatile="false" value="536870912" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="METADATA_DOCK_HOME" type="java.lang.String" transient="false"
core/java/android/content/Intent.java +17 −3 Original line number Diff line number Diff line Loading @@ -2398,6 +2398,20 @@ public class Intent implements Parcelable { * called -- no BroadcastReceiver components will be launched. */ public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000; /** * If set, when sending a broadcast the new broadcast will replace * any existing pending broadcast that matches it. Matching is defined * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning * true for the intents of the two broadcasts. When a match is found, * the new broadcast (and receivers associated with it) will replace the * existing one in the pending broadcast list, remaining at the same * position in the list. * * <p>This flag is most typically used with sticky broadcasts, which * only care about delivering the most recent values of the broadcast * to their receivers. */ public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000; /** * If set, when sending a broadcast <i>before boot has completed</i> only * registered receivers will be called -- no BroadcastReceiver components Loading @@ -2411,14 +2425,14 @@ public class Intent implements Parcelable { * * @hide */ public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x20000000; public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x10000000; /** * Set when this broadcast is for a boot upgrade, a special mode that * allows the broadcast to be sent before the system is ready and launches * the app process with no providers running in it. * @hide */ public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x10000000; public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x08000000; /** * @hide Flags that can't be changed with PendingIntent. Loading
core/java/android/server/search/SearchManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -150,8 +150,9 @@ public class SearchManagerService extends ISearchManager.Stub { * Informs all listeners that the list of searchables has been updated. */ void broadcastSearchablesChanged() { mContext.sendBroadcast( new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED)); Intent intent = new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); mContext.sendBroadcast(intent); } // Loading
media/java/android/media/AudioService.java +7 −7 Original line number Diff line number Diff line Loading @@ -892,14 +892,14 @@ public class AudioService extends IAudioService.Stub { private void broadcastRingerMode() { // Send sticky broadcast if (ActivityManagerNative.isSystemReady()) { Intent broadcast = new Intent(AudioManager.RINGER_MODE_CHANGED_ACTION); broadcast.putExtra(AudioManager.EXTRA_RINGER_MODE, mRingerMode); broadcast.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_REPLACE_PENDING); long origCallerIdentityToken = Binder.clearCallingIdentity(); mContext.sendStickyBroadcast(broadcast); Binder.restoreCallingIdentity(origCallerIdentityToken); } } private void broadcastVibrateSetting(int vibrateType) { // Send broadcast Loading
services/java/com/android/server/AlarmManagerService.java +7 −3 Original line number Diff line number Diff line Loading @@ -127,8 +127,9 @@ class AlarmManagerService extends IAlarmManager.Stub { mTimeTickSender = PendingIntent.getBroadcast(context, 0, new Intent(Intent.ACTION_TIME_TICK).addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY), 0); mDateChangeSender = PendingIntent.getBroadcast(context, 0, new Intent(Intent.ACTION_DATE_CHANGED), 0); Intent intent = new Intent(Intent.ACTION_DATE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); mDateChangeSender = PendingIntent.getBroadcast(context, 0, intent, 0); // now that we have initied the driver schedule the alarm mClockReceiver= new ClockReceiver(); Loading Loading @@ -272,6 +273,7 @@ class AlarmManagerService extends IAlarmManager.Stub { if (timeZoneWasChanged) { Intent intent = new Intent(Intent.ACTION_TIMEZONE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); intent.putExtra("time-zone", zone.getID()); mContext.sendBroadcast(intent); } Loading Loading @@ -609,7 +611,9 @@ class AlarmManagerService extends IAlarmManager.Stub { if ((result & TIME_CHANGED_MASK) != 0) { remove(mTimeTickSender); mClockReceiver.scheduleTimeTickEvent(); mContext.sendBroadcast(new Intent(Intent.ACTION_TIME_CHANGED)); Intent intent = new Intent(Intent.ACTION_TIME_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); mContext.sendBroadcast(intent); } synchronized (mLock) { Loading