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:
Hans-Christoph Steiner 2019-01-02 22:23:08 +00:00
commit 4cc5d58480
9 changed files with 22 additions and 28 deletions

View File

@ -9,6 +9,7 @@
<issue id="ImpliedQuantity" severity="error"/>
<issue id="DefaultLocale" severity="error"/>
<issue id="SimpleDateFormat" severity="error"/>
<issue id="NewApi" severity="error"/>
<issue id="InlinedApi" severity="error"/>
@ -23,10 +24,12 @@
</issue>
<issue id="AppCompatMethod" severity="error"/>
<issue id="NestedScrolling" severity="error"/>
<issue id="Typos" severity="error"/>
<issue id="StringFormatCount" severity="error"/>
<issue id="UnsafeProtectedBroadcastReceiver" severity="error"/>
<issue id="GetInstance" severity="error"/>
<issue id="PackageManagerGetSignatures" severity="error"/>
<issue id="HardwareIds" severity="error"/>
<issue id="TrustAllX509TrustManager" severity="error">
<!-- these come from included libraries -->
<ignore path="org/apache/commons/net/ftp/FTPSTrustManager.class"/>

View File

@ -18,12 +18,13 @@ package kellinwood.logging;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public abstract class AbstractLogger implements LoggerInterface {
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) {
this.category = category;

View File

@ -28,7 +28,7 @@ import java.util.Locale;
*/
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) {
log.debug(" Length Method Size Ratio Date Time CRC-32 Name");

View File

@ -10,6 +10,7 @@ package org.fdroid.fdroid.compat;
* freely, as long as the origin is not misrepresented.
*/
import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Process;
import android.util.Log;
@ -31,18 +32,23 @@ import java.security.Security;
/**
* 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
* Cryptography Architecture primitives. A good place to invoke them is in the
* 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 {
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.
@ -131,7 +137,7 @@ public final class PRNGFixes {
rng2.getProvider().getClass())) {
throw new SecurityException(
"SecureRandom.getInstance(\"SHA1PRNG\") backed by wrong"
+ " Provider: " + rng2.getProvider().getClass());
+ " Provider: " + rng2.getProvider().getClass());
}
}
@ -146,7 +152,7 @@ public final class PRNGFixes {
super("LinuxPRNG",
1.0,
"A Linux-specific random number provider that uses"
+ " /dev/urandom");
+ " /dev/urandom");
// Although /dev/urandom is not a SHA-1 PRNG, some apps
// explicitly request a SHA1PRNG SecureRandom and we thus need to
// prevent them from getting the default implementation whose output
@ -300,6 +306,7 @@ public final class PRNGFixes {
}
}
@SuppressLint("HardwareIds")
private static byte[] getBuildFingerprintAndDeviceSerial() {
StringBuilder result = new StringBuilder();
String fingerprint = Build.FINGERPRINT;

View File

@ -335,7 +335,7 @@ public class ApkProvider extends FDroidProvider {
antiFeaturesRequested = true;
addAntiFeatures();
} else if (field.equals(Cols._ID)) {
appendField("rowid", "apk", "_id");
appendField(Cols.ROW_ID, "apk", Cols._ID);
} else if (field.equals(Cols._COUNT)) {
appendField("COUNT(*) AS " + Cols._COUNT);
} else if (field.equals(Cols._COUNT_DISTINCT)) {

View File

@ -692,19 +692,6 @@ public class AppProvider extends FDroidProvider {
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() {
// 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

View File

@ -20,10 +20,6 @@ abstract class QueryBuilder {
public abstract void addField(String field);
protected int fieldCount() {
return fields.size();
}
public void addFields(String[] fields) {
for (final String field : fields) {
addField(field);

View File

@ -516,7 +516,7 @@
<string name="over_wifi">Descargar usando WiFi</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_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="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>

View File

@ -536,7 +536,7 @@
<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="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="send_installed_apps">Compartilhar aplicativos instalados</string>