Skip to content

Commit

Permalink
Fix detekt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bidetofevil committed Oct 26, 2023
1 parent e3d4777 commit bb8e459
Show file tree
Hide file tree
Showing 50 changed files with 85 additions and 68 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import io.embrace.android.embracesdk.Embrace;
import io.embrace.android.embracesdk.InternalApi;
import io.embrace.android.embracesdk.clock.Clock;
import io.embrace.android.embracesdk.clock.SystemClock;
import io.embrace.android.embracesdk.internal.ApkToolsConfig;
import io.embrace.android.embracesdk.internal.clock.Clock;
import io.embrace.android.embracesdk.internal.clock.SystemClock;
import io.embrace.android.embracesdk.network.EmbraceNetworkRequest;
import io.embrace.android.embracesdk.network.http.EmbraceHttpPathOverride;
import io.embrace.android.embracesdk.network.http.HttpMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.embrace.android.embracesdk.okhttp3

import io.embrace.android.embracesdk.Embrace
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.EmbraceInternalInterface
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.network.EmbraceNetworkRequest
import io.embrace.android.embracesdk.network.http.NetworkCaptureData
import io.embrace.android.embracesdk.okhttp3.EmbraceOkHttp3ApplicationInterceptor.UNKNOWN_EXCEPTION
Expand Down
18 changes: 9 additions & 9 deletions embrace-android-sdk/api/embrace-android-sdk.api
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,6 @@ public final class io/embrace/android/embracesdk/WebViewClientSwazzledHooks {
public abstract interface annotation class io/embrace/android/embracesdk/annotation/StartupActivity : java/lang/annotation/Annotation {
}

public abstract interface class io/embrace/android/embracesdk/clock/Clock {
public abstract fun now ()J
}

public final class io/embrace/android/embracesdk/clock/SystemClock : io/embrace/android/embracesdk/clock/Clock {
public fun <init> ()V
public fun now ()J
}

public abstract interface class io/embrace/android/embracesdk/internal/EmbraceInternalInterface {
public abstract fun getSdkCurrentTime ()J
public abstract fun isNetworkSpanForwardingEnabled ()Z
Expand All @@ -202,6 +193,15 @@ public abstract interface class io/embrace/android/embracesdk/internal/EmbraceIn
public abstract fun shouldCaptureNetworkBody (Ljava/lang/String;Ljava/lang/String;)Z
}

public abstract interface class io/embrace/android/embracesdk/internal/clock/Clock {
public abstract fun now ()J
}

public final class io/embrace/android/embracesdk/internal/clock/SystemClock : io/embrace/android/embracesdk/internal/clock/Clock {
public fun <init> ()V
public fun now ()J
}

public final class io/embrace/android/embracesdk/network/EmbraceNetworkRequest {
public static fun fromCompletedRequest (Ljava/lang/String;Lio/embrace/android/embracesdk/network/http/HttpMethod;JJJJI)Lio/embrace/android/embracesdk/network/EmbraceNetworkRequest;
public static fun fromCompletedRequest (Ljava/lang/String;Lio/embrace/android/embracesdk/network/http/HttpMethod;JJJJILjava/lang/String;)Lio/embrace/android/embracesdk/network/EmbraceNetworkRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import io.embrace.android.embracesdk.capture.strictmode.StrictModeService;
import io.embrace.android.embracesdk.capture.user.UserService;
import io.embrace.android.embracesdk.capture.webview.WebViewService;
import io.embrace.android.embracesdk.clock.Clock;
import io.embrace.android.embracesdk.internal.clock.Clock;
import io.embrace.android.embracesdk.config.ConfigService;
import io.embrace.android.embracesdk.config.behavior.NetworkBehavior;
import io.embrace.android.embracesdk.config.behavior.SessionBehavior;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.embrace.android.embracesdk.anr

import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.anr.detection.ThreadMonitoringState
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.enforceThread
import io.embrace.android.embracesdk.payload.AnrInterval
import io.embrace.android.embracesdk.payload.AnrSample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import io.embrace.android.embracesdk.anr.detection.LivenessCheckScheduler
import io.embrace.android.embracesdk.anr.detection.ThreadMonitoringState
import io.embrace.android.embracesdk.anr.detection.UnbalancedCallDetector
import io.embrace.android.embracesdk.anr.sigquit.SigquitDetectionService
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.enforceThread
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.payload.AnrInterval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.embrace.android.embracesdk.anr.detection
import android.app.ActivityManager
import android.os.Process
import com.google.gson.annotations.SerializedName
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock

private const val DATA_LIMIT_BYTES = 16 * 1024

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.app.ActivityManager
import android.os.Process
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.anr.BlockedThreadListener
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger
import java.util.NavigableMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.embrace.android.embracesdk.anr.detection
import android.os.Debug
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.anr.BlockedThreadListener
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.enforceThread
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.embrace.android.embracesdk.anr.detection
import android.os.Message
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.anr.detection.TargetThreadHandler.Companion.HEARTBEAT_REQUEST
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.enforceThread
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.os.Looper
import android.os.Message
import android.os.MessageQueue
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.enforceThread
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logError
import java.util.concurrent.ExecutorService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.embrace.android.embracesdk.anr.detection

import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock
import java.util.concurrent.atomic.AtomicBoolean

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.net.ConnectivityManager
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.comms.delivery.NetworkStatus
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDebug
import io.embrace.android.embracesdk.payload.Interval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import io.embrace.android.embracesdk.EmbraceEvent
import io.embrace.android.embracesdk.anr.AnrService
import io.embrace.android.embracesdk.capture.metadata.MetadataService
import io.embrace.android.embracesdk.capture.user.UserService
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.comms.api.ApiClient
import io.embrace.android.embracesdk.comms.delivery.DeliveryService
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.event.EventService
import io.embrace.android.embracesdk.gating.GatingService
import io.embrace.android.embracesdk.internal.ApkToolsConfig
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.crash.CrashFileMarker
import io.embrace.android.embracesdk.internal.utils.Uuid.getEmbUuid
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDeveloper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import android.app.Activity
import android.text.TextUtils
import android.util.Pair
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.ApkToolsConfig
import io.embrace.android.embracesdk.internal.CacheableValue
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.payload.Breadcrumbs
import io.embrace.android.embracesdk.payload.CustomBreadcrumb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.app.Application
import android.os.Build
import android.os.Bundle
import androidx.annotation.RequiresApi
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.payload.ActivityLifecycleBreadcrumb
import io.embrace.android.embracesdk.payload.ActivityLifecycleData
import io.embrace.android.embracesdk.payload.ActivityLifecycleState
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.embrace.android.embracesdk.capture.memory

import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger
import io.embrace.android.embracesdk.payload.MemoryWarning
import java.util.NavigableMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.BuildConfig
import io.embrace.android.embracesdk.Embrace.AppFramework
import io.embrace.android.embracesdk.capture.cpu.CpuInfoDelegate
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.BuildInfo
import io.embrace.android.embracesdk.internal.DeviceArchitecture
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDebug
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDeveloper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.embrace.android.embracesdk.capture.orientation

import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDeveloper
import io.embrace.android.embracesdk.payload.Orientation
import java.util.LinkedList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.os.PowerManager
import android.os.PowerManager.ACTION_POWER_SAVE_MODE_CHANGED
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDebug
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDeveloper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import android.os.StrictMode
import android.os.strictmode.Violation
import androidx.annotation.RequiresApi
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.payload.ExceptionInfo
import io.embrace.android.embracesdk.payload.StrictModeViolation
import java.util.concurrent.Executor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.os.Build
import android.os.PowerManager
import androidx.annotation.RequiresApi
import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.payload.ThermalState
import java.util.LinkedList
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.embrace.android.embracesdk.comms.delivery

import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.EmbraceSerializer
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.utils.Uuid
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.payload.BackgroundActivityMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.embrace.android.embracesdk.config

import androidx.annotation.VisibleForTesting
import io.embrace.android.embracesdk.Embrace
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.comms.api.ApiService
import io.embrace.android.embracesdk.config.behavior.AnrBehavior
import io.embrace.android.embracesdk.config.behavior.AppExitInfoBehavior
Expand All @@ -22,6 +21,7 @@ import io.embrace.android.embracesdk.config.behavior.StartupBehavior
import io.embrace.android.embracesdk.config.behavior.WebViewVitalsBehavior
import io.embrace.android.embracesdk.config.local.LocalConfig
import io.embrace.android.embracesdk.config.remote.RemoteConfig
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.prefs.PreferencesService
import io.embrace.android.embracesdk.session.ActivityListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package io.embrace.android.embracesdk.event
import io.embrace.android.embracesdk.capture.PerformanceInfoService
import io.embrace.android.embracesdk.capture.metadata.MetadataService
import io.embrace.android.embracesdk.capture.user.UserService
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.comms.delivery.DeliveryService
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.CacheableValue
import io.embrace.android.embracesdk.internal.EventDescription
import io.embrace.android.embracesdk.internal.StartupEventInfo
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.spans.SpansService
import io.embrace.android.embracesdk.internal.spans.toEmbraceSpanName
import io.embrace.android.embracesdk.internal.utils.Uuid.getEmbUuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import io.embrace.android.embracesdk.LogExceptionType
import io.embrace.android.embracesdk.capture.connectivity.NetworkConnectivityService
import io.embrace.android.embracesdk.capture.metadata.MetadataService
import io.embrace.android.embracesdk.capture.user.UserService
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.comms.api.ApiClient
import io.embrace.android.embracesdk.comms.delivery.DeliveryService
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.config.behavior.LogMessageBehavior
import io.embrace.android.embracesdk.gating.GatingService
import io.embrace.android.embracesdk.internal.CacheableValue
import io.embrace.android.embracesdk.internal.MessageType
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.utils.Uuid.getEmbUuid
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDebug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import io.embrace.android.embracesdk.EmbraceEvent
import io.embrace.android.embracesdk.capture.PerformanceInfoService
import io.embrace.android.embracesdk.capture.metadata.MetadataService
import io.embrace.android.embracesdk.capture.user.UserService
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.comms.delivery.DeliveryService
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.EventDescription
import io.embrace.android.embracesdk.internal.MessageType
import io.embrace.android.embracesdk.internal.StartupEventInfo
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalEmbraceLogger
import io.embrace.android.embracesdk.payload.Event
import io.embrace.android.embracesdk.payload.EventMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package io.embrace.android.embracesdk.injection

import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.clock.NormalizedIntervalClock
import io.embrace.android.embracesdk.clock.SystemClock
import io.embrace.android.embracesdk.internal.OpenTelemetryClock
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.internal.clock.NormalizedIntervalClock
import io.embrace.android.embracesdk.internal.spans.EmbraceSpansService
import io.embrace.android.embracesdk.internal.spans.SpansService

Expand All @@ -23,6 +22,6 @@ internal interface InitModule {
}

internal class InitModuleImpl(
override val clock: Clock = NormalizedIntervalClock(systemClock = SystemClock()),
override val clock: Clock = NormalizedIntervalClock(systemClock = io.embrace.android.embracesdk.internal.clock.SystemClock()),
override val spansService: SpansService = EmbraceSpansService(clock = OpenTelemetryClock(embraceClock = clock))
) : InitModule
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.embrace.android.embracesdk.internal

import android.os.SystemClock
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.utils.BuildVersionChecker
import java.util.concurrent.TimeUnit

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
package io.embrace.android.embracesdk.internal.clock
package io.embrace.android.embracesdk.internal.clock

import io.embrace.android.embracesdk.InternalApi

@InternalApi
public fun interface Clock {

/**
* Returns the current milliseconds from epoch.
*/
public fun now(): Long
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.embrace.android.embracesdk.clock
package io.embrace.android.embracesdk.internal.clock

/**
* A clock which uses [android.os.SystemClock.elapsedRealtime] that is normalized
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.embrace.android.embracesdk.internal.clock

import io.embrace.android.embracesdk.InternalApi

@InternalApi
public class SystemClock : Clock {
override fun now(): Long {
return System.currentTimeMillis()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.embrace.android.embracesdk.logging

import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.config.ConfigService
import io.embrace.android.embracesdk.internal.clock.Clock
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDebug
import io.embrace.android.embracesdk.logging.InternalStaticEmbraceLogger.Companion.logDeveloper
import io.embrace.android.embracesdk.payload.ExceptionError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.embrace.android.embracesdk.payload

import androidx.annotation.VisibleForTesting
import com.google.gson.annotations.SerializedName
import io.embrace.android.embracesdk.clock.Clock
import io.embrace.android.embracesdk.internal.clock.Clock

/**
* Describes an Exception Error with a count of occurrences and a list of exceptions (causes).
Expand Down
Loading

0 comments on commit bb8e459

Please sign in to comment.