Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fdc7abe authored by Brian Julian's avatar Brian Julian Committed by Android (Google) Code Review
Browse files

Merge "Adds additional documentation to...

Merge "Adds additional documentation to AltitudeConverter.addMslAltitudeToLocation(Location)." into main
parents 83029199 767d978d
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -219,6 +219,27 @@ public final class AltitudeConverter {
     * called on the main thread as data will not be loaded from raw assets. Returns true if a Mean
     * Sea Level altitude is added to the {@code location}; otherwise, returns false and leaves the
     * {@code location} unchanged.
     *
     * <p>Prior calls to {@link #addMslAltitudeToLocation(Context, Location)} off the main thread
     * are necessary to load data from raw assets. Example code on the main thread is as follows:
     *
     * <pre>{@code
     *   if (!mAltitudeConverter.addMslAltitudeToLocation(location)) {
     *       // Queue up only one call off the main thread.
     *       if (mIsAltitudeConverterIdle) {
     *           mIsAltitudeConverterIdle = false;
     *           executeOffMainThread(() -> {
     *               try {
     *                   // Load raw assets for next call attempt on main thread.
     *                   mAltitudeConverter.addMslAltitudeToLocation(mContext, location);
     *               } catch (IOException e) {
     *                   Log.e(TAG, "Not loading raw assets: " + e);
     *               }
     *               mIsAltitudeConverterIdle = true;
     *           });
     *       }
     *   }
     * }</pre>
     */
    @FlaggedApi(Flags.FLAG_GEOID_HEIGHTS_VIA_ALTITUDE_HAL)
    public boolean addMslAltitudeToLocation(@NonNull Location location) {