Make old exercise end states internal
We have consolidated the end states into just one: `ENDED`. That is now
the only thing clients need to check against, with the option for
checking `exerciseStateInfo.exerciseEndReason` to see _why_ it ended.
There's a backwards compat layer in ExerciseStateInfo which will
automatically upconvert old states into the new state + reason, so
clients shouldn't need to access the old states. However, the old states
need to be kept around so that we can provide this backwards compat
layer, so they're marked `internal` rather than being removed.
Relnote: Old exercise END states removed. Use ENDED + reason instead.
Test: ./gradlew :health:health-services-client:test
Bug: 234281116
Change-Id: I6bbb0e1ef6f7f5297caff9f8765b70d8c5ee9090
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 a170f81..1af26ed 100644
--- a/health/health-services-client/api/1.0.0-beta01.txt
+++ b/health/health-services-client/api/1.0.0-beta01.txt
@@ -401,8 +401,6 @@
property public final boolean isResuming;
property public final String name;
field public static final androidx.health.services.client.data.ExerciseState ACTIVE;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_PAUSED;
@@ -411,9 +409,7 @@
field public static final androidx.health.services.client.data.ExerciseState.Companion Companion;
field public static final androidx.health.services.client.data.ExerciseState ENDED;
field public static final androidx.health.services.client.data.ExerciseState PREPARING;
- field public static final androidx.health.services.client.data.ExerciseState TERMINATED;
field public static final androidx.health.services.client.data.ExerciseState TERMINATING;
- field public static final androidx.health.services.client.data.ExerciseState USER_ENDED;
field public static final androidx.health.services.client.data.ExerciseState USER_ENDING;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSED;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSING;
diff --git a/health/health-services-client/api/current.txt b/health/health-services-client/api/current.txt
index a170f81..1af26ed 100644
--- a/health/health-services-client/api/current.txt
+++ b/health/health-services-client/api/current.txt
@@ -401,8 +401,6 @@
property public final boolean isResuming;
property public final String name;
field public static final androidx.health.services.client.data.ExerciseState ACTIVE;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_PAUSED;
@@ -411,9 +409,7 @@
field public static final androidx.health.services.client.data.ExerciseState.Companion Companion;
field public static final androidx.health.services.client.data.ExerciseState ENDED;
field public static final androidx.health.services.client.data.ExerciseState PREPARING;
- field public static final androidx.health.services.client.data.ExerciseState TERMINATED;
field public static final androidx.health.services.client.data.ExerciseState TERMINATING;
- field public static final androidx.health.services.client.data.ExerciseState USER_ENDED;
field public static final androidx.health.services.client.data.ExerciseState USER_ENDING;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSED;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSING;
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 a170f81..1af26ed 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
@@ -401,8 +401,6 @@
property public final boolean isResuming;
property public final String name;
field public static final androidx.health.services.client.data.ExerciseState ACTIVE;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_PAUSED;
@@ -411,9 +409,7 @@
field public static final androidx.health.services.client.data.ExerciseState.Companion Companion;
field public static final androidx.health.services.client.data.ExerciseState ENDED;
field public static final androidx.health.services.client.data.ExerciseState PREPARING;
- field public static final androidx.health.services.client.data.ExerciseState TERMINATED;
field public static final androidx.health.services.client.data.ExerciseState TERMINATING;
- field public static final androidx.health.services.client.data.ExerciseState USER_ENDED;
field public static final androidx.health.services.client.data.ExerciseState USER_ENDING;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSED;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSING;
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 a170f81..1af26ed 100644
--- a/health/health-services-client/api/public_plus_experimental_current.txt
+++ b/health/health-services-client/api/public_plus_experimental_current.txt
@@ -401,8 +401,6 @@
property public final boolean isResuming;
property public final String name;
field public static final androidx.health.services.client.data.ExerciseState ACTIVE;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_PAUSED;
@@ -411,9 +409,7 @@
field public static final androidx.health.services.client.data.ExerciseState.Companion Companion;
field public static final androidx.health.services.client.data.ExerciseState ENDED;
field public static final androidx.health.services.client.data.ExerciseState PREPARING;
- field public static final androidx.health.services.client.data.ExerciseState TERMINATED;
field public static final androidx.health.services.client.data.ExerciseState TERMINATING;
- field public static final androidx.health.services.client.data.ExerciseState USER_ENDED;
field public static final androidx.health.services.client.data.ExerciseState USER_ENDING;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSED;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSING;
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 a170f81..1af26ed 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
@@ -401,8 +401,6 @@
property public final boolean isResuming;
property public final String name;
field public static final androidx.health.services.client.data.ExerciseState ACTIVE;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_PAUSED;
@@ -411,9 +409,7 @@
field public static final androidx.health.services.client.data.ExerciseState.Companion Companion;
field public static final androidx.health.services.client.data.ExerciseState ENDED;
field public static final androidx.health.services.client.data.ExerciseState PREPARING;
- field public static final androidx.health.services.client.data.ExerciseState TERMINATED;
field public static final androidx.health.services.client.data.ExerciseState TERMINATING;
- field public static final androidx.health.services.client.data.ExerciseState USER_ENDED;
field public static final androidx.health.services.client.data.ExerciseState USER_ENDING;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSED;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSING;
diff --git a/health/health-services-client/api/restricted_current.txt b/health/health-services-client/api/restricted_current.txt
index a170f81..1af26ed 100644
--- a/health/health-services-client/api/restricted_current.txt
+++ b/health/health-services-client/api/restricted_current.txt
@@ -401,8 +401,6 @@
property public final boolean isResuming;
property public final String name;
field public static final androidx.health.services.client.data.ExerciseState ACTIVE;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED;
- field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDED_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING;
field public static final androidx.health.services.client.data.ExerciseState AUTO_ENDING_PERMISSION_LOST;
field public static final androidx.health.services.client.data.ExerciseState AUTO_PAUSED;
@@ -411,9 +409,7 @@
field public static final androidx.health.services.client.data.ExerciseState.Companion Companion;
field public static final androidx.health.services.client.data.ExerciseState ENDED;
field public static final androidx.health.services.client.data.ExerciseState PREPARING;
- field public static final androidx.health.services.client.data.ExerciseState TERMINATED;
field public static final androidx.health.services.client.data.ExerciseState TERMINATING;
- field public static final androidx.health.services.client.data.ExerciseState USER_ENDED;
field public static final androidx.health.services.client.data.ExerciseState USER_ENDING;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSED;
field public static final androidx.health.services.client.data.ExerciseState USER_PAUSING;
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseState.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseState.kt
index fa5f612..7bf98af 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseState.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/ExerciseState.kt
@@ -161,7 +161,7 @@
* Used only in the manually started exercise.
*/
@JvmField
- public val USER_ENDED: ExerciseState = ExerciseState(10, "USER_ENDED")
+ internal val USER_ENDED: ExerciseState = ExerciseState(10, "USER_ENDED")
/**
* The exercise is being automatically ended due to a lack of exercise updates being
@@ -180,7 +180,7 @@
* Used only in the manually started exercise.
*/
@JvmField
- public val AUTO_ENDED: ExerciseState = ExerciseState(12, "AUTO_ENDED")
+ internal val AUTO_ENDED: ExerciseState = ExerciseState(12, "AUTO_ENDED")
/**
* The exercise is being automatically ended due to lack of client's permissions to receive
@@ -195,7 +195,7 @@
* data for the exercise.
*/
@JvmField
- public val AUTO_ENDED_PERMISSION_LOST: ExerciseState =
+ internal val AUTO_ENDED_PERMISSION_LOST: ExerciseState =
ExerciseState(17, "AUTO_ENDED_PERMISSION_LOST")
/**
@@ -215,7 +215,7 @@
* Used in both of the manually started exercise and the automatic exercise detection.
*/
@JvmField
- public val TERMINATED: ExerciseState = ExerciseState(14, "TERMINATED")
+ internal val TERMINATED: ExerciseState = ExerciseState(14, "TERMINATED")
/**
* The exercise has been ended, with the reason specified by [ExerciseStateInfo.endReason].
@@ -226,7 +226,7 @@
private val RESUMING_STATES = setOf(USER_RESUMING, AUTO_RESUMING)
private val PAUSED_STATES = setOf(USER_PAUSED, AUTO_PAUSED)
private val ENDED_STATES =
- setOf(USER_ENDED, AUTO_ENDED, AUTO_ENDED_PERMISSION_LOST, TERMINATED)
+ setOf(USER_ENDED, AUTO_ENDED, AUTO_ENDED_PERMISSION_LOST, TERMINATED, ENDED)
private val ENDING_STATES =
setOf(USER_ENDING, AUTO_ENDING, AUTO_ENDING_PERMISSION_LOST, TERMINATING)
private val OTHER_STATES =