Make ExerciseUpdate's constructor internal
We do not expect external developers to use this constructor in their
production code, instead it is generally constructed from a proto and
passed to them.
In the future we will review the best way to make this functionality
available externally for tests.
Relnote: ExerciseUpdate's constructor is now internal
Bug: 233209777
Test: ./gradlew :health:health-services-client:test
Change-Id: I1589a0de0b3a7b5433d4cace806e2ef5c3bdb328
diff --git a/health/health-services-client/api/1.0.0-beta01.txt b/health/health-services-client/api/1.0.0-beta01.txt
index 137fe7b..84e9862 100644
--- a/health/health-services-client/api/1.0.0-beta01.txt
+++ b/health/health-services-client/api/1.0.0-beta01.txt
@@ -533,7 +533,6 @@
}
public final class ExerciseUpdate {
- ctor public ExerciseUpdate(androidx.health.services.client.data.DataPointContainer latestMetrics, java.util.Set<? extends androidx.health.services.client.data.ExerciseGoal<? extends java.lang.Number>> latestAchievedGoals, java.util.Set<androidx.health.services.client.data.MilestoneMarkerSummary> latestMilestoneMarkerSummaries, androidx.health.services.client.data.ExerciseStateInfo exerciseStateInfo, optional androidx.health.services.client.data.ExerciseConfig? exerciseConfig, optional androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? activeDurationCheckpoint, optional java.time.Duration? updateDurationFromBoot, optional java.time.Instant? startTime);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint<?> dataPoint);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint<?> dataPoint);
method public androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? getActiveDurationCheckpoint();
diff --git a/health/health-services-client/api/current.txt b/health/health-services-client/api/current.txt
index 137fe7b..84e9862 100644
--- a/health/health-services-client/api/current.txt
+++ b/health/health-services-client/api/current.txt
@@ -533,7 +533,6 @@
}
public final class ExerciseUpdate {
- ctor public ExerciseUpdate(androidx.health.services.client.data.DataPointContainer latestMetrics, java.util.Set<? extends androidx.health.services.client.data.ExerciseGoal<? extends java.lang.Number>> latestAchievedGoals, java.util.Set<androidx.health.services.client.data.MilestoneMarkerSummary> latestMilestoneMarkerSummaries, androidx.health.services.client.data.ExerciseStateInfo exerciseStateInfo, optional androidx.health.services.client.data.ExerciseConfig? exerciseConfig, optional androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? activeDurationCheckpoint, optional java.time.Duration? updateDurationFromBoot, optional java.time.Instant? startTime);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint<?> dataPoint);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint<?> dataPoint);
method public androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? getActiveDurationCheckpoint();
diff --git a/health/health-services-client/api/public_plus_experimental_1.0.0-beta01.txt b/health/health-services-client/api/public_plus_experimental_1.0.0-beta01.txt
index 137fe7b..84e9862 100644
--- a/health/health-services-client/api/public_plus_experimental_1.0.0-beta01.txt
+++ b/health/health-services-client/api/public_plus_experimental_1.0.0-beta01.txt
@@ -533,7 +533,6 @@
}
public final class ExerciseUpdate {
- ctor public ExerciseUpdate(androidx.health.services.client.data.DataPointContainer latestMetrics, java.util.Set<? extends androidx.health.services.client.data.ExerciseGoal<? extends java.lang.Number>> latestAchievedGoals, java.util.Set<androidx.health.services.client.data.MilestoneMarkerSummary> latestMilestoneMarkerSummaries, androidx.health.services.client.data.ExerciseStateInfo exerciseStateInfo, optional androidx.health.services.client.data.ExerciseConfig? exerciseConfig, optional androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? activeDurationCheckpoint, optional java.time.Duration? updateDurationFromBoot, optional java.time.Instant? startTime);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint<?> dataPoint);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint<?> dataPoint);
method public androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? getActiveDurationCheckpoint();
diff --git a/health/health-services-client/api/public_plus_experimental_current.txt b/health/health-services-client/api/public_plus_experimental_current.txt
index 137fe7b..84e9862 100644
--- a/health/health-services-client/api/public_plus_experimental_current.txt
+++ b/health/health-services-client/api/public_plus_experimental_current.txt
@@ -533,7 +533,6 @@
}
public final class ExerciseUpdate {
- ctor public ExerciseUpdate(androidx.health.services.client.data.DataPointContainer latestMetrics, java.util.Set<? extends androidx.health.services.client.data.ExerciseGoal<? extends java.lang.Number>> latestAchievedGoals, java.util.Set<androidx.health.services.client.data.MilestoneMarkerSummary> latestMilestoneMarkerSummaries, androidx.health.services.client.data.ExerciseStateInfo exerciseStateInfo, optional androidx.health.services.client.data.ExerciseConfig? exerciseConfig, optional androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? activeDurationCheckpoint, optional java.time.Duration? updateDurationFromBoot, optional java.time.Instant? startTime);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint<?> dataPoint);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint<?> dataPoint);
method public androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? getActiveDurationCheckpoint();
diff --git a/health/health-services-client/api/restricted_1.0.0-beta01.txt b/health/health-services-client/api/restricted_1.0.0-beta01.txt
index 137fe7b..84e9862 100644
--- a/health/health-services-client/api/restricted_1.0.0-beta01.txt
+++ b/health/health-services-client/api/restricted_1.0.0-beta01.txt
@@ -533,7 +533,6 @@
}
public final class ExerciseUpdate {
- ctor public ExerciseUpdate(androidx.health.services.client.data.DataPointContainer latestMetrics, java.util.Set<? extends androidx.health.services.client.data.ExerciseGoal<? extends java.lang.Number>> latestAchievedGoals, java.util.Set<androidx.health.services.client.data.MilestoneMarkerSummary> latestMilestoneMarkerSummaries, androidx.health.services.client.data.ExerciseStateInfo exerciseStateInfo, optional androidx.health.services.client.data.ExerciseConfig? exerciseConfig, optional androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? activeDurationCheckpoint, optional java.time.Duration? updateDurationFromBoot, optional java.time.Instant? startTime);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint<?> dataPoint);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint<?> dataPoint);
method public androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? getActiveDurationCheckpoint();
diff --git a/health/health-services-client/api/restricted_current.txt b/health/health-services-client/api/restricted_current.txt
index 137fe7b..84e9862 100644
--- a/health/health-services-client/api/restricted_current.txt
+++ b/health/health-services-client/api/restricted_current.txt
@@ -533,7 +533,6 @@
}
public final class ExerciseUpdate {
- ctor public ExerciseUpdate(androidx.health.services.client.data.DataPointContainer latestMetrics, java.util.Set<? extends androidx.health.services.client.data.ExerciseGoal<? extends java.lang.Number>> latestAchievedGoals, java.util.Set<androidx.health.services.client.data.MilestoneMarkerSummary> latestMilestoneMarkerSummaries, androidx.health.services.client.data.ExerciseStateInfo exerciseStateInfo, optional androidx.health.services.client.data.ExerciseConfig? exerciseConfig, optional androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? activeDurationCheckpoint, optional java.time.Duration? updateDurationFromBoot, optional java.time.Instant? startTime);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint<?> dataPoint);
method public java.time.Duration getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint<?> dataPoint);
method public androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint? getActiveDurationCheckpoint();
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseUpdate.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseUpdate.kt
index 243938b..a5b8ea1 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseUpdate.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseUpdate.kt
@@ -18,6 +18,7 @@
import androidx.health.services.client.proto.DataProto.ExerciseUpdate.LatestMetricsEntry as LatestMetricsEntryProto
import androidx.annotation.RestrictTo
+import androidx.annotation.RestrictTo.Scope
import androidx.health.services.client.data.ExerciseEndReason.Companion.toProto
import androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint
import androidx.health.services.client.proto.DataProto
@@ -27,7 +28,7 @@
/** Contains the latest updated state and metrics for the current exercise. */
@Suppress("ParcelCreator")
-public class ExerciseUpdate(
+public class ExerciseUpdate internal constructor(
/** Returns the list of the latest [DataPoint]s. */
public val latestMetrics: DataPointContainer,
@@ -71,7 +72,7 @@
public val startTime: Instant? = null,
) {
/** @hide */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RestrictTo(Scope.LIBRARY)
public constructor(
proto: DataProto.ExerciseUpdate
) : this(
@@ -123,7 +124,7 @@
) {
/** @hide */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RestrictTo(Scope.LIBRARY)
internal fun toProto(): DataProto.ExerciseUpdate.ActiveDurationCheckpoint =
DataProto.ExerciseUpdate.ActiveDurationCheckpoint.newBuilder()
.setTimeEpochMs(time.toEpochMilli())
@@ -153,7 +154,7 @@
internal companion object {
/** @hide */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @RestrictTo(Scope.LIBRARY)
internal fun fromProto(
proto: DataProto.ExerciseUpdate.ActiveDurationCheckpoint
): ActiveDurationCheckpoint? =