Merge "Add tests for PassiveListenerService" into androidx-main
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java
index cb4f1cd..6d5f28a 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java
@@ -37,6 +37,8 @@
import androidx.camera.camera2.internal.compat.CameraCharacteristicsCompat;
import androidx.camera.camera2.internal.compat.CameraManagerCompat;
import androidx.camera.camera2.internal.compat.quirk.CameraQuirks;
+import androidx.camera.camera2.internal.compat.quirk.DeviceQuirks;
+import androidx.camera.camera2.internal.compat.quirk.ZslDisablerQuirk;
import androidx.camera.camera2.internal.compat.workaround.FlashAvailabilityChecker;
import androidx.camera.camera2.interop.Camera2CameraInfo;
import androidx.camera.camera2.interop.ExperimentalCamera2Interop;
@@ -358,7 +360,8 @@
@Override
public boolean isZslSupported() {
- return Build.VERSION.SDK_INT >= 23 && isPrivateReprocessingSupported();
+ return Build.VERSION.SDK_INT >= 23 && isPrivateReprocessingSupported()
+ && (DeviceQuirks.get(ZslDisablerQuirk.class) == null);
}
@Override
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/ZslControlImpl.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/ZslControlImpl.java
index 12ecb98..bcf5423 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/ZslControlImpl.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/ZslControlImpl.java
@@ -38,6 +38,8 @@
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.camera.camera2.internal.compat.CameraCharacteristicsCompat;
+import androidx.camera.camera2.internal.compat.quirk.DeviceQuirks;
+import androidx.camera.camera2.internal.compat.quirk.ZslDisablerQuirk;
import androidx.camera.core.ExperimentalGetImage;
import androidx.camera.core.ImageProxy;
import androidx.camera.core.Logger;
@@ -86,6 +88,8 @@
private boolean mIsZslDisabledByFlashMode = false;
private boolean mIsPrivateReprocessingSupported = false;
+ private boolean mShouldZslDisabledByQuirks = false;
+
@SuppressWarnings("WeakerAccess")
SafeCloseImageReaderProxy mReprocessingImageReader;
private CameraCaptureCallback mMetadataMatchingCaptureCallback;
@@ -102,6 +106,8 @@
mReprocessingInputSizeMap = createReprocessingInputSizeMap(mCameraCharacteristicsCompat);
+ mShouldZslDisabledByQuirks = DeviceQuirks.get(ZslDisablerQuirk.class) != null;
+
mImageRingBuffer = new ZslRingBuffer(
RING_BUFFER_CAPACITY,
imageProxy -> imageProxy.close());
@@ -139,6 +145,10 @@
return;
}
+ if (mShouldZslDisabledByQuirks) {
+ return;
+ }
+
// Due to b/232268355 and feedback from pixel team that private format will have better
// performance, we will use private only for zsl.
if (!mIsPrivateReprocessingSupported
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/DeviceQuirksLoader.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/DeviceQuirksLoader.java
index fe2ab38..706f1a6 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/DeviceQuirksLoader.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/DeviceQuirksLoader.java
@@ -80,6 +80,9 @@
if (TorchIsClosedAfterImageCapturingQuirk.load()) {
quirks.add(new TorchIsClosedAfterImageCapturingQuirk());
}
+ if (ZslDisablerQuirk.load()) {
+ quirks.add(new ZslDisablerQuirk());
+ }
return quirks;
}
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/ZslDisablerQuirk.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/ZslDisablerQuirk.java
new file mode 100644
index 0000000..6a4ec43
--- /dev/null
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/quirk/ZslDisablerQuirk.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.camera.camera2.internal.compat.quirk;
+
+import android.os.Build;
+
+import androidx.annotation.RequiresApi;
+import androidx.camera.core.CameraInfo;
+import androidx.camera.core.impl.Quirk;
+
+import java.util.Locale;
+
+/**
+ * <p>QuirkSummary
+ * Bug Id: 252818931
+ * Description: On certain devices, the captured image has color issue for reprocessing. We
+ * need to disable zero-shutter lag and return false for
+ * {@link CameraInfo#isZslSupported()}.
+ * Device(s): Samsung Fold4
+ */
+@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
+public class ZslDisablerQuirk implements Quirk {
+
+ static boolean load() {
+ return isSamsungFold4();
+ }
+
+ private static boolean isSamsungFold4() {
+ return "samsung".equalsIgnoreCase(Build.BRAND)
+ && android.os.Build.MODEL.toUpperCase(Locale.US).startsWith("SM-F936");
+ }
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java
index 5cea42a..0062a4b 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java
@@ -61,6 +61,7 @@
import org.robolectric.shadow.api.Shadow;
import org.robolectric.shadows.ShadowCameraCharacteristics;
import org.robolectric.shadows.ShadowCameraManager;
+import org.robolectric.util.ReflectionHelpers;
import java.util.Arrays;
import java.util.HashMap;
@@ -512,6 +513,36 @@
assertThat(cameraInfo.isZslSupported()).isFalse();
}
+ @Config(minSdk = 23)
+ @Test
+ public void isZslSupported_hasZslDisablerQuirk_returnFalse()
+ throws CameraAccessExceptionCompat {
+ ReflectionHelpers.setStaticField(Build.class, "BRAND", "samsung");
+ ReflectionHelpers.setStaticField(Build.class, "MODEL", "SM-F936B");
+
+ init(/* hasReprocessingCapabilities = */ true);
+
+ final Camera2CameraInfoImpl cameraInfo = new Camera2CameraInfoImpl(
+ CAMERA0_ID, mCameraManagerCompat);
+
+ assertThat(cameraInfo.isZslSupported()).isFalse();
+ }
+
+ @Config(minSdk = 23)
+ @Test
+ public void isZslSupported_hasNoZslDisablerQuirk_returnTrue()
+ throws CameraAccessExceptionCompat {
+ ReflectionHelpers.setStaticField(Build.class, "BRAND", "samsung");
+ ReflectionHelpers.setStaticField(Build.class, "MODEL", "SM-G973");
+
+ init(/* hasReprocessingCapabilities = */ true);
+
+ final Camera2CameraInfoImpl cameraInfo = new Camera2CameraInfoImpl(
+ CAMERA0_ID, mCameraManagerCompat);
+
+ assertThat(cameraInfo.isZslSupported()).isTrue();
+ }
+
private CameraManagerCompat initCameraManagerWithPhysicalIds(
List<Pair<String, CameraCharacteristics>> cameraIdsAndCharacteristicsList) {
FakeCameraManagerImpl cameraManagerImpl = new FakeCameraManagerImpl();
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/ZslControlImplTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/ZslControlImplTest.kt
index 33ddaf5..5804642 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/ZslControlImplTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/ZslControlImplTest.kt
@@ -39,6 +39,7 @@
import org.robolectric.annotation.internal.DoNotInstrument
import org.robolectric.shadow.api.Shadow
import org.robolectric.shadows.ShadowCameraCharacteristics
+import org.robolectric.util.ReflectionHelpers
val YUV_REPROCESSING_MAXIMUM_SIZE = Size(4000, 3000)
val PRIVATE_REPROCESSING_MAXIMUM_SIZE = Size(3000, 2000)
@@ -49,20 +50,20 @@
@RunWith(RobolectricTestRunner::class)
@DoNotInstrument
@Config(minSdk = Build.VERSION_CODES.M)
-public class ZslControlImplTest {
+class ZslControlImplTest {
private lateinit var zslControl: ZslControlImpl
private lateinit var sessionConfigBuilder: SessionConfig.Builder
@Before
- public fun setUp() {
+ fun setUp() {
sessionConfigBuilder = SessionConfig.Builder().also { sessionConfigBuilder ->
sessionConfigBuilder.setTemplateType(CameraDevice.TEMPLATE_ZERO_SHUTTER_LAG)
}
}
@Test
- public fun isPrivateReprocessingSupported_addZslConfig() {
+ fun isPrivateReprocessingSupported_addZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = false,
@@ -85,7 +86,7 @@
}
@Test
- public fun isYuvReprocessingSupported_notAddZslConfig() {
+ fun isYuvReprocessingSupported_notAddZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = true,
@@ -99,7 +100,7 @@
}
@Test
- public fun isJpegNotValidOutputFormat_notAddZslConfig() {
+ fun isJpegNotValidOutputFormat_notAddZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = true,
@@ -113,7 +114,7 @@
}
@Test
- public fun isReprocessingNotSupported_notAddZslConfig() {
+ fun isReprocessingNotSupported_notAddZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = false,
@@ -127,7 +128,7 @@
}
@Test
- public fun isZslDisabledByUserCaseConfig_notAddZslConfig() {
+ fun isZslDisabledByUserCaseConfig_notAddZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = false,
@@ -142,7 +143,7 @@
}
@Test
- public fun isZslDisabledByFlashMode_addZslConfig() {
+ fun isZslDisabledByFlashMode_addZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = false,
@@ -166,7 +167,7 @@
}
@Test
- public fun isZslDisabled_clearZslConfig() {
+ fun isZslDisabled_clearZslConfig() {
zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
hasCapabilities = true,
isYuvReprocessingSupported = false,
@@ -182,6 +183,49 @@
assertThat(zslControl.mReprocessingImageReader).isNull()
}
+ @Test
+ fun hasZslDisablerQuirk_notAddZslConfig() {
+ ReflectionHelpers.setStaticField(Build::class.java, "BRAND", "samsung")
+ ReflectionHelpers.setStaticField(Build::class.java, "MODEL", "SM-F936B")
+
+ zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
+ hasCapabilities = true,
+ isYuvReprocessingSupported = false,
+ isPrivateReprocessingSupported = true,
+ isJpegValidOutputFormat = true
+ ))
+
+ zslControl.addZslConfig(sessionConfigBuilder)
+
+ assertThat(zslControl.mReprocessingImageReader).isNull()
+ }
+
+ @Test
+ fun hasNoZslDisablerQuirk_addZslConfig() {
+ ReflectionHelpers.setStaticField(Build::class.java, "BRAND", "samsung")
+ ReflectionHelpers.setStaticField(Build::class.java, "MODEL", "SM-G973")
+
+ zslControl = ZslControlImpl(createCameraCharacteristicsCompat(
+ hasCapabilities = true,
+ isYuvReprocessingSupported = false,
+ isPrivateReprocessingSupported = true,
+ isJpegValidOutputFormat = true
+ ))
+
+ zslControl.addZslConfig(sessionConfigBuilder)
+
+ assertThat(zslControl.mReprocessingImageReader).isNotNull()
+ assertThat(zslControl.mReprocessingImageReader.imageFormat).isEqualTo(PRIVATE)
+ assertThat(zslControl.mReprocessingImageReader.maxImages).isEqualTo(
+ MAX_IMAGES)
+ assertThat(zslControl.mReprocessingImageReader.width).isEqualTo(
+ PRIVATE_REPROCESSING_MAXIMUM_SIZE.width)
+ assertThat(zslControl.mReprocessingImageReader.height).isEqualTo(
+ PRIVATE_REPROCESSING_MAXIMUM_SIZE.height)
+ assertThat(zslControl.mImageRingBuffer.maxCapacity).isEqualTo(
+ RING_BUFFER_CAPACITY)
+ }
+
private fun createCameraCharacteristicsCompat(
hasCapabilities: Boolean,
isYuvReprocessingSupported: Boolean,
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 84e9862..e37c668 100644
--- a/health/health-services-client/api/1.0.0-beta01.txt
+++ b/health/health-services-client/api/1.0.0-beta01.txt
@@ -85,11 +85,6 @@
method public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setPassiveListenerServiceAsync(Class<? extends androidx.health.services.client.PassiveListenerService> service, androidx.health.services.client.data.PassiveListenerConfig config);
}
- public final class VersionApiService extends android.app.Service {
- ctor public VersionApiService();
- method public android.os.IBinder? onBind(android.content.Intent? intent);
- }
-
}
package androidx.health.services.client.data {
@@ -660,7 +655,7 @@
}
public final class LocationData {
- ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional @FloatRange double altitude, optional @FloatRange(from=-1.0, to=360.0, toInclusive=false) double bearing);
+ ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional double altitude, optional double bearing);
method public double getAltitude();
method public double getBearing();
method public double getLatitude();
@@ -669,8 +664,8 @@
property public final double bearing;
property public final double latitude;
property public final double longitude;
- field public static final double ALTITUDE_UNAVAILABLE = 1.7976931348623157E308;
- field public static final double BEARING_UNAVAILABLE = -1.0;
+ field public static final double ALTITUDE_UNAVAILABLE = (0.0/0.0);
+ field public static final double BEARING_UNAVAILABLE = (0.0/0.0);
}
public final class MeasureCapabilities {
diff --git a/health/health-services-client/api/current.txt b/health/health-services-client/api/current.txt
index 84e9862..e37c668 100644
--- a/health/health-services-client/api/current.txt
+++ b/health/health-services-client/api/current.txt
@@ -85,11 +85,6 @@
method public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setPassiveListenerServiceAsync(Class<? extends androidx.health.services.client.PassiveListenerService> service, androidx.health.services.client.data.PassiveListenerConfig config);
}
- public final class VersionApiService extends android.app.Service {
- ctor public VersionApiService();
- method public android.os.IBinder? onBind(android.content.Intent? intent);
- }
-
}
package androidx.health.services.client.data {
@@ -660,7 +655,7 @@
}
public final class LocationData {
- ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional @FloatRange double altitude, optional @FloatRange(from=-1.0, to=360.0, toInclusive=false) double bearing);
+ ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional double altitude, optional double bearing);
method public double getAltitude();
method public double getBearing();
method public double getLatitude();
@@ -669,8 +664,8 @@
property public final double bearing;
property public final double latitude;
property public final double longitude;
- field public static final double ALTITUDE_UNAVAILABLE = 1.7976931348623157E308;
- field public static final double BEARING_UNAVAILABLE = -1.0;
+ field public static final double ALTITUDE_UNAVAILABLE = (0.0/0.0);
+ field public static final double BEARING_UNAVAILABLE = (0.0/0.0);
}
public final class MeasureCapabilities {
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 84e9862..e37c668 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
@@ -85,11 +85,6 @@
method public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setPassiveListenerServiceAsync(Class<? extends androidx.health.services.client.PassiveListenerService> service, androidx.health.services.client.data.PassiveListenerConfig config);
}
- public final class VersionApiService extends android.app.Service {
- ctor public VersionApiService();
- method public android.os.IBinder? onBind(android.content.Intent? intent);
- }
-
}
package androidx.health.services.client.data {
@@ -660,7 +655,7 @@
}
public final class LocationData {
- ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional @FloatRange double altitude, optional @FloatRange(from=-1.0, to=360.0, toInclusive=false) double bearing);
+ ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional double altitude, optional double bearing);
method public double getAltitude();
method public double getBearing();
method public double getLatitude();
@@ -669,8 +664,8 @@
property public final double bearing;
property public final double latitude;
property public final double longitude;
- field public static final double ALTITUDE_UNAVAILABLE = 1.7976931348623157E308;
- field public static final double BEARING_UNAVAILABLE = -1.0;
+ field public static final double ALTITUDE_UNAVAILABLE = (0.0/0.0);
+ field public static final double BEARING_UNAVAILABLE = (0.0/0.0);
}
public final class MeasureCapabilities {
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 84e9862..e37c668 100644
--- a/health/health-services-client/api/public_plus_experimental_current.txt
+++ b/health/health-services-client/api/public_plus_experimental_current.txt
@@ -85,11 +85,6 @@
method public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setPassiveListenerServiceAsync(Class<? extends androidx.health.services.client.PassiveListenerService> service, androidx.health.services.client.data.PassiveListenerConfig config);
}
- public final class VersionApiService extends android.app.Service {
- ctor public VersionApiService();
- method public android.os.IBinder? onBind(android.content.Intent? intent);
- }
-
}
package androidx.health.services.client.data {
@@ -660,7 +655,7 @@
}
public final class LocationData {
- ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional @FloatRange double altitude, optional @FloatRange(from=-1.0, to=360.0, toInclusive=false) double bearing);
+ ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional double altitude, optional double bearing);
method public double getAltitude();
method public double getBearing();
method public double getLatitude();
@@ -669,8 +664,8 @@
property public final double bearing;
property public final double latitude;
property public final double longitude;
- field public static final double ALTITUDE_UNAVAILABLE = 1.7976931348623157E308;
- field public static final double BEARING_UNAVAILABLE = -1.0;
+ field public static final double ALTITUDE_UNAVAILABLE = (0.0/0.0);
+ field public static final double BEARING_UNAVAILABLE = (0.0/0.0);
}
public final class MeasureCapabilities {
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 84e9862..e37c668 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
@@ -85,11 +85,6 @@
method public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setPassiveListenerServiceAsync(Class<? extends androidx.health.services.client.PassiveListenerService> service, androidx.health.services.client.data.PassiveListenerConfig config);
}
- public final class VersionApiService extends android.app.Service {
- ctor public VersionApiService();
- method public android.os.IBinder? onBind(android.content.Intent? intent);
- }
-
}
package androidx.health.services.client.data {
@@ -660,7 +655,7 @@
}
public final class LocationData {
- ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional @FloatRange double altitude, optional @FloatRange(from=-1.0, to=360.0, toInclusive=false) double bearing);
+ ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional double altitude, optional double bearing);
method public double getAltitude();
method public double getBearing();
method public double getLatitude();
@@ -669,8 +664,8 @@
property public final double bearing;
property public final double latitude;
property public final double longitude;
- field public static final double ALTITUDE_UNAVAILABLE = 1.7976931348623157E308;
- field public static final double BEARING_UNAVAILABLE = -1.0;
+ field public static final double ALTITUDE_UNAVAILABLE = (0.0/0.0);
+ field public static final double BEARING_UNAVAILABLE = (0.0/0.0);
}
public final class MeasureCapabilities {
diff --git a/health/health-services-client/api/restricted_current.txt b/health/health-services-client/api/restricted_current.txt
index 84e9862..e37c668 100644
--- a/health/health-services-client/api/restricted_current.txt
+++ b/health/health-services-client/api/restricted_current.txt
@@ -85,11 +85,6 @@
method public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setPassiveListenerServiceAsync(Class<? extends androidx.health.services.client.PassiveListenerService> service, androidx.health.services.client.data.PassiveListenerConfig config);
}
- public final class VersionApiService extends android.app.Service {
- ctor public VersionApiService();
- method public android.os.IBinder? onBind(android.content.Intent? intent);
- }
-
}
package androidx.health.services.client.data {
@@ -660,7 +655,7 @@
}
public final class LocationData {
- ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional @FloatRange double altitude, optional @FloatRange(from=-1.0, to=360.0, toInclusive=false) double bearing);
+ ctor public LocationData(@FloatRange(from=-90.0, to=90.0) double latitude, @FloatRange(from=-180.0, to=180.0) double longitude, optional double altitude, optional double bearing);
method public double getAltitude();
method public double getBearing();
method public double getLatitude();
@@ -669,8 +664,8 @@
property public final double bearing;
property public final double latitude;
property public final double longitude;
- field public static final double ALTITUDE_UNAVAILABLE = 1.7976931348623157E308;
- field public static final double BEARING_UNAVAILABLE = -1.0;
+ field public static final double ALTITUDE_UNAVAILABLE = (0.0/0.0);
+ field public static final double BEARING_UNAVAILABLE = (0.0/0.0);
}
public final class MeasureCapabilities {
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/VersionApiService.kt b/health/health-services-client/src/main/java/androidx/health/services/client/VersionApiService.kt
index 48f6af7..91d58a2 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/VersionApiService.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/VersionApiService.kt
@@ -20,10 +20,13 @@
import android.content.Intent
import android.os.IBinder
import android.util.Log
+import androidx.annotation.RestrictTo
+import androidx.annotation.RestrictTo.Scope
import androidx.health.services.client.impl.IVersionApiService
import androidx.health.services.client.impl.IpcConstants
/** Service that allows querying the canonical SDK version used to compile this app. */
+@RestrictTo(Scope.LIBRARY)
public class VersionApiService : Service() {
private val stub: VersionApiServiceStub = VersionApiServiceStub()
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPoints.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPoints.kt
index 07c0479..9d188b9 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPoints.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPoints.kt
@@ -391,9 +391,8 @@
@FloatRange(from = -90.0, to = 90.0) latitude: Double,
@FloatRange(from = -180.0, to = 180.0) longitude: Double,
timeDurationFromBoot: Duration,
- @FloatRange altitude: Double = LocationData.ALTITUDE_UNAVAILABLE,
- @FloatRange(from = -1.0, to = 360.0, toInclusive = false) bearing: Double =
- LocationData.BEARING_UNAVAILABLE,
+ altitude: Double = LocationData.ALTITUDE_UNAVAILABLE,
+ bearing: Double = LocationData.BEARING_UNAVAILABLE,
accuracy: LocationAccuracy? = null
): SampleDataPoint<LocationData> {
if (latitude !in -90.0..90.0) {
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt
index c1a68a5..8537b1b 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt
@@ -27,12 +27,11 @@
/** Longitude of location. Range from -180.0 to = 180.0. */
@FloatRange(from = -180.0, to = 180.0) public val longitude: Double,
/** Altitude of location in meters or [ALTITUDE_UNAVAILABLE] if not available. */
- @FloatRange public val altitude: Double = ALTITUDE_UNAVAILABLE,
+ public val altitude: Double = ALTITUDE_UNAVAILABLE,
/** Bearing in degrees within the range of [0.0 (inclusive), 360.0(exclusive)] or
* [BEARING_UNAVAILABLE] if not available.
*/
- @FloatRange(from = -1.0, to = 360.0, toInclusive = false) public val bearing: Double =
- BEARING_UNAVAILABLE,
+ public val bearing: Double = BEARING_UNAVAILABLE,
) {
init {
if (latitude !in -90.0..90.0) {
@@ -114,10 +113,10 @@
private const val BEARING_INDEX: Int = 3
/** When using [DataType.LOCATION], the default value if altitude value is not available. */
- public const val ALTITUDE_UNAVAILABLE: Double = Double.MAX_VALUE
+ public const val ALTITUDE_UNAVAILABLE: Double = Double.NaN
/** When using [DataType.LOCATION], the default value if bearing value is not available. */
- public const val BEARING_UNAVAILABLE: Double = -1.0
+ public const val BEARING_UNAVAILABLE: Double = Double.NaN
internal fun fromDataProtoValue(proto: DataProto.Value): LocationData {
require(proto.hasDoubleArrayVal())
diff --git a/navigation/navigation-compose/build.gradle b/navigation/navigation-compose/build.gradle
index 3d7416c..322181e 100644
--- a/navigation/navigation-compose/build.gradle
+++ b/navigation/navigation-compose/build.gradle
@@ -28,7 +28,7 @@
implementation(libs.kotlinStdlib)
implementation("androidx.compose.foundation:foundation-layout:1.0.1")
- api("androidx.activity:activity-compose:1.5.1")
+ api("androidx.activity:activity-compose:1.6.1")
api("androidx.compose.animation:animation:1.0.1")
api("androidx.compose.runtime:runtime:1.0.1")
api("androidx.compose.runtime:runtime-saveable:1.0.1")
diff --git a/navigation/navigation-runtime/build.gradle b/navigation/navigation-runtime/build.gradle
index 5e3f870..03a4616 100644
--- a/navigation/navigation-runtime/build.gradle
+++ b/navigation/navigation-runtime/build.gradle
@@ -25,7 +25,7 @@
dependencies {
api(project(":navigation:navigation-common"))
- api("androidx.activity:activity-ktx:1.5.1")
+ api("androidx.activity:activity-ktx:1.6.1")
api("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
api("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
api("androidx.annotation:annotation-experimental:1.1.0")