commit | b9f566fcc8c504ecf048c04e607fca1582947d31 | [log] [tgz] |
---|---|---|
author | Sean Kelley <[email protected]> | Mon Apr 25 10:24:17 2022 -0700 |
committer | Sean Kelley <[email protected]> | Fri Jul 22 16:03:43 2022 -0700 |
tree | 70da26b75f0408fb4da9f7355f99afaddc9de972 | |
parent | 6836cf1685153bbf1aee9b75c843cd56bfb285a2 [diff] |
Implement new DataType/DataPoint Relnote: """Updated how data is modeled The data model and how DataTypes, DataPoints, and their underlying values are represented has been overhauled. The top level impact is that APIs are now much more explicit and type safe. Previously developers may have written code that looked like: ``` exerciseUpdate.latestMetrics[DataType.LOCATION]?.forEach { val loc = it.value.asDoubleArray() val lat = loc[DataPoints.LOCATION_DATA_POINT_LATITUDE_INDEX] val lon = loc[DataPoints.LOCATION_DATA_POINT_LONGITUDE_INDEX] val alt = loc[DataPoints.LOCATION_DATA_POINT_ALTITUDE_INDEX] println("($lat,$lon,$alt) @ ${it.startDurationFromBoot}") } ``` With these changes, the equivalent code would now be: ``` exerciseUpdate.latestMetrics.getData(DataType.LOCATION).forEach { val loc = it.value val time = it.timeDurationFromBoot println("loc = [${loc.latitude}, ${loc.longitude}, ${loc.altitude}] @ $time") } ``` There is now sufficient information embedded in the definition of a `DataType` and `DataPoint` for the compiler and IDE to know that `getData(DataType.Location)` will return a `List<SampleDataPoint<LocationData>>`. That enables type safety inside the IDE and at compile time rather than at runtime. DataType is now generic on the type of `DataPoint` that can represent it: * DeltaDataType * NumericDeltaDataType * AggregateDataType (numeric by default) DataPoint<D : DataType> is now generic and has subclasses * IntervalDataPoint<DeltaDataType> (for e.g. DataType.STEPS) * Previously: DataPoint for a DataType with TimeType.INTERVAL * SampleDataPoint<DeltaDataType> (DataType.HEART_RATE_BPM) * Previously: DataPoint for a DataType with TimeType.SAMPLE * CumulativeDataPoint<AggregateDataType> (DataType.STEPS_TOTAL) * Previously: CumulativeDataPoint for DataType with TimeType.INTERVAL * StatisticalDataPoint<AggregateDataType> (DataType.HEART_RATE_BPM_STATS) * Previously: StatisticalDataPoint for DataType with TimeType.SAMPLE `DataPointContainer` has been added. Where previously APIs returned a map from DataType to DataPoint, they now return a `DataPointContainer` object which enables them to access DataPoints in a type safe way through `getData` methods. Location: Previously `DataType.LOCATION` was a `DoubleArray` with Latitude/Longitude/Altitude/Bearing available at indexes specified by constants, with Altitude/Bearing being optional and alternatively containing `Double.MAX_VALUE` if unavailable. This has now been changed such that DataType.LOCATION now maps to `LocationData` which has latitude/longitude/altitude/bearing properties, with altitude and bearing being nullable to indicate absence. `AchievedExerciseGoal` removed. It only contained the `exerciseGoal` property which is now inlined. `AggregateDataPoints` class has been removed. Utility functions have been moved to `DataPoints` ExerciseUpdate: Since ExerciseType is required, the builder now requires this to be specified in its constructor. """ Test: ./gradlew :health:health-services-client:test Bug: 227475943 Change-Id: I287a816075bf721c9cec2471a5032366f70eee4f
Jetpack is a suite of libraries, tools, and guidance to help developers write high-quality apps easier. These components help you follow best practices, free you from writing boilerplate code, and simplify complex tasks, so you can focus on the code you care about.
Jetpack comprises the androidx.*
package libraries, unbundled from the platform APIs. This means that it offers backward compatibility and is updated more frequently than the Android platform, making sure you always have access to the latest and greatest versions of the Jetpack components.
Our official AARs and JARs binaries are distributed through Google Maven.
You can learn more about using it from Android Jetpack landing page.
For contributions via GitHub, see the GitHub Contribution Guide.
Note: The contributions workflow via GitHub is currently experimental - only contributions to the following projects are being accepted at this time:
When contributing to Jetpack, follow the code review etiquette.
We are not currently accepting new modules.
Head over to the onboarding docs to learn more about getting set up and the development workflow!
Our continuous integration system builds all in progress (and potentially unstable) libraries as new changes are merged. You can manually download these AARs and JARs for your experimentation.
Before uploading your first contribution, you will need setup a password and agree to the contribution agreement:
Generate a HTTPS password: https://android-review.googlesource.com/new-password
Agree to the Google Contributor Licenses Agreement: https://android-review.googlesource.com/settings/new-agreement
AndroidX uses git to store all the binary Gradle dependencies. They are stored in prebuilts/androidx/internal
and prebuilts/androidx/external
directories in your checkout. All the dependencies in these directories are also available from google()
, jcenter()
, or mavenCentral()
. We store copies of these dependencies to have hermetic builds. You can pull in a new dependency using our importMaven tool.