1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 12:51:16 +00:00

Remove TargetApi annotations

They are not used correctly and suppress important linter warnings. (e.g. ea8621cfc3)
This commit is contained in:
Unrud 2017-07-18 17:41:57 +02:00
parent d119517614
commit fd69477e6c
4 changed files with 2 additions and 10 deletions

View file

@ -1,7 +1,6 @@
package com.nutomic.syncthingandroid.activities; package com.nutomic.syncthingandroid.activities;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -131,13 +130,13 @@ public class MainActivity extends SyncthingActivity
} }
} }
@TargetApi(23)
private void showBatteryOptimizationDialogIfNecessary() { private void showBatteryOptimizationDialogIfNecessary() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
return;
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
boolean dontShowAgain = sp.getBoolean("battery_optimization_dont_show_again", false); boolean dontShowAgain = sp.getBoolean("battery_optimization_dont_show_again", false);
if (dontShowAgain || mBatteryOptimizationsDialog != null || if (dontShowAgain || mBatteryOptimizationsDialog != null ||
Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
pm.isIgnoringBatteryOptimizations(getPackageName()) || pm.isIgnoringBatteryOptimizations(getPackageName()) ||
mBatteryOptimizationDialogDismissed) { mBatteryOptimizationDialogDismissed) {
return; return;

View file

@ -1,6 +1,5 @@
package com.nutomic.syncthingandroid.receiver; package com.nutomic.syncthingandroid.receiver;
import android.annotation.TargetApi;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -35,7 +34,6 @@ public class AppConfigReceiver extends BroadcastReceiver {
public static final String ACTION_STOP = "com.nutomic.syncthingandroid.action.STOP"; public static final String ACTION_STOP = "com.nutomic.syncthingandroid.action.STOP";
@Override @Override
@TargetApi(21)
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) { switch (intent.getAction()) {
case ACTION_START: case ACTION_START:

View file

@ -1,6 +1,5 @@
package com.nutomic.syncthingandroid.service; package com.nutomic.syncthingandroid.service;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -49,7 +48,6 @@ public class DeviceStateHolder extends BroadcastReceiver {
private boolean mIsCharging = false; private boolean mIsCharging = false;
@TargetApi(16)
public DeviceStateHolder(Context context) { public DeviceStateHolder(Context context) {
mContext = context; mContext = context;
ConnectivityManager cm = (ConnectivityManager) ConnectivityManager cm = (ConnectivityManager)
@ -111,7 +109,6 @@ public class DeviceStateHolder extends BroadcastReceiver {
/** /**
* Determines if Syncthing should currently run. * Determines if Syncthing should currently run.
*/ */
@TargetApi(21)
public boolean shouldRun() { public boolean shouldRun() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);

View file

@ -1,6 +1,5 @@
package com.nutomic.syncthingandroid.service; package com.nutomic.syncthingandroid.service;
import android.annotation.TargetApi;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
@ -305,7 +304,6 @@ public class SyncthingService extends Service implements
* Starts the native binary. * Starts the native binary.
*/ */
@Override @Override
@TargetApi(21)
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
PRNGFixes.apply(); PRNGFixes.apply();