diff --git a/android-agent/build.gradle.kts b/android-agent/build.gradle.kts index a162286fe..2312e2d16 100644 --- a/android-agent/build.gradle.kts +++ b/android-agent/build.gradle.kts @@ -9,6 +9,7 @@ android { dependencies { api(project(":core")) + implementation(project(":common")) implementation(libs.opentelemetry.instrumentation.api) // Default instrumentations: diff --git a/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt index c3a011208..4139ae9a8 100644 --- a/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt +++ b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt @@ -5,6 +5,7 @@ package io.opentelemetry.android.agent +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork import io.opentelemetry.android.config.OtelRumConfig import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader import io.opentelemetry.android.instrumentation.activity.ActivityLifecycleInstrumentation @@ -15,7 +16,6 @@ import io.opentelemetry.android.instrumentation.crash.CrashReporterInstrumentati import io.opentelemetry.android.instrumentation.fragment.FragmentLifecycleInstrumentation import io.opentelemetry.android.instrumentation.network.NetworkChangeInstrumentation import io.opentelemetry.android.instrumentation.slowrendering.SlowRenderingInstrumentation -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork import io.opentelemetry.api.trace.Tracer import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor import java.time.Duration diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 000000000..5862bcdf7 --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id("otel.android-library-conventions") +} + +description = "OpenTelemetry android common utils" + +android { + namespace = "io.opentelemetry.android.common" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + +dependencies { + api(platform(libs.opentelemetry.platform.alpha)) + api(libs.opentelemetry.api) + implementation(libs.opentelemetry.sdk) + implementation(libs.opentelemetry.instrumentation.api) + implementation(libs.opentelemetry.semconv.incubating) + implementation(libs.androidx.core) + + testImplementation(libs.robolectric) +} diff --git a/common/consumer-rules.pro b/common/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/core/src/main/java/io/opentelemetry/android/common/RumConstants.java b/common/src/main/java/io/opentelemetry/android/common/RumConstants.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/common/RumConstants.java rename to common/src/main/java/io/opentelemetry/android/common/RumConstants.java diff --git a/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java b/common/src/main/java/io/opentelemetry/android/common/RuntimeDetailsExtractor.java similarity index 98% rename from core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java rename to common/src/main/java/io/opentelemetry/android/common/RuntimeDetailsExtractor.java index 307ff4c13..3c0ce9ceb 100644 --- a/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java +++ b/common/src/main/java/io/opentelemetry/android/common/RuntimeDetailsExtractor.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android; +package io.opentelemetry.android.common; import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; diff --git a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractor.java similarity index 91% rename from core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractor.java index 66eff3110..22a69779f 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractor.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.features.networkattrs; +package io.opentelemetry.android.common.internal.features.networkattributes; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_ICC; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_MCC; @@ -13,7 +13,7 @@ import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CONNECTION_TYPE; import androidx.annotation.Nullable; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt similarity index 88% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt index 5531892b1..1b558f3ec 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services.network.data +package io.opentelemetry.android.common.internal.features.networkattributes.data import android.os.Build import android.telephony.TelephonyManager diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/CurrentNetwork.java similarity index 97% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/CurrentNetwork.java index 56675b0fc..f776ccec3 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/CurrentNetwork.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services.network.data; +package io.opentelemetry.android.common.internal.features.networkattributes.data; import android.os.Build; import androidx.annotation.Nullable; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/NetworkState.java similarity index 92% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/NetworkState.java index cc178289d..b6402e42e 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/NetworkState.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services.network.data; +package io.opentelemetry.android.common.internal.features.networkattributes.data; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NetworkConnectionTypeIncubatingValues; diff --git a/core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt b/common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt similarity index 89% rename from core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt rename to common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt index d5a76164f..64ff0778e 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt +++ b/common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.tools.time +package io.opentelemetry.android.common.internal.tools.time /** * Utility to be able to mock the current system time for testing purposes. @@ -11,7 +11,7 @@ package io.opentelemetry.android.internal.tools.time *

This class is internal and not for public use. Its APIs are unstable and can change at any * time. */ -internal interface SystemTime { +interface SystemTime { companion object { private var instance: SystemTime = DefaultSystemTime() diff --git a/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java b/common/src/test/java/io/opentelemetry/android/common/RuntimeDetailsExtractorTest.java similarity index 97% rename from core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java rename to common/src/test/java/io/opentelemetry/android/common/RuntimeDetailsExtractorTest.java index 17dc5c59c..2ccc197e6 100644 --- a/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java +++ b/common/src/test/java/io/opentelemetry/android/common/RuntimeDetailsExtractorTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android; +package io.opentelemetry.android.common; import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; diff --git a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java b/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractorTest.java similarity index 88% rename from core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java rename to common/src/test/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractorTest.java index 476bad126..a191f0041 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java +++ b/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractorTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.features.networkattrs; +package io.opentelemetry.android.common.internal.features.networkattributes; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_ICC; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_MCC; @@ -14,9 +14,9 @@ import static org.assertj.core.api.Assertions.entry; import android.os.Build; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/build.gradle.kts b/core/build.gradle.kts index f3ba3cab5..9dfcdcec7 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -62,9 +62,11 @@ android { } dependencies { + implementation(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) + implementation(libs.androidx.core) - implementation(libs.androidx.navigation.fragment) - implementation(libs.androidx.lifecycle.process) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) @@ -74,6 +76,7 @@ dependencies { implementation(libs.opentelemetry.instrumentation.api) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.diskBuffering) + testImplementation(libs.opentelemetry.api.incubator) testImplementation(libs.androidx.test.core) testImplementation(libs.awaitility) diff --git a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java index f71e29c2e..28febe03b 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java +++ b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java @@ -5,8 +5,9 @@ package io.opentelemetry.android.internal.features.networkattrs; +import io.opentelemetry.android.common.internal.features.networkattributes.CurrentNetworkAttributesExtractor; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.trace.ReadWriteSpan; diff --git a/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index 67d425115..28654643c 100644 --- a/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -34,8 +34,8 @@ import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader; import io.opentelemetry.android.instrumentation.InstallationContext; +import io.opentelemetry.android.instrumentation.internal.AndroidInstrumentationLoaderImpl; import io.opentelemetry.android.internal.initialization.InitializationEvents; -import io.opentelemetry.android.internal.instrumentation.AndroidInstrumentationLoaderImpl; import io.opentelemetry.android.internal.services.CacheStorage; import io.opentelemetry.android.internal.services.Preferences; import io.opentelemetry.android.internal.services.ServiceManager; diff --git a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java index 50e1cb23e..f6c8e1329 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java +++ b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java @@ -12,9 +12,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.trace.ReadWriteSpan; diff --git a/instrumentation/activity/build.gradle.kts b/instrumentation/activity/build.gradle.kts index c92ee2ca0..dae90c26d 100644 --- a/instrumentation/activity/build.gradle.kts +++ b/instrumentation/activity/build.gradle.kts @@ -17,7 +17,9 @@ dependencies { api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) - api(project(":core")) + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) implementation(libs.opentelemetry.sdk) implementation(libs.androidx.core) implementation(libs.androidx.navigation.fragment) diff --git a/instrumentation/android-instrumentation/build.gradle.kts b/instrumentation/android-instrumentation/build.gradle.kts new file mode 100644 index 000000000..8ccb6dd87 --- /dev/null +++ b/instrumentation/android-instrumentation/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("otel.android-library-conventions") + id("otel.publish-conventions") +} + +description = "OpenTelemetry Android Instrumentation Auto Service" + +android { + namespace = "io.opentelemetry.android.instrumentation" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + +dependencies { + implementation(project(":services")) + + api(platform(libs.opentelemetry.platform.alpha)) + api(libs.opentelemetry.api) +} diff --git a/instrumentation/android-instrumentation/consumer-rules.pro b/instrumentation/android-instrumentation/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt similarity index 97% rename from core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt index c3934bfec..0cf57516e 100644 --- a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt +++ b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt @@ -5,8 +5,6 @@ package io.opentelemetry.android.instrumentation -import io.opentelemetry.android.OpenTelemetryRum - /** * This interface defines a tool that automatically generates telemetry for a specific use-case, * without the need for end users to directly interact with the OpenTelemetry SDK to create telemetry manually. diff --git a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt similarity index 95% rename from core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt index 480dc95c4..ec921b650 100644 --- a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt +++ b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt @@ -5,7 +5,7 @@ package io.opentelemetry.android.instrumentation -import io.opentelemetry.android.internal.instrumentation.AndroidInstrumentationLoaderImpl +import io.opentelemetry.android.instrumentation.internal.AndroidInstrumentationLoaderImpl /** * Loads and provides [AndroidInstrumentation] instances from the runtime classpath. diff --git a/core/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImpl.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImpl.kt similarity index 95% rename from core/src/main/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImpl.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImpl.kt index cd4d91b1a..0228ae50a 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImpl.kt +++ b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImpl.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.instrumentation +package io.opentelemetry.android.instrumentation.internal import io.opentelemetry.android.instrumentation.AndroidInstrumentation import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader diff --git a/core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt rename to instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt rename to instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImplTest.kt similarity index 95% rename from core/src/test/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt rename to instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImplTest.kt index a4374859b..aaa42917b 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt +++ b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImplTest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.instrumentation +package io.opentelemetry.android.instrumentation.internal import io.mockk.mockk import io.opentelemetry.android.instrumentation.TestAndroidInstrumentation diff --git a/core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation b/instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation similarity index 100% rename from core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation rename to instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation diff --git a/instrumentation/anr/build.gradle.kts b/instrumentation/anr/build.gradle.kts index be9edc570..8621bc0d7 100644 --- a/instrumentation/anr/build.gradle.kts +++ b/instrumentation/anr/build.gradle.kts @@ -18,9 +18,10 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/common-api/build.gradle.kts b/instrumentation/common-api/build.gradle.kts index e845a681c..fd01a3fd9 100644 --- a/instrumentation/common-api/build.gradle.kts +++ b/instrumentation/common-api/build.gradle.kts @@ -14,7 +14,7 @@ android { } dependencies { - api(project(":core")) + implementation(project(":common")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) implementation(libs.androidx.navigation.fragment) diff --git a/instrumentation/crash/build.gradle.kts b/instrumentation/crash/build.gradle.kts index c03511dea..b84f22f4a 100644 --- a/instrumentation/crash/build.gradle.kts +++ b/instrumentation/crash/build.gradle.kts @@ -14,9 +14,11 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":common")) + implementation(project(":services")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java b/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java index 13dd2fe91..e7513115c 100644 --- a/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java +++ b/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java @@ -7,7 +7,7 @@ import androidx.annotation.NonNull; import com.google.auto.service.AutoService; -import io.opentelemetry.android.RuntimeDetailsExtractor; +import io.opentelemetry.android.common.RuntimeDetailsExtractor; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.InstallationContext; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; diff --git a/instrumentation/fragment/build.gradle.kts b/instrumentation/fragment/build.gradle.kts index 1752678fa..e3de91974 100644 --- a/instrumentation/fragment/build.gradle.kts +++ b/instrumentation/fragment/build.gradle.kts @@ -17,7 +17,9 @@ dependencies { api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) - api(project(":core")) + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) implementation(libs.androidx.core) api(libs.androidx.navigation.fragment) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/httpurlconnection/library/build.gradle.kts b/instrumentation/httpurlconnection/library/build.gradle.kts index 447ae2e07..ea0b31b2c 100644 --- a/instrumentation/httpurlconnection/library/build.gradle.kts +++ b/instrumentation/httpurlconnection/library/build.gradle.kts @@ -10,10 +10,10 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(libs.opentelemetry.context) - api(project(":core")) implementation(libs.opentelemetry.instrumentation.apiSemconv) implementation(libs.opentelemetry.instrumentation.api) } diff --git a/instrumentation/network/build.gradle.kts b/instrumentation/network/build.gradle.kts index e0caa2c3b..abb4a3696 100644 --- a/instrumentation/network/build.gradle.kts +++ b/instrumentation/network/build.gradle.kts @@ -19,10 +19,11 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) - api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java index f0374032b..32d94aa98 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java @@ -7,10 +7,10 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.android.internal.services.network.NetworkChangeListener; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java index 47c50e857..1f9ce895d 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java @@ -8,9 +8,9 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CONNECTION_TYPE; -import io.opentelemetry.android.internal.features.networkattrs.CurrentNetworkAttributesExtractor; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.CurrentNetworkAttributesExtractor; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java index d0245db19..d5540c27e 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java @@ -7,9 +7,9 @@ import androidx.annotation.NonNull; import com.google.auto.service.AutoService; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.InstallationContext; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import java.util.ArrayList; import java.util.Collections; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java index 39dbe2b8a..3b2d72511 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.network; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; diff --git a/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java b/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java index 51df0f253..3899f1d62 100644 --- a/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java +++ b/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java @@ -18,13 +18,13 @@ import static org.mockito.Mockito.verify; import android.os.Build; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService; import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.android.internal.services.network.NetworkChangeListener; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule; import io.opentelemetry.sdk.trace.data.SpanData; import java.util.Collections; diff --git a/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts b/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts index b80525bb1..59861c4e3 100644 --- a/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts +++ b/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts @@ -14,8 +14,8 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) compileOnly(libs.okhttp) api(libs.opentelemetry.instrumentation.okhttp) - api(project(":core")) implementation(libs.opentelemetry.instrumentation.apiSemconv) } diff --git a/instrumentation/slowrendering/build.gradle.kts b/instrumentation/slowrendering/build.gradle.kts index f5bd09c79..9df6786e5 100644 --- a/instrumentation/slowrendering/build.gradle.kts +++ b/instrumentation/slowrendering/build.gradle.kts @@ -14,10 +14,11 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) - api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/startup/build.gradle.kts b/instrumentation/startup/build.gradle.kts index fd802a2f7..91d61d1fc 100644 --- a/instrumentation/startup/build.gradle.kts +++ b/instrumentation/startup/build.gradle.kts @@ -17,6 +17,9 @@ dependencies { api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(project(":core")) + api(project(":instrumentation:android-instrumentation")) + implementation(project(":common")) + implementation(project(":services")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/services/build.gradle.kts b/services/build.gradle.kts new file mode 100644 index 000000000..587ca9bee --- /dev/null +++ b/services/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id("otel.android-library-conventions") +} + +description = "OpenTelemetry android internal services" + +android { + namespace = "io.opentelemetry.android.internal.services" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + +dependencies { + implementation(project(":common")) + + implementation(libs.androidx.core) + implementation(libs.androidx.navigation.fragment) + implementation(libs.androidx.lifecycle.process) + + testImplementation(libs.androidx.test.core) + testImplementation(libs.robolectric) +} diff --git a/services/consumer-rules.pro b/services/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/services/src/main/AndroidManifest.xml b/services/src/main/AndroidManifest.xml new file mode 100644 index 000000000..298c8b6e8 --- /dev/null +++ b/services/src/main/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java b/services/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java rename to services/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java b/services/src/main/java/io/opentelemetry/android/internal/services/Preferences.java similarity index 87% rename from core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java rename to services/src/main/java/io/opentelemetry/android/internal/services/Preferences.java index 6c600ac67..ebcd2788c 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/Preferences.java @@ -7,7 +7,6 @@ import android.content.Context; import android.content.SharedPreferences; -import io.opentelemetry.android.BuildConfig; /** * Utility to store and retrieve apps' preferences. @@ -21,7 +20,7 @@ public class Preferences { public static Preferences create(Context context) { return new Preferences( context.getSharedPreferences( - BuildConfig.LIBRARY_PACKAGE_NAME + ".prefs", Context.MODE_PRIVATE)); + "io.opentelemetry.android" + ".prefs", Context.MODE_PRIVATE)); } private Preferences(SharedPreferences sharedPreferences) { diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt b/services/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt b/services/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/Startable.java b/services/src/main/java/io/opentelemetry/android/internal/services/Startable.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/Startable.java rename to services/src/main/java/io/opentelemetry/android/internal/services/Startable.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java b/services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java rename to services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt b/services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java similarity index 94% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java index 7690e0540..432f63dd8 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java @@ -8,7 +8,7 @@ import android.os.Build; import android.telephony.TelephonyManager; import androidx.annotation.RequiresApi; -import io.opentelemetry.android.internal.services.network.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java similarity index 96% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java index 2da0fcc9a..8d1e06a6f 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java @@ -15,9 +15,9 @@ import android.util.Log; import androidx.annotation.NonNull; import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.Startable; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import io.opentelemetry.android.internal.services.network.detector.NetworkDetector; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java similarity index 78% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java index c1b46ba7f..54c697d8e 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.internal.services.network; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java similarity index 92% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java index 27a6483e9..5a2c730bd 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java @@ -9,8 +9,8 @@ import android.net.ConnectivityManager; import android.os.Build; import android.telephony.TelephonyManager; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.network.CarrierFinder; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java similarity index 94% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java index 09edde22e..da622fcbc 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java @@ -18,10 +18,10 @@ import android.telephony.TelephonyManager; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.CarrierFinder; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java similarity index 91% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java index bba6ef27a..6022c3cce 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java @@ -10,8 +10,8 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt similarity index 96% rename from core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt index 3fb9662a8..5ddd3c68f 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt +++ b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt @@ -5,7 +5,7 @@ package io.opentelemetry.android.internal.services.periodicwork -import io.opentelemetry.android.internal.tools.time.SystemTime +import io.opentelemetry.android.common.internal.tools.time.SystemTime /** * Utility for creating a Runnable that needs to run multiple times. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java similarity index 94% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java index 4d94d512c..b7cc49052 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java @@ -10,7 +10,7 @@ import static org.mockito.Mockito.when; import android.telephony.TelephonyManager; -import io.opentelemetry.android.internal.services.network.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; import org.junit.jupiter.api.Test; class CarrierFinderTest { diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java similarity index 98% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java index 4c7f6a72f..87f2eff80 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java @@ -21,8 +21,8 @@ import android.net.Network; import android.net.NetworkRequest; import android.os.Build; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.detector.NetworkDetector; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Assert; diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java similarity index 95% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java index 7acb9bea5..81f6645a8 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java @@ -15,10 +15,10 @@ import android.net.NetworkCapabilities; import android.os.Build; import android.telephony.TelephonyManager; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.CarrierFinder; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java similarity index 97% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java index 697fbd551..2484dcb2f 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java @@ -13,8 +13,8 @@ import android.net.NetworkInfo; import android.os.Build; import androidx.test.core.app.ApplicationProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt similarity index 98% rename from core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt index 8013ac01a..9be39c642 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt +++ b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt @@ -10,7 +10,7 @@ import io.mockk.every import io.mockk.just import io.mockk.mockk import io.mockk.verify -import io.opentelemetry.android.internal.tools.time.SystemTime +import io.opentelemetry.android.common.internal.tools.time.SystemTime import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index 0ed23cc0d..b095e855c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,3 +18,6 @@ include(":instrumentation:httpurlconnection:agent") include(":instrumentation:httpurlconnection:library") include(":instrumentation:httpurlconnection:testing") include(":test-common") +include(":instrumentation:android-instrumentation") +include(":services") +include(":common")