diff options
author | 2025-01-28 07:11:13 -0800 | |
---|---|---|
committer | 2025-01-28 07:11:13 -0800 | |
commit | 71cee49524b60f9c9f7915f4865257bd90748742 (patch) | |
tree | ffb122256638a249affca67c72456e49a2a9ab7f /packages/NeuralNetworks | |
parent | 4c5938167300997a22d67ddb6da8971c9bbc6b32 (diff) |
BEGIN_PUBLIC
Use `@DurationMillisLong` rather than `@CurrentTimeMillisLong` for the "suspended time".
Update the accessor methods for the `long suspendedTimeMs` field of `InferenceInfo` to use a duration annotation, rather than a timestamp annotation, since that field holds a duration, not an instant in time.
END_PUBLIC
Change-Id: I1d85bb1796f708dd2c3841ebc6e01e1678545a53
Bug: 392668668
Flag: EXEMPT bugfix
Diffstat (limited to 'packages/NeuralNetworks')
2 files changed, 27 insertions, 17 deletions
diff --git a/packages/NeuralNetworks/framework/module/java/android/app/ondeviceintelligence/InferenceInfo.java b/packages/NeuralNetworks/framework/module/java/android/app/ondeviceintelligence/InferenceInfo.java index cae8db27a435..428997e0c446 100644 --- a/packages/NeuralNetworks/framework/module/java/android/app/ondeviceintelligence/InferenceInfo.java +++ b/packages/NeuralNetworks/framework/module/java/android/app/ondeviceintelligence/InferenceInfo.java @@ -19,6 +19,7 @@ package android.app.ondeviceintelligence; import static android.app.ondeviceintelligence.flags.Flags.FLAG_ENABLE_ON_DEVICE_INTELLIGENCE_MODULE; import android.annotation.CurrentTimeMillisLong; +import android.annotation.DurationMillisLong; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemApi; @@ -51,7 +52,8 @@ public final class InferenceInfo implements Parcelable { private final long endTimeMs; /** - * Suspended time in milliseconds. + * The total duration of the period(s) during which the inference was + * suspended (i.e. not running), in milliseconds. */ private final long suspendedTimeMs; @@ -61,7 +63,7 @@ public final class InferenceInfo implements Parcelable { * @param uid Uid for the caller app. * @param startTimeMs Inference start time (milliseconds from the epoch time). * @param endTimeMs Inference end time (milliseconds from the epoch time). - * @param suspendedTimeMs Suspended time in milliseconds. + * @param suspendedTimeMs Suspended duration, in milliseconds. */ InferenceInfo(int uid, long startTimeMs, long endTimeMs, long suspendedTimeMs) { @@ -128,11 +130,12 @@ public final class InferenceInfo implements Parcelable { } /** - * Returns the suspended time in milliseconds. + * Returns the suspended duration, in milliseconds. * - * @return the suspended time in milliseconds. + * @return the total duration of the period(s) during which the inference + * was suspended (i.e. not running), in milliseconds. */ - @CurrentTimeMillisLong + @DurationMillisLong public long getSuspendedTimeMillis() { return suspendedTimeMs; } @@ -197,12 +200,14 @@ public final class InferenceInfo implements Parcelable { } /** - * Sets the suspended time in milliseconds. + * Sets the suspended duration, in milliseconds. * - * @param suspendedTimeMs the suspended time in milliseconds. + * @param suspendedTimeMs the total duration of the period(s) in which + * the request was suspended (i.e. not running), + * in milliseconds. * @return the Builder instance. */ - public @NonNull Builder setSuspendedTimeMillis(@CurrentTimeMillisLong long suspendedTimeMs) { + public @NonNull Builder setSuspendedTimeMillis(@DurationMillisLong long suspendedTimeMs) { this.suspendedTimeMs = suspendedTimeMs; return this; } diff --git a/packages/NeuralNetworks/framework/platform/java/android/app/ondeviceintelligence/InferenceInfo.java b/packages/NeuralNetworks/framework/platform/java/android/app/ondeviceintelligence/InferenceInfo.java index cae8db27a435..64524fb096cb 100644 --- a/packages/NeuralNetworks/framework/platform/java/android/app/ondeviceintelligence/InferenceInfo.java +++ b/packages/NeuralNetworks/framework/platform/java/android/app/ondeviceintelligence/InferenceInfo.java @@ -19,6 +19,7 @@ package android.app.ondeviceintelligence; import static android.app.ondeviceintelligence.flags.Flags.FLAG_ENABLE_ON_DEVICE_INTELLIGENCE_MODULE; import android.annotation.CurrentTimeMillisLong; +import android.annotation.DurationMillisLong; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemApi; @@ -50,8 +51,9 @@ public final class InferenceInfo implements Parcelable { */ private final long endTimeMs; - /** - * Suspended time in milliseconds. + /** + * The total duration of the period(s) during which the inference was + * suspended (i.e. not running), in milliseconds. */ private final long suspendedTimeMs; @@ -61,7 +63,7 @@ public final class InferenceInfo implements Parcelable { * @param uid Uid for the caller app. * @param startTimeMs Inference start time (milliseconds from the epoch time). * @param endTimeMs Inference end time (milliseconds from the epoch time). - * @param suspendedTimeMs Suspended time in milliseconds. + * @param suspendedTimeMs Suspended duration, in milliseconds. */ InferenceInfo(int uid, long startTimeMs, long endTimeMs, long suspendedTimeMs) { @@ -128,11 +130,12 @@ public final class InferenceInfo implements Parcelable { } /** - * Returns the suspended time in milliseconds. + * Returns the suspended duration, in milliseconds. * - * @return the suspended time in milliseconds. + * @return the total duration of the period(s) during which the inference + * was suspended (i.e. not running), in milliseconds. */ - @CurrentTimeMillisLong + @DurationMillisLong public long getSuspendedTimeMillis() { return suspendedTimeMs; } @@ -197,12 +200,14 @@ public final class InferenceInfo implements Parcelable { } /** - * Sets the suspended time in milliseconds. + * Sets the suspended duration, in milliseconds. * - * @param suspendedTimeMs the suspended time in milliseconds. + * @param suspendedTimeMs the total duration of the period(s) in which + * the request was suspended (i.e. not running), + * in milliseconds. * @return the Builder instance. */ - public @NonNull Builder setSuspendedTimeMillis(@CurrentTimeMillisLong long suspendedTimeMs) { + public @NonNull Builder setSuspendedTimeMillis(@DurationMillisLong long suspendedTimeMs) { this.suspendedTimeMs = suspendedTimeMs; return this; } |