migrate to androidx
This commit is contained in:
parent
5cd210831b
commit
5172002f0e
343 changed files with 946 additions and 2335 deletions
|
@ -7,12 +7,12 @@ dependencies {
|
|||
// NOTE: libraries are pinned to a specific build, see below
|
||||
|
||||
// from local Android SDK
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||
implementation 'com.android.support:cardview-v7:28.0.0'
|
||||
implementation 'com.android.support:support-annotations:28.0.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.annotation:annotation:1.1.0'
|
||||
|
||||
// JCenter etc.
|
||||
implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
|
||||
|
@ -29,7 +29,7 @@ dependencies {
|
|||
implementation 'com.jpardogo.materialtabstrip:library:1.1.1'
|
||||
implementation 'com.getbase:floatingactionbutton:1.10.1'
|
||||
implementation 'com.nispok:snackbar:2.11.0'
|
||||
implementation 'com.cocosw:bottomsheet:1.3.1@aar'
|
||||
implementation 'com.cocosw:bottomsheet:1.5.0@aar'
|
||||
|
||||
// RecyclerView
|
||||
implementation 'eu.davidea:flexible-adapter:5.0.5'
|
||||
|
@ -60,7 +60,7 @@ dependencies {
|
|||
implementation project(':extern:bouncycastle:prov')
|
||||
implementation project(':extern:MaterialChipsInput')
|
||||
|
||||
implementation "android.arch.work:work-runtime:1.0.0-alpha02"
|
||||
implementation 'androidx.work:work-runtime:2.2.0'
|
||||
|
||||
// Unit tests in the local JVM with Robolectric
|
||||
// https://developer.android.com/training/testing/unit-testing/local-unit-tests.html
|
||||
|
@ -75,14 +75,14 @@ dependencies {
|
|||
// UI testing with Espresso
|
||||
// Force usage of support libs in the test app, since they are internally used by the runner module.
|
||||
// https://github.com/googlesamples/android-testing/blob/master/ui/espresso/BasicSample/app/build.gradle#L28
|
||||
androidTestCompile 'com.android.support:support-annotations:27.1.1'
|
||||
androidTestCompile 'com.android.support:appcompat-v7:27.1.1'
|
||||
androidTestCompile 'com.android.support:design:27.1.1'
|
||||
androidTestCompile 'com.android.support.test:runner:0.5'
|
||||
androidTestCompile 'com.android.support.test:rules:0.5'
|
||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
||||
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
|
||||
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.2') {
|
||||
androidTestCompile 'androidx.annotation:annotation:1.0.0'
|
||||
androidTestCompile 'androidx.appcompat:appcompat:1.0.0'
|
||||
androidTestCompile 'com.google.android.material:material:1.0.0'
|
||||
androidTestCompile 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestCompile 'androidx.test:rules:1.1.1'
|
||||
androidTestCompile 'androidx.test.espresso:espresso-core:3.1.0'
|
||||
androidTestCompile 'androidx.test.espresso:espresso-intents:3.1.0'
|
||||
androidTestCompile ('androidx.test.espresso:espresso-contrib:3.1.0') {
|
||||
exclude group: 'com.android.support', module: 'appcompat'
|
||||
exclude group: 'com.android.support', module: 'support-v4'
|
||||
exclude module: 'recyclerview-v7'
|
||||
|
@ -96,11 +96,11 @@ dependencies {
|
|||
annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:0.2.5"
|
||||
implementation 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5'
|
||||
|
||||
implementation "android.arch.lifecycle:extensions:1.0.0"
|
||||
annotationProcessor "android.arch.lifecycle:compiler:1.0.0"
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
|
||||
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'
|
||||
|
||||
implementation "android.arch.persistence:db-framework:1.0.0"
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
implementation 'androidx.sqlite:sqlite-framework:2.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
|
||||
// for debugging the db. don't enable by default, this will expose the database no the network!
|
||||
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.3'
|
||||
|
@ -117,7 +117,7 @@ android {
|
|||
applicationId "org.sufficientlysecure.keychain"
|
||||
// the androidjunitrunner is broken regarding coverage, see here:
|
||||
// https://code.google.com/p/android/issues/detail?id=170607
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
// this workaround runner fixes the coverage problem, BUT doesn't work
|
||||
// with android studio single test execution. use it to generate coverage
|
||||
// data, but keep the other one otherwis
|
||||
|
|
|
@ -28,10 +28,10 @@ import java.io.OutputStream;
|
|||
import java.util.Random;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.test.espresso.UiController;
|
||||
import android.support.test.espresso.ViewAction;
|
||||
import android.support.test.espresso.matcher.ViewMatchers;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.espresso.matcher.ViewMatchers;
|
||||
import android.view.View;
|
||||
|
||||
import com.nispok.snackbar.Snackbar;
|
||||
|
@ -42,12 +42,12 @@ import org.sufficientlysecure.keychain.daos.KeyWritableRepository;
|
|||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
|
||||
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.endsWith;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withSnackbarLineColor;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ package org.sufficientlysecure.keychain;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.test.runner.AndroidJUnitRunner;
|
||||
import androidx.test.runner.AndroidJUnitRunner;
|
||||
|
||||
|
||||
public class JacocoWorkaroundJUnitRunner extends AndroidJUnitRunner {
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
package org.sufficientlysecure.keychain.actions;
|
||||
|
||||
|
||||
import android.support.test.espresso.UiController;
|
||||
import android.support.test.espresso.ViewAction;
|
||||
import android.support.test.espresso.matcher.ViewMatchers;
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.espresso.matcher.ViewMatchers;
|
||||
import android.view.View;
|
||||
|
||||
import com.tokenautocomplete.TokenCompleteTextView;
|
||||
|
@ -29,7 +29,7 @@ import org.hamcrest.Matcher;
|
|||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.daos.KeyWritableRepository;
|
||||
|
||||
import static android.support.test.InstrumentationRegistry.getTargetContext;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getTargetContext;
|
||||
|
||||
|
||||
public abstract class CustomActions {
|
||||
|
|
|
@ -7,15 +7,15 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.test.espresso.UiController;
|
||||
import android.support.test.espresso.ViewAction;
|
||||
import android.support.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
|
||||
import android.support.test.runner.lifecycle.Stage;
|
||||
import androidx.test.espresso.UiController;
|
||||
import androidx.test.espresso.ViewAction;
|
||||
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
|
||||
import androidx.test.runner.lifecycle.Stage;
|
||||
import android.view.View;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isRoot;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
|
||||
|
||||
public class OrientationChangeAction implements ViewAction {
|
||||
private final int orientation;
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
package org.sufficientlysecure.keychain.matcher;
|
||||
|
||||
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.test.espresso.matcher.BoundedMatcher;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.test.espresso.matcher.BoundedMatcher;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
|
@ -32,12 +32,12 @@ import org.hamcrest.Description;
|
|||
import org.hamcrest.Matcher;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.sufficientlysecure.keychain.matcher.DrawableMatcher.withDrawable;
|
||||
|
|
|
@ -5,9 +5,9 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.rule.ServiceTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.ServiceTestRule;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -21,12 +21,12 @@ import org.sufficientlysecure.keychain.R;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import static android.support.test.espresso.Espresso.closeSoftKeyboard;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.espresso.Espresso.closeSoftKeyboard;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.cleanupForTests;
|
||||
|
|
|
@ -25,8 +25,8 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.test.espresso.intent.Intents;
|
||||
import android.support.test.espresso.intent.rule.IntentsTestRule;
|
||||
import androidx.test.espresso.intent.Intents;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -38,26 +38,26 @@ import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
||||
import static android.support.test.espresso.Espresso.onData;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||
import static android.support.test.espresso.Espresso.pressBack;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasCategories;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasType;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.assertThat;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.espresso.Espresso.onData;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||
import static androidx.test.espresso.Espresso.pressBack;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasCategories;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasType;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.assertThat;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -30,18 +30,18 @@ import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
|||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onData;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.Espresso.pressBack;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.espresso.Espresso.onData;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.Espresso.pressBack;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.checkSnackbar;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.importKeysFromResource;
|
||||
|
|
|
@ -18,33 +18,27 @@
|
|||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
|
||||
import android.support.test.espresso.matcher.ViewMatchers;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import androidx.test.espresso.matcher.ViewMatchers;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.text.method.HideReturnsTransformationMethod;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.swipeLeft;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.matcher.RootMatchers.isDialog;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasSibling;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.swipeLeft;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.RootMatchers.isDialog;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasSibling;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.sufficientlysecure.keychain.matcher.EditTextMatchers.withError;
|
||||
import static org.sufficientlysecure.keychain.matcher.EditTextMatchers.withTransformationMethod;
|
||||
|
||||
|
||||
//TODO This test is disabled because it needs to be fixed to work with updated code
|
||||
//@RunWith(AndroidJUnit4.class)
|
||||
|
|
|
@ -20,22 +20,21 @@ package org.sufficientlysecure.keychain.ui;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Rule;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnHolderItem;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnHolderItem;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.checkSnackbar;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.importKeysFromResource;
|
||||
|
|
|
@ -27,9 +27,9 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.test.espresso.intent.Intents;
|
||||
import android.support.test.espresso.intent.rule.IntentsTestRule;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import androidx.test.espresso.intent.Intents;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
@ -42,25 +42,25 @@ import org.sufficientlysecure.keychain.util.Preferences;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||
import static android.support.test.espresso.Espresso.pressBack;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnHolderItem;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasCategories;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasType;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasSibling;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isChecked;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isNotChecked;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withChild;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||
import static androidx.test.espresso.Espresso.pressBack;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnHolderItem;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasCategories;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasType;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasSibling;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isChecked;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isNotChecked;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withChild;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.checkSnackbar;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||
import android.app.Activity;
|
||||
import android.app.Instrumentation.ActivityResult;
|
||||
import android.content.Intent;
|
||||
import android.support.test.espresso.intent.rule.IntentsTestRule;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Rule;
|
||||
|
@ -30,26 +30,26 @@ import org.sufficientlysecure.keychain.R;
|
|||
import org.sufficientlysecure.keychain.provider.TemporaryFileProvider;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
|
||||
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||
import static android.support.test.espresso.Espresso.pressBack;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.intent.Intents.intending;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasFlags;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasType;
|
||||
import static android.support.test.espresso.intent.matcher.UriMatchers.hasHost;
|
||||
import static android.support.test.espresso.intent.matcher.UriMatchers.hasScheme;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
|
||||
import static androidx.test.espresso.Espresso.pressBack;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.intent.Intents.intending;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasData;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasFlags;
|
||||
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasType;
|
||||
import static androidx.test.espresso.intent.matcher.UriMatchers.hasHost;
|
||||
import static androidx.test.espresso.intent.matcher.UriMatchers.hasScheme;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.checkSnackbar;
|
||||
|
|
|
@ -20,10 +20,10 @@ package org.sufficientlysecure.keychain.ui.widget;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.support.test.espresso.action.ViewActions;
|
||||
import android.support.test.espresso.matcher.RootMatchers;
|
||||
import android.support.test.espresso.matcher.ViewMatchers;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import androidx.test.espresso.action.ViewActions;
|
||||
import androidx.test.espresso.matcher.RootMatchers;
|
||||
import androidx.test.espresso.matcher.ViewMatchers;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
|
@ -31,14 +31,14 @@ import org.junit.Rule;
|
|||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.EncryptTextActivity;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onData;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.action.ViewActions.typeText;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.Espresso.onData;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.typeText;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.sufficientlysecure.keychain.AndroidTestHelpers.importKeysFromResource;
|
||||
import static org.sufficientlysecure.keychain.actions.CustomActions.tokenEncryptViewAddToken;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
package android.support.design.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.WindowInsetsCompat;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class FixedCollapsingToolbarLayout extends CollapsingToolbarLayout {
|
||||
|
||||
public FixedCollapsingToolbarLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public FixedCollapsingToolbarLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// During the super call to onMeasure(), we'll save a copy of mLastInsets,
|
||||
// consume the insets of mLastInsets so the super call has no insets to work with,
|
||||
// then re-assign mLastInsets to what it was before the super call.
|
||||
WindowInsetsCompat oldInsets = mLastInsets;
|
||||
if (mLastInsets != null) {
|
||||
mLastInsets = mLastInsets.consumeSystemWindowInsets();
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
mLastInsets = oldInsets;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,7 @@ import android.accounts.AccountManager;
|
|||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
@ -106,7 +106,7 @@ public class KeychainApplication extends Application {
|
|||
|
||||
KeyserverSyncManager.updateKeyserverSyncScheduleAsync(this, false);
|
||||
|
||||
TemporaryFileProvider.scheduleCleanupImmediately();
|
||||
TemporaryFileProvider.scheduleCleanupImmediately(getApplicationContext());
|
||||
|
||||
analyticsManager = AnalyticsManager.getInstance(getApplicationContext());
|
||||
analyticsManager.initialize(this);
|
||||
|
|
|
@ -23,11 +23,11 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import android.arch.persistence.db.SupportSQLiteOpenHelper;
|
||||
import android.arch.persistence.db.SupportSQLiteOpenHelper.Callback;
|
||||
import android.arch.persistence.db.SupportSQLiteOpenHelper.Configuration;
|
||||
import android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper;
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper.Callback;
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper.Configuration;
|
||||
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.SQLException;
|
||||
|
|
|
@ -6,8 +6,8 @@ import android.app.NotificationManager;
|
|||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.annotation.StringRes;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
|
||||
public class NotificationChannelManager {
|
||||
|
|
|
@ -19,11 +19,11 @@ package org.sufficientlysecure.keychain.compatibility;
|
|||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.compatibility;
|
|||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ package org.sufficientlysecure.keychain.daos;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import android.arch.persistence.db.SupportSQLiteQuery;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||
import android.database.Cursor;
|
||||
|
||||
import com.squareup.sqldelight.RowMapper;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.squareup.sqldelight.SqlDelightQuery;
|
||||
import org.sufficientlysecure.keychain.AutocryptPeersModel.DeleteByIdentifier;
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.sufficientlysecure.keychain.daos;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import org.sufficientlysecure.keychain.CertsModel.InsertCert;
|
||||
import org.sufficientlysecure.keychain.KeyRingsPublicModel.InsertKeyRingPublic;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.squareup.sqldelight.SqlDelightQuery;
|
||||
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
||||
|
|
|
@ -25,10 +25,10 @@ import java.util.Collections;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.collection.LongSparseArray;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.KeyRingsPublicModel.DeleteByMasterKeyId;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.sufficientlysecure.keychain.keyimport;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
|
|
@ -26,8 +26,8 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.net.URI;
|
|||
import java.net.URISyntaxException;
|
||||
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.keyimport;
|
||||
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.ResponseBody;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.keyimport;
|
|||
|
||||
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.sufficientlysecure.keychain.keyimport;
|
||||
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.Nullable;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package org.sufficientlysecure.keychain.keyimport.processing;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.loader.content.AsyncTaskLoader;
|
||||
import org.sufficientlysecure.keychain.keyimport.CloudSearch;
|
||||
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
||||
import org.sufficientlysecure.keychain.keyimport.KeyserverClient;
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.sufficientlysecure.keychain.keyimport.processing;
|
|||
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.loader.content.AsyncTaskLoader;
|
||||
|
||||
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
||||
import org.sufficientlysecure.keychain.operations.results.GetKeyResult;
|
||||
|
|
|
@ -19,22 +19,22 @@ package org.sufficientlysecure.keychain.keysync;
|
|||
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.WorkerThread;
|
||||
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.work.Constraints.Builder;
|
||||
import androidx.work.NetworkType;
|
||||
import androidx.work.OneTimeWorkRequest;
|
||||
import androidx.work.PeriodicWorkRequest;
|
||||
import androidx.work.State;
|
||||
import androidx.work.SynchronousWorkManager;
|
||||
import androidx.work.WorkInfo;
|
||||
import androidx.work.WorkInfo.State;
|
||||
import androidx.work.WorkManager;
|
||||
import androidx.work.WorkStatus;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
@ -58,30 +58,26 @@ public class KeyserverSyncManager {
|
|||
@WorkerThread
|
||||
private static void updateKeyserverSyncSchedule(Context context, boolean forceReschedule) {
|
||||
Preferences prefs = Preferences.getPreferences(context);
|
||||
WorkManager workManager = WorkManager.getInstance();
|
||||
if (workManager == null) {
|
||||
Timber.e("WorkManager unavailable!");
|
||||
return;
|
||||
}
|
||||
SynchronousWorkManager synchronousWorkManager = workManager.synchronous();
|
||||
if (synchronousWorkManager == null) {
|
||||
Timber.e("WorkManager unavailable!");
|
||||
return;
|
||||
}
|
||||
WorkManager workManager = WorkManager.getInstance(context);
|
||||
|
||||
UUID workUuid = prefs.getKeyserverSyncWorkUuid();
|
||||
WorkStatus status = workUuid != null ? synchronousWorkManager.getStatusByIdSync(workUuid) : null;
|
||||
boolean workIsScheduled = status != null && status.getState() != State.CANCELLED;
|
||||
if (workIsScheduled == prefs.isKeyserverSyncEnabled()) {
|
||||
if (!forceReschedule) {
|
||||
Timber.d("Key sync already scheduled, no changes necessary");
|
||||
return;
|
||||
try {
|
||||
WorkInfo info = workUuid != null ? workManager.getWorkInfoById(workUuid).get() : null;
|
||||
|
||||
boolean workIsScheduled = info != null && info.getState() != State.CANCELLED;
|
||||
if (workIsScheduled == prefs.isKeyserverSyncEnabled()) {
|
||||
if (!forceReschedule) {
|
||||
Timber.d("Key sync already scheduled, no changes necessary");
|
||||
return;
|
||||
}
|
||||
Timber.d("Key sync already scheduled, but forcing reschedule");
|
||||
}
|
||||
Timber.d("Key sync already scheduled, but forcing reschedule");
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
Timber.e(e, "Error getting info for scheduled key sync work?");
|
||||
}
|
||||
|
||||
Timber.d("Cancelling sync tasks…");
|
||||
synchronousWorkManager.cancelAllWorkByTagSync(PERIODIC_WORK_TAG);
|
||||
workManager.cancelAllWorkByTag(PERIODIC_WORK_TAG);
|
||||
|
||||
if (!prefs.isKeyserverSyncEnabled()) {
|
||||
Timber.d("Key sync disabled");
|
||||
|
@ -102,14 +98,17 @@ public class KeyserverSyncManager {
|
|||
.setConstraints(constraints.build())
|
||||
.addTag(PERIODIC_WORK_TAG)
|
||||
.build();
|
||||
synchronousWorkManager.enqueueSync(workRequest);
|
||||
|
||||
Timber.d("Work id: %s", workRequest.getId());
|
||||
prefs.setKeyserverSyncScheduled(workRequest.getId());
|
||||
try {
|
||||
workManager.enqueue(workRequest).getResult().get();
|
||||
Timber.d("Work id: %s", workRequest.getId());
|
||||
prefs.setKeyserverSyncScheduled(workRequest.getId());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
Timber.e(e, "Error enqueueing job!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void debugRunSyncNow() {
|
||||
WorkManager workManager = WorkManager.getInstance();
|
||||
public static void debugRunSyncNow(Context context) {
|
||||
WorkManager workManager = WorkManager.getInstance(context);
|
||||
OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(KeyserverSyncWorker.class).build();
|
||||
workManager.enqueue(workRequest);
|
||||
}
|
||||
|
|
|
@ -5,11 +5,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationCompat.Builder;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationCompat.Builder;
|
||||
import androidx.work.Worker;
|
||||
import androidx.work.WorkerParameters;
|
||||
import org.sufficientlysecure.keychain.Constants.NotificationIds;
|
||||
import org.sufficientlysecure.keychain.NotificationChannelManager;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
|
@ -28,9 +29,13 @@ import timber.log.Timber;
|
|||
public class KeyserverSyncWorker extends Worker {
|
||||
private AtomicBoolean cancellationSignal = new AtomicBoolean(false);
|
||||
|
||||
public KeyserverSyncWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
|
||||
super(context, workerParams);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public WorkerResult doWork() {
|
||||
public Result doWork() {
|
||||
KeyWritableRepository keyWritableRepository = KeyWritableRepository.create(getApplicationContext());
|
||||
|
||||
Timber.d("Starting key sync…");
|
||||
|
@ -47,7 +52,7 @@ public class KeyserverSyncWorker extends Worker {
|
|||
* @param result
|
||||
* result of keyserver sync
|
||||
*/
|
||||
private WorkerResult handleUpdateResult(ImportKeyResult result) {
|
||||
private Result handleUpdateResult(ImportKeyResult result) {
|
||||
if (result.isPending()) {
|
||||
Timber.d("Orbot required for sync but not running, attempting to start");
|
||||
// result is pending due to Orbot not being started
|
||||
|
@ -62,13 +67,13 @@ public class KeyserverSyncWorker extends Worker {
|
|||
OrbotRequiredDialogActivity.showOrbotRequiredNotification(getApplicationContext());
|
||||
}
|
||||
}.startOrbotAndListen(getApplicationContext(), false);
|
||||
return WorkerResult.RETRY;
|
||||
return Result.retry();
|
||||
} else if (isStopped()) {
|
||||
Timber.d("Keyserver sync cancelled");
|
||||
return WorkerResult.FAILURE;
|
||||
return Result.failure();
|
||||
} else {
|
||||
Timber.d("Keyserver sync completed: Updated: %d, Failed: %d", result.mUpdatedKeys, result.mBadKeys);
|
||||
return WorkerResult.SUCCESS;
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.sufficientlysecure.keychain.model;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import org.sufficientlysecure.keychain.CertsModel;
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.sufficientlysecure.keychain.model;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.squareup.sqldelight.ColumnAdapter;
|
||||
import org.sufficientlysecure.keychain.model.AutocryptPeer.GossipOrigin;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package org.sufficientlysecure.keychain.model;
|
||||
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import org.sufficientlysecure.keychain.KeyRingsPublicModel;
|
||||
import org.sufficientlysecure.keychain.KeysModel.InsertKey;
|
||||
|
||||
|
||||
@AutoValue
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.sufficientlysecure.keychain.model;
|
||||
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import org.sufficientlysecure.keychain.KeySignaturesModel;
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Collections;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.squareup.sqldelight.RowMapper;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.sufficientlysecure.keychain.model;
|
||||
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import android.support.annotation.NonNull;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import org.sufficientlysecure.keychain.UserPacketsModel;
|
||||
|
|
|
@ -41,8 +41,8 @@ import java.util.Set;
|
|||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.net.URISyntaxException;
|
|||
import java.nio.charset.Charset;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import org.bouncycastle.util.encoders.DecoderException;
|
||||
|
|