Merge branch 'collection-of-lint-and-code-cleanups' into 'master'
Collection of lint and code cleanups See merge request fdroid/fdroidclient!780
This commit is contained in:
commit
4cc5d58480
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<issue id="ImpliedQuantity" severity="error"/>
|
<issue id="ImpliedQuantity" severity="error"/>
|
||||||
<issue id="DefaultLocale" severity="error"/>
|
<issue id="DefaultLocale" severity="error"/>
|
||||||
|
<issue id="SimpleDateFormat" severity="error"/>
|
||||||
<issue id="NewApi" severity="error"/>
|
<issue id="NewApi" severity="error"/>
|
||||||
<issue id="InlinedApi" severity="error"/>
|
<issue id="InlinedApi" severity="error"/>
|
||||||
|
|
||||||
@ -23,10 +24,12 @@
|
|||||||
</issue>
|
</issue>
|
||||||
<issue id="AppCompatMethod" severity="error"/>
|
<issue id="AppCompatMethod" severity="error"/>
|
||||||
<issue id="NestedScrolling" severity="error"/>
|
<issue id="NestedScrolling" severity="error"/>
|
||||||
|
<issue id="Typos" severity="error"/>
|
||||||
<issue id="StringFormatCount" severity="error"/>
|
<issue id="StringFormatCount" severity="error"/>
|
||||||
<issue id="UnsafeProtectedBroadcastReceiver" severity="error"/>
|
<issue id="UnsafeProtectedBroadcastReceiver" severity="error"/>
|
||||||
<issue id="GetInstance" severity="error"/>
|
<issue id="GetInstance" severity="error"/>
|
||||||
<issue id="PackageManagerGetSignatures" severity="error"/>
|
<issue id="PackageManagerGetSignatures" severity="error"/>
|
||||||
|
<issue id="HardwareIds" severity="error"/>
|
||||||
<issue id="TrustAllX509TrustManager" severity="error">
|
<issue id="TrustAllX509TrustManager" severity="error">
|
||||||
<!-- these come from included libraries -->
|
<!-- these come from included libraries -->
|
||||||
<ignore path="org/apache/commons/net/ftp/FTPSTrustManager.class"/>
|
<ignore path="org/apache/commons/net/ftp/FTPSTrustManager.class"/>
|
||||||
|
@ -18,12 +18,13 @@ package kellinwood.logging;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public abstract class AbstractLogger implements LoggerInterface {
|
public abstract class AbstractLogger implements LoggerInterface {
|
||||||
|
|
||||||
protected String category;
|
protected String category;
|
||||||
|
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.ENGLISH);
|
||||||
|
|
||||||
public AbstractLogger(String category) {
|
public AbstractLogger(String category) {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Locale;
|
|||||||
*/
|
*/
|
||||||
public class ZipListingHelper {
|
public class ZipListingHelper {
|
||||||
|
|
||||||
static DateFormat dateFormat = new SimpleDateFormat("MM-dd-yy HH:mm");
|
static DateFormat dateFormat = new SimpleDateFormat("MM-dd-yy HH:mm", Locale.ENGLISH);
|
||||||
|
|
||||||
public static void listHeader(LoggerInterface log) {
|
public static void listHeader(LoggerInterface log) {
|
||||||
log.debug(" Length Method Size Ratio Date Time CRC-32 Name");
|
log.debug(" Length Method Size Ratio Date Time CRC-32 Name");
|
||||||
|
@ -10,6 +10,7 @@ package org.fdroid.fdroid.compat;
|
|||||||
* freely, as long as the origin is not misrepresented.
|
* freely, as long as the origin is not misrepresented.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -31,18 +32,23 @@ import java.security.Security;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixes for the output of the default PRNG having low entropy.
|
* Fixes for the output of the default PRNG having low entropy.
|
||||||
*
|
* <p>
|
||||||
* The fixes need to be applied via {@link #apply()} before any use of Java
|
* The fixes need to be applied via {@link #apply()} before any use of Java
|
||||||
* Cryptography Architecture primitives. A good place to invoke them is in the
|
* Cryptography Architecture primitives. A good place to invoke them is in the
|
||||||
* application's {@code onCreate}.
|
* application's {@code onCreate}.
|
||||||
|
*
|
||||||
|
* @see <a href="http://android-developers.blogspot.jp/2013/08/some-securerandom-thoughts.html">Some SecureRandom Thoughts</a>
|
||||||
*/
|
*/
|
||||||
public final class PRNGFixes {
|
public final class PRNGFixes {
|
||||||
|
|
||||||
private static final byte[] BUILD_FINGERPRINT_AND_DEVICE_SERIAL =
|
private static final byte[] BUILD_FINGERPRINT_AND_DEVICE_SERIAL =
|
||||||
getBuildFingerprintAndDeviceSerial();
|
getBuildFingerprintAndDeviceSerial();
|
||||||
|
|
||||||
/** Hidden constructor to prevent instantiation. */
|
/**
|
||||||
private PRNGFixes() { }
|
* Hidden constructor to prevent instantiation.
|
||||||
|
*/
|
||||||
|
private PRNGFixes() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies all fixes.
|
* Applies all fixes.
|
||||||
@ -131,7 +137,7 @@ public final class PRNGFixes {
|
|||||||
rng2.getProvider().getClass())) {
|
rng2.getProvider().getClass())) {
|
||||||
throw new SecurityException(
|
throw new SecurityException(
|
||||||
"SecureRandom.getInstance(\"SHA1PRNG\") backed by wrong"
|
"SecureRandom.getInstance(\"SHA1PRNG\") backed by wrong"
|
||||||
+ " Provider: " + rng2.getProvider().getClass());
|
+ " Provider: " + rng2.getProvider().getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +152,7 @@ public final class PRNGFixes {
|
|||||||
super("LinuxPRNG",
|
super("LinuxPRNG",
|
||||||
1.0,
|
1.0,
|
||||||
"A Linux-specific random number provider that uses"
|
"A Linux-specific random number provider that uses"
|
||||||
+ " /dev/urandom");
|
+ " /dev/urandom");
|
||||||
// Although /dev/urandom is not a SHA-1 PRNG, some apps
|
// Although /dev/urandom is not a SHA-1 PRNG, some apps
|
||||||
// explicitly request a SHA1PRNG SecureRandom and we thus need to
|
// explicitly request a SHA1PRNG SecureRandom and we thus need to
|
||||||
// prevent them from getting the default implementation whose output
|
// prevent them from getting the default implementation whose output
|
||||||
@ -300,6 +306,7 @@ public final class PRNGFixes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("HardwareIds")
|
||||||
private static byte[] getBuildFingerprintAndDeviceSerial() {
|
private static byte[] getBuildFingerprintAndDeviceSerial() {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
String fingerprint = Build.FINGERPRINT;
|
String fingerprint = Build.FINGERPRINT;
|
||||||
|
@ -335,7 +335,7 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
antiFeaturesRequested = true;
|
antiFeaturesRequested = true;
|
||||||
addAntiFeatures();
|
addAntiFeatures();
|
||||||
} else if (field.equals(Cols._ID)) {
|
} else if (field.equals(Cols._ID)) {
|
||||||
appendField("rowid", "apk", "_id");
|
appendField(Cols.ROW_ID, "apk", Cols._ID);
|
||||||
} else if (field.equals(Cols._COUNT)) {
|
} else if (field.equals(Cols._COUNT)) {
|
||||||
appendField("COUNT(*) AS " + Cols._COUNT);
|
appendField("COUNT(*) AS " + Cols._COUNT);
|
||||||
} else if (field.equals(Cols._COUNT_DISTINCT)) {
|
} else if (field.equals(Cols._COUNT_DISTINCT)) {
|
||||||
|
@ -692,19 +692,6 @@ public class AppProvider extends FDroidProvider {
|
|||||||
return new AppQuerySelection(selection, args).add(queryPackageName(packageName));
|
return new AppQuerySelection(selection, args).add(queryPackageName(packageName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as {@link AppProvider#querySingle(String, long)} except it is used for the purpose
|
|
||||||
* of an UPDATE query rather than a SELECT query. This means that it must use a subquery to get
|
|
||||||
* the {@link Cols.Package#PACKAGE_ID} rather than the join which is already in place for that
|
|
||||||
* table. The reason is because UPDATE queries cannot include joins in SQLite.
|
|
||||||
*/
|
|
||||||
protected AppQuerySelection querySingleForUpdate(String packageName, long repoId) {
|
|
||||||
final String selection = Cols.PACKAGE_ID + " = (" + getPackageIdFromPackageNameQuery() +
|
|
||||||
") AND " + Cols.REPO_ID + " = ? ";
|
|
||||||
final String[] args = {packageName, Long.toString(repoId)};
|
|
||||||
return new AppQuerySelection(selection, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private AppQuerySelection queryExcludeSwap() {
|
private AppQuerySelection queryExcludeSwap() {
|
||||||
// fdroid_repo will have null fields if the LEFT JOIN didn't resolve, e.g. due to there
|
// fdroid_repo will have null fields if the LEFT JOIN didn't resolve, e.g. due to there
|
||||||
// being no apks for the app in the result set. In that case, we can't tell if it is from
|
// being no apks for the app in the result set. In that case, we can't tell if it is from
|
||||||
|
@ -20,10 +20,6 @@ abstract class QueryBuilder {
|
|||||||
|
|
||||||
public abstract void addField(String field);
|
public abstract void addField(String field);
|
||||||
|
|
||||||
protected int fieldCount() {
|
|
||||||
return fields.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addFields(String[] fields) {
|
public void addFields(String[] fields) {
|
||||||
for (final String field : fields) {
|
for (final String field : fields) {
|
||||||
addField(field);
|
addField(field);
|
||||||
|
@ -516,7 +516,7 @@
|
|||||||
<string name="over_wifi">Descargar usando WiFi</string>
|
<string name="over_wifi">Descargar usando WiFi</string>
|
||||||
<string name="over_data">Descargar usando tus datos</string>
|
<string name="over_data">Descargar usando tus datos</string>
|
||||||
<string name="over_network_always_summary">Usar siempre esta conexion cuando este disponible</string>
|
<string name="over_network_always_summary">Usar siempre esta conexion cuando este disponible</string>
|
||||||
<string name="over_network_on_demand_summary">Usar esta conexion unicamente cuando seleccione descargar</string>
|
<string name="over_network_on_demand_summary">Usar esta conexion únicamente cuando seleccione descargar</string>
|
||||||
<string name="over_network_never_summary">No descargar nada usando esta conexion</string>
|
<string name="over_network_never_summary">No descargar nada usando esta conexion</string>
|
||||||
<string name="antidisabledalgorithmlist">Esta aplicación tiene una firma de seguridad débil</string>
|
<string name="antidisabledalgorithmlist">Esta aplicación tiene una firma de seguridad débil</string>
|
||||||
<string name="antiknownvulnlist">Esta aplicación contiene una vulnerabilidad de seguridad conocida</string>
|
<string name="antiknownvulnlist">Esta aplicación contiene una vulnerabilidad de seguridad conocida</string>
|
||||||
|
@ -536,7 +536,7 @@
|
|||||||
<string name="allow_push_requests">Repositórios permitidos para instalar/desinstalar aplicativos</string>
|
<string name="allow_push_requests">Repositórios permitidos para instalar/desinstalar aplicativos</string>
|
||||||
<string name="updates_disabled_by_settings">Todas as atualizações estão desativadas por causa das configurações de Dados/WiFi</string>
|
<string name="updates_disabled_by_settings">Todas as atualizações estão desativadas por causa das configurações de Dados/WiFi</string>
|
||||||
|
|
||||||
<string name="antinosourcesince">Não é possível atualizar, o código fonte não está mais disponivel.</string>
|
<string name="antinosourcesince">Não é possível atualizar, o código fonte não está mais disponível.</string>
|
||||||
|
|
||||||
<string name="allow_push_requests_summary">Repositório de metadados podem incluir solicitações de envio para instalar ou desinstalar aplicativos</string>
|
<string name="allow_push_requests_summary">Repositório de metadados podem incluir solicitações de envio para instalar ou desinstalar aplicativos</string>
|
||||||
<string name="send_installed_apps">Compartilhar aplicativos instalados</string>
|
<string name="send_installed_apps">Compartilhar aplicativos instalados</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user