From 64bc13de8a1c5751f0f3104f486bddeb8f39fd53 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Thu, 23 Jun 2016 11:06:16 +1000 Subject: [PATCH 1/3] Use symlink instead of hardlink, which was accidentally used on API < 19. At the same time, also changed visibility of methods to package local to remove need for test class. --- .../fdroid/compat/FileCompatForTest.java | 27 ------------------- .../fdroid/{ => compat}/FileCompatTest.java | 10 +++---- .../org/fdroid/fdroid/compat/FileCompat.java | 9 ++++--- 3 files changed, 10 insertions(+), 36 deletions(-) delete mode 100644 app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatForTest.java rename app/src/androidTest/java/org/fdroid/fdroid/{ => compat}/FileCompatTest.java (94%) diff --git a/app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatForTest.java b/app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatForTest.java deleted file mode 100644 index 07fb04ac6..000000000 --- a/app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatForTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.fdroid.fdroid.compat; - -import android.annotation.TargetApi; -import android.os.Build; - -import org.fdroid.fdroid.data.SanitizedFile; - -/** - * Used to expose the protected methods from FileCompat in a public manner so - * that they can be called from a test harness. - */ -public class FileCompatForTest extends FileCompat { - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public static void symlinkOsTest(SanitizedFile source, SanitizedFile dest) { - symlinkOs(source, dest); - } - - public static void symlinkRuntimeTest(SanitizedFile source, SanitizedFile dest) { - symlinkRuntime(source, dest); - } - - public static void symlinkLibcoreTest(SanitizedFile source, SanitizedFile dest) { - symlinkLibcore(source, dest); - } - -} diff --git a/app/src/androidTest/java/org/fdroid/fdroid/FileCompatTest.java b/app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatTest.java similarity index 94% rename from app/src/androidTest/java/org/fdroid/fdroid/FileCompatTest.java rename to app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatTest.java index 18456f749..f65c28b46 100644 --- a/app/src/androidTest/java/org/fdroid/fdroid/FileCompatTest.java +++ b/app/src/androidTest/java/org/fdroid/fdroid/compat/FileCompatTest.java @@ -1,4 +1,4 @@ -package org.fdroid.fdroid; +package org.fdroid.fdroid.compat; import android.app.Instrumentation; import android.content.Context; @@ -9,7 +9,7 @@ import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.util.Log; -import org.fdroid.fdroid.compat.FileCompatForTest; +import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.data.SanitizedFile; import org.junit.After; import org.junit.Before; @@ -64,21 +64,21 @@ public class FileCompatTest { @Test public void testSymlinkRuntime() { - FileCompatForTest.symlinkRuntimeTest(sourceFile, destFile); + FileCompat.symlinkRuntime(sourceFile, destFile); assertTrue(destFile.getAbsolutePath() + " should exist after symlinking", destFile.exists()); } @Test public void testSymlinkLibcore() { assumeTrue(Build.VERSION.SDK_INT >= 19); - FileCompatForTest.symlinkLibcoreTest(sourceFile, destFile); + FileCompat.symlinkLibcore(sourceFile, destFile); assertTrue(destFile.getAbsolutePath() + " should exist after symlinking", destFile.exists()); } @Test public void testSymlinkOs() { assumeTrue(Build.VERSION.SDK_INT >= 21); - FileCompatForTest.symlinkOsTest(sourceFile, destFile); + FileCompat.symlinkOs(sourceFile, destFile); assertTrue(destFile.getAbsolutePath() + " should exist after symlinking", destFile.exists()); } diff --git a/app/src/main/java/org/fdroid/fdroid/compat/FileCompat.java b/app/src/main/java/org/fdroid/fdroid/compat/FileCompat.java index d80844143..cf26ffd61 100644 --- a/app/src/main/java/org/fdroid/fdroid/compat/FileCompat.java +++ b/app/src/main/java/org/fdroid/fdroid/compat/FileCompat.java @@ -43,7 +43,7 @@ public class FileCompat { private static class Symlink21 { @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public void symlink(SanitizedFile source, SanitizedFile dest) { + void symlink(SanitizedFile source, SanitizedFile dest) { try { android.system.Os.symlink(source.getAbsolutePath(), dest.getAbsolutePath()); } catch (ErrnoException e) { @@ -54,13 +54,14 @@ public class FileCompat { } @TargetApi(21) - protected static void symlinkOs(SanitizedFile source, SanitizedFile dest) { + static void symlinkOs(SanitizedFile source, SanitizedFile dest) { new Symlink21().symlink(source, dest); } - protected static void symlinkRuntime(SanitizedFile source, SanitizedFile dest) { + static void symlinkRuntime(SanitizedFile source, SanitizedFile dest) { String[] commands = { FDroidApp.SYSTEM_DIR_NAME + "/bin/ln", + "-s", source.getAbsolutePath(), dest.getAbsolutePath(), }; @@ -74,7 +75,7 @@ public class FileCompat { } } - protected static void symlinkLibcore(SanitizedFile source, SanitizedFile dest) { + static void symlinkLibcore(SanitizedFile source, SanitizedFile dest) { try { Object os = Class.forName("libcore.io.Libcore").getField("os").get(null); Method symlink = os.getClass().getMethod("symlink", String.class, String.class); From c7fd3f238d5acff83297f8765c096d21e854c987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 21 Jun 2016 12:20:46 +0100 Subject: [PATCH 2/3] CI: replace v17 emulator with v23 --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f0a8365b8..5b3a47d7c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: mvdan/fdroid-ci:client-20160617 +image: mvdan/fdroid-ci:client-20160621 cache: paths: @@ -47,9 +47,9 @@ connected10: - exit $EXITVALUE allow_failure: true # remove once install segfaults are gone -connected17: +connected23: variables: - AVD_SDK: "17" + AVD_SDK: "23" script: - export GRADLE_USER_HOME=$PWD/.gradle - emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window & From 3b649138bdc229a1c5e1c15d42d834c556623dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 21 Jun 2016 12:26:55 +0100 Subject: [PATCH 3/3] Bump buildToolsVersions The new CI image has 24, not 23.0.3. --- Privileged-Extension/build.gradle | 2 +- app/build.gradle | 2 +- privileged-api-lib/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Privileged-Extension/build.gradle b/Privileged-Extension/build.gradle index 73bc43b69..f8b62f135 100644 --- a/Privileged-Extension/build.gradle +++ b/Privileged-Extension/build.gradle @@ -11,7 +11,7 @@ dependencies { android { compileSdkVersion 23 - buildToolsVersion '23.0.3' + buildToolsVersion '24' defaultConfig { minSdkVersion 8 diff --git a/app/build.gradle b/app/build.gradle index 7c73e3d06..6fa5c7227 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -140,7 +140,7 @@ if (!hasProperty('sourceDeps')) { android { compileSdkVersion 23 - buildToolsVersion '23.0.3' + buildToolsVersion '24' useLibrary 'org.apache.http.legacy' buildTypes { diff --git a/privileged-api-lib/build.gradle b/privileged-api-lib/build.gradle index ef9bd8b99..8ff047977 100644 --- a/privileged-api-lib/build.gradle +++ b/privileged-api-lib/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion '23.0.3' + buildToolsVersion '24' defaultConfig { minSdkVersion 8