Merge branch 'finalize-1.6' into 'master'

Finalize 1.6

Closes #1556

See merge request fdroid/fdroidclient!813
This commit is contained in:
Hans-Christoph Steiner 2019-04-09 22:16:00 +00:00
commit 307abc5706
11 changed files with 38 additions and 12 deletions

View File

@ -66,8 +66,15 @@ errorprone:
- export AVD_PACKAGE="system-images;android-${AVD_SDK};${AVD_TAG};${AVD_ARCH}" - export AVD_PACKAGE="system-images;android-${AVD_SDK};${AVD_TAG};${AVD_ARCH}"
- echo $AVD_PACKAGE - echo $AVD_PACKAGE
- emulator -accel-check || true - emulator -accel-check || true
- if [[ "$AVD_ARCH" != arm* ]]; then
set -x; echo y | sdkmanager "emulator" > /dev/null; set +x;
elif [[ "$AVD_SDK" == Q ]]; then
set -x; echo y | sdkmanager --channel=2 "emulator" > /dev/null; set +x;
fi
- alias sdkmanager - alias sdkmanager
- echo y | sdkmanager "emulator" "platforms;android-$AVD_SDK" > /dev/null - echo y | sdkmanager "platforms;android-$AVD_SDK" > /dev/null
- if ! avdmanager list avd | grep "Name. avd$AVD_SDK$"; then - if ! avdmanager list avd | grep "Name. avd$AVD_SDK$"; then
set -x; set -x;
rm -rf ~/.android/avd $ANDROID_HOME/system-images; rm -rf ~/.android/avd $ANDROID_HOME/system-images;
@ -81,6 +88,7 @@ errorprone:
fi fi
- adb start-server - adb start-server
- ls -l ~/.android - ls -l ~/.android
- emulator -version
- emulator -avd avd$AVD_SDK - emulator -avd avd$AVD_SDK
-no-audio -no-audio
-no-jni -no-jni
@ -98,9 +106,9 @@ errorprone:
- ./gradlew connectedFullDebugAndroidTest $FLAG || (adb -e logcat -d > logcat.txt; exit 1) - ./gradlew connectedFullDebugAndroidTest $FLAG || (adb -e logcat -d > logcat.txt; exit 1)
connected 22 default armeabi-v7a: connected 22 default armeabi-v7a:
retry: 1
<<: *test-template <<: *test-template
<<: *connected-template <<: *connected-template
allow_failure: true
.kvm-template: &kvm-template .kvm-template: &kvm-template
tags: tags:

View File

@ -276,7 +276,7 @@ public class WifiStateChangeService extends IntentService {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
e.printStackTrace(); e.printStackTrace();
} else { } else {
Log.i(TAG, e.getLocalizedMessage()); Log.i(TAG, "Getting subnet failed: " + e.getLocalizedMessage());
} }
} }
} }

View File

