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
78 files changed
tree: 70da26b75f0408fb4da9f7355f99afaddc9de972
  1. .github/
  2. .idea/
  3. activity/
  4. ads/
  5. annotation/
  6. appcompat/
  7. appsearch/
  8. arch/
  9. asynclayoutinflater/
  10. autofill/
  11. benchmark/
  12. biometric/
  13. bluetooth/
  14. browser/
  15. buildSrc/
  16. buildSrc-tests/
  17. busytown/
  18. camera/
  19. car/
  20. cardview/
  21. collection/
  22. compose/
  23. concurrent/
  24. contentpager/
  25. coordinatorlayout/
  26. core/
  27. cursoradapter/
  28. customview/
  29. datastore/
  30. development/
  31. docs/
  32. docs-public/
  33. docs-tip-of-tree/
  34. documentfile/
  35. draganddrop/
  36. drawerlayout/
  37. dynamicanimation/
  38. emoji/
  39. emoji2/
  40. enterprise/
  41. exifinterface/
  42. external/
  43. fakeannotations/
  44. fragment/
  45. frameworks/
  46. glance/
  47. gradle/
  48. gridlayout/
  49. health/
  50. heifwriter/
  51. hilt/
  52. inspection/
  53. interpolator/
  54. javascriptengine/
  55. leanback/
  56. lifecycle/
  57. lint-checks/
  58. loader/
  59. media/
  60. media2/
  61. mediarouter/
  62. metrics/
  63. navigation/
  64. paging/
  65. palette/
  66. percentlayout/
  67. placeholder-tests/
  68. playground-common/
  69. preference/
  70. print/
  71. profileinstaller/
  72. recommendation/
  73. recyclerview/
  74. remotecallback/
  75. resourceinspection/
  76. room/
  77. samples/
  78. savedstate/
  79. security/
  80. sharetarget/
  81. slice/
  82. slidingpanelayout/
  83. sqlite/
  84. startup/
  85. swiperefreshlayout/
  86. test/
  87. testutils/
  88. text/
  89. tracing/
  90. transition/
  91. tv/
  92. tvprovider/
  93. vectordrawable/
  94. versionedparcelable/
  95. viewpager/
  96. viewpager2/
  97. wear/
  98. webkit/
  99. window/
  100. work/
  101. .gitignore
  102. .mailmap
  103. build.gradle
  104. cleanBuild.sh
  105. code-review.md
  106. CONTRIBUTING.md
  107. gradle.properties
  108. gradlew
  109. include-composite-deps.gradle
  110. libraryversions.toml
  111. LICENSE.txt
  112. OWNERS
  113. PREUPLOAD.cfg
  114. README.md
  115. settings.gradle
  116. studiow
  117. TEXT_OWNERS
README.md

Android Jetpack

Revved up by Gradle Enterprise

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.

Contribution Guide

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:

Code Review Etiquette

When contributing to Jetpack, follow the code review etiquette.

Accepted Types of Contributions

  • Bug fixes - needs a corresponding bug report in the Android Issue Tracker
  • Each bug fix is expected to come with tests
  • Fixing spelling errors
  • Updating documentation
  • Adding new tests to the area that is not currently covered by tests
  • New features to existing libraries if the feature request bug has been approved by an AndroidX team member.

We are not currently accepting new modules.

Checking Out the Code

Head over to the onboarding docs to learn more about getting set up and the development workflow!

Continuous integration

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.

Password and Contributor Agreement before making a change

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

Getting reviewed

  • After you run repo upload, open r.android.com
  • Sign in into your account (or create one if you do not have one yet)
  • Add an appropriate reviewer (use git log to find who did most modifications on the file you are fixing or check the OWNERS file in the project's directory)

Handling binary dependencies

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.