diff --git a/.gitignore b/.gitignore index 67eb53c8..f625d6f8 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,6 @@ nb-configuration.xml ## Gradle .gradle gradle-app.setting -build/ ## OS Specific .DS_Store diff --git a/.travis.yml b/.travis.yml index 745ce62f..d358323b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: android android: components: - - build-tools-28.0.0 + - build-tools-28.0.3 - android-28 deploy: provider: releases diff --git a/app/build.gradle b/app/build.gradle index 21815699..4a39d833 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,13 +3,18 @@ import groovy.xml.XmlUtil apply plugin: 'com.android.application' android { + compileSdkVersion 28 - buildToolsVersion '28.0.0' + buildToolsVersion '28.0.3' + + defaultConfig { + minSdkVersion 26 + targetSdkVersion 26 + } buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } @@ -28,28 +33,25 @@ gradle.projectsEvaluated { } } -preBuild { +preBuild.doLast { + def imlFile = file(project.name + ".iml") - doLast { - def imlFile = file(project.name + ".iml") + try { + def parsedXml = (new XmlParser()).parse(imlFile) + def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' } + parsedXml.component[1].remove(jdkNode) - try { - def parsedXml = (new XmlParser()).parse(imlFile) - def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' } - parsedXml.component[1].remove(jdkNode) + def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform" + new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK']) + XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile)) - def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform" - new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK']) - XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile)) - - } catch (FileNotFoundException ex) { - ex.printStackTrace() - } + } catch (NullPointerException | FileNotFoundException ex) { + ex.printStackTrace() } } dependencies { compileOnly fileTree(include: ['android.jar', 'libcore.jar'], dir: 'libs') - compile group: 'commons-io', name: 'commons-io', version: '2.6' + implementation group: 'commons-io', name: 'commons-io', version: '2.6' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d1b0d4fb..7f1f1360 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,12 +5,14 @@ android:versionCode="5" android:versionName="0.3.0"> - - + + + tools:ignore="GoogleAppIndexingWarning"> - + diff --git a/app/src/main/java/com/stevesoltys/backup/session/backup/BackupSession.java b/app/src/main/java/com/stevesoltys/backup/session/backup/BackupSession.java index a61e96b1..4e7d0ea7 100644 --- a/app/src/main/java/com/stevesoltys/backup/session/backup/BackupSession.java +++ b/app/src/main/java/com/stevesoltys/backup/session/backup/BackupSession.java @@ -39,17 +39,17 @@ public class BackupSession extends IBackupObserver.Stub { } @Override - public void onUpdate(String currentPackage, BackupProgress backupProgress) throws RemoteException { + public void onUpdate(String currentPackage, BackupProgress backupProgress) { backupSessionObserver.backupPackageStarted(this, currentPackage, backupProgress); } @Override - public void onResult(String currentPackage, int status) throws RemoteException { + public void onResult(String currentPackage, int status) { backupSessionObserver.backupPackageCompleted(this, currentPackage, getBackupResult(status)); } @Override - public void backupFinished(int status) throws RemoteException { + public void backupFinished(int status) { backupSessionObserver.backupSessionCompleted(this, getBackupResult(status)); } diff --git a/app/src/main/java/com/stevesoltys/backup/session/restore/RestoreSession.java b/app/src/main/java/com/stevesoltys/backup/session/restore/RestoreSession.java index 03161ea8..8b8ed83a 100644 --- a/app/src/main/java/com/stevesoltys/backup/session/restore/RestoreSession.java +++ b/app/src/main/java/com/stevesoltys/backup/session/restore/RestoreSession.java @@ -71,12 +71,12 @@ public class RestoreSession extends IRestoreObserver.Stub { } @Override - public void restoreStarting(int numPackages) throws RemoteException { + public void restoreStarting(int numPackages) { observer.restoreSessionStarted(numPackages); } @Override - public void onUpdate(int nowBeingRestored, String currentPackage) throws RemoteException { + public void onUpdate(int nowBeingRestored, String currentPackage) { observer.restorePackageStarted(nowBeingRestored, currentPackage); } diff --git a/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransport.java b/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransport.java index fac82afe..6cddb1a8 100644 --- a/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransport.java +++ b/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransport.java @@ -24,7 +24,7 @@ public class ConfigurableBackupTransport extends BackupTransport { private RestoreComponent restoreComponent; - public ConfigurableBackupTransport() { + ConfigurableBackupTransport() { backupComponent = new StubBackupComponent(); restoreComponent = new StubRestoreComponent(); } @@ -47,14 +47,6 @@ public class ConfigurableBackupTransport extends BackupTransport { return !(backupComponent instanceof StubBackupComponent || restoreComponent instanceof StubRestoreComponent); } - public BackupComponent getBackupComponent() { - return backupComponent; - } - - public RestoreComponent getRestoreComponent() { - return restoreComponent; - } - @Override public String transportDirName() { return TRANSPORT_DIRECTORY_NAME; diff --git a/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransportService.java b/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransportService.java index e50db90a..cbbd89ad 100644 --- a/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransportService.java +++ b/app/src/main/java/com/stevesoltys/backup/transport/ConfigurableBackupTransportService.java @@ -26,7 +26,6 @@ public class ConfigurableBackupTransportService extends Service { @Override public void onCreate() { super.onCreate(); - startForeground(FOREGROUND_ID, new Notification.Builder(this).build()); } diff --git a/app/src/main/java/com/stevesoltys/backup/transport/component/provider/ContentProviderRestoreComponent.java b/app/src/main/java/com/stevesoltys/backup/transport/component/provider/ContentProviderRestoreComponent.java index fd9f25e6..47aeeb55 100644 --- a/app/src/main/java/com/stevesoltys/backup/transport/component/provider/ContentProviderRestoreComponent.java +++ b/app/src/main/java/com/stevesoltys/backup/transport/component/provider/ContentProviderRestoreComponent.java @@ -8,15 +8,18 @@ import android.content.pm.PackageInfo; import android.os.ParcelFileDescriptor; import android.util.Base64; import android.util.Log; + import com.android.internal.util.Preconditions; import com.stevesoltys.backup.security.CipherUtil; import com.stevesoltys.backup.security.KeyGenerator; import com.stevesoltys.backup.transport.component.RestoreComponent; -import libcore.io.IoUtils; -import libcore.io.Streams; -import javax.crypto.SecretKey; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -24,7 +27,15 @@ import java.util.Optional; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import static android.app.backup.BackupTransport.*; +import javax.crypto.SecretKey; + +import libcore.io.IoUtils; +import libcore.io.Streams; + +import static android.app.backup.BackupTransport.NO_MORE_DATA; +import static android.app.backup.BackupTransport.TRANSPORT_ERROR; +import static android.app.backup.BackupTransport.TRANSPORT_OK; +import static android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED; import static android.app.backup.RestoreDescription.TYPE_FULL_STREAM; import static android.app.backup.RestoreDescription.TYPE_KEY_VALUE; @@ -310,7 +321,7 @@ public class ContentProviderRestoreComponent implements RestoreComponent { return contentResolver.openFileDescriptor(configuration.getUri(), "r"); } - private ZipInputStream buildInputStream(ParcelFileDescriptor inputFileDescriptor) throws FileNotFoundException { + private ZipInputStream buildInputStream(ParcelFileDescriptor inputFileDescriptor) { FileInputStream fileInputStream = new FileInputStream(inputFileDescriptor.getFileDescriptor()); return new ZipInputStream(fileInputStream); } diff --git a/app/src/main/res/layout/activity_create_backup.xml b/app/src/main/res/layout/activity_create_backup.xml index f7f693ed..c7eca266 100644 --- a/app/src/main/res/layout/activity_create_backup.xml +++ b/app/src/main/res/layout/activity_create_backup.xml @@ -1,6 +1,5 @@ + android:id="@+id/popup_layout" + android:layout_width="@dimen/popup_width" + android:layout_height="@dimen/popup_height" + android:orientation="vertical"> + android:textAlignment="center" /> + android:layout_marginRight="@dimen/progress_bar_horizontal_margin" />