Use integers for SDK checks
More consistent with other checks as introduced in e021eb5c
This commit is contained in:
parent
a31fb068ae
commit
19a033db32
@ -42,7 +42,7 @@ public class FileCompat {
|
||||
*/
|
||||
private static class Symlink21 {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
void symlink(SanitizedFile source, SanitizedFile dest) {
|
||||
try {
|
||||
android.system.Os.symlink(source.getAbsolutePath(), dest.getAbsolutePath());
|
||||
|
@ -8,7 +8,7 @@ public class SupportedArchitectures {
|
||||
/**
|
||||
* The most preferred ABI is the first element in the list.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String[] getAbis() {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
|
@ -92,6 +92,6 @@ public class DefaultInstaller extends Installer {
|
||||
@Override
|
||||
protected boolean supportsContentUri() {
|
||||
// Android N only supports content Uris
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
|
||||
return Build.VERSION.SDK_INT >= 24;
|
||||
}
|
||||
}
|
||||
|
@ -79,11 +79,11 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
||||
throw new RuntimeException("Set the data uri to point to an apk location!");
|
||||
}
|
||||
// https://code.google.com/p/android/issues/detail?id=205827
|
||||
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||
if ((Build.VERSION.SDK_INT < 24)
|
||||
&& (!uri.getScheme().equals("file"))) {
|
||||
throw new RuntimeException("PackageInstaller < Android N only supports file scheme!");
|
||||
}
|
||||
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
if ((Build.VERSION.SDK_INT >= 24)
|
||||
&& (!uri.getScheme().equals("content"))) {
|
||||
throw new RuntimeException("PackageInstaller >= Android N only supports content scheme!");
|
||||
}
|
||||
@ -94,16 +94,16 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
||||
// works only when being installed as system-app
|
||||
// https://code.google.com/p/android/issues/detail?id=42253
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
if (Build.VERSION.SDK_INT < 14) {
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
} else if (Build.VERSION.SDK_INT < 16) {
|
||||
intent.setAction(Intent.ACTION_INSTALL_PACKAGE);
|
||||
intent.setData(uri);
|
||||
intent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
|
||||
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_REPLACE, true);
|
||||
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
} else if (Build.VERSION.SDK_INT < 24) {
|
||||
intent.setAction(Intent.ACTION_INSTALL_PACKAGE);
|
||||
intent.setData(uri);
|
||||
intent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
|
||||
@ -144,7 +144,7 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
||||
Intent intent = new Intent();
|
||||
intent.setData(uri);
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
if (Build.VERSION.SDK_INT < 14) {
|
||||
intent.setAction(Intent.ACTION_DELETE);
|
||||
} else {
|
||||
intent.setAction(Intent.ACTION_UNINSTALL_PACKAGE);
|
||||
@ -170,7 +170,7 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
||||
* com.android.packageinstaller.PackageInstallerActivity: setResult is
|
||||
* never executed on Androids < 4.0
|
||||
*/
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
if (Build.VERSION.SDK_INT < 14) {
|
||||
installer.sendBroadcastInstall(downloadUri, Installer.ACTION_INSTALL_COMPLETE);
|
||||
break;
|
||||
}
|
||||
@ -196,7 +196,7 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
||||
break;
|
||||
case REQUEST_CODE_UNINSTALL:
|
||||
// resultCode is always 0 on Android < 4.0.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
if (Build.VERSION.SDK_INT < 14) {
|
||||
installer.sendBroadcastUninstall(uninstallPackageName,
|
||||
Installer.ACTION_UNINSTALL_COMPLETE);
|
||||
break;
|
||||
|
@ -24,7 +24,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PatternMatcher;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.text.TextUtils;
|
||||
@ -103,7 +102,7 @@ public abstract class Installer {
|
||||
}
|
||||
|
||||
private int newPermissionCount(Apk apk) {
|
||||
boolean supportsRuntimePermissions = apk.targetSdkVersion >= Build.VERSION_CODES.M;
|
||||
boolean supportsRuntimePermissions = apk.targetSdkVersion >= 23;
|
||||
if (supportsRuntimePermissions) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class BluetoothConnection {
|
||||
return output;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
@TargetApi(14)
|
||||
public void open() throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= 14 && !socket.isConnected()) {
|
||||
// Server sockets will already be connected when they are passed to us,
|
||||
|
@ -104,10 +104,10 @@ public class AppSecurityPermissions {
|
||||
super(info);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
|
||||
@TargetApi(22)
|
||||
public Drawable loadGroupIcon(Context context, PackageManager pm) {
|
||||
if (icon != 0) {
|
||||
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) ? loadIcon(pm) : loadUnbadgedIcon(pm);
|
||||
return (Build.VERSION.SDK_INT < 22) ? loadIcon(pm) : loadUnbadgedIcon(pm);
|
||||
}
|
||||
return ContextCompat.getDrawable(context, R.drawable.ic_perm_device_info);
|
||||
}
|
||||
@ -325,9 +325,9 @@ public class AppSecurityPermissions {
|
||||
* doesn't currently hold this permission. On older devices that don't support
|
||||
* this concept, permissions are never "new permissions".
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
@TargetApi(16)
|
||||
private static boolean isNewPermission(PackageInfo installedPkgInfo, int existingFlags) {
|
||||
if (installedPkgInfo == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
if (installedPkgInfo == null || Build.VERSION.SDK_INT < 16) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package org.fdroid.fdroid.views.swap;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
@ -32,7 +31,7 @@ public class ConfirmReceive extends RelativeLayout implements SwapWorkflowActivi
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public ConfirmReceive(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package org.fdroid.fdroid.views.swap;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
@ -27,7 +26,7 @@ public class InitialLoadingView extends RelativeLayout implements SwapWorkflowAc
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public InitialLoadingView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
@ -40,7 +39,7 @@ public class JoinWifiView extends RelativeLayout implements SwapWorkflowActivity
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public JoinWifiView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package org.fdroid.fdroid.views.swap;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
@ -32,7 +31,7 @@ public class NfcView extends RelativeLayout implements SwapWorkflowActivity.Inne
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public NfcView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import android.database.Cursor;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -56,7 +55,7 @@ public class SelectAppsView extends ListView implements
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public SelectAppsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -60,12 +59,12 @@ public class StartSwapView extends RelativeLayout implements SwapWorkflowActivit
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@TargetApi(11)
|
||||
public StartSwapView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public StartSwapView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import android.content.IntentFilter;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@ -76,7 +75,7 @@ public class SwapAppsView extends ListView implements
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public SwapAppsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
@ -35,12 +34,12 @@ public class SwapConnecting extends LinearLayout implements SwapWorkflowActivity
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@TargetApi(11)
|
||||
public SwapConnecting(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public SwapConnecting(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.LightingColorFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
@ -51,7 +50,7 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@TargetApi(21)
|
||||
public WifiQrView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user