mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-20 06:47:06 -04:00
Merge branch 'spotless-prep' into 'master'
simple code format fixes on the path towards spotless See merge request fdroid/fdroidclient!1255
This commit is contained in:
@@ -40,5 +40,4 @@ public class AssetUtils {
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -368,6 +368,5 @@ public class Netstat {
|
||||
",Status=" + status +
|
||||
"]";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -445,5 +445,4 @@ public class ApkVerifierTest {
|
||||
}
|
||||
assertTrue(ApkVerifier.requestedPermissionsEqual(expectedPermissions, apk.requestedPermissions));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,5 +33,4 @@ public class HidingManager {
|
||||
public static void showHideDialog(final Context context) {
|
||||
throw new IllegalStateException("unimplemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ public class FDroidServiceInfo extends ServiceInfoImpl implements Parcelable {
|
||||
in.readInt(),
|
||||
in.readInt(),
|
||||
in.readByte() != 0,
|
||||
readBytes(in)
|
||||
);
|
||||
readBytes(in));
|
||||
|
||||
int addressCount = in.readInt();
|
||||
for (int i = 0; i < addressCount; i++) {
|
||||
|
||||
@@ -29,7 +29,6 @@ public interface LoggerInterface {
|
||||
|
||||
public void error(String message, Throwable t);
|
||||
|
||||
|
||||
public boolean isWarningEnabled();
|
||||
|
||||
public void warning(String message);
|
||||
@@ -47,6 +46,4 @@ public interface LoggerInterface {
|
||||
public void debug(String message);
|
||||
|
||||
public void debug(String message, Throwable t);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -66,5 +66,4 @@ public class NullLoggerFactory implements LoggerFactory {
|
||||
public LoggerInterface getLogger(String category) {
|
||||
return logger;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,5 +32,4 @@ public class StreamLogger extends AbstractLogger {
|
||||
out.print(format(level, message));
|
||||
if (t != null) t.printStackTrace(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package kellinwood.security.zipsigner;
|
||||
|
||||
public class AutoKeyException extends RuntimeException {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package kellinwood.security.zipsigner;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -31,6 +30,5 @@ public class DefaultResourceAdapter implements ResourceAdapter {
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown item " + item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package kellinwood.security.zipsigner;
|
||||
|
||||
import org.bouncycastle.util.encoders.HexEncoder;
|
||||
@@ -54,9 +52,9 @@ public class HexDumpEncoder {
|
||||
if ((j + 2) % 4 == 0) hexOut.append(' ');
|
||||
|
||||
int dataChar = data[j / 2];
|
||||
if (dataChar >= 32 && dataChar < 127) chrOut.append(Character.valueOf((char) dataChar));
|
||||
else chrOut.append('.');
|
||||
|
||||
if (dataChar >= 32 && dataChar < 127) {
|
||||
chrOut.append(Character.valueOf((char) dataChar));
|
||||
} else chrOut.append('.');
|
||||
}
|
||||
|
||||
hexDumpOut.append(hexOut.toString());
|
||||
@@ -71,5 +69,4 @@ public class HexDumpEncoder {
|
||||
throw new IllegalStateException(x.getClass().getName() + ": " + x.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,5 +48,4 @@ public class ProgressEvent {
|
||||
public void setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package kellinwood.security.zipsigner;
|
||||
|
||||
/**
|
||||
@@ -17,7 +16,5 @@ public interface ResourceAdapter {
|
||||
COPYING_ZIP_ENTRY
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public String getString(Item item, Object... args);
|
||||
}
|
||||
|
||||
@@ -22,25 +22,14 @@
|
||||
* - removal of main()
|
||||
* - switch to a signature generation method that verifies
|
||||
* in Android recovery
|
||||
* - eliminated dependency on sun.security and sun.misc APIs by
|
||||
* - eliminated dependency on sun.security and sun.misc APIs by
|
||||
* using signature block template files.
|
||||
*/
|
||||
|
||||
|
||||
package kellinwood.security.zipsigner;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
import kellinwood.zipio.ZioEntry;
|
||||
import kellinwood.zipio.ZipInput;
|
||||
import kellinwood.zipio.ZipOutput;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.EncryptedPrivateKeyInfo;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
@@ -81,6 +70,17 @@ import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.EncryptedPrivateKeyInfo;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
import kellinwood.zipio.ZioEntry;
|
||||
import kellinwood.zipio.ZipInput;
|
||||
import kellinwood.zipio.ZipOutput;
|
||||
|
||||
/**
|
||||
* This is a modified copy of com.android.signapk.SignApk.java. It provides an
|
||||
* API to sign JAR files (including APKs and Zip/OTA updates) in
|
||||
@@ -134,7 +134,6 @@ public class ZipSigner {
|
||||
autoKeyDetect.put("e60418c4b638f20d0721e115674ca11f", "platform");
|
||||
autoKeyDetect.put("3e24e49741b60c215c010dc6048fca7d", "shared");
|
||||
autoKeyDetect.put("dab2cead827ef5313f28e22b6fa8479f", "testkey");
|
||||
|
||||
}
|
||||
|
||||
public ResourceAdapter getResourceAdapter() {
|
||||
@@ -169,14 +168,12 @@ public class ZipSigner {
|
||||
return SUPPORTED_KEY_MODES;
|
||||
}
|
||||
|
||||
|
||||
protected String autoDetectKey(String mode, Map<String, ZioEntry> zioEntries)
|
||||
throws NoSuchAlgorithmException, IOException {
|
||||
boolean debug = getLogger().isDebugEnabled();
|
||||
|
||||
if (!mode.startsWith(MODE_AUTO)) return mode;
|
||||
|
||||
|
||||
// Auto-determine which keys to use
|
||||
String keyName = null;
|
||||
// Start by finding the signature block file in the input.
|
||||
@@ -184,11 +181,11 @@ public class ZipSigner {
|
||||
String entryName = entry.getKey();
|
||||
if (entryName.startsWith("META-INF/") && entryName.endsWith(".RSA")) {
|
||||
|
||||
// Compute MD5 of the first 1458 bytes, which is the size of our signature block templates --
|
||||
// e.g., the portion of the sig block file that is the same for a given certificate.
|
||||
// Compute MD5 of the first 1458 bytes, which is the size of our signature block templates --
|
||||
// e.g., the portion of the sig block file that is the same for a given certificate.
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
byte[] entryData = entry.getValue().getData();
|
||||
if (entryData.length < 1458) break; // sig block too short to be a supported key
|
||||
if (entryData.length < 1458) break; // sig block too short to be a supported key
|
||||
md5.update(entryData, 0, 1458);
|
||||
byte[] rawDigest = md5.digest();
|
||||
|
||||
@@ -202,7 +199,6 @@ public class ZipSigner {
|
||||
// Lookup the key name
|
||||
keyName = autoKeyDetect.get(md5String);
|
||||
|
||||
|
||||
if (debug) {
|
||||
if (keyName != null) {
|
||||
getLogger().debug(String.format("Auto-determined key=%s using md5=%s", keyName, md5String));
|
||||
@@ -558,7 +554,6 @@ public class ZipSigner {
|
||||
ZioEntry inEntry = input.get(name);
|
||||
inEntry.setTime(timestamp);
|
||||
output.write(inEntry);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,7 +598,6 @@ public class ZipSigner {
|
||||
IOException, GeneralSecurityException {
|
||||
InputStream keystoreStream = null;
|
||||
|
||||
|
||||
try {
|
||||
KeyStore keystore = null;
|
||||
if (keystoreType == null) keystoreType = KeyStore.getDefaultType();
|
||||
@@ -624,7 +618,6 @@ public class ZipSigner {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sign the input with the default test key and certificate.
|
||||
* Save result to output file.
|
||||
@@ -635,7 +628,6 @@ public class ZipSigner {
|
||||
signZip(zioEntries, new FileOutputStream(outputZipFilename), outputZipFilename);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sign the file using the given public key cert, private key,
|
||||
* and signature block template. The signature block template
|
||||
@@ -689,15 +681,12 @@ public class ZipSigner {
|
||||
autoKeyObservable.notifyObservers(keyName);
|
||||
|
||||
loadKeys(keyName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
ZipOutput zipOutput = null;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
zipOutput = new ZipOutput(outputStream);
|
||||
|
||||
if (KEY_NONE.equals(keySet.getName())) {
|
||||
@@ -734,7 +723,6 @@ public class ZipSigner {
|
||||
manifest.write(ze.getOutputStream());
|
||||
zipOutput.write(ze);
|
||||
|
||||
|
||||
// CERT.SF
|
||||
ze = new ZioEntry(CERT_SF_NAME);
|
||||
ze.setTime(timestamp);
|
||||
@@ -782,13 +770,11 @@ public class ZipSigner {
|
||||
progressHelper.removeProgressListener(l);
|
||||
}
|
||||
|
||||
|
||||
public static class AutoKeyObservable extends Observable {
|
||||
@Override
|
||||
public void notifyObservers(Object arg) {
|
||||
super.setChanged();
|
||||
super.notifyObservers(arg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
|
||||
package kellinwood.security.zipsigner.optional;
|
||||
|
||||
import kellinwood.security.zipsigner.KeySet;
|
||||
import org.bouncycastle.cert.jcajce.JcaCertStore;
|
||||
import org.bouncycastle.cms.CMSProcessableByteArray;
|
||||
import org.bouncycastle.cms.CMSSignedData;
|
||||
@@ -18,6 +16,8 @@ import org.bouncycastle.util.Store;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import kellinwood.security.zipsigner.KeySet;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -57,5 +57,4 @@ public class SignatureBlockGenerator {
|
||||
throw new RuntimeException(x.getMessage(), x);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package kellinwood.zipio;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CentralEnd {
|
||||
public int signature = 0x06054b50; // end of central dir signature 4 bytes
|
||||
public short numberThisDisk = 0; // number of this disk 2 bytes
|
||||
public short numberThisDisk = 0; // number of this disk 2 bytes
|
||||
public short centralStartDisk = 0; // number of the disk with the start of the central directory 2 bytes
|
||||
public short numCentralEntries; // total number of entries in the central directory on this disk 2 bytes
|
||||
public short totalCentralEntries; // total number of entries in the central directory 2 bytes
|
||||
@@ -54,7 +54,6 @@ public class CentralEnd {
|
||||
return log;
|
||||
}
|
||||
|
||||
|
||||
private void doRead(ZipInput input) throws IOException {
|
||||
|
||||
boolean debug = getLogger().isDebugEnabled();
|
||||
@@ -63,13 +62,19 @@ public class CentralEnd {
|
||||
if (debug) log.debug(String.format("This disk number: 0x%04x", numberThisDisk));
|
||||
|
||||
centralStartDisk = input.readShort();
|
||||
if (debug) log.debug(String.format("Central dir start disk number: 0x%04x", centralStartDisk));
|
||||
if (debug) {
|
||||
log.debug(String.format("Central dir start disk number: 0x%04x", centralStartDisk));
|
||||
}
|
||||
|
||||
numCentralEntries = input.readShort();
|
||||
if (debug) log.debug(String.format("Central entries on this disk: 0x%04x", numCentralEntries));
|
||||
if (debug) {
|
||||
log.debug(String.format("Central entries on this disk: 0x%04x", numCentralEntries));
|
||||
}
|
||||
|
||||
totalCentralEntries = input.readShort();
|
||||
if (debug) log.debug(String.format("Total number of central entries: 0x%04x", totalCentralEntries));
|
||||
if (debug) {
|
||||
log.debug(String.format("Total number of central entries: 0x%04x", totalCentralEntries));
|
||||
}
|
||||
|
||||
centralDirectorySize = input.readInt();
|
||||
if (debug) log.debug(String.format("Central directory size: 0x%08x", centralDirectorySize));
|
||||
@@ -80,11 +85,8 @@ public class CentralEnd {
|
||||
short zipFileCommentLen = input.readShort();
|
||||
fileComment = input.readString(zipFileCommentLen);
|
||||
if (debug) log.debug(".ZIP file comment: " + fileComment);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void write(ZipOutput output) throws IOException {
|
||||
|
||||
boolean debug = getLogger().isDebugEnabled();
|
||||
@@ -98,8 +100,5 @@ public class CentralEnd {
|
||||
output.writeInt(centralStartOffset);
|
||||
output.writeShort((short) fileComment.length());
|
||||
output.writeString(fileComment);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package kellinwood.zipio;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@@ -32,6 +29,9 @@ import java.util.zip.CRC32;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
public class ZioEntry implements Cloneable {
|
||||
|
||||
private ZipInput zipInput;
|
||||
@@ -59,7 +59,6 @@ public class ZioEntry implements Cloneable {
|
||||
private byte[] data = null;
|
||||
private ZioEntryOutputStream entryOut = null;
|
||||
|
||||
|
||||
private static byte[] alignBytes = new byte[4];
|
||||
|
||||
private static LoggerInterface log;
|
||||
@@ -81,7 +80,6 @@ public class ZioEntry implements Cloneable {
|
||||
setTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
public ZioEntry(String name, String sourceDataFile)
|
||||
throws IOException {
|
||||
zipInput = new ZipInput(sourceDataFile);
|
||||
@@ -151,7 +149,9 @@ public class ZioEntry implements Cloneable {
|
||||
|
||||
input.seek(localHeaderOffset);
|
||||
|
||||
if (debug) getLogger().debug(String.format("FILE POSITION: 0x%08x", input.getFilePointer()));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format("FILE POSITION: 0x%08x", input.getFilePointer()));
|
||||
}
|
||||
|
||||
// 0 4 Local file header signature = 0x04034b50
|
||||
int signature = input.readInt();
|
||||
@@ -171,12 +171,16 @@ public class ZioEntry implements Cloneable {
|
||||
// 4 2 Version needed to extract (minimum)
|
||||
/* versionRequired */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("Version required: 0x%04x", tmpShort /*versionRequired*/));
|
||||
if (debug) {
|
||||
log.debug(String.format("Version required: 0x%04x", tmpShort /*versionRequired*/));
|
||||
}
|
||||
|
||||
// 6 2 General purpose bit flag
|
||||
/* generalPurposeBits */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("General purpose bits: 0x%04x", tmpShort /* generalPurposeBits */));
|
||||
if (debug) {
|
||||
log.debug(String.format("General purpose bits: 0x%04x", tmpShort /* generalPurposeBits */));
|
||||
}
|
||||
|
||||
// 8 2 Compression method
|
||||
/* compression */
|
||||
@@ -186,12 +190,16 @@ public class ZioEntry implements Cloneable {
|
||||
// 10 2 File last modification time
|
||||
/* modificationTime */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("Modification time: 0x%04x", tmpShort /* modificationTime */));
|
||||
if (debug) {
|
||||
log.debug(String.format("Modification time: 0x%04x", tmpShort /* modificationTime */));
|
||||
}
|
||||
|
||||
// 12 2 File last modification date
|
||||
/* modificationDate */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("Modification date: 0x%04x", tmpShort /* modificationDate */));
|
||||
if (debug) {
|
||||
log.debug(String.format("Modification date: 0x%04x", tmpShort /* modificationDate */));
|
||||
}
|
||||
|
||||
// 14 4 CRC-32
|
||||
/* crc32 */
|
||||
@@ -216,7 +224,7 @@ public class ZioEntry implements Cloneable {
|
||||
short extraLen = input.readShort();
|
||||
if (debug) log.debug(String.format("Extra length: 0x%04x", extraLen));
|
||||
|
||||
// 30 n File name
|
||||
// 30 n File name
|
||||
String filename = input.readString(fileNameLen);
|
||||
if (debug) log.debug("Filename: " + filename);
|
||||
|
||||
@@ -226,7 +234,6 @@ public class ZioEntry implements Cloneable {
|
||||
// Record the file position of this entry's data.
|
||||
dataPosition = input.getFilePointer();
|
||||
if (debug) log.debug(String.format("Data position: 0x%08x", dataPosition));
|
||||
|
||||
}
|
||||
|
||||
public void writeLocalEntry(ZipOutput output) throws IOException {
|
||||
@@ -278,7 +285,6 @@ public class ZioEntry implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 28 2 Extra field length (m)
|
||||
output.writeShort((short) (extraData.length + numAlignBytes));
|
||||
|
||||
@@ -293,10 +299,14 @@ public class ZioEntry implements Cloneable {
|
||||
output.writeBytes(alignBytes, 0, numAlignBytes);
|
||||
}
|
||||
|
||||
if (debug) getLogger().debug(String.format(Locale.ENGLISH, "Data position 0x%08x", output.getFilePointer()));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format(Locale.ENGLISH, "Data position 0x%08x", output.getFilePointer()));
|
||||
}
|
||||
if (data != null) {
|
||||
output.writeBytes(data);
|
||||
if (debug) getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", data.length));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", data.length));
|
||||
}
|
||||
} else {
|
||||
|
||||
if (debug) getLogger().debug(String.format("Seeking to position 0x%08x", dataPosition));
|
||||
@@ -310,7 +320,9 @@ public class ZioEntry implements Cloneable {
|
||||
int numRead = zipInput.in.read(buffer, 0, (int) Math.min(compressedSize - totalCount, bufferSize));
|
||||
if (numRead > 0) {
|
||||
output.writeBytes(buffer, 0, numRead);
|
||||
if (debug) getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", numRead));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", numRead));
|
||||
}
|
||||
totalCount += numRead;
|
||||
} else
|
||||
throw new IllegalStateException(String.format(Locale.ENGLISH, "EOF reached while copying %s with %d bytes left to go", filename, compressedSize - totalCount));
|
||||
@@ -401,7 +413,7 @@ public class ZioEntry implements Cloneable {
|
||||
localHeaderOffset = input.readInt();
|
||||
if (debug) log.debug(String.format("Local header offset: 0x%08x", localHeaderOffset));
|
||||
|
||||
// 30 n File name
|
||||
// 30 n File name
|
||||
filename = input.readString(fileNameLen);
|
||||
if (debug) log.debug("Filename: " + filename);
|
||||
|
||||
@@ -418,7 +430,6 @@ public class ZioEntry implements Cloneable {
|
||||
compression = 0;
|
||||
crc32 = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,12 +452,12 @@ public class ZioEntry implements Cloneable {
|
||||
return tmpdata;
|
||||
}
|
||||
|
||||
// Returns an input stream for reading the entry's data.
|
||||
// Returns an input stream for reading the entry's data.
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return getInputStream(null);
|
||||
}
|
||||
|
||||
// Returns an input stream for reading the entry's data.
|
||||
// Returns an input stream for reading the entry's data.
|
||||
public InputStream getInputStream(OutputStream monitorStream) throws IOException {
|
||||
|
||||
if (entryOut != null) {
|
||||
@@ -459,8 +470,8 @@ public class ZioEntry implements Cloneable {
|
||||
InputStream rawis = new ByteArrayInputStream(data);
|
||||
if (compression == 0) return rawis;
|
||||
else {
|
||||
// Hacky, inflate using a sequence of input streams that returns 1 byte more than the actual length of the data.
|
||||
// This extra dummy byte is required by InflaterInputStream when the data doesn't have the header and crc fields (as it is in zip files).
|
||||
// Hacky, inflate using a sequence of input streams that returns 1 byte more than the actual length of the data.
|
||||
// This extra dummy byte is required by InflaterInputStream when the data doesn't have the header and crc fields (as it is in zip files).
|
||||
return new InflaterInputStream(new SequenceInputStream(rawis, new ByteArrayInputStream(new byte[1])), new Inflater(true));
|
||||
}
|
||||
}
|
||||
@@ -469,8 +480,8 @@ public class ZioEntry implements Cloneable {
|
||||
dataStream = new ZioEntryInputStream(this);
|
||||
if (monitorStream != null) dataStream.setMonitorStream(monitorStream);
|
||||
if (compression != 0) {
|
||||
// Note: When using nowrap=true with Inflater it is also necessary to provide
|
||||
// an extra "dummy" byte as input. This is required by the ZLIB native library
|
||||
// Note: When using nowrap=true with Inflater it is also necessary to provide
|
||||
// an extra "dummy" byte as input. This is required by the ZLIB native library
|
||||
// in order to support certain optimizations.
|
||||
dataStream.setReturnDummyByte(true);
|
||||
return new InflaterInputStream(dataStream, new Inflater(true));
|
||||
@@ -483,11 +494,9 @@ public class ZioEntry implements Cloneable {
|
||||
return entryOut;
|
||||
}
|
||||
|
||||
|
||||
public void write(ZipOutput output) throws IOException {
|
||||
boolean debug = getLogger().isDebugEnabled();
|
||||
|
||||
|
||||
output.writeInt(0x02014b50);
|
||||
output.writeShort(versionMadeBy);
|
||||
output.writeShort(versionRequired);
|
||||
@@ -510,7 +519,6 @@ public class ZioEntry implements Cloneable {
|
||||
output.writeBytes(extraData);
|
||||
if (numAlignBytes > 0) output.writeBytes(alignBytes, 0, numAlignBytes);
|
||||
output.writeString(fileComment);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -628,5 +636,4 @@ public class ZioEntry implements Cloneable {
|
||||
public ZipInput getZipInput() {
|
||||
return zipInput;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,15 +16,14 @@
|
||||
|
||||
package kellinwood.zipio;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Locale;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
/**
|
||||
* Input stream used to read just the data from a zip file entry.
|
||||
@@ -48,14 +47,15 @@ public class ZioEntryInputStream extends InputStream {
|
||||
raf = entry.getZipInput().in;
|
||||
long dpos = entry.getDataPosition();
|
||||
if (dpos >= 0) {
|
||||
if (debug) log.debug(String.format(Locale.ENGLISH, "Seeking to %d", entry.getDataPosition()));
|
||||
if (debug) {
|
||||
log.debug(String.format(Locale.ENGLISH, "Seeking to %d", entry.getDataPosition()));
|
||||
}
|
||||
raf.seek(entry.getDataPosition());
|
||||
} else {
|
||||
// seeks to, then reads, the local header, causing the
|
||||
// seeks to, then reads, the local header, causing the
|
||||
// file pointer to be positioned at the start of the data.
|
||||
entry.readLocalHeader();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setReturnDummyByte(boolean returnExtraByte) {
|
||||
@@ -120,7 +120,9 @@ public class ZioEntryInputStream extends InputStream {
|
||||
if (monitor != null) monitor.write(b, off, numRead);
|
||||
offset += numRead;
|
||||
}
|
||||
if (debug) log.debug(String.format(Locale.ENGLISH, "Read %d bytes for read(b,%d,%d)", numRead, off, len));
|
||||
if (debug) {
|
||||
log.debug(String.format(Locale.ENGLISH, "Read %d bytes for read(b,%d,%d)", numRead, off, len));
|
||||
}
|
||||
return numRead;
|
||||
}
|
||||
|
||||
@@ -137,5 +139,3 @@ public class ZioEntryInputStream extends InputStream {
|
||||
return numToSkip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.zip.Deflater;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
public class ZioEntryOutputStream extends OutputStream {
|
||||
int size = 0; // tracks uncompressed size of data
|
||||
int size = 0; // tracks uncompressed size of data
|
||||
CRC32 crc = new CRC32();
|
||||
int crcValue = 0;
|
||||
OutputStream wrapped;
|
||||
@@ -82,6 +82,4 @@ public class ZioEntryOutputStream extends OutputStream {
|
||||
public OutputStream getWrappedStream() {
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package kellinwood.zipio;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -33,6 +30,9 @@ import java.util.jar.Manifest;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -73,7 +73,6 @@ public class ZipInput implements Closeable {
|
||||
return zipInput;
|
||||
}
|
||||
|
||||
|
||||
public ZioEntry getEntry(String filename) {
|
||||
return zioEntries.get(filename);
|
||||
}
|
||||
@@ -88,7 +87,9 @@ public class ZipInput implements Closeable {
|
||||
* to get the root entries.
|
||||
*/
|
||||
public Collection<String> list(String path) {
|
||||
if (!path.endsWith("/")) throw new IllegalArgumentException("Invalid path -- does not end with '/'");
|
||||
if (!path.endsWith("/")) {
|
||||
throw new IllegalArgumentException("Invalid path -- does not end with '/'");
|
||||
}
|
||||
|
||||
if (path.startsWith("/")) path = path.substring(1);
|
||||
|
||||
@@ -140,7 +141,6 @@ public class ZipInput implements Closeable {
|
||||
return scanForEOCDR(size * 2);
|
||||
}
|
||||
|
||||
|
||||
private void doRead() {
|
||||
try {
|
||||
int bufferSize = 256;
|
||||
@@ -232,5 +232,3 @@ public class ZipInput implements Closeable {
|
||||
return in.read(b, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package kellinwood.zipio;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -33,12 +33,13 @@ public class ZipListingHelper {
|
||||
public static void listHeader(LoggerInterface log) {
|
||||
log.debug(" Length Method Size Ratio Date Time CRC-32 Name");
|
||||
log.debug("-------- ------ ------- ----- ---- ---- ------ ----");
|
||||
|
||||
}
|
||||
|
||||
public static void listEntry(LoggerInterface log, ZioEntry entry) {
|
||||
int ratio = 0;
|
||||
if (entry.getSize() > 0) ratio = (100 * (entry.getSize() - entry.getCompressedSize())) / entry.getSize();
|
||||
if (entry.getSize() > 0) {
|
||||
ratio = (100 * (entry.getSize() - entry.getCompressedSize())) / entry.getSize();
|
||||
}
|
||||
log.debug(String.format(Locale.ENGLISH, "%8d %6s %8d %4d%% %s %08x %s",
|
||||
entry.getSize(),
|
||||
entry.getCompression() == 0 ? "Stored" : "Defl:N",
|
||||
@@ -49,5 +50,3 @@ public class ZipListingHelper {
|
||||
entry.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package kellinwood.zipio;
|
||||
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -28,9 +25,9 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
import kellinwood.logging.LoggerInterface;
|
||||
import kellinwood.logging.LoggerManager;
|
||||
|
||||
public class ZipOutput {
|
||||
|
||||
static LoggerInterface log;
|
||||
@@ -58,7 +55,6 @@ public class ZipOutput {
|
||||
if (ofile.exists()) ofile.delete();
|
||||
out = new FileOutputStream(ofile);
|
||||
if (getLogger().isDebugEnabled()) ZipListingHelper.listHeader(getLogger());
|
||||
|
||||
}
|
||||
|
||||
public ZipOutput(OutputStream os) throws IOException {
|
||||
@@ -80,10 +76,8 @@ public class ZipOutput {
|
||||
entriesWritten.add(entry);
|
||||
namesWritten.add(entryName);
|
||||
if (getLogger().isDebugEnabled()) ZipListingHelper.listEntry(getLogger(), entry);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void close() throws IOException {
|
||||
CentralEnd centralEnd = new CentralEnd();
|
||||
|
||||
@@ -109,7 +103,6 @@ public class ZipOutput {
|
||||
return filePointer;
|
||||
}
|
||||
|
||||
|
||||
public void writeInt(int value) throws IOException {
|
||||
byte[] data = new byte[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -148,7 +141,4 @@ public class ZipOutput {
|
||||
out.write(value, offset, length);
|
||||
filePointer += length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -134,7 +134,6 @@ public class BluetoothServer extends Thread {
|
||||
}
|
||||
|
||||
connection.closeQuietly();
|
||||
|
||||
}
|
||||
|
||||
private Response handleRequest(Request request) {
|
||||
@@ -344,5 +343,4 @@ public class BluetoothServer extends Thread {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,8 +72,7 @@ import fi.iki.elonen.NanoHTTPD.Response.IStatus;
|
||||
* <p>
|
||||
* This is mostly just synced from {@code SimpleWebServer.java} from NanoHTTPD.
|
||||
*
|
||||
* @see
|
||||
* <a href="https://github.com/NanoHttpd/nanohttpd/blob/nanohttpd-project-2.3.1/webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java">webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java</a>
|
||||
* @see <a href="https://github.com/NanoHttpd/nanohttpd/blob/nanohttpd-project-2.3.1/webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java">webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java</a>
|
||||
*/
|
||||
public class LocalHTTPD extends NanoHTTPD {
|
||||
private static final String TAG = "LocalHTTPD";
|
||||
|
||||
@@ -374,5 +374,4 @@ public final class LocalRepoKeyStore {
|
||||
return wrapped.getServerAliases(keyType, issuers);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -295,7 +295,5 @@ public final class LocalRepoManager {
|
||||
} finally {
|
||||
attemptToDelete(indexJarUnsigned);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -162,5 +162,4 @@ public class SDCardScannerService extends IntentService {
|
||||
Utils.closeQuietly(inputStream);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -219,5 +219,4 @@ public class SelectAppsView extends SwapView {
|
||||
this(packageInfo.packageName, Utils.getApplicationLabel(context, packageInfo.packageName));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ import java.util.Map;
|
||||
*/
|
||||
// TODO merge this with AppListActivity, perhaps there could be AppListView?
|
||||
public class SwapSuccessView extends SwapView {
|
||||
private static final String TAG = "SwapAppsView";
|
||||
private static final String TAG = "SwapSuccessView";
|
||||
|
||||
public SwapSuccessView(Context context) {
|
||||
super(context);
|
||||
|
||||
@@ -33,7 +33,6 @@ import android.util.Log;
|
||||
|
||||
import org.fdroid.fdroid.views.main.NearbyViewBinder;
|
||||
|
||||
|
||||
/**
|
||||
* This is just a shim to receive {@link UsbManager#ACTION_USB_ACCESSORY_ATTACHED}
|
||||
* events.
|
||||
@@ -41,7 +40,6 @@ import org.fdroid.fdroid.views.main.NearbyViewBinder;
|
||||
public class UsbDeviceAttachedReceiver extends BroadcastReceiver {
|
||||
public static final String TAG = "UsbDeviceAttachedReceiv";
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
|
||||
|
||||
@@ -85,10 +85,10 @@ public class WifiStateChangeService extends Worker {
|
||||
|
||||
public static void registerReceiver(Context context) {
|
||||
ContextCompat.registerReceiver(
|
||||
context,
|
||||
new WifiStateChangeReceiver(),
|
||||
new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION),
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED);
|
||||
context,
|
||||
new WifiStateChangeReceiver(),
|
||||
new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION),
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED);
|
||||
}
|
||||
|
||||
public static void start(Context context, @Nullable Intent intent) {
|
||||
|
||||
@@ -157,5 +157,4 @@ public class CalculatorActivity extends AppCompatActivity {
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,5 +29,4 @@ public class ExitActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -284,5 +284,4 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
|
||||
builder.setView(R.layout.dialog_app_hiding);
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -110,5 +110,4 @@ public final class Contents {
|
||||
ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE,
|
||||
ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -181,7 +181,6 @@ public final class QRCodeEncoder {
|
||||
contents = null;
|
||||
displayContents = null;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case Contents.Type.LOCATION:
|
||||
|
||||
@@ -105,7 +105,7 @@ import java.util.Map;
|
||||
* @author Isaac Potoczny-Jones
|
||||
* @author Brad Drehmer
|
||||
* @author gcstang
|
||||
*/
|
||||
*/
|
||||
@SuppressWarnings("LineLength")
|
||||
public class IntentIntegrator {
|
||||
|
||||
@@ -438,5 +438,4 @@ public class IntentIntegrator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,5 +86,4 @@ public final class IntentResult {
|
||||
return "Format: " + formatName + '\n' + "Contents: " + contents + '\n' + "Raw bytes: (" + rawBytesLength
|
||||
+ " bytes)\n" + "Orientation: " + orientation + '\n' + "EC level: " + errorCorrectionLevel + '\n';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,5 +96,4 @@ public class Hasher {
|
||||
}
|
||||
return rawdata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -200,5 +200,4 @@ public final class Languages {
|
||||
new Locale("uk"),
|
||||
new Locale("vi"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class NfcHelper {
|
||||
try {
|
||||
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
|
||||
Uri[] uris = {
|
||||
Uri.parse("file://" + appInfo.publicSourceDir),
|
||||
Uri.parse("file://" + appInfo.publicSourceDir),
|
||||
};
|
||||
nfcAdapter.setBeamPushUris(uris, activity);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
@@ -53,5 +53,4 @@ public class NfcHelper {
|
||||
nfcAdapter.setBeamPushUris(null, activity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -681,5 +681,4 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class Utils {
|
||||
private static final int BUFFER_SIZE = 4096;
|
||||
|
||||
private static final String[] FRIENDLY_SIZE_FORMAT = {
|
||||
"%.0f B", "%.0f KiB", "%.1f MiB", "%.2f GiB",
|
||||
"%.0f B", "%.0f KiB", "%.1f MiB", "%.2f GiB",
|
||||
};
|
||||
|
||||
private static RequestOptions iconRequestOptions;
|
||||
@@ -272,37 +272,37 @@ public final class Utils {
|
||||
}
|
||||
|
||||
private static final String[] ANDROID_VERSION_NAMES = {
|
||||
"?", // 0, undefined
|
||||
"1.0", // 1
|
||||
"1.1", // 2
|
||||
"1.5", // 3
|
||||
"1.6", // 4
|
||||
"2.0", // 5
|
||||
"2.0.1", // 6
|
||||
"2.1", // 7
|
||||
"2.2", // 8
|
||||
"2.3", // 9
|
||||
"2.3.3", // 10
|
||||
"3.0", // 11
|
||||
"3.1", // 12
|
||||
"3.2", // 13
|
||||
"4.0", // 14
|
||||
"4.0.3", // 15
|
||||
"4.1", // 16
|
||||
"4.2", // 17
|
||||
"4.3", // 18
|
||||
"4.4", // 19
|
||||
"4.4W", // 20
|
||||
"5.0", // 21
|
||||
"5.1", // 22
|
||||
"6.0", // 23
|
||||
"7.0", // 24
|
||||
"7.1", // 25
|
||||
"8.0", // 26
|
||||
"8.1", // 27
|
||||
"9.0", // 28
|
||||
"10.0", // 29
|
||||
"11.0", // 30
|
||||
"?", // 0, undefined
|
||||
"1.0", // 1
|
||||
"1.1", // 2
|
||||
"1.5", // 3
|
||||
"1.6", // 4
|
||||
"2.0", // 5
|
||||
"2.0.1", // 6
|
||||
"2.1", // 7
|
||||
"2.2", // 8
|
||||
"2.3", // 9
|
||||
"2.3.3", // 10
|
||||
"3.0", // 11
|
||||
"3.1", // 12
|
||||
"3.2", // 13
|
||||
"4.0", // 14
|
||||
"4.0.3", // 15
|
||||
"4.1", // 16
|
||||
"4.2", // 17
|
||||
"4.3", // 18
|
||||
"4.4", // 19
|
||||
"4.4W", // 20
|
||||
"5.0", // 21
|
||||
"5.1", // 22
|
||||
"6.0", // 23
|
||||
"7.0", // 24
|
||||
"7.1", // 25
|
||||
"8.0", // 26
|
||||
"8.1", // 27
|
||||
"9.0", // 28
|
||||
"10.0", // 29
|
||||
"11.0", // 30
|
||||
};
|
||||
|
||||
public static String getAndroidVersionName(int sdkLevel) {
|
||||
|
||||
@@ -39,7 +39,6 @@ public class FileCompat {
|
||||
// Do nothing...
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void symlinkOs(SanitizedFile source, SanitizedFile dest) {
|
||||
@@ -75,5 +74,4 @@ public class FileCompat {
|
||||
Log.e(TAG, "Could not symlink " + source.getAbsolutePath() + " to " + dest.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,15 +31,14 @@ public class PackageManagerCompat {
|
||||
if (Build.VERSION.SDK_INT >= 30) return; // not working anymore on this SDK level
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 24 && PrivilegedInstaller.isDefault(context)) {
|
||||
mPm.setInstallerPackageName(packageName, PrivilegedInstaller.PRIVILEGED_EXTENSION_PACKAGE_NAME);
|
||||
mPm.setInstallerPackageName(
|
||||
packageName, PrivilegedInstaller.PRIVILEGED_EXTENSION_PACKAGE_NAME);
|
||||
} else {
|
||||
mPm.setInstallerPackageName(packageName, BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
Utils.debugLog(TAG, "Installer package name for " + packageName + " set successfully");
|
||||
} catch (SecurityException | IllegalArgumentException e) {
|
||||
Log.e(TAG, "Could not set installer package name for " +
|
||||
packageName, e);
|
||||
Log.e(TAG, "Could not set installer package name for " + packageName, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class App implements Comparable<App>, Parcelable {
|
||||
* True if compatible with the device (i.e. if at least one apk is)
|
||||
*/
|
||||
public boolean compatible;
|
||||
|
||||
public Apk installedApk; // might be null if not installed
|
||||
public String installedSigner;
|
||||
public long installedVersionCode;
|
||||
@@ -825,5 +826,4 @@ public class App implements Comparable<App>, Parcelable {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,8 +44,17 @@ final class ContentProviderMigrator {
|
||||
List<Repository> repos = repoDao.getRepositories();
|
||||
int weight = repos.isEmpty() ? 0 : repos.get(repos.size() - 1).getWeight();
|
||||
|
||||
String[] projection = new String[]{"name", "address", "pubkey", "inuse", "userMirrors", "disabledMirrors",
|
||||
"username", "password"};
|
||||
String[] projection =
|
||||
new String[] {
|
||||
"name",
|
||||
"address",
|
||||
"pubkey",
|
||||
"inuse",
|
||||
"userMirrors",
|
||||
"disabledMirrors",
|
||||
"username",
|
||||
"password"
|
||||
};
|
||||
try (Cursor c = oldDb.query("fdroid_repo", projection, null, null, null, null, null)) {
|
||||
while (c.moveToNext()) {
|
||||
String name = c.getString(c.getColumnIndexOrThrow("name"));
|
||||
|
||||
@@ -232,5 +232,4 @@ public class DBHelper {
|
||||
+ repoItems.size() + " % " + (REPO_XML_ITEM_COUNT - 1) + " != 0");
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,5 +66,4 @@ public class SanitizedFile extends File {
|
||||
public static SanitizedFile knownSanitized(File file) {
|
||||
return new SanitizedFile(file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -105,5 +105,4 @@ public class ApkFileProvider extends FileProvider {
|
||||
return Uri.fromFile(tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -138,5 +138,4 @@ class ApkVerifier {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -202,5 +202,4 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
||||
// after doing the broadcasts, finish this transparent wrapper activity
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class FileInstallerActivity extends FragmentActivity {
|
||||
private App app;
|
||||
private Apk apk;
|
||||
private Uri localApkUri;
|
||||
|
||||
/**
|
||||
* @see InstallManagerService
|
||||
*/
|
||||
@@ -77,7 +78,6 @@ public class FileInstallerActivity extends FragmentActivity {
|
||||
} else {
|
||||
throw new IllegalStateException("Intent action not specified!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean hasStoragePermission() {
|
||||
|
||||
@@ -50,13 +50,14 @@ public class InstallHistoryService extends JobIntentService {
|
||||
public static final String TAG = "InstallHistoryService";
|
||||
private static final int JOB_ID = TAG.hashCode();
|
||||
|
||||
public static final Uri LOG_URI = Uri.parse("content://" + Installer.AUTHORITY + "/install_history/all");
|
||||
public static final Uri LOG_URI =
|
||||
Uri.parse("content://" + Installer.AUTHORITY + "/install_history/all");
|
||||
|
||||
private static BroadcastReceiver broadcastReceiver;
|
||||
|
||||
public static void register(Context context) {
|
||||
if (broadcastReceiver != null) {
|
||||
return; // already registered
|
||||
return; // already registered
|
||||
}
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addDataScheme("http");
|
||||
|
||||
@@ -245,5 +245,4 @@ public class SessionInstallManager extends BroadcastReceiver {
|
||||
// TODO check targetSdk Android 14 sources have been published, just a guess so far
|
||||
return Build.VERSION.SDK_INT == 34 && targetSdk >= 31;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,5 +39,4 @@ class SessionInstaller extends Installer {
|
||||
// may not always be unattended, but no easy way to find out up-front
|
||||
return SessionInstallManager.canBeUsed(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,5 +14,4 @@ class BluetoothConstants {
|
||||
// This UUID is just from mashing random hex characters on the keyboard.
|
||||
return UUID.fromString("cd59ba31-5729-b3bb-cb29-732b59eb61aa");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,5 +10,4 @@ public class ContentLengthHeader extends Header {
|
||||
public void handle(FileDetails details, String value) {
|
||||
details.setFileSize(Integer.parseInt(value));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,5 +10,4 @@ public class ETagHeader extends Header {
|
||||
public void handle(FileDetails details, String value) {
|
||||
details.setCacheTag(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,5 +22,4 @@ public abstract class Header {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -190,7 +190,6 @@ public final class Request {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
@@ -202,5 +201,4 @@ public final class Request {
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -117,7 +117,6 @@ public class Response {
|
||||
}
|
||||
|
||||
output.flush();
|
||||
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
@@ -163,6 +162,5 @@ public class Response {
|
||||
|
||||
return new Response(statusCode, headers, contentStream);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,5 +109,4 @@ public class BluetoothDownloader extends Downloader {
|
||||
connection.closeQuietly();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class TreeUriDownloader extends Downloader {
|
||||
|
||||
@Override
|
||||
public boolean hasChanged() {
|
||||
return true; // TODO how should this actually be implemented?
|
||||
return true; // TODO how should this actually be implemented?
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -130,7 +130,6 @@ public class AppSecurityPermissions {
|
||||
DrawableCompat.setTint(wrappedIconDrawable, theme == Preferences.Theme.light ? Color.BLACK : Color.WHITE);
|
||||
return wrappedIconDrawable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// PermissionInfo implements Parcelable but its Parcel constructor is private and thus cannot be extended.
|
||||
@@ -233,7 +232,6 @@ public class AppSecurityPermissions {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AppSecurityPermissions(Context context) {
|
||||
|
||||
@@ -45,7 +45,6 @@ public class CameraCharacteristicsMinApiLevel21 extends CameraCharacteristicsChe
|
||||
Log.e(TAG, e.getMessage(), e);
|
||||
throw new FDroidDeviceException("Exception accessing the camera list", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -106,5 +105,4 @@ public class CameraCharacteristicsMinApiLevel21 extends CameraCharacteristicsChe
|
||||
private boolean isAutofocus(final int mode) {
|
||||
return mode != android.hardware.camera2.CameraMetadata.CONTROL_AF_MODE_OFF;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,5 +36,4 @@ public class StartupReceiver extends BroadcastReceiver {
|
||||
Utils.debugLog(TAG, "received unsupported Intent " + intent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -516,7 +516,6 @@ public class AppDetailsActivity extends AppCompatActivity
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final BroadcastReceiver appStatusReceiver = new BroadcastReceiver() {
|
||||
@@ -846,5 +845,4 @@ public class AppDetailsActivity extends AppCompatActivity
|
||||
}
|
||||
startUninstall();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@ public class AppDetailsRecyclerViewAdapter
|
||||
void installCancel();
|
||||
|
||||
void launchApk();
|
||||
|
||||
}
|
||||
|
||||
private static final int VIEWTYPE_HEADER = 0;
|
||||
|
||||
@@ -131,7 +131,6 @@ public class AntiFeaturesListingView extends RecyclerView {
|
||||
antiFeatureText = itemView.findViewById(R.id.anti_feature_text);
|
||||
antiFeatureReason = itemView.findViewById(R.id.anti_feature_reason);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static String getAntiFeatureDescriptionText(Context context, String antiFeatureName) {
|
||||
|
||||
@@ -137,5 +137,4 @@ public class AppListItemState {
|
||||
this.checkBoxChecked = checked;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class AppPreviewAdapter extends RecyclerView.Adapter<AppCardController> {
|
||||
|
||||
void setAppCursor(List<AppOverviewItem> items) {
|
||||
if (this.items == items) {
|
||||
//don't notify when the cursor did not change
|
||||
// don't notify when the cursor did not change
|
||||
return;
|
||||
}
|
||||
this.items = items;
|
||||
|
||||
@@ -157,5 +157,4 @@ class CategoriesViewBinder implements Observer<List<Category>> {
|
||||
});
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class LatestAdapter extends RecyclerView.Adapter<AppCardController> {
|
||||
|
||||
public void setApps(@Nullable List<AppOverviewItem> apps) {
|
||||
if (this.apps == apps) {
|
||||
//don't notify when the apps did not change
|
||||
// don't notify when the apps did not change
|
||||
return;
|
||||
}
|
||||
this.apps = apps;
|
||||
|
||||
@@ -401,5 +401,4 @@ public class MainActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,5 +80,4 @@ public class SettingsView extends FrameLayout {
|
||||
currentTransaction = null;
|
||||
activity.getSupportFragmentManager().executePendingTransactions();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,5 +66,4 @@ public class UpdatesItemTouchCallback extends ItemTouchHelper.Callback {
|
||||
public boolean isItemViewSwipeEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,5 +57,4 @@ public class AppStatus extends AppUpdateData {
|
||||
((AppStatusListItemController) holder).bindModel(app.status.app, app.status.apk, app.status);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,9 +63,7 @@ public class AppStatusListItemController extends AppListItemController {
|
||||
final AppUpdateStatus appUpdateStatus = manager.get(status.getCanonicalUrl());
|
||||
manager.removeApk(status.getCanonicalUrl());
|
||||
|
||||
|
||||
switch (status.status) {
|
||||
|
||||
case Downloading:
|
||||
cancelDownload();
|
||||
Snackbar.make(itemView, R.string.app_list__dismiss_downloading_app, Snackbar.LENGTH_SHORT).show();
|
||||
@@ -89,5 +87,4 @@ public class AppStatusListItemController extends AppListItemController {
|
||||
|
||||
adapter.refreshItems();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,5 +62,4 @@ public class KnownVulnApp extends AppUpdateData {
|
||||
((KnownVulnAppListItemController) holder).bindModel(app.app, app.apk, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,5 +60,4 @@ public class UpdateableApp extends AppUpdateData {
|
||||
((UpdateableAppListItemController) holder).bindModel(app.app, app.apk, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -118,5 +118,4 @@ public class UpdateableAppsHeader extends AppUpdateData {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M10,16.5V7.5L16,12M20,4.4C19.4,4.2 15.7,4 12,4C8.3,4 4.6,4.19 4,4.38C2.44,4.9 2,8.4 2,12C2,15.59 2.44,19.1 4,19.61C4.6,19.81 8.3,20 12,20C15.7,20 19.4,19.81 20,19.61C21.56,19.1 22,15.59 22,12C22,8.4 21.56,4.91 20,4.4Z" />
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M10,16.5V7.5L16,12M20,4.4C19.4,4.2 15.7,4 12,4C8.3,4 4.6,4.19 4,4.38C2.44,4.9 2,8.4 2,12C2,15.59 2.44,19.1 4,19.61C4.6,19.81 8.3,20 12,20C15.7,20 19.4,19.81 20,19.61C21.56,19.1 22,15.59 22,12C22,8.4 21.56,4.91 20,4.4Z" />
|
||||
</vector>
|
||||
@@ -43,7 +43,6 @@ public class SanitizedFileTest {
|
||||
assertEquals("safe", safeSanitized.getName());
|
||||
assertEquals("safe-and_bleh.boo", nonEvilSanitized.getName());
|
||||
assertEquals("rm etcshadow", evilSanitized.getName());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -138,5 +138,4 @@ public class SuggestedVersionTest {
|
||||
AppPrefs appPrefs = new AppPrefs(app.packageName, 0, Collections.singletonList(releaseChannel));
|
||||
assertEquals(hasUpdates, app.hasUpdates(apks, appPrefs));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,5 +21,4 @@ public class MainActivityTest {
|
||||
assertNotEquals(invalid, MainActivity.sanitizeSearchTerms(invalid));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package kellinwood.security.zipsigner;
|
||||
|
||||
import kellinwood.security.zipsigner.ZipSigner;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
import org.bouncycastle.operator.OperatorCreationException;
|
||||
@@ -10,7 +12,6 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowLog;
|
||||
@@ -26,23 +27,20 @@ import java.security.PrivateKey;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* This test the JAR signing functions of {@link ZipSigner}.
|
||||
*/
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(sdk={23, 25, 32}) // minSdkVersion, targetSdkVersion, max SDK supported by Robolectric
|
||||
@Config(sdk = {23, 25, 32}) // minSdkVersion, targetSdkVersion, max SDK supported by Robolectric
|
||||
public class ZipSignerTest {
|
||||
public static final String TAG = "ZipSignerTest";
|
||||
|
||||
private File unsigned;
|
||||
private File signed;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
ShadowLog.stream = System.out;
|
||||
@@ -60,7 +58,7 @@ public class ZipSignerTest {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (unsigned != null) {
|
||||
@@ -74,7 +72,7 @@ public class ZipSignerTest {
|
||||
@Test
|
||||
public void testSignApk()
|
||||
throws CertificateException, ClassNotFoundException, GeneralSecurityException, IllegalAccessException, InstantiationException, IOException, NoSuchAlgorithmException, OperatorCreationException {
|
||||
|
||||
|
||||
System.out.println("wrote " + unsigned);
|
||||
assertTrue(unsigned.exists());
|
||||
assertTrue(unsigned.length() > 0);
|
||||
@@ -92,5 +90,5 @@ public class ZipSignerTest {
|
||||
|
||||
assertTrue(signed.exists());
|
||||
assertTrue(signed.length() > unsigned.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.robolectric.shadows.ShadowLog;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* Test that this can start and stop the webserver.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user