Several small nitpicks and fixes
This commit is contained in:
parent
cdaf842866
commit
2434fe30f4
19 changed files with 62 additions and 76 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -40,7 +40,6 @@ nb-configuration.xml
|
|||
## Gradle
|
||||
.gradle
|
||||
gradle-app.setting
|
||||
build/
|
||||
|
||||
## OS Specific
|
||||
.DS_Store
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
language: android
|
||||
android:
|
||||
components:
|
||||
- build-tools-28.0.0
|
||||
- build-tools-28.0.3
|
||||
- android-28
|
||||
deploy:
|
||||
provider: releases
|
||||
|
|
|
@ -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,9 +33,7 @@ gradle.projectsEvaluated {
|
|||
}
|
||||
}
|
||||
|
||||
preBuild {
|
||||
|
||||
doLast {
|
||||
preBuild.doLast {
|
||||
def imlFile = file(project.name + ".iml")
|
||||
|
||||
try {
|
||||
|
@ -42,14 +45,13 @@ preBuild {
|
|||
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
|
||||
XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
|
||||
|
||||
} catch (FileNotFoundException ex) {
|
||||
} 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'
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
android:versionCode="5"
|
||||
android:versionName="0.3.0">
|
||||
|
||||
<uses-permission android:name="android.permission.BACKUP" />
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="26"
|
||||
android:targetSdkVersion="26" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.BACKUP"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<application
|
||||
android:name=".Backup"
|
||||
android:supportsRtl="true"
|
||||
|
@ -18,9 +20,11 @@
|
|||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:allowBackup="false"
|
||||
tools:replace="android:allowBackup">
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
|
||||
<activity android:name="com.stevesoltys.backup.activity.MainActivity">
|
||||
<activity
|
||||
android:name="com.stevesoltys.backup.activity.MainActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -26,7 +26,6 @@ public class ConfigurableBackupTransportService extends Service {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
startForeground(FOREGROUND_ID, new Notification.Builder(this).build());
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_create_backup"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_restore_backup"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/popup_layout"
|
||||
android:layout_width="@dimen/popup_width"
|
||||
android:layout_height="@dimen/popup_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/popup_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"/>
|
||||
android:textAlignment="center" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/popup_progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/progress_bar_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/progress_bar_horizontal_margin"/>
|
||||
android:layout_marginRight="@dimen/progress_bar_horizontal_margin" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/popup_cancel_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/button_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/button_horizontal_margin"
|
||||
android:layout_marginTop="@dimen/button_vertical_margin"
|
||||
android:text="@string/popup_cancel"/>
|
||||
android:layout_marginRight="@dimen/button_horizontal_margin"
|
||||
android:text="@string/popup_cancel" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="packages">
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
<item>package</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -4,7 +4,6 @@
|
|||
<string name="create_backup_button">Create backup</string>
|
||||
<string name="restore_backup_button">Restore backup</string>
|
||||
|
||||
<string name="backup_button">Backup packages</string>
|
||||
<string name="backup_success">Backup success</string>
|
||||
<string name="backup_failure">Backup failure</string>
|
||||
<string name="backup_cancelled">Backup cancelled</string>
|
||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
|||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:3.4.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
|
||||
distributionSha256Sum=14cd15fc8cc8705bd69dcfa3c8fefb27eb7027f5de4b47a8b279218f76895a91
|
Loading…
Reference in a new issue