@ -69,7 +69,7 @@ public class AddRepoIntentService extends IntentService {
try { try {
urlString = normalizeUrl(uri); urlString = normalizeUrl(uri);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
Log.i(TAG, e.getLocalizedMessage()); Log.i(TAG, "Bad URI: " + e.getLocalizedMessage());
return; return;
} }

View File

@ -27,7 +27,10 @@ public class DeleteCacheService extends JobIntentService {
Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST); Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);
Log.w(TAG, "Deleting all cached contents!"); Log.w(TAG, "Deleting all cached contents!");
try { try {
FileUtils.deleteDirectory(getCacheDir()); File cacheDir = getCacheDir();
if (cacheDir != null) {
FileUtils.deleteDirectory(cacheDir);
}
for (File dir : ContextCompat.getExternalCacheDirs(this)) { for (File dir : ContextCompat.getExternalCacheDirs(this)) {
FileUtils.deleteDirectory(dir); FileUtils.deleteDirectory(dir);
} }

View File

@ -544,12 +544,27 @@ public class UpdateService extends JobIntentService {
} }
} }
/**
* Queues all apps needing update. If this app itself (e.g. F-Droid) needs
* to be updated, it is queued last.
*/
public static void autoDownloadUpdates(Context context) { public static void autoDownloadUpdates(Context context) {
List<App> canUpdate = AppProvider.Helper.findCanUpdate(context, Schema.AppMetadataTable.Cols.ALL); List<App> canUpdate = AppProvider.Helper.findCanUpdate(context, Schema.AppMetadataTable.Cols.ALL);
String packageName = context.getPackageName();
App updateLastApp = null;
Apk updateLastApk = null;
for (App app : canUpdate) { for (App app : canUpdate) {
if (TextUtils.equals(packageName, app.packageName)) {
updateLastApp = app;
updateLastApk = ApkProvider.Helper.findSuggestedApk(context, app);
continue;
}
Apk apk = ApkProvider.Helper.findSuggestedApk(context, app); Apk apk = ApkProvider.Helper.findSuggestedApk(context, app);
InstallManagerService.queue(context, app, apk); InstallManagerService.queue(context, app, apk);
} }
if (updateLastApp != null && updateLastApk != null) {
InstallManagerService.queue(context, updateLastApp, updateLastApk);
}
} }
private void showAppUpdatesNotification(List<App> canUpdate) { private void showAppUpdatesNotification(List<App> canUpdate) {

View File

@ -92,7 +92,7 @@ public class BluetoothDownloader extends Downloader {
@Override @Override
public void download() throws IOException, InterruptedException { public void download() throws IOException, InterruptedException {
downloadFromStream(1024, false); downloadFromStream(false);
connection.closeQuietly(); connection.closeQuietly();
} }

View File

@ -116,7 +116,7 @@ public abstract class Downloader {
return notFound; return notFound;
} }
void downloadFromStream(int bufferSize, boolean resumable) throws IOException, InterruptedException { void downloadFromStream(boolean resumable) throws IOException, InterruptedException {
Utils.debugLog(TAG, "Downloading from stream"); Utils.debugLog(TAG, "Downloading from stream");
InputStream input = null; InputStream input = null;
OutputStream outputStream = new FileOutputStream(outputFile, resumable); OutputStream outputStream = new FileOutputStream(outputFile, resumable);
@ -127,7 +127,7 @@ public abstract class Downloader {
// we were interrupted before proceeding to the download. // we were interrupted before proceeding to the download.
throwExceptionIfInterrupted(); throwExceptionIfInterrupted();
copyInputToOutputStream(input, bufferSize, outputStream); copyInputToOutputStream(input, 8192, outputStream);
} finally { } finally {
Utils.closeQuietly(outputStream); Utils.closeQuietly(outputStream);
Utils.closeQuietly(input); Utils.closeQuietly(input);

View File

@ -248,7 +248,7 @@ public class DownloaderService extends Service {
| SSLHandshakeException | SSLKeyException | SSLPeerUnverifiedException | SSLProtocolException | SSLHandshakeException | SSLKeyException | SSLPeerUnverifiedException | SSLProtocolException
| ProtocolException | UnknownHostException e) { | ProtocolException | UnknownHostException e) {
// if the above list of exceptions changes, also change it in IndexV1Updater.update() // if the above list of exceptions changes, also change it in IndexV1Updater.update()
Log.e(TAG, e.getLocalizedMessage()); Log.e(TAG, "CONNECTION_FAILED: " + e.getLocalizedMessage());
sendBroadcast(uri, Downloader.ACTION_CONNECTION_FAILED, localFile, repoId, canonicalUrl); sendBroadcast(uri, Downloader.ACTION_CONNECTION_FAILED, localFile, repoId, canonicalUrl);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -175,7 +175,7 @@ public class HttpDownloader extends Downloader {
} }
setupConnection(resumable); setupConnection(resumable);
Utils.debugLog(TAG, "downloading " + urlString + " (is resumable: " + resumable + ")"); Utils.debugLog(TAG, "downloading " + urlString + " (is resumable: " + resumable + ")");
downloadFromStream(8192, resumable); downloadFromStream(resumable);
cacheTag = connection.getHeaderField(HEADER_FIELD_ETAG); cacheTag = connection.getHeaderField(HEADER_FIELD_ETAG);
} }

View File

@ -81,6 +81,6 @@ public class LocalFileDownloader extends Downloader {
} else if (fileLength > 0) { } else if (fileLength > 0) {
resumable = true; resumable = true;
} }
downloadFromStream(8192, resumable); downloadFromStream(resumable);
} }
} }

View File

@ -96,7 +96,7 @@ public class TreeUriDownloader extends Downloader {
@Override @Override
public void download() throws IOException, InterruptedException { public void download() throws IOException, InterruptedException {
downloadFromStream(8192, false); downloadFromStream(false);
} }
@Override @Override