Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ android {
lint {
warningsAsErrors = true
checkDependencies = true
// TODO: Re-enable once the SDK_INT checks made obsolete by minSdk 24 are removed.
disable += "ObsoleteSdkInt"

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static io.sentry.IConnectionStatusProvider.ConnectionStatus.DISCONNECTED;
import static java.util.concurrent.TimeUnit.SECONDS;

import android.os.Build;
import io.sentry.CompositePerformanceCollector;
import io.sentry.DataCategory;
import io.sentry.IContinuousProfiler;
Expand Down Expand Up @@ -176,10 +175,6 @@ private void initScopes() {
private void start() {
initScopes();

// Debug.startMethodTracingSampling() is only available since Lollipop, but Android Profiler
// causes crashes on api 21 -> https://github.com/getsentry/sentry-java/issues/3392
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) return;

// Let's initialize trace folder and profiling interval
init();
// init() didn't create profiler, should never happen
Expand Down Expand Up @@ -281,12 +276,6 @@ private void stop(final boolean restartProfiler) {
return;
}

// onTransactionStart() is only available since Lollipop_MR1
// and SystemClock.elapsedRealtimeNanos() since Jelly Bean
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) {
return;
}

List<PerformanceCollectionData> performanceCollectionData = null;
if (performanceCollector != null) {
performanceCollectionData = performanceCollector.stop(chunkId.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.core;

import android.annotation.SuppressLint;
import android.os.Debug;
import android.os.Process;
import android.os.SystemClock;
Expand Down Expand Up @@ -116,7 +115,6 @@ public AndroidProfiler(
Objects.requireNonNull(frameMetricsCollector, "SentryFrameMetricsCollector is required");
}

@SuppressLint("NewApi")
public @Nullable ProfileStartData start() {
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
// intervalUs is 0 only if there was a problem in the init
Expand Down Expand Up @@ -225,7 +223,6 @@ public void onFrameMetricCollected(
}
}

@SuppressLint("NewApi")
public @Nullable ProfileEndData endAndCollect(
final boolean isTimeout,
final @Nullable List<PerformanceCollectionData> performanceCollectionData) {
Expand Down Expand Up @@ -299,7 +296,6 @@ public void close() {
}
}

@SuppressLint("NewApi")
private void putPerformanceCollectionDataInMeasurements(
final @Nullable List<PerformanceCollectionData> performanceCollectionData) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static java.util.concurrent.TimeUnit.SECONDS;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import io.sentry.DateUtils;
Expand Down Expand Up @@ -151,10 +150,6 @@ private void init() {

@Override
public void start() {
// Debug.startMethodTracingSampling() is only available since Lollipop, but Android Profiler
// causes crashes on api 21 -> https://github.com/getsentry/sentry-java/issues/3392
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) return;

// When the first transaction is starting, we can start profiling
if (!isRunning.getAndSet(true)) {
// Let's initialize trace folder and profiling interval
Expand All @@ -179,7 +174,6 @@ public void start() {
}
}

@SuppressLint("NewApi")
private boolean onFirstStart() {
// init() didn't create profiler, should never happen
if (profiler == null) {
Expand Down Expand Up @@ -225,7 +219,6 @@ public void bindTransaction(final @NotNull ITransaction transaction) {
options);
}

@SuppressLint("NewApi")
private @Nullable ProfilingTraceData onTransactionFinish(
final @NotNull String transactionName,
final @NotNull String transactionId,
Expand All @@ -234,11 +227,6 @@ public void bindTransaction(final @NotNull ITransaction transaction) {
final @Nullable List<PerformanceCollectionData> performanceCollectionData,
final @NotNull SentryOptions options) {

// onTransactionStart() is only available since Lollipop_MR1
// and SystemClock.elapsedRealtimeNanos() since Jelly Bean
// and SUPPORTED_ABIS since KITKAT
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.LOLLIPOP_MR1) return null;

// check if profiler was created
if (profiler == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public AnrV2Integration(final @NotNull Context context) {
this.dateProvider = dateProvider;
}

@SuppressLint("NewApi") // we do the check in the AnrIntegrationFactory
@Override
public void register(@NotNull IScopes scopes, @NotNull SentryOptions options) {
this.options =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static io.sentry.cache.PersistingScopeObserver.USER_FILENAME;
import static io.sentry.protocol.Contexts.REPLAY_ID;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageInfo;
Expand Down Expand Up @@ -728,7 +727,6 @@ private void setDevice(final @NotNull SentryBaseEvent event) {

// only use static data that does not change between app launches (e.g. timezone, boottime,
// battery level will change)
@SuppressLint("NewApi")
private @NotNull Device getDevice() {
Device device = new Device();
device.setManufacturer(Build.MANUFACTURER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ static PackageInfo getPackageInfo(
*
* @return the Application's ApplicationInfo if possible, or throws
*/
@SuppressLint("NewApi")
@Nullable
@SuppressWarnings("deprecation")
static ApplicationInfo getApplicationInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ private void setDeviceIO(
}
}

@SuppressWarnings("NewApi")
@NotNull
private TimeZone getTimeZone() {
// Only use the costly Calendar API on Android 13+ (API Level 33+) when the locale contains a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions

if (androidOptions.isEnableNetworkEventBreadcrumbs()) {

// The specific error is logged in the ConnectivityChecker method
if (buildInfoProvider.getSdkInfoVersion() < Build.VERSION_CODES.N) {
options.getLogger().log(SentryLevel.DEBUG, "NetworkCallbacks need Android N+.");
return;
}

try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
networkCallback =
new NetworkBreadcrumbsNetworkCallback(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.core;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.os.Process;
Expand Down Expand Up @@ -91,7 +90,6 @@ public static void init(
* @param logger your custom logger that implements ILogger
* @param configuration Sentry.OptionsConfiguration configuration handler
*/
@SuppressLint("NewApi")
public static void init(
@NotNull final Context context,
@NotNull ILogger logger,
Expand Down Expand Up @@ -154,11 +152,9 @@ public static void init(
// if SentryPerformanceProvider was disabled or removed,
// we set the app start / sdk init time here instead
final @NotNull AppStartMetrics appStartMetrics = AppStartMetrics.getInstance();
if (buildInfoProvider.getSdkInfoVersion() >= android.os.Build.VERSION_CODES.N) {
final @NotNull TimeSpan appStartTimeSpan = appStartMetrics.getAppStartTimeSpan();
if (appStartTimeSpan.hasNotStarted()) {
appStartTimeSpan.setStartedAt(Process.getStartUptimeMillis());
}
final @NotNull TimeSpan appStartTimeSpan = appStartMetrics.getAppStartTimeSpan();
if (appStartTimeSpan.hasNotStarted()) {
appStartTimeSpan.setStartedAt(Process.getStartUptimeMillis());
}
if (context.getApplicationContext() instanceof Application) {
appStartMetrics.registerLifecycleCallbacks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static io.sentry.Sentry.APP_START_PROFILING_CONFIG_FILE_NAME;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.content.pm.ProviderInfo;
Expand Down Expand Up @@ -250,20 +249,15 @@ private void createAndStartTransactionProfiler(
appStartProfiler.start();
}

@SuppressLint("NewApi")
private void onAppLaunched(
final @Nullable Context context, final @NotNull AppStartMetrics appStartMetrics) {

// sdk-init uses static field init as start time
final @NotNull TimeSpan sdkInitTimeSpan = appStartMetrics.getSdkInitTimeSpan();
sdkInitTimeSpan.setStartedAt(sdkInitMillis);

// performance v2: Uses Process.getStartUptimeMillis()
// requires API level 24+
if (buildInfoProvider.getSdkInfoVersion() >= android.os.Build.VERSION_CODES.N) {
final @NotNull TimeSpan appStartTimespan = appStartMetrics.getAppStartTimeSpan();
appStartTimespan.setStartedAt(Process.getStartUptimeMillis());
}
final @NotNull TimeSpan appStartTimespan = appStartMetrics.getAppStartTimeSpan();
appStartTimespan.setStartedAt(Process.getStartUptimeMillis());

if (context instanceof Application) {
app = (Application) context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.android.core.internal.gestures;

import android.annotation.SuppressLint;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
Expand Down Expand Up @@ -115,7 +114,6 @@ public boolean onSearchRequested() {
return delegate.onSearchRequested();
}

@SuppressLint("NewApi")
@Override
public boolean onSearchRequested(SearchEvent searchEvent) {
return delegate.onSearchRequested(searchEvent);
Expand All @@ -127,7 +125,6 @@ public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
return delegate.onWindowStartingActionMode(callback);
}

@SuppressLint("NewApi")
@Nullable
@Override
public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) {
Expand Down
Loading
Loading