Target alarm manager intent with package

Target alarm manager intent with package: The purpose of the intent is
to trigger network time refreshes so there should be no reason for other
components to listen for it.

This was suggested by the Android broadcasts team.

Test: manual / treehugger
Bug: 269425914
Change-Id: I2cf26ffe47abbb9abdcb039bd9387a7275db501e
This commit is contained in:
Neil Fuller
2023-02-15 19:20:53 +00:00
parent 9511093518
commit 264eac123f

View File

@@ -115,7 +115,7 @@ public class NetworkTimeUpdateService extends Binder {
TimeDetectorInternal timeDetectorInternal =
LocalServices.getService(TimeDetectorInternal.class);
// Broadcast alarms sent by system are immutable
Intent pollIntent = new Intent(ACTION_POLL, null);
Intent pollIntent = new Intent(ACTION_POLL, null).setPackage("android");
PendingIntent pendingPollIntent = PendingIntent.getBroadcast(mContext, POLL_REQUEST,
pollIntent, PendingIntent.FLAG_IMMUTABLE);
mRefreshCallbacks = new Engine.RefreshCallbacks() {