diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-10-25 18:43:39 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-10-25 18:43:39 +0000 |
| commit | d62ff511dcec5b3052eef9786c346279145a025d (patch) | |
| tree | da7103f5c55dac8e07296f566ca3e3d3288fe057 /core/java/android | |
| parent | 4b3a7f2987f9e9fa31e2421fb30b3f40ecb94213 (diff) | |
| parent | 61e03292077343a4a3282f5ce513ee8f9152e255 (diff) | |
Merge "incidentd: Adding proto dump for AlarmManager."
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/AlarmManager.java | 23 | ||||
| -rw-r--r-- | core/java/android/app/PendingIntent.java | 12 |
2 files changed, 27 insertions, 8 deletions
diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java index 2813e8b9707e..55f9e289f52d 100644 --- a/core/java/android/app/AlarmManager.java +++ b/core/java/android/app/AlarmManager.java @@ -33,6 +33,7 @@ import android.os.WorkSource; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; +import android.util.proto.ProtoOutputStream; import libcore.util.ZoneInfoDB; @@ -48,7 +49,7 @@ import java.lang.annotation.RetentionPolicy; * if it is not already running. Registered alarms are retained while the * device is asleep (and can optionally wake the device up if they go off * during that time), but will be cleared if it is turned off and rebooted. - * + * * <p>The Alarm Manager holds a CPU wake lock as long as the alarm receiver's * onReceive() method is executing. This guarantees that the phone will not sleep * until you have finished handling the broadcast. Once onReceive() returns, the @@ -296,7 +297,7 @@ public class AlarmManager { * {@link Intent#EXTRA_ALARM_COUNT Intent.EXTRA_ALARM_COUNT} that indicates * how many past alarm events have been accumulated into this intent * broadcast. Recurring alarms that have gone undelivered because the - * phone was asleep may have a count greater than one when delivered. + * phone was asleep may have a count greater than one when delivered. * * <div class="note"> * <p> @@ -396,10 +397,10 @@ public class AlarmManager { * set a recurring alarm for the top of every hour but the phone was asleep * from 7:45 until 8:45, an alarm will be sent as soon as the phone awakens, * then the next alarm will be sent at 9:00. - * - * <p>If your application wants to allow the delivery times to drift in + * + * <p>If your application wants to allow the delivery times to drift in * order to guarantee that at least a certain time interval always elapses - * between alarms, then the approach to take is to use one-time alarms, + * between alarms, then the approach to take is to use one-time alarms, * scheduling the next one yourself when handling each alarm delivery. * * <p class="note"> @@ -1056,7 +1057,7 @@ public class AlarmManager { /** * Creates a new alarm clock description. * - * @param triggerTime time at which the underlying alarm is triggered in wall time + * @param triggerTime time at which the underlying alarm is triggered in wall time * milliseconds since the epoch * @param showIntent an intent that can be used to show or edit details of * the alarm clock. @@ -1089,7 +1090,7 @@ public class AlarmManager { * Returns an intent that can be used to show or edit details of the alarm clock in * the application that scheduled it. * - * <p class="note">Beware that any application can retrieve and send this intent, + * <p class="note">Beware that any application can retrieve and send this intent, * potentially with additional fields filled in. See * {@link PendingIntent#send(android.content.Context, int, android.content.Intent) * PendingIntent.send()} and {@link android.content.Intent#fillIn Intent.fillIn()} @@ -1121,5 +1122,13 @@ public class AlarmManager { return new AlarmClockInfo[size]; } }; + + /** @hide */ + public void writeToProto(ProtoOutputStream proto, long fieldId) { + final long token = proto.start(fieldId); + proto.write(AlarmClockInfoProto.TRIGGER_TIME_MS, mTriggerTime); + mShowIntent.writeToProto(proto, AlarmClockInfoProto.SHOW_INTENT); + proto.end(token); + } } } diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index a25c2267214e..baeabc39e3fb 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -33,6 +33,7 @@ import android.os.Parcelable; import android.os.RemoteException; import android.os.UserHandle; import android.util.AndroidException; +import android.util.proto.ProtoOutputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -1081,7 +1082,16 @@ public final class PendingIntent implements Parcelable { sb.append('}'); return sb.toString(); } - + + /** @hide */ + public void writeToProto(ProtoOutputStream proto, long fieldId) { + final long token = proto.start(fieldId); + if (mTarget != null) { + proto.write(PendingIntentProto.TARGET, mTarget.asBinder().toString()); + } + proto.end(token); + } + public int describeContents() { return 0; } |
