diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java index bc7b1ebf..62aa677e 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java @@ -1,7 +1,6 @@ package com.nutomic.syncthingandroid.activities; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -131,13 +130,13 @@ public class MainActivity extends SyncthingActivity } } - @TargetApi(23) private void showBatteryOptimizationDialogIfNecessary() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) + return; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); boolean dontShowAgain = sp.getBoolean("battery_optimization_dont_show_again", false); if (dontShowAgain || mBatteryOptimizationsDialog != null || - Build.VERSION.SDK_INT < Build.VERSION_CODES.M || pm.isIgnoringBatteryOptimizations(getPackageName()) || mBatteryOptimizationDialogDismissed) { return; diff --git a/src/main/java/com/nutomic/syncthingandroid/receiver/AppConfigReceiver.java b/src/main/java/com/nutomic/syncthingandroid/receiver/AppConfigReceiver.java index 12315eaf..81e1311c 100644 --- a/src/main/java/com/nutomic/syncthingandroid/receiver/AppConfigReceiver.java +++ b/src/main/java/com/nutomic/syncthingandroid/receiver/AppConfigReceiver.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.receiver; -import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -35,7 +34,6 @@ public class AppConfigReceiver extends BroadcastReceiver { public static final String ACTION_STOP = "com.nutomic.syncthingandroid.action.STOP"; @Override - @TargetApi(21) public void onReceive(Context context, Intent intent) { switch (intent.getAction()) { case ACTION_START: diff --git a/src/main/java/com/nutomic/syncthingandroid/service/DeviceStateHolder.java b/src/main/java/com/nutomic/syncthingandroid/service/DeviceStateHolder.java index 913278c4..81b791a8 100644 --- a/src/main/java/com/nutomic/syncthingandroid/service/DeviceStateHolder.java +++ b/src/main/java/com/nutomic/syncthingandroid/service/DeviceStateHolder.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.service; -import android.annotation.TargetApi; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -49,7 +48,6 @@ public class DeviceStateHolder extends BroadcastReceiver { private boolean mIsCharging = false; - @TargetApi(16) public DeviceStateHolder(Context context) { mContext = context; ConnectivityManager cm = (ConnectivityManager) @@ -111,7 +109,6 @@ public class DeviceStateHolder extends BroadcastReceiver { /** * Determines if Syncthing should currently run. */ - @TargetApi(21) public boolean shouldRun() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); diff --git a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java index 5952030c..c36d6fe4 100644 --- a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.service; -import android.annotation.TargetApi; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; @@ -305,7 +304,6 @@ public class SyncthingService extends Service implements * Starts the native binary. */ @Override - @TargetApi(21) public void onCreate() { super.onCreate(); PRNGFixes.apply();