Merge changes Ia0726197,I3698d82d

* changes:
  Update documentation
  Add package to DND alarm broadcast
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index cf54ecf..6bfde9a 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -7915,7 +7915,7 @@
          * Adds a message for display by this notification. Convenience call for a simple
          * {@link Message} in {@link #addMessage(Notification.MessagingStyle.Message)}.
          * @param text A {@link CharSequence} to be displayed as the message content
-         * @param timestamp Time at which the message arrived
+         * @param timestamp Time in milliseconds at which the message arrived
          * @param sender A {@link CharSequence} to be used for displaying the name of the
          * sender. Should be <code>null</code> for messages by the current user, in which case
          * the platform will insert {@link #getUserDisplayName()}.
@@ -7937,7 +7937,7 @@
          * Adds a message for display by this notification. Convenience call for a simple
          * {@link Message} in {@link #addMessage(Notification.MessagingStyle.Message)}.
          * @param text A {@link CharSequence} to be displayed as the message content
-         * @param timestamp Time at which the message arrived
+         * @param timestamp Time in milliseconds at which the message arrived
          * @param sender The {@link Person} who sent the message.
          * Should be <code>null</code> for messages by the current user, in which case
          * the platform will insert the user set in {@code MessagingStyle(Person)}.
diff --git a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
index 14affe7..92cdce7 100644
--- a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
+++ b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
@@ -40,6 +40,7 @@
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.server.notification.NotificationManagerService.DumpFilter;
+import com.android.server.pm.PackageManagerService;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -218,12 +219,7 @@
 
     private void updateAlarm(long now, long time) {
         final AlarmManager alarms = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
-        final PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext,
-                REQUEST_CODE_EVALUATE,
-                new Intent(ACTION_EVALUATE)
-                        .addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
-                        .putExtra(EXTRA_TIME, time),
-                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
+        final PendingIntent pendingIntent = getPendingIntent(time);
         alarms.cancel(pendingIntent);
         if (time > now) {
             if (DEBUG) Slog.d(TAG, String.format("Scheduling evaluate for %s, in %s, now=%s",
@@ -234,6 +230,17 @@
         }
     }
 
+    @VisibleForTesting
+    PendingIntent getPendingIntent(long time) {
+        return PendingIntent.getBroadcast(mContext,
+                REQUEST_CODE_EVALUATE,
+                new Intent(ACTION_EVALUATE)
+                        .setPackage(PackageManagerService.PLATFORM_PACKAGE_NAME)
+                        .addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
+                        .putExtra(EXTRA_TIME, time),
+                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
+    }
+
     public long getNextAlarm() {
         final AlarmManager.AlarmClockInfo info = mAlarmManager.getNextAlarmClock(
                 ActivityManager.getCurrentUser());
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java
index 7446e9e..7d89d87 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ScheduleConditionProviderTest.java
@@ -7,6 +7,7 @@
 import static org.mockito.Mockito.spy;
 
 import android.app.Application;
+import android.app.PendingIntent;
 import android.content.Intent;
 import android.net.Uri;
 import android.service.notification.Condition;
@@ -18,6 +19,7 @@
 import androidx.test.filters.SmallTest;
 
 import com.android.server.UiServiceTestCase;
+import com.android.server.pm.PackageManagerService;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -326,6 +328,12 @@
         assertEquals(Condition.STATE_FALSE, condition.state);
     }
 
+    @Test
+    public void testGetPendingIntent() {
+        PendingIntent pi = mService.getPendingIntent(1000);
+        assertEquals(PackageManagerService.PLATFORM_PACKAGE_NAME, pi.getIntent().getPackage());
+    }
+
     private Calendar getNow() {
         Calendar now = new GregorianCalendar();
         now.set(Calendar.HOUR_OF_DAY, 14);