From 573ea47a40d91b739181e59a5f39414feb9c97c6 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 11:23:21 +0100 Subject: [PATCH 01/19] ditch safeslinger --- .gitmodules | 4 - OpenKeychain/build.gradle | 1 - OpenKeychain/src/main/AndroidManifest.xml | 10 - .../keychain/ui/KeyListFragment.java | 6 - .../keychain/ui/SafeSlingerActivity.java | 218 ------------------ .../keychain/ui/ViewKeyAdvShareFragment.java | 14 +- .../keychain/ui/keyview/ViewKeyActivity.java | 16 +- .../layout/view_key_adv_share_fragment.xml | 17 -- settings.gradle | 6 - 9 files changed, 3 insertions(+), 289 deletions(-) delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java diff --git a/.gitmodules b/.gitmodules index fdc6dddb3..d12dc6223 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,10 +10,6 @@ path = extern/minidns url = https://github.com/open-keychain/minidns.git ignore = dirty -[submodule "extern/safeslinger-exchange"] - path = extern/safeslinger-exchange - url = https://github.com/open-keychain/exchange-android - ignore = dirty [submodule "OpenKeychain/src/test/resources/openpgp-interop"] path = OpenKeychain/src/test/resources/openpgp-interop url = https://github.com/google/openpgp-interop diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 8b4c4251d..010a9a929 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -62,7 +62,6 @@ dependencies { implementation project(':extern:bouncycastle:prov') implementation project(':extern:minidns') implementation project(':KeybaseLib') - implementation project(':safeslinger-exchange') implementation project(':extern:MaterialChipsInput') implementation "android.arch.work:work-runtime:1.0.0-alpha02" diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 2d3ec5fc8..eb99d3ff6 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -166,16 +166,6 @@ - - - . - */ - -package org.sufficientlysecure.keychain.ui; - - -import java.io.IOException; -import java.util.ArrayList; - -import android.annotation.TargetApi; -import android.content.Intent; -import android.graphics.PorterDuff; -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.widget.ImageView; -import android.widget.NumberPicker; - -import edu.cmu.cylab.starslinger.exchange.ExchangeActivity; -import edu.cmu.cylab.starslinger.exchange.ExchangeConfig; -import org.sufficientlysecure.keychain.Constants; -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; -import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; -import org.sufficientlysecure.keychain.operations.ImportOperation; -import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; -import org.sufficientlysecure.keychain.operations.results.OperationResult; -import org.sufficientlysecure.keychain.daos.KeyRepository; -import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException; -import org.sufficientlysecure.keychain.service.ImportKeyringParcel; -import org.sufficientlysecure.keychain.ui.base.BaseActivity; -import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; -import org.sufficientlysecure.keychain.ui.util.FormattingUtils; -import org.sufficientlysecure.keychain.ui.util.Notify; -import org.sufficientlysecure.keychain.util.ParcelableFileCache; -import timber.log.Timber; - - -@TargetApi(Build.VERSION_CODES.HONEYCOMB) -public class SafeSlingerActivity extends BaseActivity - implements CryptoOperationHelper.Callback { - - private static final int REQUEST_CODE_SAFE_SLINGER = 211; - - public static final String EXTRA_MASTER_KEY_ID = "master_key_id"; - - private long mMasterKeyId; - private int mSelectedNumber = 2; - - // for CryptoOperationHelper - private ArrayList mKeyList; - private HkpKeyserverAddress mKeyserver; - private CryptoOperationHelper mOperationHelper; - private KeyRepository keyRepository; - - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - keyRepository = KeyRepository.create(this); - mMasterKeyId = getIntent().getLongExtra(EXTRA_MASTER_KEY_ID, 0); - - NumberPicker picker = findViewById(R.id.safe_slinger_picker); - picker.setMinValue(2); - picker.setMaxValue(10); - picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { - @Override - public void onValueChange(NumberPicker picker, int oldVal, int newVal) { - mSelectedNumber = newVal; - } - }); - - ImageView buttonIcon = findViewById(R.id.safe_slinger_button_image); - buttonIcon.setColorFilter(FormattingUtils.getColorFromAttr(this, R.attr.colorTertiaryText), - PorterDuff.Mode.SRC_IN); - - View button = findViewById(R.id.safe_slinger_button); - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - startExchange(mMasterKeyId, mSelectedNumber); - } - }); - } - - @Override - protected void initLayout() { - setContentView(R.layout.safe_slinger_activity); - } - - private void startExchange(long masterKeyId, int number) { - try { - byte[] keyBlob = keyRepository.loadPublicKeyRingData(masterKeyId); - - Intent slingerIntent = new Intent(this, ExchangeActivity.class); - - slingerIntent.putExtra(ExchangeConfig.extra.NUM_USERS, number); - slingerIntent.putExtra(ExchangeConfig.extra.USER_DATA, keyBlob); - slingerIntent.putExtra(ExchangeConfig.extra.HOST_NAME, Constants.SAFESLINGER_SERVER); - startActivityForResult(slingerIntent, REQUEST_CODE_SAFE_SLINGER); - } catch (NotFoundException e) { - Timber.e(e, "key for transfer not found"); - } - } - - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (mOperationHelper != null) { - mOperationHelper.handleActivityResult(requestCode, resultCode, data); - } - - if (requestCode == REQUEST_CODE_SAFE_SLINGER) { - if (resultCode == ExchangeActivity.RESULT_EXCHANGE_CANCELED) { - return; - } - - Timber.d("importKeys started"); - - // instead of giving the entries by Intent extra, cache them into a - // file to prevent Java Binder problems on heavy imports - // read FileImportCache for more info. - try { - // import exchanged keys - ArrayList it = getSlingedKeys(data.getExtras()); - - // We parcel this iteratively into a file - anything we can - // display here, we should be able to import. - ParcelableFileCache cache = - new ParcelableFileCache<>(this, ImportOperation.CACHE_FILE_NAME); - cache.writeCache(it.size(), it.iterator()); - - mOperationHelper = - new CryptoOperationHelper(1, this, this, R.string.progress_importing); - - mKeyList = null; - mKeyserver = null; - mOperationHelper.cryptoOperation(); - } catch (IOException e) { - Timber.e(e, "Problem writing cache file"); - Notify.create(this, "Problem writing cache file!", Notify.Style.ERROR).show(); - } - } else { - // give everything else down to KeyListActivity! - setResult(resultCode, data); - finish(); - } - } - - private static ArrayList getSlingedKeys(Bundle extras) { - ArrayList list = new ArrayList<>(); - - if (extras != null) { - byte[] d; - int i = 0; - do { - d = extras.getByteArray(ExchangeConfig.extra.MEMBER_DATA + i); - if (d != null) { - list.add(ParcelableKeyRing.createFromEncodedBytes(d)); - i++; - } - } while (d != null); - } - - return list; - } - - // CryptoOperationHelper.Callback functions - - @Override - public ImportKeyringParcel createOperationInput() { - return ImportKeyringParcel.createImportKeyringParcel(mKeyList, mKeyserver); - } - - @Override - public void onCryptoOperationSuccess(ImportKeyResult result) { - Intent certifyIntent = new Intent(this, CertifyKeyActivity.class); - certifyIntent.putExtra(CertifyKeyActivity.EXTRA_RESULT, result); - certifyIntent.putExtra(CertifyKeyActivity.EXTRA_KEY_IDS, result.getImportedMasterKeyIds()); - certifyIntent.putExtra(CertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, mMasterKeyId); - startActivityForResult(certifyIntent, 0); - } - - @Override - public void onCryptoOperationCancelled() { - - } - - @Override - public void onCryptoOperationError(ImportKeyResult result) { - Bundle returnData = new Bundle(); - returnData.putParcelable(OperationResult.EXTRA_RESULT, result); - Intent data = new Intent(); - data.putExtras(returnData); - setResult(RESULT_OK, data); - finish(); - } - - @Override - public boolean onCryptoSetProgress(String msg, int progress, int max) { - return false; - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java index 6f080c468..a705c783d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java @@ -28,7 +28,6 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; -import android.graphics.PorterDuff; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -40,15 +39,14 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.AlphaAnimation; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; + import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.livedata.GenericLiveData; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; import org.sufficientlysecure.keychain.ui.ViewKeyAdvActivity.ViewKeyAdvViewModel; -import org.sufficientlysecure.keychain.ui.util.FormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify.Style; @@ -99,12 +97,9 @@ public class ViewKeyAdvShareFragment extends Fragment { View vFingerprintClipboardButton = view.findViewById(R.id.view_key_action_fingerprint_clipboard); View vKeyShareButton = view.findViewById(R.id.view_key_action_key_share); View vKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard); - ImageButton vKeySafeSlingerButton = view.findViewById(R.id.view_key_action_key_safeslinger); View vKeySshShareButton = view.findViewById(R.id.view_key_action_key_ssh_share); View vKeySshClipboardButton = view.findViewById(R.id.view_key_action_key_ssh_clipboard); View vKeyUploadButton = view.findViewById(R.id.view_key_action_upload); - vKeySafeSlingerButton.setColorFilter(FormattingUtils.getColorFromAttr(requireContext(), R.attr.colorTertiaryText), - PorterDuff.Mode.SRC_IN); vFingerprintShareButton.setOnClickListener(v -> shareFingerprint(false)); vFingerprintClipboardButton.setOnClickListener(v -> shareFingerprint(true)); @@ -113,7 +108,6 @@ public class ViewKeyAdvShareFragment extends Fragment { vKeyClipboardButton.setOnClickListener(v -> ShareKeyHelper.shareKeyToClipboard(getActivity(), unifiedKeyInfo.master_key_id())); - vKeySafeSlingerButton.setOnClickListener(v -> startSafeSlinger()); vKeySshShareButton.setOnClickListener(v -> ShareKeyHelper.shareSshKey(getActivity(), unifiedKeyInfo.master_key_id())); vKeySshClipboardButton.setOnClickListener(v -> ShareKeyHelper.shareSshKeyToClipboard(getActivity(), unifiedKeyInfo.master_key_id())); @@ -122,12 +116,6 @@ public class ViewKeyAdvShareFragment extends Fragment { return view; } - private void startSafeSlinger() { - Intent safeSlingerIntent = new Intent(getActivity(), SafeSlingerActivity.class); - safeSlingerIntent.putExtra(SafeSlingerActivity.EXTRA_MASTER_KEY_ID, unifiedKeyInfo.master_key_id()); - startActivityForResult(safeSlingerIntent, 0); - } - private void shareFingerprint(boolean toClipboard) { Activity activity = getActivity(); if (activity == null || unifiedKeyInfo == null) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java index 6f013c34f..29ab5d785 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java @@ -91,7 +91,6 @@ import org.sufficientlysecure.keychain.ui.ImportKeysProxyActivity; import org.sufficientlysecure.keychain.ui.MainActivity; import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity; import org.sufficientlysecure.keychain.ui.QrCodeViewActivity; -import org.sufficientlysecure.keychain.ui.SafeSlingerActivity; import org.sufficientlysecure.keychain.ui.ViewKeyAdvActivity; import org.sufficientlysecure.keychain.ui.ViewKeyKeybaseFragment; import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity; @@ -267,11 +266,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity { actionShareClipboard.setOnClickListener(v -> ShareKeyHelper.shareKeyToClipboard(this, masterKeyId)); floatingActionButton.setOnClickListener(v -> { - if (unifiedKeyInfo.has_any_secret()) { - startSafeSlinger(); - } else { - scanQrCode(); - } + scanQrCode(); }); qrCodeLayout.setOnClickListener(v -> showQrCodeDialog()); @@ -592,12 +587,6 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity { startActivityForResult(intent, 0); } - private void startSafeSlinger() { - Intent safeSlingerIntent = new Intent(this, SafeSlingerActivity.class); - safeSlingerIntent.putExtra(SafeSlingerActivity.EXTRA_MASTER_KEY_ID, unifiedKeyInfo.master_key_id()); - startActivityForResult(safeSlingerIntent, 0); - } - /** * Load QR Code asynchronously and with a fade in animation */ @@ -778,8 +767,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity { actionShare.setVisibility(View.VISIBLE); actionShareClipboard.setVisibility(View.VISIBLE); - showFab(); - floatingActionButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_repeat_white_24dp)); + hideFab(); } else { actionEncryptFile.setVisibility(View.VISIBLE); actionEncryptText.setVisibility(View.VISIBLE); diff --git a/OpenKeychain/src/main/res/layout/view_key_adv_share_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_adv_share_fragment.xml index b144d0201..5d9e6cb75 100644 --- a/OpenKeychain/src/main/res/layout/view_key_adv_share_fragment.xml +++ b/OpenKeychain/src/main/res/layout/view_key_adv_share_fragment.xml @@ -134,23 +134,6 @@ android:layout_gravity="center_vertical" android:background="?android:selectableItemBackground" /> - - - - Date: Fri, 15 Nov 2019 11:38:30 +0100 Subject: [PATCH 02/19] ditch gradle-witness --- OpenKeychain/build.gradle | 71 +++++++++++++++++++-------------------- build.gradle | 1 - 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 010a9a929..0a0b150ee 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -8,46 +8,46 @@ dependencies { // NOTE: libraries are pinned to a specific build, see below // from local Android SDK - compile 'com.android.support:support-v4:27.1.1' - compile 'com.android.support:appcompat-v7:27.1.1' - compile 'com.android.support:design:27.1.1' - compile 'com.android.support:recyclerview-v7:27.1.1' - compile 'com.android.support:cardview-v7:27.1.1' - compile 'com.android.support:support-annotations:27.1.1' + implementation 'com.android.support:support-v4:27.1.1' + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support:design:27.1.1' + implementation 'com.android.support:recyclerview-v7:27.1.1' + implementation 'com.android.support:cardview-v7:27.1.1' + implementation 'com.android.support:support-annotations:27.1.1' // JCenter etc. - compile 'com.journeyapps:zxing-android-embedded:3.4.0' - compile 'com.google.zxing:core:3.3.0' - compile 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1' - compile 'org.sufficientlysecure:donations:2.5' - compile 'com.squareup.okhttp3:okhttp:3.9.1' - compile 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1' - compile 'org.apache.james:apache-mime4j-core:0.8.0' - compile 'org.apache.james:apache-mime4j-dom:0.8.0' + implementation 'com.journeyapps:zxing-android-embedded:3.4.0' + implementation 'com.google.zxing:core:3.3.0' + implementation 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1' + implementation 'org.sufficientlysecure:donations:2.5' + implementation 'com.squareup.okhttp3:okhttp:3.9.1' + implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1' + implementation 'org.apache.james:apache-mime4j-core:0.8.0' + implementation 'org.apache.james:apache-mime4j-dom:0.8.0' // UI - compile 'org.sufficientlysecure:html-textview:3.1' - compile 'com.jpardogo.materialtabstrip:library:1.1.1' - compile 'com.getbase:floatingactionbutton:1.10.1' - compile 'com.nispok:snackbar:2.11.0' - compile 'com.cocosw:bottomsheet:1.3.1@aar' + implementation 'org.sufficientlysecure:html-textview:3.1' + 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' // RecyclerView - compile 'eu.davidea:flexible-adapter:5.0.5' - compile 'eu.davidea:flexible-adapter-ui:1.0.0-b5' - compile 'eu.davidea:flexible-adapter-livedata:1.0.0-b2' + implementation 'eu.davidea:flexible-adapter:5.0.5' + implementation 'eu.davidea:flexible-adapter-ui:1.0.0-b5' + implementation 'eu.davidea:flexible-adapter-livedata:1.0.0-b2' // Material Drawer - compile 'com.mikepenz:materialdrawer:5.6.0@aar' - compile 'com.mikepenz:fastadapter:1.8.2' - compile 'com.mikepenz:materialize:1.0.0' - compile 'com.mikepenz:iconics-core:2.8.1@aar' - compile 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar' - compile 'com.mikepenz:fontawesome-typeface:4.6.0.3@aar' - compile 'com.mikepenz:community-material-typeface:1.5.54.2@aar' + implementation 'com.mikepenz:materialdrawer:5.6.0@aar' + implementation 'com.mikepenz:fastadapter:1.8.2' + implementation 'com.mikepenz:materialize:1.0.0' + implementation 'com.mikepenz:iconics-core:2.8.1@aar' + implementation 'com.mikepenz:google-material-typeface:2.2.0.3.original@aar' + implementation 'com.mikepenz:fontawesome-typeface:4.6.0.3@aar' + implementation 'com.mikepenz:community-material-typeface:1.5.54.2@aar' // Nordpol - compile 'com.fidesmo:nordpol-android:0.1.22' + implementation 'com.fidesmo:nordpol-android:0.1.22' // piwik implementation 'org.piwik.sdk:piwik-sdk:3.0.3' @@ -92,25 +92,24 @@ dependencies { exclude module: 'recyclerview-v7' } - compile "com.jakewharton.timber:timber:4.5.1" + implementation "com.jakewharton.timber:timber:4.5.1" - compile 'org.glassfish:javax.annotation:10.0-b28' + implementation 'org.glassfish:javax.annotation:10.0-b28' provided "com.google.auto.value:auto-value:1.5" annotationProcessor "com.google.auto.value:auto-value:1.5" annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:0.2.5" - compile 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5' + implementation 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5' - compile "android.arch.lifecycle:extensions:1.0.0" + implementation "android.arch.lifecycle:extensions:1.0.0" annotationProcessor "android.arch.lifecycle:compiler:1.0.0" - compile "android.arch.persistence:db-framework:1.0.0" + implementation "android.arch.persistence:db-framework:1.0.0" implementation 'com.android.support.constraint:constraint-layout: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' } - android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion diff --git a/build.gradle b/build.gradle index 93f96959f..527117962 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ buildscript { dependencies { // NOTE: Always use fixed version codes not dynamic ones, e.g. 0.7.3 instead of 0.7.+, see README for more information classpath 'com.android.tools.build:gradle:3.1.4' - classpath files('gradle-witness.jar') // bintray dependency to satisfy dependency of openpgp-api lib classpath 'com.novoda:bintray-release:0.8.0' classpath 'com.squareup.sqldelight:gradle-plugin:0.7.0' From d3e48db5203a0cb9b24c01bed3bf92b510abb9aa Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 11:47:46 +0100 Subject: [PATCH 03/19] ditch keybase --- .gitmodules | 4 - OpenKeychain/build.gradle | 1 - .../src/main/assets/api.keybase.io.CA.cer | 38 -- .../keychain/Constants.java | 6 +- .../keychain/KeychainApplication.java | 1 - .../keychain/keyimport/CloudSearch.java | 3 - .../keychain/keyimport/ImportKeysList.java | 6 - .../keyimport/ImportKeysListEntry.java | 62 +-- .../keyimport/KeybaseKeyserverClient.java | 121 ----- .../keychain/keyimport/ParcelableKeyRing.java | 10 +- .../processing/ImportKeysListCloudLoader.java | 5 +- .../keychain/network/OkHttpKeybaseClient.java | 55 --- .../keychain/operations/ImportOperation.java | 39 +- .../keychain/operations/KeySyncOperation.java | 2 +- .../KeybaseVerificationOperation.java | 188 ------- .../results/KeybaseVerificationResult.java | 87 ---- .../operations/results/OperationResult.java | 13 - .../service/KeybaseVerificationParcel.java | 60 --- .../keychain/service/KeychainServiceTask.java | 3 - .../keychain/ui/DecryptFragment.java | 2 +- .../keychain/ui/DecryptListFragment.java | 2 +- .../keychain/ui/ImportKeysProxyActivity.java | 2 +- .../keychain/ui/ViewKeyKeybaseFragment.java | 465 ------------------ .../ui/adapter/ImportKeysAdapter.java | 13 +- .../keychain/ui/keyview/ViewKeyActivity.java | 8 +- .../keychain/util/EmailKeyHelper.java | 3 +- .../keychain/util/Preferences.java | 16 +- .../src/main/res/layout/view_key_activity.xml | 5 - .../layout/view_key_adv_keybase_fragment.xml | 81 --- .../res/layout/view_key_adv_keybase_proof.xml | 19 - OpenKeychain/src/main/res/values/strings.xml | 49 +- .../main/res/xml/cloud_search_preferences.xml | 5 - .../main/res/xml/experimental_preferences.xml | 7 - extern/KeybaseLib | 1 - settings.gradle | 3 - 35 files changed, 41 insertions(+), 1344 deletions(-) delete mode 100644 OpenKeychain/src/main/assets/api.keybase.io.CA.cer delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserverClient.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/OkHttpKeybaseClient.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeybaseVerificationOperation.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/KeybaseVerificationResult.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeybaseVerificationParcel.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyKeybaseFragment.java delete mode 100644 OpenKeychain/src/main/res/layout/view_key_adv_keybase_fragment.xml delete mode 100644 OpenKeychain/src/main/res/layout/view_key_adv_keybase_proof.xml delete mode 160000 extern/KeybaseLib diff --git a/.gitmodules b/.gitmodules index d12dc6223..b4c3f256c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,10 +2,6 @@ path = extern/openpgp-api-lib url = https://github.com/open-keychain/openpgp-api.git ignore = dirty -[submodule "extern/KeybaseLib"] - path = extern/KeybaseLib - url = https://github.com/open-keychain/KeybaseLib.git - ignore = dirty [submodule "extern/minidns"] path = extern/minidns url = https://github.com/open-keychain/minidns.git diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 0a0b150ee..3470bf6a7 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -61,7 +61,6 @@ dependencies { implementation project(':extern:bouncycastle:pg') implementation project(':extern:bouncycastle:prov') implementation project(':extern:minidns') - implementation project(':KeybaseLib') implementation project(':extern:MaterialChipsInput') implementation "android.arch.work:work-runtime:1.0.0-alpha02" diff --git a/OpenKeychain/src/main/assets/api.keybase.io.CA.cer b/OpenKeychain/src/main/assets/api.keybase.io.CA.cer deleted file mode 100644 index c7da715c4..000000000 --- a/OpenKeychain/src/main/assets/api.keybase.io.CA.cer +++ /dev/null @@ -1,38 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIGmzCCBIOgAwIBAgIJAPzhpcIBaOeNMA0GCSqGSIb3DQEBBQUAMIGPMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCTlkxETAPBgNVBAcTCE5ldyBZb3JrMRQwEgYDVQQK -EwtLZXliYXNlIExMQzEXMBUGA1UECxMOQ2VydCBBdXRob3JpdHkxEzARBgNVBAMT -CmtleWJhc2UuaW8xHDAaBgkqhkiG9w0BCQEWDWNhQGtleWJhc2UuaW8wHhcNMTQw -MTAyMTY0MjMzWhcNMjMxMjMxMTY0MjMzWjCBjzELMAkGA1UEBhMCVVMxCzAJBgNV -BAgTAk5ZMREwDwYDVQQHEwhOZXcgWW9yazEUMBIGA1UEChMLS2V5YmFzZSBMTEMx -FzAVBgNVBAsTDkNlcnQgQXV0aG9yaXR5MRMwEQYDVQQDEwprZXliYXNlLmlvMRww -GgYJKoZIhvcNAQkBFg1jYUBrZXliYXNlLmlvMIICIjANBgkqhkiG9w0BAQEFAAOC -Ag8AMIICCgKCAgEA3sLA6ZG8uOvmlFvFLVIOURmcQrZyMFKbVu9/TeDiemls3w3/ -JzVTduD+7KiUi9R7QcCW/V1ZpReTfunm7rfACiJ1fpIkjSQrgsvKDLghIzxIS5FM -I8utet5p6QtuJhaAwmmXn8xX05FvqWNbrcXRdpL4goFdigPsFK2xhTUiWatLMste -oShI7+zmrgkx75LeLMD0bL2uOf87JjOzbY8x2sUIZLGwPoATyG8WS38ey6KkJxRj -AhG3p+OTYEjYSrsAtQA6ImbeDpfSHKOB8HF3nVp//Eb4HEiEsWwBRbQXvAWh3DYL -GukFW0wiO0HVCoWY+bHL/Mqa0NdRGOlLsbL4Z4pLrhqKgSDU8umX9YuNRRaB0P5n -TkzyU6axHqzq990Gep/I62bjsBdYYp+DjSPK43mXRrfWJl2NTcl8xKAyfsOW+9hQ -9vwK0tpSicNxfYuUZs0BhfjSZ/Tc6Z1ERdgUYRiXTtohl+SRA2IgZMloHCllVMNj -EjXhguvHgLAOrcuyhVBupiUQGUHQvkMsr1Uz8VPNDFOJedwucRU2AaR881bknnSb -ds9+zNLsvUFV+BK7Qdnt/WkFpYL78rGwY47msi9Ooddx6fPyeg3qkJGM6cwn/boy -w9lQeleYDq8kyJdixIAxtAskNzRPJ4nDu2izTfByQoM8epwAWboc/gNFObMCAwEA -AaOB9zCB9DAdBgNVHQ4EFgQURqpATOw1gVVrzlqqFKbkfaKXvwowgcQGA1UdIwSB -vDCBuYAURqpATOw1gVVrzlqqFKbkfaKXvwqhgZWkgZIwgY8xCzAJBgNVBAYTAlVT -MQswCQYDVQQIEwJOWTERMA8GA1UEBxMITmV3IFlvcmsxFDASBgNVBAoTC0tleWJh -c2UgTExDMRcwFQYDVQQLEw5DZXJ0IEF1dGhvcml0eTETMBEGA1UEAxMKa2V5YmFz -ZS5pbzEcMBoGCSqGSIb3DQEJARYNY2FAa2V5YmFzZS5pb4IJAPzhpcIBaOeNMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggIBAA3Z5FIhulYghMuHdcHYTYWc -7xT5WD4hXQ0WALZs4p5Y+b2Af54o6v1wUE1Au97FORq5CsFXX/kGl/JzzTimeucn -YJwGuXMpilrlHCBAL5/lSQjA7qbYIolQ3SB9ON+LYuF1jKB9k8SqNp7qzucxT3tO -b8ZMDEPNsseC7NE2uwNtcW3yrTh6WZnSqg/jwswiWjHYDdG7U8FjMYlRol3wPux2 -PizGbSgiR+ztI2OthxtxNWMrT9XKxNQTpcxOXnLuhiSwqH8PoY17ecP8VPpaa0K6 -zym0zSkbroqydazaxcXRk3eSlc02Ktk7HzRzuqQQXhRMkxVnHbFHgGsz03L533pm -mlIEgBMggZkHwNvs1LR7f3v2McdKulDH7Mv8yyfguuQ5Jxxt7RJhUuqSudbEhoaM -6jAJwBkMFxsV2YnyFEd3eZ/qBYPf7TYHhyzmHW6WkSypGqSnXd4gYpJ8o7LxSf4F -inLjxRD+H9Xn1UVXWLM0gaBB7zZcXd2zjMpRsWgezf5IR5vyakJsc7fxzgor3Qeq -Ri6LvdEkhhFVl5rHMQBwNOPngySrq8cs/ikTLTfQVTYXXA4Ba1YyiMOlfaR1LhKw -If1AkUV0tfCTNRZ01EotKSK77+o+k214n+BAu+7mO+9B5Kb7lMFQcuWCHXKYB2Md -cT7Yh09F0QpFUd0ymEfv ------END CERTIFICATE----- diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index b1fef45ea..c1e83c150 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -132,7 +132,6 @@ public final class Constants { public static final String FIRST_TIME_APP = "firstTimeApp"; public static final String CACHED_CONSOLIDATE = "cachedConsolidate"; public static final String SEARCH_KEYSERVER = "search_keyserver_pref"; - public static final String SEARCH_KEYBASE = "search_keybase_pref"; public static final String SEARCH_WEB_KEY_DIRECTORY = "search_wkd_pref"; public static final String USE_NUMKEYPAD_FOR_SECURITY_TOKEN_PIN = "useNumKeypadForYubikeyPin"; public static final String ENCRYPT_FILENAMES = "encryptFilenames"; @@ -154,7 +153,6 @@ public final class Constants { public static final String ENABLE_WIFI_SYNC_ONLY = "enableWifiSyncOnly"; public static final String SYNC_WORK_UUID = "syncWorkUuid"; // other settings - public static final String EXPERIMENTAL_ENABLE_KEYBASE = "experimentalEnableKeybase"; public static final String EXPERIMENTAL_USB_ALLOW_UNTESTED = "experimentalUsbAllowUntested"; public static final String EXPERIMENTAL_SMARTPGP_VERIFY_AUTHORITY = "smartpgp_authorities_pref"; public static final String EXPERIMENTAL_SMARTPGP_AUTHORITIES = "smartpgp_authorities"; @@ -178,9 +176,9 @@ public final class Constants { // we generally only track booleans. never snoop around in the user's string settings!! public static final List ANALYTICS_PREFS = Arrays.asList(USE_NORMAL_PROXY, USE_TOR_PROXY, - SYNC_CONTACTS, SYNC_KEYSERVER, ENABLE_WIFI_SYNC_ONLY, EXPERIMENTAL_ENABLE_KEYBASE, + SYNC_CONTACTS, SYNC_KEYSERVER, ENABLE_WIFI_SYNC_ONLY, EXPERIMENTAL_USB_ALLOW_UNTESTED, - PASSPHRASE_CACHE_SUBS, SEARCH_KEYSERVER, SEARCH_KEYBASE, SEARCH_WEB_KEY_DIRECTORY, + PASSPHRASE_CACHE_SUBS, SEARCH_KEYSERVER, SEARCH_WEB_KEY_DIRECTORY, TEXT_USE_COMPRESSION, TEXT_SELF_ENCRYPT, FILE_USE_COMPRESSION, FILE_SELF_ENCRYPT, USE_ARMOR, USE_NUMKEYPAD_FOR_SECURITY_TOKEN_PIN, ENCRYPT_FILENAMES); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java index 7d1d631d2..a1df7832d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java @@ -102,7 +102,6 @@ public class KeychainApplication extends Application { TlsCertificatePinning.addPinnedCertificate("keys.openpgp.org", getAssets(), "LetsEncryptCA.cer"); TlsCertificatePinning.addPinnedCertificate("hkps.pool.sks-keyservers.net", getAssets(), "hkps.pool.sks-keyservers.net.CA.cer"); TlsCertificatePinning.addPinnedCertificate("pgp.mit.edu", getAssets(), "pgp.mit.edu.cer"); - TlsCertificatePinning.addPinnedCertificate("api.keybase.io", getAssets(), "api.keybase.io.CA.cer"); TlsCertificatePinning.addPinnedCertificate("keyserver.ubuntu.com", getAssets(), "LetsEncryptCA.cer"); KeyserverSyncManager.updateKeyserverSyncScheduleAsync(this, false); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java index 51c840d89..a054c4524 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java @@ -45,9 +45,6 @@ public class CloudSearch { if (cloudPrefs.isKeyserverEnabled()) { servers.add(HkpKeyserverClient.fromHkpKeyserverAddress(cloudPrefs.getKeyserver())); } - if (cloudPrefs.isKeybaseEnabled()) { - servers.add(KeybaseKeyserverClient.getInstance()); - } if (cloudPrefs.isFacebookEnabled()) { servers.add(FacebookKeyserverClient.getInstance()); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysList.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysList.java index b698f6b02..e5abf0946 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysList.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysList.java @@ -77,14 +77,8 @@ public class ImportKeysList extends ArrayList { if (incoming.getKeyserver() != null) { existing.setKeyserver(incoming.getKeyserver()); - // Mail addresses returned by HKP servers are preferred over keybase.io IDs existing.setPrimaryUserId(incoming.getPrimaryUserId()); - modified = true; - } else if (incoming.getKeybaseName() != null) { - // to work properly, Keybase-sourced/Facebook-sourced entries need to pass along the - // identifying name/id - existing.setKeybaseName(incoming.getKeybaseName()); modified = true; } else if (incoming.getFbUsername() != null) { existing.setFbUsername(incoming.getFbUsername()); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysListEntry.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysListEntry.java index 61716e36c..cb672958d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysListEntry.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ImportKeysListEntry.java @@ -17,6 +17,18 @@ package org.sufficientlysecure.keychain.keyimport; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + import android.content.Context; import android.os.Parcel; import android.os.Parcelable; @@ -27,18 +39,6 @@ import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; import org.sufficientlysecure.keychain.pgp.UncachedPublicKey; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - public class ImportKeysListEntry implements Serializable, Parcelable { private static final long serialVersionUID = -7797972103284992662L; @@ -64,7 +64,6 @@ public class ImportKeysListEntry implements Serializable, Parcelable { private UserId mPrimaryUserId; private HkpKeyserverAddress mKeyserver; - private String mKeybaseName; private String mFbUsername; private String mQuery; @@ -197,14 +196,6 @@ public class ImportKeysListEntry implements Serializable, Parcelable { mKeyserver = keyserver; } - public String getKeybaseName() { - return mKeybaseName; - } - - public void setKeybaseName(String keybaseName) { - mKeybaseName = keybaseName; - } - public String getFbUsername() { return mFbUsername; } @@ -257,20 +248,11 @@ public class ImportKeysListEntry implements Serializable, Parcelable { return modified; } - public ArrayList getKeybaseUserIds() { - ArrayList keybaseUserIds = new ArrayList<>(); - for (String s : mUserIds) { - if (s.contains(":")) - keybaseUserIds.add(s); - } - return keybaseUserIds; - } - /** * Constructor for later querying from keyserver */ public ImportKeysListEntry() { - // keys from keyserver are always public keys; from keybase too + // keys from keyserver are always public keys mSecretKey = false; mUserIds = new ArrayList<>(); @@ -339,20 +321,8 @@ public class ImportKeysListEntry implements Serializable, Parcelable { private void sortMergedUserIds() { mSortedUserIds = new ArrayList<>(mMergedUserIds.entrySet()); - Collections.sort(mSortedUserIds, new Comparator>>() { - @Override - public int compare(Map.Entry> entry1, - Map.Entry> entry2) { - - // sort keybase UserIds after non-Keybase - boolean e1IsKeybase = entry1.getKey().contains(":"); - boolean e2IsKeybase = entry2.getKey().contains(":"); - if (e1IsKeybase != e2IsKeybase) { - return (e1IsKeybase) ? 1 : -1; - } - return entry1.getKey().compareTo(entry2.getKey()); - } - }); + Collections.sort(mSortedUserIds, + (entry1, entry2) -> entry1.getKey().compareTo(entry2.getKey())); } @Override @@ -377,7 +347,6 @@ public class ImportKeysListEntry implements Serializable, Parcelable { dest.writeString(mAlgorithm); dest.writeByte((byte) (mSecretKey ? 1 : 0)); dest.writeParcelable(mKeyserver, flags); - dest.writeString(mKeybaseName); dest.writeString(mFbUsername); } @@ -400,7 +369,6 @@ public class ImportKeysListEntry implements Serializable, Parcelable { vr.mAlgorithm = source.readString(); vr.mSecretKey = source.readByte() == 1; vr.mKeyserver = source.readParcelable(HkpKeyserverAddress.class.getClassLoader()); - vr.mKeybaseName = source.readString(); vr.mFbUsername = source.readString(); return vr; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserverClient.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserverClient.java deleted file mode 100644 index e0b20b55e..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserverClient.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.keyimport; - -import com.textuality.keybase.lib.KeybaseException; -import com.textuality.keybase.lib.KeybaseQuery; -import com.textuality.keybase.lib.Match; -import com.textuality.keybase.lib.User; - -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import org.sufficientlysecure.keychain.network.OkHttpKeybaseClient; -import org.sufficientlysecure.keychain.util.ParcelableProxy; -import timber.log.Timber; - -import java.util.ArrayList; -import java.util.List; - -public class KeybaseKeyserverClient implements KeyserverClient { - - public static KeybaseKeyserverClient getInstance() { - return new KeybaseKeyserverClient(); - } - - private KeybaseKeyserverClient() { } - - @Override - public ArrayList search(String query, ParcelableProxy proxy) throws QueryFailedException, - QueryNeedsRepairException { - ArrayList results = new ArrayList<>(); - - if (query.startsWith("0x")) { - // cut off "0x" if a user is searching for a key id - query = query.substring(2); - } - if (query.isEmpty()) { - throw new QueryTooShortException(); - } - - try { - KeybaseQuery keybaseQuery = new KeybaseQuery(new OkHttpKeybaseClient()); - keybaseQuery.setProxy(proxy.getProxy()); - Iterable matches = keybaseQuery.search(query); - for (Match match : matches) { - results.add(makeEntry(match, query)); - } - } catch (KeybaseException e) { - Timber.e(e, "keybase result parsing error"); - throw new QueryFailedException("Unexpected structure in keybase search result: " + e.getMessage()); - } - - return results; - } - - private ImportKeysListEntry makeEntry(Match match, String query) throws KeybaseException { - final ImportKeysListEntry entry = new ImportKeysListEntry(); - entry.setQuery(query); - - entry.setRevoked(false); // keybase doesn’t say anything about revoked keys - - String username = match.getUsername(); - String fullName = match.getFullName(); - String fingerprint = match.getFingerprint(); - entry.setFingerprint(KeyFormattingUtils.convertFingerprintHexFingerprint(fingerprint)); - - entry.setKeyIdHex("0x" + match.getKeyID()); - // so we can query for the keybase id directly, and to identify the location from which the - // key is to be retrieved - entry.setKeybaseName(username); - - final int bitStrength = match.getBitStrength(); - entry.setBitStrength(bitStrength); - final int algorithmId = match.getAlgorithmId(); - entry.setAlgorithm(KeyFormattingUtils.getAlgorithmInfo(algorithmId, bitStrength, null)); - - ArrayList userIds = new ArrayList<>(); - String name = ""; - if (fullName != null) { - name = fullName + " " + name; - } - userIds.add(name); - - List proofLabels = match.getProofLabels(); - for (String proofLabel : proofLabels) { - userIds.add(proofLabel); - } - entry.setUserIds(userIds); - entry.setPrimaryUserId(name); - return entry; - } - - @Override - public String get(String id, ParcelableProxy proxy) throws QueryFailedException { - try { - KeybaseQuery keybaseQuery = new KeybaseQuery(new OkHttpKeybaseClient()); - keybaseQuery.setProxy(proxy.getProxy()); - return User.keyForUsername(keybaseQuery, id); - } catch (KeybaseException e) { - throw new QueryFailedException(e.getMessage()); - } - } - - @Override - public void add(String armoredKey, ParcelableProxy proxy) throws AddKeyException { - throw new AddKeyException(); - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java index 37dd6cb98..b42475861 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java @@ -26,7 +26,7 @@ import com.google.auto.value.AutoValue; /** * This class is a parcelable representation of either a keyring as raw data, - * or a (unique) reference to one as a fingerprint, keyid, or keybase name. + * or a (unique) reference to one as a fingerprint, or keyid. */ @AutoValue public abstract class ParcelableKeyRing implements Parcelable { @@ -41,16 +41,14 @@ public abstract class ParcelableKeyRing implements Parcelable { @Nullable public abstract String getKeyIdHex(); @Nullable - public abstract String getKeybaseName(); - @Nullable public abstract String getFbUsername(); public static ParcelableKeyRing createFromEncodedBytes(byte[] bytes) { - return new AutoValue_ParcelableKeyRing(bytes, null, null, null, null); + return new AutoValue_ParcelableKeyRing(bytes, null, null, null); } public static ParcelableKeyRing createFromReference( - byte[] expectedFingerprint, String keyIdHex, String keybaseName, String fbUsername) { - return new AutoValue_ParcelableKeyRing(null, expectedFingerprint, keyIdHex, keybaseName, fbUsername); + byte[] expectedFingerprint, String keyIdHex, String fbUsername) { + return new AutoValue_ParcelableKeyRing(null, expectedFingerprint, keyIdHex, fbUsername); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java index 6833343ac..69cca2a6a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java @@ -51,8 +51,7 @@ public class ImportKeysListCloudLoader * * @param loaderState state containing the string to search on servers for (if it is a * fingerprint, will enforce fingerprint check) and the keyserver to - * search on (whether to search on the keyserver, and whether to search - * keybase.io) + * search on (whether to search on the keyserver) * @param parcelableProxy explicit proxy to use. If null, will retrieve from preferences */ public ImportKeysListCloudLoader(Context context, CloudLoaderState loaderState, @@ -84,7 +83,7 @@ public class ImportKeysListCloudLoader for (ImportKeysListEntry e : mEntryList) { if (e.getParcelableKeyRing() == null) { e.setParcelableKeyRing(ParcelableKeyRing.createFromReference(e.getFingerprint(), e.getKeyIdHex(), - e.getKeybaseName(), e.getFbUsername())); + e.getFbUsername())); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/OkHttpKeybaseClient.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/OkHttpKeybaseClient.java deleted file mode 100644 index 91056813d..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/OkHttpKeybaseClient.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.network; - - -import java.io.IOException; -import java.net.Proxy; -import java.net.URL; - -import com.textuality.keybase.lib.KeybaseUrlConnectionClient; -import okhttp3.OkHttpClient; -import okhttp3.Request; - -/** - * Wrapper for Keybase Lib - */ -public class OkHttpKeybaseClient implements KeybaseUrlConnectionClient { - - @Override - public Response getUrlResponse(URL url, Proxy proxy, boolean isKeybase) throws IOException { - OkHttpClient client; - - if (proxy != null) { - client = OkHttpClientFactory.getClientPinnedIfAvailable(url, proxy); - } else { - client = OkHttpClientFactory.getSimpleClient(); - } - - Request request = new Request.Builder() - .url(url).build(); - okhttp3.Response okResponse = client.newCall(request).execute(); - return new Response(okResponse.body().byteStream(), okResponse.code(), okResponse.message(), okResponse.headers().toMultimap()); - } - - @Override - public String getKeybaseBaseUrl() { - return "https://api.keybase.io/"; - } - -} \ No newline at end of file diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 452990673..5c508e88b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -41,7 +41,6 @@ import org.sufficientlysecure.keychain.daos.KeyWritableRepository; import org.sufficientlysecure.keychain.keyimport.FacebookKeyserverClient; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverClient; -import org.sufficientlysecure.keychain.keyimport.KeybaseKeyserverClient; import org.sufficientlysecure.keychain.keyimport.KeyserverClient; import org.sufficientlysecure.keychain.keyimport.KeyserverClient.QueryNotFoundException; import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; @@ -76,8 +75,7 @@ import timber.log.Timber; * all steps for this import. * For the import operation, the only valid source is an Iterator of * ParcelableKeyRing, each of which must contain either a single - * keyring encoded as bytes, or a unique reference to a keyring - * on keyservers and/or keybase.io. + * keyring encoded as bytes, or a unique reference to a keyring on keyservers. * It is important to note that public keys should generally be imported before * secret keys, because some implementations (notably Symantec PGP Desktop) do * not include self certificates for user ids in the secret keyring. The import @@ -93,7 +91,6 @@ public class ImportOperation extends BaseReadWriteOperation private final KeyMetadataDao keyMetadataDao; private FacebookKeyserverClient facebookServer; - private KeybaseKeyserverClient keybaseServer; public ImportOperation(Context context, KeyWritableRepository databaseInteractor, Progressable progressable) { super(context, databaseInteractor, progressable); @@ -355,14 +352,6 @@ public class ImportOperation extends BaseReadWriteOperation } } - boolean hasKeybaseName = entry.getKeybaseName() != null; - if (hasKeybaseName) { - UncachedKeyRing keybaseKey = fetchKeyFromKeybase(proxy, log, entry); - if (keybaseKey != null) { - key = mergeKeysOrUseEither(log, 3, key, keybaseKey); - } - } - boolean hasFacebookName = entry.getFbUsername() != null; if (hasFacebookName) { UncachedKeyRing facebookKey = fetchKeyFromFacebook(proxy, log, entry); @@ -414,32 +403,6 @@ public class ImportOperation extends BaseReadWriteOperation } } - private UncachedKeyRing fetchKeyFromKeybase(@NonNull ParcelableProxy proxy, OperationLog log, ParcelableKeyRing entry) - throws PgpGeneralException, IOException { - if (keybaseServer == null) { - keybaseServer = KeybaseKeyserverClient.getInstance(); - } - - try { - log.add(LogType.MSG_IMPORT_FETCH_KEYBASE, 2, entry.getKeybaseName()); - byte[] data = keybaseServer.get(entry.getKeybaseName(), proxy).getBytes(); - UncachedKeyRing keybaseKey = UncachedKeyRing.decodeFromData(data); - - if (keybaseKey != null) { - log.add(LogType.MSG_IMPORT_FETCH_KEYSERVER_OK, 3); - } else { - log.add(LogType.MSG_IMPORT_FETCH_ERROR_DECODE, 3); - } - - return keybaseKey; - } catch (KeyserverClient.QueryFailedException e) { - // download failed, too bad. just proceed - Timber.e(e, "query failed"); - log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage()); - return null; - } - } - private UncachedKeyRing fetchKeyFromFacebook(@NonNull ParcelableProxy proxy, OperationLog log, ParcelableKeyRing entry) throws PgpGeneralException, IOException { if (facebookServer == null) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java index e97a31bf4..a22650e37 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java @@ -72,7 +72,7 @@ public class KeySyncOperation extends BaseReadWriteOperation { ArrayList result = new ArrayList<>(staleKeyFingerprints.size()); for (byte[] fingerprint : staleKeyFingerprints) { Timber.d("Keyserver sync: Updating %s", KeyFormattingUtils.beautifyKeyId(fingerprint)); - result.add(ParcelableKeyRing.createFromReference(fingerprint, null, null, null)); + result.add(ParcelableKeyRing.createFromReference(fingerprint, null, null)); } return result; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeybaseVerificationOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeybaseVerificationOperation.java deleted file mode 100644 index 90c569f71..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeybaseVerificationOperation.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.operations; - - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.net.Proxy; -import java.util.ArrayList; -import java.util.List; - -import android.content.Context; -import android.support.annotation.NonNull; - -import com.textuality.keybase.lib.KeybaseQuery; -import com.textuality.keybase.lib.Proof; -import com.textuality.keybase.lib.prover.Prover; -import de.measite.minidns.Client; -import de.measite.minidns.DNSMessage; -import de.measite.minidns.Question; -import de.measite.minidns.Record; -import de.measite.minidns.record.Data; -import de.measite.minidns.record.TXT; -import org.bouncycastle.openpgp.PGPUtil; -import org.json.JSONObject; -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.network.OkHttpKeybaseClient; -import org.sufficientlysecure.keychain.network.orbot.OrbotHelper; -import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult; -import org.sufficientlysecure.keychain.operations.results.KeybaseVerificationResult; -import org.sufficientlysecure.keychain.operations.results.OperationResult; -import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; -import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel; -import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyOperation; -import org.sufficientlysecure.keychain.pgp.Progressable; -import org.sufficientlysecure.keychain.daos.KeyWritableRepository; -import org.sufficientlysecure.keychain.service.KeybaseVerificationParcel; -import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; -import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import org.sufficientlysecure.keychain.util.Preferences; - -public class KeybaseVerificationOperation extends BaseOperation { - - public KeybaseVerificationOperation(Context context, KeyWritableRepository databaseInteractor, - Progressable progressable) { - super(context, databaseInteractor, progressable); - } - - @NonNull - @Override - public KeybaseVerificationResult execute(KeybaseVerificationParcel keybaseInput, - CryptoInputParcel cryptoInput) { - Proxy proxy; - if (cryptoInput.getParcelableProxy() == null) { - // explicit proxy not set - if (!OrbotHelper.isOrbotInRequiredState(mContext)) { - return new KeybaseVerificationResult(null, - RequiredInputParcel.createOrbotRequiredOperation(), cryptoInput); - } - proxy = Preferences.getPreferences(mContext).getParcelableProxy().getProxy(); - } else { - proxy = cryptoInput.getParcelableProxy().getProxy(); - } - - String requiredFingerprint = keybaseInput.mRequiredFingerprint; - - OperationResult.OperationLog log = new OperationResult.OperationLog(); - log.add(OperationResult.LogType.MSG_KEYBASE_VERIFICATION, 0, requiredFingerprint); - - try { - KeybaseQuery keybaseQuery = new KeybaseQuery(new OkHttpKeybaseClient()); - keybaseQuery.setProxy(proxy); - - String keybaseProof = keybaseInput.mKeybaseProof; - Proof proof = new Proof(new JSONObject(keybaseProof)); - mProgressable.setProgress(R.string.keybase_message_fetching_data, 0, 100); - - Prover prover = Prover.findProverFor(proof); - - if (prover == null) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_NO_PROVER, 1, - proof.getPrettyName()); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - - if (!prover.fetchProofData(keybaseQuery)) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_FETCH_PROOF, 1); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - - if (!prover.checkFingerprint(requiredFingerprint)) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_FINGERPRINT_MISMATCH, 1); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - - String domain = prover.dnsTxtCheckRequired(); - if (domain != null) { - DNSMessage dnsQuery = new Client().query(new Question(domain, Record.TYPE.TXT)); - if (dnsQuery == null) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_DNS_FAIL, 1); - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 2, - getFlattenedProverLog(prover)); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - Record[] records = dnsQuery.getAnswers(); - List> extents = new ArrayList<>(); - for (Record r : records) { - Data d = r.getPayload(); - if (d instanceof TXT) { - extents.add(((TXT) d).getExtents()); - } - } - if (!prover.checkDnsTxt(extents)) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 1, - getFlattenedProverLog(prover)); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - } - - byte[] messageBytes = prover.getPgpMessage().getBytes(); - if (prover.rawMessageCheckRequired()) { - InputStream messageByteStream = PGPUtil.getDecoderStream(new - ByteArrayInputStream - (messageBytes)); - if (!prover.checkRawMessageBytes(messageByteStream)) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 1, - getFlattenedProverLog(prover)); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - } - - PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(mContext, mKeyRepository, mProgressable); - - PgpDecryptVerifyInputParcel input = PgpDecryptVerifyInputParcel.builder() - .setInputBytes(messageBytes) - .build(); - - DecryptVerifyResult decryptVerifyResult = op.execute(input, CryptoInputParcel.createCryptoInputParcel()); - - if (!decryptVerifyResult.success()) { - log.add(decryptVerifyResult, 1); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - - long verifyingKeyId = decryptVerifyResult.getSignatureResult().getKeyId(); - byte[] verifyingFingerprint = mKeyRepository.getFingerprintByKeyId(verifyingKeyId); - if (!requiredFingerprint.equals(KeyFormattingUtils.convertFingerprintToHex(verifyingFingerprint))) { - log.add(LogType.MSG_KEYBASE_ERROR_FINGERPRINT_MISMATCH, 1); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - - if (!prover.validate(new String(decryptVerifyResult.getOutputBytes()))) { - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_PAYLOAD_MISMATCH, 1); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - - return new KeybaseVerificationResult(OperationResult.RESULT_OK, log, prover); - } catch (Exception e) { - // just adds the passed parameter, in this case e.getMessage() - log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 1, e.getMessage()); - return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); - } - } - - private String getFlattenedProverLog(Prover prover) { - String log = ""; - for (String line : prover.getLog()) { - log += line + "\n"; - } - return log; - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/KeybaseVerificationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/KeybaseVerificationResult.java deleted file mode 100644 index 54b3c675a..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/KeybaseVerificationResult.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.operations.results; - -import android.os.Parcel; -import android.os.Parcelable; -import com.textuality.keybase.lib.KeybaseException; -import com.textuality.keybase.lib.prover.Prover; - -import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; -import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; - -public class KeybaseVerificationResult extends InputPendingResult { - public final String mProofUrl; - public final String mPresenceUrl; - public final String mPresenceLabel; - - public KeybaseVerificationResult(int result, OperationLog log) { - super(result, log); - mProofUrl = null; - mPresenceLabel = null; - mPresenceUrl = null; - } - - public KeybaseVerificationResult(int result, OperationLog log, Prover prover) - throws KeybaseException { - super(result, log); - mProofUrl = prover.getProofUrl(); - mPresenceUrl = prover.getPresenceUrl(); - mPresenceLabel = prover.getPresenceLabel(); - } - - public KeybaseVerificationResult(OperationLog log, RequiredInputParcel requiredInputParcel, - CryptoInputParcel cryptoInputParcel) { - super(log, requiredInputParcel, cryptoInputParcel); - mProofUrl = null; - mPresenceUrl = null; - mPresenceLabel = null; - } - - protected KeybaseVerificationResult(Parcel in) { - super(in); - mProofUrl = in.readString(); - mPresenceUrl = in.readString(); - mPresenceLabel = in.readString(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeString(mProofUrl); - dest.writeString(mPresenceUrl); - dest.writeString(mPresenceLabel); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public KeybaseVerificationResult createFromParcel(Parcel in) { - return new KeybaseVerificationResult(in); - } - - @Override - public KeybaseVerificationResult[] newArray(int size) { - return new KeybaseVerificationResult[size]; - } - }; -} \ No newline at end of file diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index cf912cbd3..872f13ac4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -756,7 +756,6 @@ public abstract class OperationResult implements Parcelable { MSG_IMPORT_FETCH_ERROR_NOT_FOUND (LogLevel.ERROR, R.string.msg_import_fetch_error_not_found), MSG_IMPORT_FETCH_ERROR_KEYSERVER(LogLevel.ERROR, R.string.msg_import_fetch_error_keyserver), MSG_IMPORT_FETCH_ERROR_KEYSERVER_SECRET (LogLevel.ERROR, R.string.msg_import_fetch_error_keyserver_secret), - MSG_IMPORT_FETCH_KEYBASE (LogLevel.INFO, R.string.msg_import_fetch_keybase), MSG_IMPORT_FETCH_FACEBOOK (LogLevel.INFO, R.string.msg_import_fetch_facebook), MSG_IMPORT_FETCH_KEYSERVER (LogLevel.INFO, R.string.msg_import_fetch_keyserver), MSG_IMPORT_FETCH_KEYSERVER_OK (LogLevel.DEBUG, R.string.msg_import_fetch_keyserver_ok), @@ -820,18 +819,6 @@ public abstract class OperationResult implements Parcelable { MSG_REVOKE_ERROR_KEY_FAIL (LogLevel.ERROR, R.string.msg_revoke_key_fail), MSG_REVOKE_OK (LogLevel.OK, R.string.msg_revoke_ok), - // keybase verification - MSG_KEYBASE_VERIFICATION(LogLevel.START, R.string.msg_keybase_verification), - - MSG_KEYBASE_ERROR_NO_PROVER(LogLevel.ERROR, R.string.msg_keybase_error_no_prover), - MSG_KEYBASE_ERROR_FETCH_PROOF(LogLevel.ERROR, R.string.msg_keybase_error_fetching_evidence), - MSG_KEYBASE_ERROR_FINGERPRINT_MISMATCH(LogLevel.ERROR, - R.string.msg_keybase_error_key_mismatch), - MSG_KEYBASE_ERROR_DNS_FAIL(LogLevel.ERROR, R.string.msg_keybase_error_dns_fail), - MSG_KEYBASE_ERROR_SPECIFIC(LogLevel.ERROR, R.string.msg_keybase_error_specific), - MSG_KEYBASE_ERROR_PAYLOAD_MISMATCH(LogLevel.ERROR, - R.string.msg_keybase_error_msg_payload_mismatch), - // InputData Operation MSG_DATA (LogLevel.START, R.string.msg_data), MSG_DATA_OPENPGP (LogLevel.DEBUG, R.string.msg_data_openpgp), diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeybaseVerificationParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeybaseVerificationParcel.java deleted file mode 100644 index 12bb296f1..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeybaseVerificationParcel.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.service; - -import android.os.Parcel; -import android.os.Parcelable; - -public class KeybaseVerificationParcel implements Parcelable { - - public String mKeybaseProof; - public String mRequiredFingerprint; - - public KeybaseVerificationParcel(String keybaseProof, String requiredFingerprint) { - mKeybaseProof = keybaseProof; - mRequiredFingerprint = requiredFingerprint; - } - - protected KeybaseVerificationParcel(Parcel in) { - mKeybaseProof = in.readString(); - mRequiredFingerprint = in.readString(); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(mKeybaseProof); - dest.writeString(mRequiredFingerprint); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public KeybaseVerificationParcel createFromParcel(Parcel in) { - return new KeybaseVerificationParcel(in); - } - - @Override - public KeybaseVerificationParcel[] newArray(int size) { - return new KeybaseVerificationParcel[size]; - } - }; -} \ No newline at end of file diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java index cd1eba398..724b8ae10 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java @@ -41,7 +41,6 @@ import org.sufficientlysecure.keychain.operations.ImportOperation; import org.sufficientlysecure.keychain.operations.InputDataOperation; import org.sufficientlysecure.keychain.operations.KeySyncOperation; import org.sufficientlysecure.keychain.operations.KeySyncParcel; -import org.sufficientlysecure.keychain.operations.KeybaseVerificationOperation; import org.sufficientlysecure.keychain.operations.PromoteKeyOperation; import org.sufficientlysecure.keychain.operations.RevokeOperation; import org.sufficientlysecure.keychain.operations.SignEncryptOperation; @@ -114,8 +113,6 @@ public class KeychainServiceTask { } else if (inputParcel instanceof UploadKeyringParcel) { op = new UploadOperation(context, keyRepository, asyncProgressable, operationCancelledBoolean); - } else if (inputParcel instanceof KeybaseVerificationParcel) { - op = new KeybaseVerificationOperation(context, keyRepository, asyncProgressable); } else if (inputParcel instanceof InputDataParcel) { op = new InputDataOperation(context, keyRepository, asyncProgressable); } else if (inputParcel instanceof BenchmarkInputParcel) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java index 81494d2df..97f2c847e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java @@ -138,7 +138,7 @@ public abstract class DecryptFragment extends Fragment { { ParcelableKeyRing keyEntry = ParcelableKeyRing.createFromReference(null, - KeyFormattingUtils.convertKeyIdToHex(unknownKeyId), null, null); + KeyFormattingUtils.convertKeyIdToHex(unknownKeyId), null); ArrayList selectedEntries = new ArrayList<>(); selectedEntries.add(keyEntry); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java index 69a3b25a1..9c46d2725 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java @@ -769,7 +769,7 @@ public class DecryptListFragment { ParcelableKeyRing keyEntry = ParcelableKeyRing.createFromReference(null, - KeyFormattingUtils.convertKeyIdToHex(unknownKeyId), null, null); + KeyFormattingUtils.convertKeyIdToHex(unknownKeyId), null); ArrayList selectedEntries = new ArrayList<>(); selectedEntries.add(keyEntry); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java index a5eb1aa01..9e76ace80 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java @@ -223,7 +223,7 @@ public class ImportKeysProxyActivity extends FragmentActivity } public void importKeysFromFingerprint(byte[] fingerprint) { - ParcelableKeyRing keyEntry = ParcelableKeyRing.createFromReference(fingerprint, null, null, null); + ParcelableKeyRing keyEntry = ParcelableKeyRing.createFromReference(fingerprint, null, null); ArrayList selectedEntries = new ArrayList<>(); selectedEntries.add(keyEntry); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyKeybaseFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyKeybaseFragment.java deleted file mode 100644 index 70fb46e70..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyKeybaseFragment.java +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.ui; - - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; - -import android.arch.lifecycle.ViewModelProviders; -import android.content.Intent; -import android.graphics.Typeface; -import android.os.AsyncTask; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.text.SpannableStringBuilder; -import android.text.Spanned; -import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; -import android.text.style.StyleSpan; -import android.text.style.URLSpan; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TableLayout; -import android.widget.TableRow; -import android.widget.TextView; - -import com.textuality.keybase.lib.KeybaseException; -import com.textuality.keybase.lib.KeybaseQuery; -import com.textuality.keybase.lib.Proof; -import com.textuality.keybase.lib.User; -import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; -import org.sufficientlysecure.keychain.network.OkHttpKeybaseClient; -import org.sufficientlysecure.keychain.network.orbot.OrbotHelper; -import org.sufficientlysecure.keychain.operations.results.KeybaseVerificationResult; -import org.sufficientlysecure.keychain.service.KeybaseVerificationParcel; -import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; -import org.sufficientlysecure.keychain.ui.keyview.UnifiedKeyInfoViewModel; -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import org.sufficientlysecure.keychain.util.ParcelableProxy; -import org.sufficientlysecure.keychain.util.Preferences; - -public class ViewKeyKeybaseFragment extends Fragment implements - CryptoOperationHelper.Callback { - private TextView mReportHeader; - private TableLayout mProofListing; - private LayoutInflater mInflater; - private View mProofVerifyHeader; - private TextView mProofVerifyDetail; - - private Proof mProof; - - // for CryptoOperationHelper,Callback - private String mKeybaseProof; - private String mKeybaseFingerprint; - private CryptoOperationHelper mKeybaseOpHelper; - - /** - * Creates new instance of this fragment - */ - public static ViewKeyKeybaseFragment newInstance() { - return new ViewKeyKeybaseFragment(); - } - - @Override - public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.view_key_adv_keybase_fragment, viewGroup, false); - mInflater = inflater; - - mReportHeader = view.findViewById(R.id.view_key_trust_cloud_narrative); - mProofListing = view.findViewById(R.id.view_key_proof_list); - mProofVerifyHeader = view.findViewById(R.id.view_key_proof_verify_header); - mProofVerifyDetail = view.findViewById(R.id.view_key_proof_verify_detail); - mReportHeader.setVisibility(View.GONE); - mProofListing.setVisibility(View.GONE); - mProofVerifyHeader.setVisibility(View.GONE); - mProofVerifyDetail.setVisibility(View.GONE); - - return view; - } - - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - - UnifiedKeyInfoViewModel viewKeyViewModel = ViewModelProviders.of(requireActivity()).get(UnifiedKeyInfoViewModel.class); - viewKeyViewModel.getUnifiedKeyInfoLiveData(requireContext()).observe(this, this::onLoadUnifiedKeyInfo); - } - - private void onLoadUnifiedKeyInfo(UnifiedKeyInfo unifiedKeyInfo) { - if (unifiedKeyInfo == null) { - return; - } - String fingerprint = KeyFormattingUtils.convertFingerprintToHex(unifiedKeyInfo.fingerprint()); - startSearch(fingerprint); - } - - private void startSearch(final String fingerprint) { - final ParcelableProxy parcelableProxy = - Preferences.getPreferences(getActivity()).getParcelableProxy(); - - OrbotHelper.DialogActions dialogActions = new OrbotHelper.DialogActions() { - @Override - public void onOrbotStarted() { - new DescribeKey(parcelableProxy).execute(fingerprint); - } - - @Override - public void onNeutralButton() { - new DescribeKey(ParcelableProxy.getForNoProxy()) - .execute(fingerprint); - } - - @Override - public void onCancel() { - - } - }; - - if (OrbotHelper.putOrbotInRequiredState(dialogActions, getActivity())) { - new DescribeKey(parcelableProxy).execute(fingerprint); - } - } - - class ResultPage { - String mHeader; - final List mProofs; - - ResultPage(String header, List proofs) { - mHeader = header; - mProofs = proofs; - } - } - - /** - * look for evidence from keybase in the background, make tabular version of result - */ - private class DescribeKey extends AsyncTask { - ParcelableProxy mParcelableProxy; - - DescribeKey(ParcelableProxy parcelableProxy) { - mParcelableProxy = parcelableProxy; - } - - @Override - protected ResultPage doInBackground(String... args) { - String fingerprint = args[0]; - - final ArrayList proofList = new ArrayList<>(); - final Hashtable> proofs = new Hashtable<>(); - try { - KeybaseQuery keybaseQuery = new KeybaseQuery(new OkHttpKeybaseClient()); - keybaseQuery.setProxy(mParcelableProxy.getProxy()); - User keybaseUser = User.findByFingerprint(keybaseQuery, fingerprint); - for (Proof proof : keybaseUser.getProofs()) { - Integer proofType = proof.getType(); - appendIfOK(proofs, proofType, proof); - } - - // a one-liner in a modern programming language - for (Integer proofType : proofs.keySet()) { - Proof[] x = {}; - Proof[] proofsFor = proofs.get(proofType).toArray(x); - if (proofsFor.length > 0) { - SpannableStringBuilder ssb = new SpannableStringBuilder(); - int i = 0; - while (i < proofsFor.length - 1) { - appendProofLinks(ssb, fingerprint, proofsFor[i]); - ssb.append(", "); - i++; - } - appendProofLinks(ssb, fingerprint, proofsFor[i]); - proofList.add(formatSpannableString(ssb, getProofNarrative(proofType))); - } - } - - } catch (KeybaseException ignored) { - } - - String prefix = ""; - if (isAdded()) { - prefix = getString(R.string.key_trust_results_prefix); - } - - return new ResultPage(prefix, proofList); - } - - private SpannableStringBuilder formatSpannableString(SpannableStringBuilder proofLinks, String proofType) { - //Formatting SpannableStringBuilder with String.format() causes the links to stop working. - //This method is to insert the links while reserving the links - - SpannableStringBuilder ssb = new SpannableStringBuilder(); - ssb.append(proofType); - if (proofType.contains("%s")) { - int i = proofType.indexOf("%s"); - ssb.replace(i, i + 2, proofLinks); - } else ssb.append(proofLinks); - - return ssb; - } - - private void appendProofLinks(SpannableStringBuilder ssb, final String fingerprint, final Proof proof) throws KeybaseException { - int startAt = ssb.length(); - String handle = proof.getHandle(); - ssb.append(handle); - ssb.setSpan(new URLSpan(proof.getServiceUrl()), startAt, startAt + handle.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - if (haveProofFor(proof.getType())) { - ssb.append("\u00a0["); - startAt = ssb.length(); - String verify = ""; - if (isAdded()) { - verify = getString(R.string.keybase_verify); - } - ssb.append(verify); - ClickableSpan clicker = new ClickableSpan() { - @Override - public void onClick(View view) { - verify(proof, fingerprint); - } - }; - ssb.setSpan(clicker, startAt, startAt + verify.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - ssb.append("]"); - } - } - - @Override - protected void onPostExecute(ResultPage result) { - super.onPostExecute(result); - // stop if fragment is no longer added to an activity - if(!isAdded()) { - return; - } - - if (result.mProofs.isEmpty()) { - result.mHeader = requireActivity().getString(R.string.key_trust_no_cloud_evidence); - } - - mReportHeader.setVisibility(View.VISIBLE); - mProofListing.setVisibility(View.VISIBLE); - mReportHeader.setText(result.mHeader); - - int rowNumber = 1; - for (CharSequence s : result.mProofs) { - TableRow row = (TableRow) mInflater.inflate(R.layout.view_key_adv_keybase_proof, null); - TextView number = row.findViewById(R.id.proof_number); - TextView text = row.findViewById(R.id.proof_text); - number.setText(Integer.toString(rowNumber++) + ". "); - text.setText(s); - text.setMovementMethod(LinkMovementMethod.getInstance()); - mProofListing.addView(row); - } - } - } - - private String getProofNarrative(int proofType) { - int stringIndex; - switch (proofType) { - case Proof.PROOF_TYPE_TWITTER: - stringIndex = R.string.keybase_narrative_twitter; - break; - case Proof.PROOF_TYPE_GITHUB: - stringIndex = R.string.keybase_narrative_github; - break; - case Proof.PROOF_TYPE_DNS: - stringIndex = R.string.keybase_narrative_dns; - break; - case Proof.PROOF_TYPE_WEB_SITE: - stringIndex = R.string.keybase_narrative_web_site; - break; - case Proof.PROOF_TYPE_HACKERNEWS: - stringIndex = R.string.keybase_narrative_hackernews; - break; - case Proof.PROOF_TYPE_COINBASE: - stringIndex = R.string.keybase_narrative_coinbase; - break; - case Proof.PROOF_TYPE_REDDIT: - stringIndex = R.string.keybase_narrative_reddit; - break; - default: - stringIndex = R.string.keybase_narrative_unknown; - } - - if (isAdded()) { - return getString(stringIndex); - } else { - return ""; - } - } - - private void appendIfOK(Hashtable> table, Integer proofType, Proof proof) { - ArrayList list = table.get(proofType); - if (list == null) { - list = new ArrayList<>(); - table.put(proofType, list); - } - list.add(proof); - } - - // which proofs do we have working verifiers for? - private boolean haveProofFor(int proofType) { - switch (proofType) { - case Proof.PROOF_TYPE_TWITTER: - return true; - case Proof.PROOF_TYPE_GITHUB: - return true; - case Proof.PROOF_TYPE_DNS: - return true; - case Proof.PROOF_TYPE_WEB_SITE: - return true; - case Proof.PROOF_TYPE_HACKERNEWS: - return true; - case Proof.PROOF_TYPE_COINBASE: - return true; - case Proof.PROOF_TYPE_REDDIT: - return true; - default: - return false; - } - } - - private void verify(final Proof proof, final String fingerprint) { - - mProof = proof; - mKeybaseProof = proof.toString(); - mKeybaseFingerprint = fingerprint; - - mProofVerifyDetail.setVisibility(View.GONE); - - mKeybaseOpHelper = new CryptoOperationHelper<>(1, this, this, - R.string.progress_verifying_signature); - mKeybaseOpHelper.cryptoOperation(); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (mKeybaseOpHelper != null) { - mKeybaseOpHelper.handleActivityResult(requestCode, resultCode, data); - } - } - - // CryptoOperationHelper.Callback methods - @Override - public KeybaseVerificationParcel createOperationInput() { - return new KeybaseVerificationParcel(mKeybaseProof, mKeybaseFingerprint); - } - - @Override - public void onCryptoOperationSuccess(KeybaseVerificationResult result) { - - result.createNotify(getActivity()).show(); - - String proofUrl = result.mProofUrl; - String presenceUrl = result.mPresenceUrl; - String presenceLabel = result.mPresenceLabel; - - Proof proof = mProof; // TODO: should ideally be contained in result - - String proofLabel; - switch (proof.getType()) { - case Proof.PROOF_TYPE_TWITTER: - proofLabel = getString(R.string.keybase_twitter_proof); - break; - case Proof.PROOF_TYPE_DNS: - proofLabel = getString(R.string.keybase_dns_proof); - break; - case Proof.PROOF_TYPE_WEB_SITE: - proofLabel = getString(R.string.keybase_web_site_proof); - break; - case Proof.PROOF_TYPE_GITHUB: - proofLabel = getString(R.string.keybase_github_proof); - break; - case Proof.PROOF_TYPE_REDDIT: - proofLabel = getString(R.string.keybase_reddit_proof); - break; - default: - proofLabel = getString(R.string.keybase_a_post); - break; - } - - SpannableStringBuilder ssb = new SpannableStringBuilder(); - - ssb.append(getString(R.string.keybase_proof_succeeded)); - StyleSpan bold = new StyleSpan(Typeface.BOLD); - ssb.setSpan(bold, 0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - ssb.append("\n\n"); - int length = ssb.length(); - ssb.append(proofLabel); - if (proofUrl != null) { - URLSpan postLink = new URLSpan(proofUrl); - ssb.setSpan(postLink, length, length + proofLabel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - } - if (Proof.PROOF_TYPE_DNS == proof.getType()) { - ssb.append(" ").append(getString(R.string.keybase_for_the_domain)).append(" "); - } else { - ssb.append(" ").append(getString(R.string.keybase_fetched_from)).append(" "); - } - length = ssb.length(); - URLSpan presenceLink = new URLSpan(presenceUrl); - ssb.append(presenceLabel); - ssb.setSpan(presenceLink, length, length + presenceLabel.length(), Spanned - .SPAN_EXCLUSIVE_EXCLUSIVE); - if (Proof.PROOF_TYPE_REDDIT == proof.getType()) { - ssb.append(", "). - append(getString(R.string.keybase_reddit_attribution)). - append(" “").append(proof.getHandle()).append("”, "); - } - ssb.append(" ").append(getString(R.string.keybase_contained_signature)); - - displaySpannableResult(ssb); - } - - @Override - public void onCryptoOperationCancelled() { - - } - - @Override - public void onCryptoOperationError(KeybaseVerificationResult result) { - result.createNotify(getActivity()).show(); - - SpannableStringBuilder ssb = new SpannableStringBuilder(); - - ssb.append(getString(R.string.keybase_proof_failure)); - String msg = getString(result.getLog().getLast().mType.mMsgId); - if (msg == null) { - msg = getString(R.string.keybase_unknown_proof_failure); - } - StyleSpan bold = new StyleSpan(Typeface.BOLD); - ssb.setSpan(bold, 0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - ssb.append("\n\n").append(msg); - - displaySpannableResult(ssb); - } - - @Override - public boolean onCryptoSetProgress(String msg, int progress, int max) { - return false; - } - - private void displaySpannableResult(SpannableStringBuilder ssb) { - mProofVerifyHeader.setVisibility(View.VISIBLE); - mProofVerifyDetail.setVisibility(View.VISIBLE); - mProofVerifyDetail.setMovementMethod(LinkMovementMethod.getInstance()); - mProofVerifyDetail.setText(ssb); - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java index bcb13376c..eb3b722ff 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java @@ -24,15 +24,16 @@ import java.util.Date; import java.util.List; import android.content.Intent; -import android.databinding.DataBindingUtil; -import android.support.v4.app.FragmentActivity; -import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.RecyclerView; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.daos.KeyRepository; import org.sufficientlysecure.keychain.databinding.ImportKeysListItemBinding; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; @@ -45,7 +46,6 @@ import org.sufficientlysecure.keychain.operations.ImportOperation; import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing; import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing.VerificationStatus; -import org.sufficientlysecure.keychain.daos.KeyRepository; import org.sufficientlysecure.keychain.service.ImportKeyringParcel; import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity; @@ -308,10 +308,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter realUserIdsPlusKeybase = keyRing.getUnorderedUserIds(); - realUserIdsPlusKeybase.addAll(entry.getKeybaseUserIds()); - entry.setUserIds(realUserIdsPlusKeybase); + entry.setUserIds(keyRing.getUnorderedUserIds()); } private class KeyState { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java index 29ab5d785..b00229746 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/ViewKeyActivity.java @@ -92,7 +92,6 @@ import org.sufficientlysecure.keychain.ui.MainActivity; import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity; import org.sufficientlysecure.keychain.ui.QrCodeViewActivity; import org.sufficientlysecure.keychain.ui.ViewKeyAdvActivity; -import org.sufficientlysecure.keychain.ui.ViewKeyKeybaseFragment; import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity; import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment; @@ -289,11 +288,6 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity { ViewKeyFragment frag = ViewKeyFragment.newInstance(); manager.beginTransaction().replace(R.id.view_key_fragment, frag, "view_key_fragment").commit(); - - if (Preferences.getPreferences(this).getExperimentalEnableKeybase()) { - final ViewKeyKeybaseFragment keybaseFrag = ViewKeyKeybaseFragment.newInstance(); - manager.beginTransaction().replace(R.id.view_key_keybase_fragment, keybaseFrag).commit(); - } } @Override @@ -890,7 +884,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity { HkpKeyserverAddress preferredKeyserver = Preferences.getPreferences(getApplicationContext()).getPreferredKeyserver(); ParcelableKeyRing keyEntry = - ParcelableKeyRing.createFromReference(unifiedKeyInfo.fingerprint(), null, null, null); + ParcelableKeyRing.createFromReference(unifiedKeyInfo.fingerprint(), null, null); return ImportKeyringParcel .createImportKeyringParcel(Collections.singletonList(keyEntry), preferredKeyserver); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java index 1a44d9dba..cd9a4caea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java @@ -65,7 +65,8 @@ public class EmailKeyHelper { // Put them in a list and import ArrayList keys = new ArrayList<>(entries.size()); for (ImportKeysListEntry entry : entries) { - keys.add(ParcelableKeyRing.createFromReference(entry.getFingerprint(), entry.getKeyIdHex(), null, null)); + keys.add(ParcelableKeyRing.createFromReference(entry.getFingerprint(), entry.getKeyIdHex(), + null)); } mKeyList = keys; mKeyserver = keyserver; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index cba8ed888..c39b48b2f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -330,7 +330,6 @@ public class Preferences { public CloudSearchPrefs getCloudSearchPrefs() { return CloudSearchPrefs.create(mSharedPreferences.getBoolean(Pref.SEARCH_KEYSERVER, true), - mSharedPreferences.getBoolean(Pref.SEARCH_KEYBASE, true), false, mSharedPreferences.getBoolean(Pref.SEARCH_WEB_KEY_DIRECTORY, true), getPreferredKeyserver()); @@ -387,7 +386,6 @@ public class Preferences { @AutoValue public static abstract class CloudSearchPrefs implements Parcelable { public abstract boolean isKeyserverEnabled(); - public abstract boolean isKeybaseEnabled(); public abstract boolean isFacebookEnabled(); public abstract boolean isWebKeyDirectoryEnabled(); @@ -396,31 +394,29 @@ public class Preferences { /** * @param searchKeyserver should passed keyserver be searched - * @param searchKeybase should keybase.io be searched * @param searchFacebook should Facebook be searched * @param searchWebKeyDirectory should WKD be searched * @param keyserver the keyserver url authority to search on */ - public static CloudSearchPrefs create(boolean searchKeyserver, boolean searchKeybase, + public static CloudSearchPrefs create(boolean searchKeyserver, boolean searchFacebook, boolean searchWebKeyDirectory, @Nullable HkpKeyserverAddress keyserver) { return new AutoValue_Preferences_CloudSearchPrefs(searchKeyserver, - searchKeybase, searchFacebook, searchWebKeyDirectory, keyserver); } public static CloudSearchPrefs createWebKeyDirectoryOnly() { - return create(false, false, false, true, null); + return create(false, false, true, null); } public static CloudSearchPrefs createKeyserverOnly(HkpKeyserverAddress keyserver) { - return create(true, false, false, false, keyserver); + return create(true, false, false, keyserver); } public static CloudSearchPrefs createSocialOnly() { - return create(false, true, true, false, null); + return create(false, true, false, null); } } @@ -432,10 +428,6 @@ public class Preferences { // experimental prefs - public boolean getExperimentalEnableKeybase() { - return mSharedPreferences.getBoolean(Pref.EXPERIMENTAL_ENABLE_KEYBASE, false); - } - public boolean getExperimentalUsbAllowUntested() { return mSharedPreferences.getBoolean(Pref.EXPERIMENTAL_USB_ALLOW_UNTESTED, false); } diff --git a/OpenKeychain/src/main/res/layout/view_key_activity.xml b/OpenKeychain/src/main/res/layout/view_key_activity.xml index 62f34b366..019a871ee 100644 --- a/OpenKeychain/src/main/res/layout/view_key_activity.xml +++ b/OpenKeychain/src/main/res/layout/view_key_activity.xml @@ -205,11 +205,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - "No proof from the Internet on this key’s trustworthiness." "Start search" - "Keybase.io offers “proofs” which assert that the owner of this key: " - - - "Posts to Twitter as %s" - "Is known on GitHub as %s" - "Controls the domain name(s) %s" - "Can post to the Web site(s) %s" - "Posts to Reddit as %s" - "Is known on Coinbase as %s" - "Posts to Hacker News as %s" - "Unknown proof type %s" - "Unfortunately this proof cannot be verified." - "Unrecognized problem with proof checker" - "Problem with proof" - "Key fingerprint doesn’t match that in proof post" - "DNS TXT Record retrieval failed" - "No proof checker found for" - "Decrypted proof post does not match expected value" - "Fetching proof" - "This proof has been verified!" - "A post" - "fetched from" - "for the domain" - "contains a message which could only have been created by the owner of this key." - "A tweet" - "A DNS TXT record" - "A text file" - "A gist" - "A JSON file" - "attributed by Reddit to" - "Verify" "Change Password" @@ -1334,7 +1297,6 @@ "Key not found!" "Could not retrieve key from keyservers: %s" "Cannot import secret key from keyserver!" - "Retrieving from keybase.io: %s" "Retrieving from Facebook: %s" "Retrieving from keyserver: %s" "Key retrieval successful" @@ -1437,15 +1399,6 @@ "An error occurred when searching for keys." - - "Attempting keybase verification for %s" - "No proof checker found for %s" - "Problem with fetching proof" - "Key fingerprint doesn’t match that in proof post" - "DNS TXT Record retrieval failed" - "%s" - "Decrypted proof post does not match expected value" - "Parsing the MIME structure" "MIME parsing failed" diff --git a/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml b/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml index 6c5540098..3b798f1ce 100644 --- a/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml +++ b/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml @@ -9,11 +9,6 @@ android:dependency="search_keyserver_pref" android:key="keyServers" android:title="@string/label_keyservers" /> - - - Date: Fri, 15 Nov 2019 11:55:00 +0100 Subject: [PATCH 04/19] re-merge libkeychain --- OpenKeychain/build.gradle | 1 - .../AuthenticationSignatureGenerator.java | 0 .../jcajce/JcaSkipMarkerPGPObjectFactory.java | 0 .../jcajce/CachingDataDecryptorFactory.java | 0 ...DsaAuthenticationContentSignerBuilder.java | 0 .../NfcSyncPGPContentSignerBuilder.java | 2 - .../SessionKeySecretKeyDecryptorBuilder.java | 0 .../analytics/AnalyticsConsentRequester.java | 1 - .../ui/RequestKeyPermissionActivity.java | 2 - .../keychain/securitytoken/NfcTransport.java | 3 -- .../service/ContactSyncAdapterService.java | 1 - .../keychain/ui/BackupCodeFragment.java | 2 - .../ui/CertifyFingerprintActivity.java | 3 -- .../CreateSecurityTokenAlgorithmFragment.java | 1 - .../ui/CreateSecurityTokenPinFragment.java | 1 - .../ui/EncryptModeAsymmetricFragment.java | 4 -- .../keychain/ui/EncryptTextActivity.java | 3 -- .../SettingsSmartPGPAuthoritiesActivity.java | 6 +-- .../ui/adapter/FlexibleKeyHeader.java | 1 - .../keychain/ui/adapter/SubkeyAddedItem.java | 7 ---- .../ui/keyview/view/IdentitiesCardView.java | 1 - .../ui/transfer/view/TransferFragment.java | 1 - .../keychain/ui/util/FormattingUtils.java | 3 -- .../keychain/util/CharsetVerifier.java | 0 .../keychain/util/CountingOutputStream.java | 0 .../keychain/util/FileHelper.java | 1 - .../keychain/util/InputData.java | 0 .../keychain/util/IterableIterator.java | 0 .../keychain/util/IteratorWithSize.java | 0 .../keychain/util/PRNGFixes.java | 1 - .../util/PositionAwareInputStream.java | 0 .../keychain/util/Utf8Util.java | 4 +- libkeychain/.gitignore | 33 --------------- libkeychain/build.gradle | 40 ------------------- libkeychain/src/main/AndroidManifest.xml | 2 - .../keychain/LibConstants.java | 31 -------------- settings.gradle | 1 - 37 files changed, 3 insertions(+), 153 deletions(-) rename {libkeychain => OpenKeychain}/src/main/java/org/bouncycastle/openpgp/AuthenticationSignatureGenerator.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/bouncycastle/openpgp/jcajce/JcaSkipMarkerPGPObjectFactory.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/bouncycastle/openpgp/operator/jcajce/CachingDataDecryptorFactory.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/bouncycastle/openpgp/operator/jcajce/EdDsaAuthenticationContentSignerBuilder.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java (98%) rename {libkeychain => OpenKeychain}/src/main/java/org/bouncycastle/openpgp/operator/jcajce/SessionKeySecretKeyDecryptorBuilder.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/InputData.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/IteratorWithSize.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java (100%) rename {libkeychain => OpenKeychain}/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java (94%) delete mode 100644 libkeychain/.gitignore delete mode 100644 libkeychain/build.gradle delete mode 100644 libkeychain/src/main/AndroidManifest.xml delete mode 100644 libkeychain/src/main/java/org/sufficientlysecure/keychain/LibConstants.java diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 3470bf6a7..e56e302fd 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -53,7 +53,6 @@ dependencies { implementation 'org.piwik.sdk:piwik-sdk:3.0.3' // libs as submodules - implementation project(':libkeychain') implementation project(':openpgp-api-lib') implementation project(':nfcsweetspot') implementation project(':sshauthentication-api') diff --git a/libkeychain/src/main/java/org/bouncycastle/openpgp/AuthenticationSignatureGenerator.java b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/AuthenticationSignatureGenerator.java similarity index 100% rename from libkeychain/src/main/java/org/bouncycastle/openpgp/AuthenticationSignatureGenerator.java rename to OpenKeychain/src/main/java/org/bouncycastle/openpgp/AuthenticationSignatureGenerator.java diff --git a/libkeychain/src/main/java/org/bouncycastle/openpgp/jcajce/JcaSkipMarkerPGPObjectFactory.java b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/jcajce/JcaSkipMarkerPGPObjectFactory.java similarity index 100% rename from libkeychain/src/main/java/org/bouncycastle/openpgp/jcajce/JcaSkipMarkerPGPObjectFactory.java rename to OpenKeychain/src/main/java/org/bouncycastle/openpgp/jcajce/JcaSkipMarkerPGPObjectFactory.java diff --git a/libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/CachingDataDecryptorFactory.java b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/CachingDataDecryptorFactory.java similarity index 100% rename from libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/CachingDataDecryptorFactory.java rename to OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/CachingDataDecryptorFactory.java diff --git a/libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/EdDsaAuthenticationContentSignerBuilder.java b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/EdDsaAuthenticationContentSignerBuilder.java similarity index 100% rename from libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/EdDsaAuthenticationContentSignerBuilder.java rename to OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/EdDsaAuthenticationContentSignerBuilder.java diff --git a/libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java similarity index 98% rename from libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java rename to OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java index 584d86891..e38e70c21 100644 --- a/libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java +++ b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/NfcSyncPGPContentSignerBuilder.java @@ -16,8 +16,6 @@ import org.bouncycastle.openpgp.operator.PGPDigestCalculator; import java.io.OutputStream; import java.nio.ByteBuffer; import java.security.Provider; -import java.util.Date; -import java.util.HashMap; import java.util.Map; diff --git a/libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/SessionKeySecretKeyDecryptorBuilder.java b/OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/SessionKeySecretKeyDecryptorBuilder.java similarity index 100% rename from libkeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/SessionKeySecretKeyDecryptorBuilder.java rename to OpenKeychain/src/main/java/org/bouncycastle/openpgp/operator/jcajce/SessionKeySecretKeyDecryptorBuilder.java diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/analytics/AnalyticsConsentRequester.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/analytics/AnalyticsConsentRequester.java index 0ff1778f8..15fe9a304 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/analytics/AnalyticsConsentRequester.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/analytics/AnalyticsConsentRequester.java @@ -13,7 +13,6 @@ import android.text.method.LinkMovementMethod; import android.widget.TextView; import org.sufficientlysecure.keychain.BuildConfig; -import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.KeychainApplication; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.SettingsActivity; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java index 934ea70aa..a98a239a9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java @@ -36,9 +36,7 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; -import org.openintents.openpgp.util.OpenPgpUtils.UserId; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; import org.sufficientlysecure.keychain.remote.ui.RequestKeyPermissionPresenter.RequestKeyPermissionMvpView; import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder; import org.sufficientlysecure.keychain.ui.util.KeyInfoFormatter; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java index 0aedc45dd..ac67676b3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java @@ -19,13 +19,10 @@ package org.sufficientlysecure.keychain.securitytoken; import android.nfc.Tag; import android.support.annotation.Nullable; -import android.util.Log; -import org.bouncycastle.util.encoders.Hex; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TokenType; import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TransportType; -import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity; import java.io.IOException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java index b87cc8591..00acb8952 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java @@ -18,7 +18,6 @@ package org.sufficientlysecure.keychain.service; -import android.Manifest; import android.accounts.Account; import android.app.PendingIntent; import android.app.Service; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java index 3911a0f67..d8699a078 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java @@ -35,8 +35,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.TextView; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java index 6c958bf5b..6b4fc964e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java @@ -18,10 +18,7 @@ package org.sufficientlysecure.keychain.ui; import android.arch.lifecycle.ViewModelProviders; -import android.content.Intent; -import android.net.Uri; import android.os.Bundle; -import android.view.View; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.base.BaseActivity; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java index 834120530..31708ae04 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java @@ -32,7 +32,6 @@ import android.widget.TextView; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.securitytoken.KeyFormat; -import org.sufficientlysecure.keychain.securitytoken.SecurityTokenConnection; import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction; import org.sufficientlysecure.keychain.util.Choice; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java index 883ad4dfa..03300baa7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java @@ -30,7 +30,6 @@ import android.widget.TextView; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.securitytoken.SecurityTokenConnection; import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction; import org.sufficientlysecure.keychain.util.Passphrase; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java index 99caf6076..e95c7a226 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java @@ -42,12 +42,8 @@ import org.sufficientlysecure.keychain.livedata.GenericLiveData; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; import org.sufficientlysecure.keychain.ui.chips.EncryptRecipientChipsInput; import org.sufficientlysecure.keychain.ui.chips.EncryptRecipientChipsInput.EncryptRecipientChip; -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; -import org.sufficientlysecure.keychain.ui.util.Notify; -import org.sufficientlysecure.keychain.ui.util.Notify.Style; import org.sufficientlysecure.keychain.ui.widget.KeySpinner; import org.sufficientlysecure.keychain.util.Passphrase; -import timber.log.Timber; public class EncryptModeAsymmetricFragment extends EncryptModeFragment { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 6ff7bfbc3..2775ea320 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -22,10 +22,8 @@ import java.io.IOException; import android.app.Activity; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; -import android.util.Log; import android.widget.Toast; import org.apache.james.mime4j.util.MimeUtil; @@ -34,7 +32,6 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify.Style; import org.sufficientlysecure.keychain.util.FileHelper; -import timber.log.Timber; public class EncryptTextActivity extends EncryptActivity { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsSmartPGPAuthoritiesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsSmartPGPAuthoritiesActivity.java index 84c894c04..6810e6fff 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsSmartPGPAuthoritiesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsSmartPGPAuthoritiesActivity.java @@ -27,13 +27,9 @@ import org.sufficientlysecure.keychain.ui.base.BaseActivity; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.IOException; import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; + public class SettingsSmartPGPAuthoritiesActivity extends BaseActivity { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/FlexibleKeyHeader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/FlexibleKeyHeader.java index 2c2327e98..554fdb828 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/FlexibleKeyHeader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/FlexibleKeyHeader.java @@ -7,7 +7,6 @@ import android.view.View; import android.widget.TextView; import eu.davidea.flexibleadapter.FlexibleAdapter; -import eu.davidea.flexibleadapter.items.AbstractHeaderItem; import eu.davidea.flexibleadapter.items.IFlexible; import eu.davidea.flexibleadapter.items.IHeader; import eu.davidea.viewholders.FlexibleViewHolder; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeyAddedItem.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeyAddedItem.java index c56c56c34..1bf5f6761 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeyAddedItem.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeyAddedItem.java @@ -18,27 +18,20 @@ package org.sufficientlysecure.keychain.ui.adapter; -import java.util.Calendar; import java.util.Date; import java.util.List; -import java.util.TimeZone; -import android.content.Context; -import android.graphics.Typeface; -import android.text.format.DateFormat; import android.view.View; import eu.davidea.flexibleadapter.FlexibleAdapter; import eu.davidea.flexibleadapter.items.AbstractFlexibleItem; import eu.davidea.flexibleadapter.items.IFlexible; -import org.bouncycastle.bcpg.sig.KeyFlags; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType; import org.sufficientlysecure.keychain.service.SaveKeyringParcel.SubkeyAdd; import org.sufficientlysecure.keychain.ui.SubKeyItem.SubkeyViewHolder; import org.sufficientlysecure.keychain.ui.ViewKeyAdvSubkeysFragment; import org.sufficientlysecure.keychain.ui.ViewKeyAdvSubkeysFragment.SubkeyEditViewModel; -import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; public class SubkeyAddedItem extends AbstractFlexibleItem { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java index aaedd2daa..1901f1d8c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java @@ -26,7 +26,6 @@ import android.support.v7.widget.RecyclerView.AdapterDataObserver; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.widget.Button; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.adapter.IdentityAdapter; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java index 6a8e0c979..262d13a8b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java @@ -28,7 +28,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.graphics.Bitmap; import android.net.NetworkInfo; -import android.net.Uri; import android.net.wifi.WifiManager; import android.os.Build.VERSION_CODES; import android.os.Bundle; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java index b284a2095..3549ad488 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java @@ -19,9 +19,6 @@ package org.sufficientlysecure.keychain.ui.util; import android.content.Context; import android.content.res.Resources.Theme; -import android.text.SpannableStringBuilder; -import android.text.Spanned; -import android.text.style.StrikethroughSpan; import android.util.TypedValue; public class FormattingUtils { diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java similarity index 100% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java similarity index 100% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java index c816a17d8..3dcbcf271 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java @@ -52,7 +52,6 @@ import android.provider.OpenableColumns; import android.support.v4.app.Fragment; import android.widget.Toast; -import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import timber.log.Timber; diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java similarity index 100% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/InputData.java diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java similarity index 100% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IterableIterator.java diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/IteratorWithSize.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IteratorWithSize.java similarity index 100% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/IteratorWithSize.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IteratorWithSize.java diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/PRNGFixes.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/PRNGFixes.java index 143d222f0..57316e1cd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/PRNGFixes.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/PRNGFixes.java @@ -12,7 +12,6 @@ package org.sufficientlysecure.keychain.util; import android.os.Build; import android.os.Process; -import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java similarity index 100% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/PositionAwareInputStream.java diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java similarity index 94% rename from libkeychain/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java index 10a7c0a67..d6a80e96f 100644 --- a/libkeychain/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Utf8Util.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.util; -import org.sufficientlysecure.keychain.LibConstants; +import org.sufficientlysecure.keychain.Constants; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; @@ -49,7 +49,7 @@ public class Utf8Util { try { return charsetDecoder.decode(ByteBuffer.wrap(input)).toString(); } catch (CharacterCodingException e) { - Log.e(LibConstants.TAG, "Decoding failed!", e); + Log.e(Constants.TAG, "Decoding failed!", e); return charsetDecoder.replacement(); } } diff --git a/libkeychain/.gitignore b/libkeychain/.gitignore deleted file mode 100644 index a44cc0f0f..000000000 --- a/libkeychain/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -#Android specific -bin -gen -obj -lint.xml -local.properties -release.properties -ant.properties -*.class -*.apk - -#Gradle -.gradle -build -gradle.properties - -#Maven -target -pom.xml.* - -#Eclipse -.project -.classpath -.settings -.metadata - -#IntelliJ IDEA -.idea -*.iml - -#Lint output -lint-report.html -lint-report_files/* \ No newline at end of file diff --git a/libkeychain/build.gradle b/libkeychain/build.gradle deleted file mode 100644 index 380bfbd80..000000000 --- a/libkeychain/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -apply plugin: 'com.android.library' - -dependencies { - // NOTE: Always use fixed version codes not dynamic ones, e.g. 0.7.3 instead of 0.7.+, see README for more information - // NOTE: libraries are pinned to a specific build, see below - - // from local Android SDK - compile 'com.android.support:support-v4:27.0.2' - - // libs as submodules - compile project(':openpgp-api-lib') // TODO: get rid of this dependency - compile project(':extern:bouncycastle:core') - compile project(':extern:bouncycastle:pg') - compile project(':extern:bouncycastle:prov') - - // Unit tests in the local JVM with Robolectric - // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html - // http://robolectric.org/getting-started/ - // http://www.vogella.com/tutorials/Robolectric/article.html - testCompile 'junit:junit:4.12' - testCompile ('org.robolectric:robolectric:3.2.2') { - exclude group: 'org.bouncycastle', module: 'bcprov-jdk16' - } - testCompile 'org.mockito:mockito-core:1.10.19' - -} - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion - - defaultConfig { - minSdkVersion 14 - } - - // Do not abort build if lint finds errors - lintOptions { - abortOnError false - } -} diff --git a/libkeychain/src/main/AndroidManifest.xml b/libkeychain/src/main/AndroidManifest.xml deleted file mode 100644 index 6a035abfa..000000000 --- a/libkeychain/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/libkeychain/src/main/java/org/sufficientlysecure/keychain/LibConstants.java b/libkeychain/src/main/java/org/sufficientlysecure/keychain/LibConstants.java deleted file mode 100644 index 6da752417..000000000 --- a/libkeychain/src/main/java/org/sufficientlysecure/keychain/LibConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2017 Dominik Schürmann - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.sufficientlysecure.libkeychain.BuildConfig; - -public final class LibConstants { - - public static final boolean DEBUG = BuildConfig.DEBUG; - - public static final String TAG = DEBUG ? "Keychain D" : "Keychain"; - - public static final String BOUNCY_CASTLE_PROVIDER_NAME = BouncyCastleProvider.PROVIDER_NAME; - -} diff --git a/settings.gradle b/settings.gradle index 0fd4795e3..fe751bf30 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,4 @@ include ':OpenKeychain' -include ':libkeychain' include ':nfcsweetspot' include ':extern:bouncycastle:core' include ':extern:bouncycastle:pg' From 8d0e7af11b308993d0a086592484a241087f3685 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 11:59:04 +0100 Subject: [PATCH 05/19] ditch jacoco --- OpenKeychain/build.gradle | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index e56e302fd..0ec1a8855 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -1,5 +1,4 @@ apply plugin: 'com.android.application' -apply plugin: 'jacoco' apply plugin: 'com.squareup.sqldelight' // apply plugin: 'com.github.kt3k.coveralls' @@ -288,34 +287,6 @@ android { } } -task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugWithTestCoverageUnitTest") { - group = "Reporting" - description = "Generate Jacoco coverage reports" - - classDirectories = fileTree( - dir: "${buildDir}/intermediates/classes/fdroid/debugWithTestCoverage", - excludes: ['**/R.class', - '**/R$*.class', - '**/*$ViewInjector*.*', - '**/BuildConfig.*', - '**/Manifest*.*', - '**/*Activity*.*', - '**/*Fragment*.*'] - ) - - sourceDirectories = files("${buildDir.parent}/src/main/java") - additionalSourceDirs = files([ - "${buildDir}/generated/source/buildConfig/fdroid/debugWithTestCoverage", - "${buildDir}/generated/source/r/fdroid/debugWithTestCoverage" - ]) - executionData = fileTree(dir: "${buildDir}/jacoco", include: "**/*.exec") - - reports { - xml.enabled true - html.enabled true - } -} - // Fix for: No report file available: [/home/travis/build/open-keychain/open-keychain/OpenKeychain/build/reports/cobertura/coverage.xml, /home/travis/build/open-keychain/open-keychain/OpenKeychain/build/reports/jacoco/test/jacocoTestReport.xml] // coveralls { // jacocoReportPath 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml' From d8a84389b812216a29f6c4711760c9871e41de73 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 11:59:14 +0100 Subject: [PATCH 06/19] update gradle wrapper and build tools --- OpenKeychain/build.gradle | 1 - build.gradle | 2 +- extern/MaterialChipsInput/build.gradle | 1 - gradle/wrapper/gradle-wrapper.properties | 2 +- nfcsweetspot/build.gradle | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 0ec1a8855..8918c07f2 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -109,7 +109,6 @@ dependencies { android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion 15 diff --git a/build.gradle b/build.gradle index 527117962..4e3b6cb2c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { dependencies { // NOTE: Always use fixed version codes not dynamic ones, e.g. 0.7.3 instead of 0.7.+, see README for more information - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.5.2' // bintray dependency to satisfy dependency of openpgp-api lib classpath 'com.novoda:bintray-release:0.8.0' classpath 'com.squareup.sqldelight:gradle-plugin:0.7.0' diff --git a/extern/MaterialChipsInput/build.gradle b/extern/MaterialChipsInput/build.gradle index 759457a57..860378783 100644 --- a/extern/MaterialChipsInput/build.gradle +++ b/extern/MaterialChipsInput/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.library' android { compileSdkVersion 27 - buildToolsVersion "27.0.3" defaultConfig { minSdkVersion 15 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 06d481c52..721ad9dfe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip diff --git a/nfcsweetspot/build.gradle b/nfcsweetspot/build.gradle index 144a8145c..47545db9c 100644 --- a/nfcsweetspot/build.gradle +++ b/nfcsweetspot/build.gradle @@ -5,7 +5,6 @@ dependencies { android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion 14 From 47212b68a1550686f31866e2dd2eb91958eebbbb Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 12:03:39 +0100 Subject: [PATCH 07/19] update compile sdk --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 4e3b6cb2c..e11d3df6b 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,5 @@ project(':extern:bouncycastle') { // SDK Version and Build Tools used by all subprojects // See http://tools.android.com/tech-docs/new-build-system/tips#TOC-Controlling-Android-properties-of-all-your-modules-from-the-main-project. ext { - compileSdkVersion = 27 - buildToolsVersion = '27.0.3' + compileSdkVersion = 28 } From 12dce183d125079bd707172878d5809f2b9afcfc Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 12:06:21 +0100 Subject: [PATCH 08/19] update support library --- OpenKeychain/build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 8918c07f2..e18503ead 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -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:27.1.1' - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support:design:27.1.1' - implementation 'com.android.support:recyclerview-v7:27.1.1' - implementation 'com.android.support:cardview-v7:27.1.1' - implementation 'com.android.support:support-annotations:27.1.1' + 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' // JCenter etc. implementation 'com.journeyapps:zxing-android-embedded:3.4.0' From 5cd210831b21f6cee3c5799393059c1ef5dcceae Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 13:40:07 +0100 Subject: [PATCH 09/19] ditch minidns --- .gitmodules | 4 - OpenKeychain/build.gradle | 1 - .../keychain/util/EmailKeyHelper.java | 144 ------------------ extern/minidns | 1 - 4 files changed, 150 deletions(-) delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java delete mode 160000 extern/minidns diff --git a/.gitmodules b/.gitmodules index b4c3f256c..4ab812ef0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,10 +2,6 @@ path = extern/openpgp-api-lib url = https://github.com/open-keychain/openpgp-api.git ignore = dirty -[submodule "extern/minidns"] - path = extern/minidns - url = https://github.com/open-keychain/minidns.git - ignore = dirty [submodule "OpenKeychain/src/test/resources/openpgp-interop"] path = OpenKeychain/src/test/resources/openpgp-interop url = https://github.com/google/openpgp-interop diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index e18503ead..1c9cdcca5 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -58,7 +58,6 @@ dependencies { implementation project(':extern:bouncycastle:core') implementation project(':extern:bouncycastle:pg') implementation project(':extern:bouncycastle:prov') - implementation project(':extern:minidns') implementation project(':extern:MaterialChipsInput') implementation "android.arch.work:work-runtime:1.0.0-alpha02" diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java deleted file mode 100644 index cd9a4caea..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2017 Schürmann & Breitmoser GbR - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.sufficientlysecure.keychain.util; - - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Set; - -import android.content.Context; - -import de.measite.minidns.Client; -import de.measite.minidns.Question; -import de.measite.minidns.Record; -import de.measite.minidns.record.SRV; -import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; -import org.sufficientlysecure.keychain.keyimport.HkpKeyserverClient; -import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; -import org.sufficientlysecure.keychain.keyimport.KeyserverClient; -import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; -import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; -import org.sufficientlysecure.keychain.service.ImportKeyringParcel; -import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; - -public class EmailKeyHelper { - // TODO: Make this not require a proxy in it's constructor, redesign when it is to be used - // to import keys, simply use CryptoOperationHelper with this callback - public abstract class ImportContactKeysCallback - implements CryptoOperationHelper.Callback { - - private ArrayList mKeyList; - private HkpKeyserverAddress mKeyserver; - - public ImportContactKeysCallback(Context context, HkpKeyserverAddress keyserver, - ParcelableProxy proxy) { - this(context, new ContactHelper(context).getContactMails(), keyserver, proxy); - } - - public ImportContactKeysCallback(Context context, List mails, - HkpKeyserverAddress keyserver, ParcelableProxy proxy) { - Set entries = new HashSet<>(); - for (String mail : mails) { - entries.addAll(getEmailKeys(context, mail, proxy)); - } - - // Put them in a list and import - ArrayList keys = new ArrayList<>(entries.size()); - for (ImportKeysListEntry entry : entries) { - keys.add(ParcelableKeyRing.createFromReference(entry.getFingerprint(), entry.getKeyIdHex(), - null)); - } - mKeyList = keys; - mKeyserver = keyserver; - } - - @Override - public ImportKeyringParcel createOperationInput() { - return ImportKeyringParcel.createImportKeyringParcel(mKeyList, mKeyserver); - } - } - - public static Set getEmailKeys(Context context, String mail, - ParcelableProxy proxy) { - Set keys = new HashSet<>(); - - // Try _hkp._tcp SRV record first - String[] mailparts = mail.split("@"); - if (mailparts.length == 2) { - HkpKeyserverAddress hkp = findKeyserverFromDns(mailparts[1]); - if (hkp != null) { - keys.addAll(getEmailKeys(mail, hkp, proxy)); - } - } - - if (keys.isEmpty()) { - // Most users don't have the SRV record, so ask a default server as well - HkpKeyserverAddress server = Preferences.getPreferences(context).getPreferredKeyserver(); - if (server != null) { - keys.addAll(getEmailKeys(mail, server, proxy)); - } - } - return keys; - } - - public static List getEmailKeys(String mail, HkpKeyserverAddress keyServer, - ParcelableProxy proxy) { - Set keys = new HashSet<>(); - try { - for (ImportKeysListEntry key : HkpKeyserverClient - .fromHkpKeyserverAddress(keyServer).search(mail, proxy)) { - if (key.isRevokedOrExpiredOrInsecure()) continue; - for (String userId : key.getUserIds()) { - if (userId.toLowerCase().contains(mail.toLowerCase(Locale.ENGLISH))) { - keys.add(key); - } - } - } - } catch (KeyserverClient.CloudSearchFailureException ignored) { - } - return new ArrayList<>(keys); - } - - public static HkpKeyserverAddress findKeyserverFromDns(String domain) { - try { - Record[] records = new Client().query(new Question("_hkp._tcp." + domain, Record.TYPE.SRV)).getAnswers(); - if (records.length > 0) { - Arrays.sort(records, new Comparator() { - @Override - public int compare(Record lhs, Record rhs) { - if (lhs.getPayload().getType() != Record.TYPE.SRV) return 1; - if (rhs.getPayload().getType() != Record.TYPE.SRV) return -1; - return ((SRV) lhs.getPayload()).getPriority() - ((SRV) rhs.getPayload()).getPriority(); - } - }); - Record record = records[0]; // This is our best choice - if (record.getPayload().getType() == Record.TYPE.SRV) { - SRV payload = (SRV) record.getPayload(); - return HkpKeyserverAddress.createFromUri(payload.getName() + ":" + payload.getPort()); - } - } - } catch (Exception ignored) { - } - return null; - } -} diff --git a/extern/minidns b/extern/minidns deleted file mode 160000 index 969ffd295..000000000 --- a/extern/minidns +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 969ffd2951fcaa07f46b441936a0c0fd4502dafd From 5172002f0e76760e74d23be284afb52793ded6c3 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 15 Nov 2019 12:09:08 +0100 Subject: [PATCH 10/19] migrate to androidx --- OpenKeychain/build.gradle | 42 +- .../keychain/AndroidTestHelpers.java | 20 +- .../keychain/JacocoWorkaroundJUnitRunner.java | 2 +- .../keychain/actions/CustomActions.java | 8 +- .../actions/OrientationChangeAction.java | 10 +- .../keychain/matcher/CustomMatchers.java | 20 +- .../keychain/remote/OpenPgpServiceTest.java | 18 +- .../ui/AsymmetricFileOperationTests.java | 44 +- .../ui/AsymmetricTextOperationTests.java | 26 +- .../keychain/ui/CreateKeyActivityTest.java | 38 +- .../keychain/ui/EditKeyTest.java | 17 +- .../keychain/ui/MiscCryptOperationTests.java | 44 +- .../ui/SymmetricTextOperationTests.java | 42 +- .../widget/EncryptKeyCompletionViewTest.java | 24 +- .../widget/FixedCollapsingToolbarLayout.java | 30 - .../v4/widget/FlingNestedScrollView.java | 1358 ----------------- .../keychain/KeychainApplication.java | 4 +- .../keychain/KeychainDatabase.java | 10 +- .../keychain/NotificationChannelManager.java | 4 +- .../AppCompatPreferenceActivity.java | 10 +- .../compatibility/ClipboardReflection.java | 2 +- .../keychain/daos/AbstractDao.java | 4 +- .../keychain/daos/AutocryptPeerDao.java | 2 +- .../daos/DatabaseBatchInteractor.java | 2 +- .../keychain/daos/KeyRepository.java | 2 +- .../keychain/daos/KeyWritableRepository.java | 6 +- .../keychain/keyimport/CloudSearch.java | 2 +- .../keyimport/FacebookKeyserverClient.java | 4 +- .../keyimport/HkpKeyserverAddress.java | 4 +- .../keyimport/HkpKeyserverClient.java | 2 +- .../keychain/keyimport/ParcelableKeyRing.java | 2 +- .../keyimport/WebKeyDirectoryClient.java | 2 +- .../processing/ImportKeysListCloudLoader.java | 4 +- .../processing/ImportKeysListLoader.java | 4 +- .../keysync/KeyserverSyncManager.java | 55 +- .../keychain/keysync/KeyserverSyncWorker.java | 21 +- .../keychain/model/Certification.java | 2 +- .../keychain/model/CustomColumnAdapters.java | 2 +- .../keychain/model/KeyRingPublic.java | 3 +- .../keychain/model/KeySignature.java | 2 +- .../keychain/model/SubKey.java | 2 +- .../keychain/model/UserPacket.java | 4 +- .../network/KeyTransferInteractor.java | 4 +- .../keychain/network/SktUri.java | 4 +- .../keychain/network/TlsPskCompat.java | 2 +- .../keychain/network/orbot/OrbotHelper.java | 4 +- .../keychain/operations/BackupOperation.java | 4 +- .../keychain/operations/BaseOperation.java | 4 +- .../operations/BenchmarkOperation.java | 2 +- .../keychain/operations/CertifyOperation.java | 2 +- .../operations/ChangeUnlockOperation.java | 2 +- .../keychain/operations/DeleteOperation.java | 2 +- .../keychain/operations/EditKeyOperation.java | 2 +- .../keychain/operations/ImportOperation.java | 4 +- .../operations/InputDataOperation.java | 2 +- .../keychain/operations/KeySyncOperation.java | 2 +- .../operations/PromoteKeyOperation.java | 2 +- .../keychain/operations/RevokeOperation.java | 2 +- .../operations/SignEncryptOperation.java | 2 +- .../keychain/operations/UploadOperation.java | 4 +- .../operations/results/DeleteResult.java | 2 +- .../operations/results/InputDataResult.java | 2 +- .../results/InputPendingResult.java | 2 +- .../operations/results/OperationResult.java | 2 +- .../operations/results/RevokeResult.java | 2 +- .../operations/results/UploadResult.java | 2 +- .../pgp/CanonicalizedPublicKeyRing.java | 2 +- .../pgp/PgpDecryptVerifyInputParcel.java | 2 +- .../pgp/PgpDecryptVerifyOperation.java | 2 +- .../keychain/pgp/PgpHelper.java | 8 +- .../keychain/pgp/PgpKeyOperation.java | 2 +- .../keychain/pgp/PgpSecurityConstants.java | 2 +- .../keychain/pgp/PgpSignEncryptData.java | 2 +- .../pgp/PgpSignEncryptInputParcel.java | 2 +- .../keychain/pgp/PgpSignEncryptOperation.java | 2 +- .../keychain/pgp/SignEncryptParcel.java | 2 +- .../keychain/pgp/UncachedKeyRing.java | 2 +- .../keychain/provider/KeychainProvider.java | 4 +- .../provider/TemporaryFileProvider.java | 20 +- .../keychain/remote/AutocryptInteractor.java | 4 +- .../remote/KeychainExternalProvider.java | 2 +- .../keychain/remote/OpenPgpService.java | 4 +- .../remote/OpenPgpServiceKeyIdExtractor.java | 4 +- .../remote/ui/AppSettingsActivity.java | 2 +- .../AppSettingsAllowedKeysListFragment.java | 6 +- .../keychain/remote/ui/AppsListFragment.java | 14 +- .../remote/ui/RemoteBackupActivity.java | 4 +- .../ui/RemoteDisplayTransferCodeActivity.java | 6 +- .../remote/ui/RemoteRegisterActivity.java | 6 +- .../RemoteSecurityProblemDialogActivity.java | 8 +- .../ui/RequestKeyPermissionActivity.java | 6 +- .../ui/RequestKeyPermissionPresenter.java | 2 +- .../remote/ui/SelectPublicKeyFragment.java | 8 +- .../ui/SelectSignKeyIdListFragment.java | 6 +- .../ui/dialog/DialogKeyChoiceAdapter.java | 6 +- .../ui/dialog/RemoteDeduplicateActivity.java | 18 +- .../ui/dialog/RemoteDeduplicatePresenter.java | 4 +- ...RemoteSelectAuthenticationKeyActivity.java | 20 +- ...emoteSelectAuthenticationKeyPresenter.java | 2 +- .../ui/dialog/RemoteSelectIdKeyActivity.java | 28 +- .../RemoteSelectIdentityKeyPresenter.java | 2 +- .../keychain/securitytoken/NfcTransport.java | 2 +- .../securitytoken/OpenPgpCapabilities.java | 4 +- .../OpenPgpCommandApduFactory.java | 2 +- .../securitytoken/SCP11bSecureMessaging.java | 4 +- .../SecurityTokenConnection.java | 6 +- .../securitytoken/SecurityTokenInfo.java | 4 +- .../keychain/securitytoken/Transport.java | 2 +- .../operations/PsoDecryptTokenOp.java | 4 +- .../SecurityTokenChangeKeyTokenOp.java | 2 +- .../securitytoken/usb/CcidDescription.java | 4 +- .../securitytoken/usb/CcidTransceiver.java | 6 +- .../usb/CcidTransportProtocol.java | 2 +- .../securitytoken/usb/UsbTransport.java | 4 +- .../securitytoken/usb/tpdu/RBlock.java | 2 +- .../usb/tpdu/T0ShortApduProtocol.java | 2 +- .../usb/tpdu/T1ShortApduProtocol.java | 2 +- .../usb/tpdu/T1TpduProtocol.java | 2 +- .../keychain/service/BackupKeyringParcel.java | 2 +- .../service/CertifyActionsParcel.java | 4 +- .../keychain/service/ChangeUnlockParcel.java | 2 +- .../service/ContactSyncAdapterService.java | 7 +- .../keychain/service/ImportKeyringParcel.java | 2 +- .../keychain/service/InputDataParcel.java | 2 +- .../keychain/service/KeychainServiceTask.java | 2 +- .../service/PassphraseCacheService.java | 8 +- .../service/ProgressDialogManager.java | 6 +- .../service/PromoteKeyringParcel.java | 2 +- .../keychain/service/RevokeKeyringParcel.java | 2 +- .../keychain/service/SaveKeyringParcel.java | 2 +- .../keychain/service/UploadKeyringParcel.java | 4 +- .../service/input/CryptoInputParcel.java | 4 +- .../keychain/ssh/AuthenticationData.java | 2 +- .../keychain/ssh/AuthenticationOperation.java | 2 +- .../keychain/ui/BackupActivity.java | 4 +- .../keychain/ui/BackupCodeFragment.java | 6 +- .../keychain/ui/BackupRestoreFragment.java | 6 +- .../ui/CertifyFingerprintActivity.java | 2 +- .../ui/CertifyFingerprintFragment.java | 8 +- .../keychain/ui/CertifyKeyFragment.java | 6 +- .../keychain/ui/CreateKeyActivity.java | 10 +- .../keychain/ui/CreateKeyEmailFragment.java | 10 +- .../keychain/ui/CreateKeyFinalFragment.java | 4 +- .../keychain/ui/CreateKeyNameFragment.java | 4 +- .../keychain/ui/CreateKeyStartFragment.java | 4 +- .../CreateSecurityTokenAlgorithmFragment.java | 4 +- .../ui/CreateSecurityTokenPinFragment.java | 2 +- .../ui/CreateSecurityTokenWaitFragment.java | 6 +- .../keychain/ui/DebugActionsActivity.java | 4 +- .../keychain/ui/DecryptActivity.java | 6 +- .../keychain/ui/DecryptFragment.java | 6 +- .../keychain/ui/DecryptListFragment.java | 10 +- .../keychain/ui/DeleteKeyDialogActivity.java | 8 +- .../keychain/ui/DisplayTextActivity.java | 2 +- .../keychain/ui/DisplayTextFragment.java | 4 +- .../keychain/ui/EditKeyFragment.java | 4 +- .../keychain/ui/EncryptActivity.java | 4 +- .../keychain/ui/EncryptDecryptFragment.java | 4 +- .../keychain/ui/EncryptFilesActivity.java | 2 +- .../keychain/ui/EncryptFilesFragment.java | 12 +- .../ui/EncryptModeAsymmetricFragment.java | 10 +- .../keychain/ui/EncryptModeFragment.java | 2 +- .../keychain/ui/EncryptTextActivity.java | 2 +- .../keychain/ui/HelpAboutFragment.java | 2 +- .../keychain/ui/HelpActivity.java | 4 +- .../keychain/ui/HelpMarkdownFragment.java | 2 +- .../keychain/ui/ImportKeysActivity.java | 6 +- .../keychain/ui/ImportKeysFileFragment.java | 4 +- .../keychain/ui/ImportKeysListFragment.java | 14 +- .../keychain/ui/ImportKeysProxyActivity.java | 2 +- .../keychain/ui/ImportKeysSearchFragment.java | 16 +- .../keychain/ui/KeyListFragment.java | 18 +- .../keychain/ui/LogDisplayFragment.java | 2 +- .../keychain/ui/MainActivity.java | 8 +- .../keychain/ui/MultiUserIdsFragment.java | 10 +- .../ui/OrbotRequiredDialogActivity.java | 4 +- .../keychain/ui/PassphraseDialogActivity.java | 8 +- .../keychain/ui/QrCodeCaptureActivity.java | 8 +- .../keychain/ui/QrCodeViewActivity.java | 6 +- .../ui/RedirectImportKeysActivity.java | 2 +- .../ui/RetryUploadDialogActivity.java | 6 +- .../keychain/ui/SecurityKeyShopFragment.java | 6 +- .../keychain/ui/SettingsActivity.java | 6 +- .../ui/SettingsKeyserverFragment.java | 10 +- .../ui/SettingsSmartPGPAuthorityFragment.java | 8 +- .../keychain/ui/SubKeyItem.java | 2 +- .../keychain/ui/ViewKeyAdvActivity.java | 16 +- .../keychain/ui/ViewKeyAdvShareFragment.java | 14 +- .../keychain/ui/ViewKeyAdvStartFragment.java | 2 +- .../ui/ViewKeyAdvSubkeysFragment.java | 14 +- .../ui/ViewKeyAdvUserIdsFragment.java | 8 +- .../keychain/ui/adapter/FlexibleKeyItem.java | 2 +- .../ui/adapter/FlexibleKeyItemFactory.java | 2 +- .../keychain/ui/adapter/IdentityAdapter.java | 4 +- .../ui/adapter/ImportKeysAdapter.java | 3 + .../keychain/ui/adapter/KeyChoiceAdapter.java | 6 +- .../ui/adapter/MultiUserIdsAdapter.java | 4 +- .../keychain/ui/adapter/NestedLogAdapter.java | 4 +- .../ui/adapter/PagerTabStripAdapter.java | 6 +- .../ui/adapter/SpacesItemDecoration.java | 4 +- .../ui/adapter/SubkeysAddedAdapter.java | 2 +- .../keychain/ui/adapter/UserIdsAdapter.java | 4 +- .../keychain/ui/base/BaseActivity.java | 6 +- .../ui/base/CryptoOperationFragment.java | 4 +- .../ui/base/CryptoOperationHelper.java | 8 +- .../keychain/ui/base/RecyclerFragment.java | 4 +- .../ui/bindings/ImportKeysBindings.java | 2 +- .../ui/bindings/ImportKeysExtraBindings.java | 2 +- .../ui/chips/EncryptRecipientChipAdapter.java | 4 +- .../EncryptRecipientDropdownAdapter.java | 4 +- .../AddEditKeyserverDialogFragment.java | 8 +- ...ddEditSmartPGPAuthorityDialogFragment.java | 8 +- .../ui/dialog/AddEmailDialogFragment.java | 4 +- .../ui/dialog/AddSubkeyDialogFragment.java | 8 +- .../ui/dialog/AddUserIdDialogFragment.java | 4 +- .../AdvancedAppSettingsDialogFragment.java | 4 +- .../ui/dialog/CustomAlertDialogBuilder.java | 2 +- .../ui/dialog/DeleteFileDialogFragment.java | 4 +- .../ui/dialog/EditSubkeyDialogFragment.java | 2 +- .../EditSubkeyExpiryDialogFragment.java | 4 +- .../ui/dialog/EditUserIdDialogFragment.java | 2 +- .../ui/dialog/FidesmoInstallDialog.java | 4 +- .../ui/dialog/FidesmoPgpInstallDialog.java | 4 +- .../ui/dialog/OrbotStartDialogFragment.java | 6 +- .../ui/dialog/ProgressDialogFragment.java | 6 +- .../dialog/SetPassphraseDialogFragment.java | 4 +- .../ui/dialog/ShareLogDialogFragment.java | 4 +- .../dialog/SupportInstallDialogFragment.java | 4 +- .../ui/dialog/UserIdInfoDialogFragment.java | 2 +- .../keychain/ui/keyview/GenericViewModel.java | 4 +- .../ui/keyview/KeyFragmentViewModel.java | 6 +- .../ui/keyview/UnifiedKeyInfoViewModel.java | 4 +- .../keychain/ui/keyview/ViewKeyActivity.java | 22 +- .../keychain/ui/keyview/ViewKeyFragment.java | 16 +- .../ui/keyview/loader/AsyncTaskLiveData.java | 10 +- .../ui/keyview/loader/IdentityDao.java | 4 +- .../ui/keyview/loader/SubkeyStatusDao.java | 2 +- .../ui/keyview/loader/SystemContactDao.java | 2 +- .../ui/keyview/presenter/ViewKeyMvpView.java | 4 +- .../ui/keyview/view/IdentitiesCardView.java | 8 +- .../ui/keyview/view/KeyHealthView.java | 8 +- .../ui/keyview/view/KeyStatusList.java | 6 +- .../ui/keyview/view/KeyserverStatusView.java | 8 +- .../keyview/view/SystemContactCardView.java | 2 +- .../ui/token/ChangePinDialogHelper.java | 6 +- .../ui/token/ManageSecurityTokenFragment.java | 14 +- .../token/ManageSecurityTokenPresenter.java | 2 +- .../token/ManageSecurityTokenViewModel.java | 6 +- .../keychain/ui/token/PublicKeyRetriever.java | 2 +- .../transfer/presenter/TransferPresenter.java | 8 +- .../transfer/view/ReceivedSecretKeyList.java | 6 +- .../ui/transfer/view/TransferFragment.java | 22 +- .../view/TransferNotAvailableFragment.java | 4 +- .../transfer/view/TransferSecretKeyList.java | 8 +- .../ui/util/InstallDialogFragmentHelper.java | 2 +- .../keychain/ui/util/KeyFormattingUtils.java | 2 +- .../keychain/ui/util/KeyInfoFormatter.java | 4 +- .../keychain/ui/util/Notify.java | 4 +- .../keychain/ui/util/PermissionsUtil.java | 4 +- .../recyclerview/DividerItemDecoration.java | 4 +- .../recyclerview/ItemTouchHelperAdapter.java | 4 +- .../ItemTouchHelperDragCallback.java | 4 +- .../ItemTouchHelperViewHolder.java | 4 +- .../RecyclerItemClickListener.java | 2 +- .../keychain/ui/widget/CacheTTLSpinner.java | 4 +- .../ui/widget/ConnectionStatusView.java | 2 +- .../keychain/ui/widget/EmailEditText.java | 2 +- .../ui/widget/KeyChoiceSpinnerAdapter.java | 2 +- .../keychain/ui/widget/KeySpinner.java | 6 +- .../keychain/ui/widget/NameEditText.java | 2 +- .../keychain/ui/widget/PrefixedEditText.java | 4 +- .../ui/widget/ToolableViewAnimator.java | 2 +- .../keychain/util/CharsetVerifier.java | 4 +- .../keychain/util/ContactHelper.java | 2 +- .../keychain/util/CountingOutputStream.java | 2 +- .../keychain/util/DatabaseUtil.java | 2 +- .../keychain/util/FileHelper.java | 2 +- .../util/IntentIntegratorSupportV4.java | 2 +- .../util/Numeric9x4PassphraseUtil.java | 2 +- .../keychain/util/ParcelableHashMap.java | 2 +- .../keychain/util/ParcelableProxy.java | 2 +- .../keychain/util/Preferences.java | 2 +- .../keychain/util/ResourceUtils.java | 6 +- .../keychain/util/ShareKeyHelper.java | 2 +- .../keychain/util/WebKeyDirectoryUtil.java | 2 +- .../main/res/layout/add_keyserver_dialog.xml | 8 +- .../layout/add_smartpgp_authority_dialog.xml | 4 +- .../res/layout/api_app_settings_activity.xml | 2 +- .../res/layout/api_remote_deduplicate.xml | 2 +- .../api_remote_select_authentication_key.xml | 2 +- .../res/layout/api_select_identity_key.xml | 2 +- .../layout/certify_fingerprint_fragment.xml | 4 +- .../res/layout/create_key_email_fragment.xml | 2 +- .../layout/decrypt_files_list_fragment.xml | 2 +- .../main/res/layout/decrypt_list_entry.xml | 4 +- .../res/layout/dialog_insecure_generic.xml | 2 +- .../res/layout/encrypt_files_fragment.xml | 2 +- .../src/main/res/layout/fake_dialog.xml | 4 +- .../src/main/res/layout/help_activity.xml | 2 +- .../src/main/res/layout/identities_card.xml | 2 +- .../layout/import_keys_list_basic_item.xml | 4 +- .../res/layout/import_keys_list_fragment.xml | 2 +- .../main/res/layout/import_keys_list_item.xml | 4 +- .../src/main/res/layout/key_list_fragment.xml | 2 +- .../src/main/res/layout/main_activity.xml | 2 +- .../src/main/res/layout/qr_code_activity.xml | 4 +- .../layout/remote_security_issue_dialog.xml | 4 +- .../res/layout/security_key_shop_fragment.xml | 4 +- .../layout/settings_keyserver_fragment.xml | 2 +- .../settings_smartpgp_authority_fragment.xml | 2 +- .../main/res/layout/toolbar_inner_layout.xml | 2 +- .../res/layout/toolbar_inner_layout_white.xml | 2 +- .../src/main/res/layout/transfer_fragment.xml | 4 +- .../src/main/res/layout/view_key_activity.xml | 24 +- .../main/res/layout/view_key_adv_activity.xml | 2 +- .../layout/view_key_adv_share_fragment.xml | 4 +- .../layout/view_key_adv_subkeys_fragment.xml | 4 +- .../layout/view_key_adv_user_ids_fragment.xml | 2 +- .../src/main/res/layout/view_key_fragment.xml | 4 +- .../res/menu/import_keys_cloud_fragment.xml | 2 +- OpenKeychain/src/main/res/menu/key_list.xml | 2 +- .../network/KeyTransferInteractorTest.java | 2 +- .../keychain/provider/Cv25519Test.java | 2 +- build.gradle | 2 +- extern/MaterialChipsInput/build.gradle | 8 +- .../ExampleInstrumentedTest.java | 4 +- .../materialchips/ChipView.java | 4 +- .../materialchips/ChipsInput.java | 4 +- .../RecyclerItemClickListener.java | 2 +- .../materialchips/adapter/ChipsAdapter.java | 6 +- .../adapter/FilterableAdapter.java | 2 +- .../materialchips/simple/SimpleChip.java | 4 +- .../simple/SimpleChipDropdownAdapter.java | 4 +- .../simple/SimpleChipsAdapter.java | 2 +- .../util/DelegateWindowCallback.java | 4 +- .../util/LetterTileProvider.java | 4 +- .../views/ChipsInputEditText.java | 3 +- .../materialchips/views/DetailedChipView.java | 2 +- .../materialchips/views/DropdownListView.java | 4 +- .../views/ScrollViewMaxHeight.java | 2 +- .../src/main/res/layout/chips_input.xml | 2 +- .../main/res/layout/list_filterable_view.xml | 2 +- gradle.properties | 2 + 343 files changed, 946 insertions(+), 2335 deletions(-) delete mode 100644 OpenKeychain/src/main/java/android/support/design/widget/FixedCollapsingToolbarLayout.java delete mode 100644 OpenKeychain/src/main/java/android/support/v4/widget/FlingNestedScrollView.java create mode 100644 gradle.properties diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 1c9cdcca5..132c93aae 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -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 diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/AndroidTestHelpers.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/AndroidTestHelpers.java index c376f7040..b2b7116da 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/AndroidTestHelpers.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/AndroidTestHelpers.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/JacocoWorkaroundJUnitRunner.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/JacocoWorkaroundJUnitRunner.java index b310ed5b8..67e2b4b44 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/JacocoWorkaroundJUnitRunner.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/JacocoWorkaroundJUnitRunner.java @@ -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 { diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomActions.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomActions.java index 65d39edb8..589b785c2 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomActions.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomActions.java @@ -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 { diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/OrientationChangeAction.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/OrientationChangeAction.java index cdded7d7f..0b0c63fa5 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/OrientationChangeAction.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/OrientationChangeAction.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/matcher/CustomMatchers.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/matcher/CustomMatchers.java index fd44c4ad1..a80cf20ac 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/matcher/CustomMatchers.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/matcher/CustomMatchers.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceTest.java index ccd83a777..064d4cd25 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceTest.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceTest.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java index 0930ef7c4..139de28e7 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java index b34ea6c81..b2bda9180 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java index a02078d8e..f9a53f4b4 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java @@ -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) diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/EditKeyTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/EditKeyTest.java index 75429dd89..eebdb3af9 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/EditKeyTest.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/EditKeyTest.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java index 74b79f020..c399ff37e 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java index b51be1e09..15155e446 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java @@ -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; diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionViewTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionViewTest.java index 554df0a51..8cb9e2bdd 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionViewTest.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/widget/EncryptKeyCompletionViewTest.java @@ -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; diff --git a/OpenKeychain/src/main/java/android/support/design/widget/FixedCollapsingToolbarLayout.java b/OpenKeychain/src/main/java/android/support/design/widget/FixedCollapsingToolbarLayout.java deleted file mode 100644 index 5cfb1c65f..000000000 --- a/OpenKeychain/src/main/java/android/support/design/widget/FixedCollapsingToolbarLayout.java +++ /dev/null @@ -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; - } - -} \ No newline at end of file diff --git a/OpenKeychain/src/main/java/android/support/v4/widget/FlingNestedScrollView.java b/OpenKeychain/src/main/java/android/support/v4/widget/FlingNestedScrollView.java deleted file mode 100644 index 65a2a56af..000000000 --- a/OpenKeychain/src/main/java/android/support/v4/widget/FlingNestedScrollView.java +++ /dev/null @@ -1,1358 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.support.v4.widget; - - -import java.util.ArrayList; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.Rect; -import android.os.Bundle; -import android.os.Parcel; -import android.os.Parcelable; -import android.support.v4.view.AccessibilityDelegateCompat; -import android.support.v4.view.MotionEventCompat; -import android.support.v4.view.NestedScrollingChild; -import android.support.v4.view.NestedScrollingChildHelper; -import android.support.v4.view.NestedScrollingParent; -import android.support.v4.view.NestedScrollingParentHelper; -import android.support.v4.view.VelocityTrackerCompat; -import android.support.v4.view.ViewCompat; -import android.support.v4.view.accessibility.AccessibilityEventCompat; -import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; -import android.support.v4.view.accessibility.AccessibilityRecordCompat; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.view.FocusFinder; -import android.view.KeyEvent; -import android.view.MotionEvent; -import android.view.VelocityTracker; -import android.view.View; -import android.view.ViewConfiguration; -import android.view.ViewGroup; -import android.view.ViewParent; -import android.view.accessibility.AccessibilityEvent; -import android.view.animation.AnimationUtils; -import android.widget.FrameLayout; -import android.widget.ScrollView; - -import timber.log.Timber; - - -/** - * Workaround for bug in support lib. From https://code.google.com/p/android/issues/detail?id=177729 - * - * Also see workaround with padding in view_key_fragment.xml - */ -public class FlingNestedScrollView extends FrameLayout implements NestedScrollingParent, NestedScrollingChild { - static final int ANIMATED_SCROLL_GAP = 250; - static final float MAX_SCROLL_FACTOR = 0.5F; - private static final String TAG = "FlingNestedScrollView"; - private long mLastScroll; - private final Rect mTempRect; - private ScrollerCompat mScroller; - private EdgeEffectCompat mEdgeGlowTop; - private EdgeEffectCompat mEdgeGlowBottom; - private int mLastMotionY; - private boolean mIsLayoutDirty; - private boolean mIsLaidOut; - private View mChildToScrollTo; - private boolean mIsBeingDragged; - private VelocityTracker mVelocityTracker; - private boolean mFillViewport; - private boolean mSmoothScrollingEnabled; - private int mTouchSlop; - private int mMinimumVelocity; - private int mMaximumVelocity; - private int mActivePointerId; - private final int[] mScrollOffset; - private final int[] mScrollConsumed; - private int mNestedYOffset; - private static final int INVALID_POINTER = -1; - private FlingNestedScrollView.SavedState mSavedState; - private static final FlingNestedScrollView.AccessibilityDelegate ACCESSIBILITY_DELEGATE = new FlingNestedScrollView.AccessibilityDelegate(); - private static final int[] SCROLLVIEW_STYLEABLE = new int[]{16843130}; - private final NestedScrollingParentHelper mParentHelper; - private final NestedScrollingChildHelper mChildHelper; - private float mVerticalScrollFactor; - - public FlingNestedScrollView(Context context) { - this(context, null); - } - - public FlingNestedScrollView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public FlingNestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - this.mTempRect = new Rect(); - this.mIsLayoutDirty = true; - this.mIsLaidOut = false; - this.mChildToScrollTo = null; - this.mIsBeingDragged = false; - this.mSmoothScrollingEnabled = true; - this.mActivePointerId = -1; - this.mScrollOffset = new int[2]; - this.mScrollConsumed = new int[2]; - this.initScrollView(); - TypedArray a = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0); - this.setFillViewport(a.getBoolean(0, false)); - a.recycle(); - this.mParentHelper = new NestedScrollingParentHelper(this); - this.mChildHelper = new NestedScrollingChildHelper(this); - this.setNestedScrollingEnabled(true); - ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE); - } - - public void setNestedScrollingEnabled(boolean enabled) { - this.mChildHelper.setNestedScrollingEnabled(enabled); - } - - public boolean isNestedScrollingEnabled() { - return this.mChildHelper.isNestedScrollingEnabled(); - } - - public boolean startNestedScroll(int axes) { - return this.mChildHelper.startNestedScroll(axes); - } - - public void stopNestedScroll() { - this.mChildHelper.stopNestedScroll(); - } - - public boolean hasNestedScrollingParent() { - return this.mChildHelper.hasNestedScrollingParent(); - } - - public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { - return this.mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); - } - - public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { - return this.mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); - } - - public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { - return this.mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); - } - - public boolean dispatchNestedPreFling(float velocityX, float velocityY) { - return this.mChildHelper.dispatchNestedPreFling(velocityX, velocityY); - } - - public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { - return (nestedScrollAxes & 2) != 0; - } - - public void onNestedScrollAccepted(View child, View target, int nestedScrollAxes) { - this.mParentHelper.onNestedScrollAccepted(child, target, nestedScrollAxes); - this.startNestedScroll(2); - } - - public void onStopNestedScroll(View target) { - this.stopNestedScroll(); - } - - public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { - int oldScrollY = this.getScrollY(); - this.scrollBy(0, dyUnconsumed); - int myConsumed = this.getScrollY() - oldScrollY; - int myUnconsumed = dyUnconsumed - myConsumed; - this.dispatchNestedScroll(0, myConsumed, 0, myUnconsumed, null); - } - - public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { - } - - public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) { - if(!consumed) { - this.flingWithNestedDispatch((int)velocityY); - return true; - } else { - return false; - } - } - - public boolean onNestedPreFling(View target, float velocityX, float velocityY) { - return false; - } - - public int getNestedScrollAxes() { - return this.mParentHelper.getNestedScrollAxes(); - } - - public boolean shouldDelayChildPressedState() { - return true; - } - - protected float getTopFadingEdgeStrength() { - if(this.getChildCount() == 0) { - return 0.0F; - } else { - int length = this.getVerticalFadingEdgeLength(); - int scrollY = this.getScrollY(); - return scrollY < length?(float)scrollY / (float)length:1.0F; - } - } - - protected float getBottomFadingEdgeStrength() { - if(this.getChildCount() == 0) { - return 0.0F; - } else { - int length = this.getVerticalFadingEdgeLength(); - int bottomEdge = this.getHeight() - this.getPaddingBottom(); - int span = this.getChildAt(0).getBottom() - this.getScrollY() - bottomEdge; - return span < length?(float)span / (float)length:1.0F; - } - } - - public int getMaxScrollAmount() { - return (int)(0.5F * (float)this.getHeight()); - } - - private void initScrollView() { - this.mScroller = ScrollerCompat.create(this.getContext()); - this.setFocusable(true); - //noinspection ResourceType - this.setDescendantFocusability(262144); - this.setWillNotDraw(false); - ViewConfiguration configuration = ViewConfiguration.get(this.getContext()); - this.mTouchSlop = configuration.getScaledTouchSlop(); - this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); - this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); - } - - public void addView(View child) { - if(this.getChildCount() > 0) { - throw new IllegalStateException("ScrollView can host only one direct child"); - } else { - super.addView(child); - } - } - - public void addView(View child, int index) { - if(this.getChildCount() > 0) { - throw new IllegalStateException("ScrollView can host only one direct child"); - } else { - super.addView(child, index); - } - } - - public void addView(View child, LayoutParams params) { - if(this.getChildCount() > 0) { - throw new IllegalStateException("ScrollView can host only one direct child"); - } else { - super.addView(child, params); - } - } - - public void addView(View child, int index, LayoutParams params) { - if(this.getChildCount() > 0) { - throw new IllegalStateException("ScrollView can host only one direct child"); - } else { - super.addView(child, index, params); - } - } - - private boolean canScroll() { - View child = this.getChildAt(0); - if(child != null) { - int childHeight = child.getHeight(); - return this.getHeight() < childHeight + this.getPaddingTop() + this.getPaddingBottom(); - } else { - return false; - } - } - - public boolean isFillViewport() { - return this.mFillViewport; - } - - public void setFillViewport(boolean fillViewport) { - if(fillViewport != this.mFillViewport) { - this.mFillViewport = fillViewport; - this.requestLayout(); - } - - } - - public boolean isSmoothScrollingEnabled() { - return this.mSmoothScrollingEnabled; - } - - public void setSmoothScrollingEnabled(boolean smoothScrollingEnabled) { - this.mSmoothScrollingEnabled = smoothScrollingEnabled; - } - - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - if(this.mFillViewport) { - int heightMode = MeasureSpec.getMode(heightMeasureSpec); - if(heightMode != 0) { - if(this.getChildCount() > 0) { - View child = this.getChildAt(0); - int height = this.getMeasuredHeight(); - if(child.getMeasuredHeight() < height) { - android.widget.FrameLayout.LayoutParams lp = (android.widget.FrameLayout.LayoutParams)child.getLayoutParams(); - int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, this.getPaddingLeft() + this.getPaddingRight(), lp.width); - height -= this.getPaddingTop(); - height -= this.getPaddingBottom(); - //noinspection ResourceType - int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, 1073741824); - child.measure(childWidthMeasureSpec, childHeightMeasureSpec); - } - } - - } - } - } - - public boolean dispatchKeyEvent(KeyEvent event) { - return super.dispatchKeyEvent(event) || this.executeKeyEvent(event); - } - - public boolean executeKeyEvent(KeyEvent event) { - this.mTempRect.setEmpty(); - if(this.canScroll()) { - boolean handled1 = false; - if(event.getAction() == 0) { - switch(event.getKeyCode()) { - case 19: - if(!event.isAltPressed()) { - handled1 = this.arrowScroll(33); - } else { - handled1 = this.fullScroll(33); - } - break; - case 20: - if(!event.isAltPressed()) { - handled1 = this.arrowScroll(130); - } else { - handled1 = this.fullScroll(130); - } - break; - case 62: - this.pageScroll(event.isShiftPressed()?33:130); - } - } - - return handled1; - } else if(this.isFocused() && event.getKeyCode() != 4) { - View handled = this.findFocus(); - if(handled == this) { - handled = null; - } - - View nextFocused = FocusFinder.getInstance().findNextFocus(this, handled, 130); - return nextFocused != null && nextFocused != this && nextFocused.requestFocus(130); - } else { - return false; - } - } - - private boolean inChild(int x, int y) { - if(this.getChildCount() <= 0) { - return false; - } else { - int scrollY = this.getScrollY(); - View child = this.getChildAt(0); - return y >= child.getTop() - scrollY && y < child.getBottom() - scrollY && x >= child.getLeft() && x < child.getRight(); - } - } - - private void initOrResetVelocityTracker() { - if(this.mVelocityTracker == null) { - this.mVelocityTracker = VelocityTracker.obtain(); - } else { - this.mVelocityTracker.clear(); - } - - } - - private void initVelocityTrackerIfNotExists() { - if(this.mVelocityTracker == null) { - this.mVelocityTracker = VelocityTracker.obtain(); - } - - } - - private void recycleVelocityTracker() { - if(this.mVelocityTracker != null) { - this.mVelocityTracker.recycle(); - this.mVelocityTracker = null; - } - - } - - public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) { - if(disallowIntercept) { - this.recycleVelocityTracker(); - } - - super.requestDisallowInterceptTouchEvent(disallowIntercept); - } - - public boolean onInterceptTouchEvent(MotionEvent ev) { - int action = ev.getAction(); - if(action == 2 && this.mIsBeingDragged) { - return true; - } else if(this.getScrollY() == 0 && !ViewCompat.canScrollVertically(this, 1)) { - return false; - } else { - int y; - switch(action & 255) { - case 0: - y = (int)ev.getY(); - if(!this.inChild((int)ev.getX(), y)) { - this.mIsBeingDragged = false; - this.recycleVelocityTracker(); - } else { - this.mLastMotionY = y; - this.mActivePointerId = MotionEventCompat.getPointerId(ev, 0); - this.initOrResetVelocityTracker(); - this.mVelocityTracker.addMovement(ev); - this.mIsBeingDragged = !this.mScroller.isFinished(); - this.startNestedScroll(2); - } - break; - case 1: - case 3: - this.mIsBeingDragged = false; - this.mActivePointerId = -1; - this.recycleVelocityTracker(); - this.stopNestedScroll(); - break; - case 2: - y = this.mActivePointerId; - if(y != -1) { - int pointerIndex = MotionEventCompat.findPointerIndex(ev, y); - if(pointerIndex == -1) { - Timber.e("Invalid pointerId=" + y + " in onInterceptTouchEvent"); - } else { - int y1 = (int)MotionEventCompat.getY(ev, pointerIndex); - int yDiff = Math.abs(y1 - this.mLastMotionY); - if(yDiff > this.mTouchSlop && (this.getNestedScrollAxes() & 2) == 0) { - this.mIsBeingDragged = true; - this.mLastMotionY = y1; - this.initVelocityTrackerIfNotExists(); - this.mVelocityTracker.addMovement(ev); - this.mNestedYOffset = 0; - ViewParent parent = this.getParent(); - if(parent != null) { - parent.requestDisallowInterceptTouchEvent(true); - } - } - } - } - case 4: - case 5: - default: - break; - case 6: - this.onSecondaryPointerUp(ev); - } - - return this.mIsBeingDragged; - } - } - - public boolean onTouchEvent(MotionEvent ev) { - this.initVelocityTrackerIfNotExists(); - MotionEvent vtev = MotionEvent.obtain(ev); - int actionMasked = MotionEventCompat.getActionMasked(ev); - if(actionMasked == 0) { - this.mNestedYOffset = 0; - } - - vtev.offsetLocation(0.0F, (float)this.mNestedYOffset); - int index; - int initialVelocity; - switch(actionMasked) { - case 0: - if(this.getChildCount() == 0) { - return false; - } - - if(this.mIsBeingDragged = !this.mScroller.isFinished()) { - ViewParent activePointerIndex1 = this.getParent(); - if(activePointerIndex1 != null) { - activePointerIndex1.requestDisallowInterceptTouchEvent(true); - } - } - - if(!this.mScroller.isFinished()) { - this.mScroller.abortAnimation(); - } - - this.mLastMotionY = (int)ev.getY(); - this.mActivePointerId = MotionEventCompat.getPointerId(ev, 0); - this.startNestedScroll(2); - break; - case 1: - if(this.mIsBeingDragged) { - VelocityTracker index2 = this.mVelocityTracker; - index2.computeCurrentVelocity(1000, (float)this.mMaximumVelocity); - initialVelocity = (int) VelocityTrackerCompat.getYVelocity(index2, this.mActivePointerId); - if(Math.abs(initialVelocity) > this.mMinimumVelocity) { - this.flingWithNestedDispatch(-initialVelocity); - } - - this.mActivePointerId = -1; - this.endDrag(); - } - break; - case 2: - int activePointerIndex = MotionEventCompat.findPointerIndex(ev, this.mActivePointerId); - if(activePointerIndex == -1) { - Timber.e("Invalid pointerId=" + this.mActivePointerId + " in onTouchEvent"); - } else { - int y = (int)MotionEventCompat.getY(ev, activePointerIndex); - int deltaY = this.mLastMotionY - y; - if(this.dispatchNestedPreScroll(0, deltaY, this.mScrollConsumed, this.mScrollOffset)) { - deltaY -= this.mScrollConsumed[1]; - vtev.offsetLocation(0.0F, (float)this.mScrollOffset[1]); - this.mNestedYOffset += this.mScrollOffset[1]; - } - - if(!this.mIsBeingDragged && Math.abs(deltaY) > this.mTouchSlop) { - ViewParent index1 = this.getParent(); - if(index1 != null) { - index1.requestDisallowInterceptTouchEvent(true); - } - - this.mIsBeingDragged = true; - if(deltaY > 0) { - deltaY -= this.mTouchSlop; - } else { - deltaY += this.mTouchSlop; - } - } - - if(this.mIsBeingDragged) { - this.mLastMotionY = y - this.mScrollOffset[1]; - index = this.getScrollY(); - initialVelocity = this.getScrollRange(); - int overscrollMode = ViewCompat.getOverScrollMode(this); - boolean canOverscroll = overscrollMode == 0 || overscrollMode == 1 && initialVelocity > 0; - if(this.overScrollByCompat(0, deltaY, 0, this.getScrollY(), 0, initialVelocity, 0, 0, true) && !this.hasNestedScrollingParent()) { - this.mVelocityTracker.clear(); - } - - int scrolledDeltaY = this.getScrollY() - index; - int unconsumedY = deltaY - scrolledDeltaY; - if(this.dispatchNestedScroll(0, scrolledDeltaY, 0, unconsumedY, this.mScrollOffset)) { - this.mLastMotionY -= this.mScrollOffset[1]; - vtev.offsetLocation(0.0F, (float)this.mScrollOffset[1]); - this.mNestedYOffset += this.mScrollOffset[1]; - } else if(canOverscroll) { - this.ensureGlows(); - int pulledToY = index + deltaY; - if(pulledToY < 0) { - this.mEdgeGlowTop.onPull((float)deltaY / (float)this.getHeight(), MotionEventCompat.getX(ev, activePointerIndex) / (float)this.getWidth()); - if(!this.mEdgeGlowBottom.isFinished()) { - this.mEdgeGlowBottom.onRelease(); - } - } else if(pulledToY > initialVelocity) { - this.mEdgeGlowBottom.onPull((float)deltaY / (float)this.getHeight(), 1.0F - MotionEventCompat.getX(ev, activePointerIndex) / (float)this.getWidth()); - if(!this.mEdgeGlowTop.isFinished()) { - this.mEdgeGlowTop.onRelease(); - } - } - - if(this.mEdgeGlowTop != null && (!this.mEdgeGlowTop.isFinished() || !this.mEdgeGlowBottom.isFinished())) { - ViewCompat.postInvalidateOnAnimation(this); - } - } - } - } - break; - case 3: - if(this.mIsBeingDragged && this.getChildCount() > 0) { - this.mActivePointerId = -1; - this.endDrag(); - } - case 4: - default: - break; - case 5: - index = MotionEventCompat.getActionIndex(ev); - this.mLastMotionY = (int)MotionEventCompat.getY(ev, index); - this.mActivePointerId = MotionEventCompat.getPointerId(ev, index); - break; - case 6: - this.onSecondaryPointerUp(ev); - this.mLastMotionY = (int)MotionEventCompat.getY(ev, MotionEventCompat.findPointerIndex(ev, this.mActivePointerId)); - } - - if(this.mVelocityTracker != null) { - this.mVelocityTracker.addMovement(vtev); - } - - vtev.recycle(); - return true; - } - - private void onSecondaryPointerUp(MotionEvent ev) { - int pointerIndex = (ev.getAction() & '\uff00') >> 8; - int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex); - if(pointerId == this.mActivePointerId) { - int newPointerIndex = pointerIndex == 0?1:0; - this.mLastMotionY = (int)MotionEventCompat.getY(ev, newPointerIndex); - this.mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex); - if(this.mVelocityTracker != null) { - this.mVelocityTracker.clear(); - } - } - - } - - public boolean onGenericMotionEvent(MotionEvent event) { - if((MotionEventCompat.getSource(event) & 2) != 0) { - switch(event.getAction()) { - case 8: - if(!this.mIsBeingDragged) { - float vscroll = MotionEventCompat.getAxisValue(event, 9); - if(vscroll != 0.0F) { - int delta = (int)(vscroll * this.getVerticalScrollFactorCompat()); - int range = this.getScrollRange(); - int oldScrollY = this.getScrollY(); - int newScrollY = oldScrollY - delta; - if(newScrollY < 0) { - newScrollY = 0; - } else if(newScrollY > range) { - newScrollY = range; - } - - if(newScrollY != oldScrollY) { - super.scrollTo(this.getScrollX(), newScrollY); - return true; - } - } - } - } - } - - return false; - } - - private float getVerticalScrollFactorCompat() { - if(this.mVerticalScrollFactor == 0.0F) { - TypedValue outValue = new TypedValue(); - Context context = this.getContext(); - if(!context.getTheme().resolveAttribute(16842829, outValue, true)) { - throw new IllegalStateException("Expected theme to define listPreferredItemHeight."); - } - - this.mVerticalScrollFactor = outValue.getDimension(context.getResources().getDisplayMetrics()); - } - - return this.mVerticalScrollFactor; - } - - protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) { - super.scrollTo(scrollX, scrollY); - } - - boolean overScrollByCompat(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { - int overScrollMode = ViewCompat.getOverScrollMode(this); - boolean canScrollHorizontal = this.computeHorizontalScrollRange() > this.computeHorizontalScrollExtent(); - boolean canScrollVertical = this.computeVerticalScrollRange() > this.computeVerticalScrollExtent(); - boolean overScrollHorizontal = overScrollMode == 0 || overScrollMode == 1 && canScrollHorizontal; - boolean overScrollVertical = overScrollMode == 0 || overScrollMode == 1 && canScrollVertical; - int newScrollX = scrollX + deltaX; - if(!overScrollHorizontal) { - maxOverScrollX = 0; - } - - int newScrollY = scrollY + deltaY; - if(!overScrollVertical) { - maxOverScrollY = 0; - } - - int left = -maxOverScrollX; - int right = maxOverScrollX + scrollRangeX; - int top = -maxOverScrollY; - int bottom = maxOverScrollY + scrollRangeY; - boolean clampedX = false; - if(newScrollX > right) { - newScrollX = right; - clampedX = true; - } else if(newScrollX < left) { - newScrollX = left; - clampedX = true; - } - - boolean clampedY = false; - if(newScrollY > bottom) { - newScrollY = bottom; - clampedY = true; - } else if(newScrollY < top) { - newScrollY = top; - clampedY = true; - } - - this.onOverScrolled(newScrollX, newScrollY, clampedX, clampedY); - return clampedX || clampedY; - } - - private int getScrollRange() { - int scrollRange = 0; - if(this.getChildCount() > 0) { - View child = this.getChildAt(0); - scrollRange = Math.max(0, child.getHeight() - (this.getHeight() - this.getPaddingBottom() - this.getPaddingTop())); - } - - return scrollRange; - } - - private View findFocusableViewInBounds(boolean topFocus, int top, int bottom) { - //noinspection ResourceType - ArrayList focusables = this.getFocusables(2); - View focusCandidate = null; - boolean foundFullyContainedFocusable = false; - int count = focusables.size(); - - for(int i = 0; i < count; ++i) { - View view = (View)focusables.get(i); - int viewTop = view.getTop(); - int viewBottom = view.getBottom(); - if(top < viewBottom && viewTop < bottom) { - boolean viewIsFullyContained = top < viewTop && viewBottom < bottom; - if(focusCandidate == null) { - focusCandidate = view; - foundFullyContainedFocusable = viewIsFullyContained; - } else { - boolean viewIsCloserToBoundary = topFocus && viewTop < focusCandidate.getTop() || !topFocus && viewBottom > focusCandidate.getBottom(); - if(foundFullyContainedFocusable) { - if(viewIsFullyContained && viewIsCloserToBoundary) { - focusCandidate = view; - } - } else if(viewIsFullyContained) { - focusCandidate = view; - foundFullyContainedFocusable = true; - } else if(viewIsCloserToBoundary) { - focusCandidate = view; - } - } - } - } - - return focusCandidate; - } - - public boolean pageScroll(int direction) { - boolean down = direction == 130; - int height = this.getHeight(); - if(down) { - this.mTempRect.top = this.getScrollY() + height; - int count = this.getChildCount(); - if(count > 0) { - View view = this.getChildAt(count - 1); - if(this.mTempRect.top + height > view.getBottom()) { - this.mTempRect.top = view.getBottom() - height; - } - } - } else { - this.mTempRect.top = this.getScrollY() - height; - if(this.mTempRect.top < 0) { - this.mTempRect.top = 0; - } - } - - this.mTempRect.bottom = this.mTempRect.top + height; - return this.scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom); - } - - public boolean fullScroll(int direction) { - boolean down = direction == 130; - int height = this.getHeight(); - this.mTempRect.top = 0; - this.mTempRect.bottom = height; - if(down) { - int count = this.getChildCount(); - if(count > 0) { - View view = this.getChildAt(count - 1); - this.mTempRect.bottom = view.getBottom() + this.getPaddingBottom(); - this.mTempRect.top = this.mTempRect.bottom - height; - } - } - - return this.scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom); - } - - private boolean scrollAndFocus(int direction, int top, int bottom) { - boolean handled = true; - int height = this.getHeight(); - int containerTop = this.getScrollY(); - int containerBottom = containerTop + height; - boolean up = direction == 33; - Object newFocused = this.findFocusableViewInBounds(up, top, bottom); - if(newFocused == null) { - newFocused = this; - } - - if(top >= containerTop && bottom <= containerBottom) { - handled = false; - } else { - int delta = up?top - containerTop:bottom - containerBottom; - this.doScrollY(delta); - } - - if(newFocused != this.findFocus()) { - ((View)newFocused).requestFocus(direction); - } - - return handled; - } - - public boolean arrowScroll(int direction) { - View currentFocused = this.findFocus(); - if(currentFocused == this) { - currentFocused = null; - } - - View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); - int maxJump = this.getMaxScrollAmount(); - int descendantFocusability; - if(nextFocused != null && this.isWithinDeltaOfScreen(nextFocused, maxJump, this.getHeight())) { - nextFocused.getDrawingRect(this.mTempRect); - this.offsetDescendantRectToMyCoords(nextFocused, this.mTempRect); - descendantFocusability = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect); - this.doScrollY(descendantFocusability); - nextFocused.requestFocus(direction); - } else { - descendantFocusability = maxJump; - if(direction == 33 && this.getScrollY() < maxJump) { - descendantFocusability = this.getScrollY(); - } else if(direction == 130 && this.getChildCount() > 0) { - int daBottom = this.getChildAt(0).getBottom(); - int screenBottom = this.getScrollY() + this.getHeight() - this.getPaddingBottom(); - if(daBottom - screenBottom < maxJump) { - descendantFocusability = daBottom - screenBottom; - } - } - - if(descendantFocusability == 0) { - return false; - } - - this.doScrollY(direction == 130?descendantFocusability:-descendantFocusability); - } - - if(currentFocused != null && currentFocused.isFocused() && this.isOffScreen(currentFocused)) { - descendantFocusability = this.getDescendantFocusability(); - //noinspection ResourceType - this.setDescendantFocusability(131072); - this.requestFocus(); - this.setDescendantFocusability(descendantFocusability); - } - - return true; - } - - private boolean isOffScreen(View descendant) { - return !this.isWithinDeltaOfScreen(descendant, 0, this.getHeight()); - } - - private boolean isWithinDeltaOfScreen(View descendant, int delta, int height) { - descendant.getDrawingRect(this.mTempRect); - this.offsetDescendantRectToMyCoords(descendant, this.mTempRect); - return this.mTempRect.bottom + delta >= this.getScrollY() && this.mTempRect.top - delta <= this.getScrollY() + height; - } - - private void doScrollY(int delta) { - if(delta != 0) { - if(this.mSmoothScrollingEnabled) { - this.smoothScrollBy(0, delta); - } else { - this.scrollBy(0, delta); - } - } - - } - - public final void smoothScrollBy(int dx, int dy) { - if(this.getChildCount() != 0) { - long duration = AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll; - if(duration > 250L) { - int height = this.getHeight() - this.getPaddingBottom() - this.getPaddingTop(); - int bottom = this.getChildAt(0).getHeight(); - int maxY = Math.max(0, bottom - height); - int scrollY = this.getScrollY(); - dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY; - this.mScroller.startScroll(this.getScrollX(), scrollY, 0, dy); - ViewCompat.postInvalidateOnAnimation(this); - } else { - if(!this.mScroller.isFinished()) { - this.mScroller.abortAnimation(); - } - - this.scrollBy(dx, dy); - } - - this.mLastScroll = AnimationUtils.currentAnimationTimeMillis(); - } - } - - public final void smoothScrollTo(int x, int y) { - this.smoothScrollBy(x - this.getScrollX(), y - this.getScrollY()); - } - - protected int computeVerticalScrollRange() { - int count = this.getChildCount(); - int contentHeight = this.getHeight() - this.getPaddingBottom() - this.getPaddingTop(); - if(count == 0) { - return contentHeight; - } else { - int scrollRange = this.getChildAt(0).getBottom(); - int scrollY = this.getScrollY(); - int overscrollBottom = Math.max(0, scrollRange - contentHeight); - if(scrollY < 0) { - scrollRange -= scrollY; - } else if(scrollY > overscrollBottom) { - scrollRange += scrollY - overscrollBottom; - } - - return scrollRange; - } - } - - protected int computeVerticalScrollOffset() { - return Math.max(0, super.computeVerticalScrollOffset()); - } - - protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) { - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, this.getPaddingLeft() + this.getPaddingRight(), lp.width); - //noinspection ResourceType - int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, 0); - child.measure(childWidthMeasureSpec, childHeightMeasureSpec); - } - - protected void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) { - MarginLayoutParams lp = (MarginLayoutParams)child.getLayoutParams(); - int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, this.getPaddingLeft() + this.getPaddingRight() + lp.leftMargin + lp.rightMargin + widthUsed, lp.width); - //noinspection ResourceType - int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(lp.topMargin + lp.bottomMargin, 0); - child.measure(childWidthMeasureSpec, childHeightMeasureSpec); - } - - public void computeScroll() { - if(this.mScroller.computeScrollOffset()) { - int oldX = this.getScrollX(); - int oldY = this.getScrollY(); - int x = this.mScroller.getCurrX(); - int y = this.mScroller.getCurrY(); - if(oldX != x || oldY != y) { - int range = this.getScrollRange(); - int overscrollMode = ViewCompat.getOverScrollMode(this); - boolean canOverscroll = overscrollMode == 0 || overscrollMode == 1 && range > 0; - this.overScrollByCompat(x - oldX, y - oldY, oldX, oldY, 0, range, 0, 0, false); - if(canOverscroll) { - this.ensureGlows(); - if(y <= 0 && oldY > 0) { - this.mEdgeGlowTop.onAbsorb((int)this.mScroller.getCurrVelocity()); - } else if(y >= range && oldY < range) { - this.mEdgeGlowBottom.onAbsorb((int)this.mScroller.getCurrVelocity()); - } - } - } - } - - } - - private void scrollToChild(View child) { - child.getDrawingRect(this.mTempRect); - this.offsetDescendantRectToMyCoords(child, this.mTempRect); - int scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect); - if(scrollDelta != 0) { - this.scrollBy(0, scrollDelta); - } - - } - - private boolean scrollToChildRect(Rect rect, boolean immediate) { - int delta = this.computeScrollDeltaToGetChildRectOnScreen(rect); - boolean scroll = delta != 0; - if(scroll) { - if(immediate) { - this.scrollBy(0, delta); - } else { - this.smoothScrollBy(0, delta); - } - } - - return scroll; - } - - protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) { - if(this.getChildCount() == 0) { - return 0; - } else { - int height = this.getHeight(); - int screenTop = this.getScrollY(); - int screenBottom = screenTop + height; - int fadingEdge = this.getVerticalFadingEdgeLength(); - if(rect.top > 0) { - screenTop += fadingEdge; - } - - if(rect.bottom < this.getChildAt(0).getHeight()) { - screenBottom -= fadingEdge; - } - - int scrollYDelta = 0; - if(rect.bottom > screenBottom && rect.top > screenTop) { - if(rect.height() > height) { - scrollYDelta += rect.top - screenTop; - } else { - scrollYDelta += rect.bottom - screenBottom; - } - - int bottom = this.getChildAt(0).getBottom(); - int distanceToBottom = bottom - screenBottom; - scrollYDelta = Math.min(scrollYDelta, distanceToBottom); - } else if(rect.top < screenTop && rect.bottom < screenBottom) { - if(rect.height() > height) { - scrollYDelta -= screenBottom - rect.bottom; - } else { - scrollYDelta -= screenTop - rect.top; - } - - scrollYDelta = Math.max(scrollYDelta, -this.getScrollY()); - } - - return scrollYDelta; - } - } - - public void requestChildFocus(View child, View focused) { - if(!this.mIsLayoutDirty) { - this.scrollToChild(focused); - } else { - this.mChildToScrollTo = focused; - } - - super.requestChildFocus(child, focused); - } - - protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) { - if(direction == 2) { - direction = 130; - } else if(direction == 1) { - direction = 33; - } - - View nextFocus = previouslyFocusedRect == null?FocusFinder.getInstance().findNextFocus(this, null, direction):FocusFinder.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction); - return nextFocus != null && (!this.isOffScreen(nextFocus) && - nextFocus.requestFocus(direction, previouslyFocusedRect)); - } - - public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) { - rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY()); - return this.scrollToChildRect(rectangle, immediate); - } - - public void requestLayout() { - this.mIsLayoutDirty = true; - super.requestLayout(); - } - - protected void onLayout(boolean changed, int l, int t, int r, int b) { - super.onLayout(changed, l, t, r, b); - this.mIsLayoutDirty = false; - if(this.mChildToScrollTo != null && isViewDescendantOf(this.mChildToScrollTo, this)) { - this.scrollToChild(this.mChildToScrollTo); - } - - this.mChildToScrollTo = null; - if(!this.mIsLaidOut) { - if(this.mSavedState != null) { - this.scrollTo(this.getScrollX(), this.mSavedState.scrollPosition); - this.mSavedState = null; - } - - int childHeight = this.getChildCount() > 0?this.getChildAt(0).getMeasuredHeight():0; - int scrollRange = Math.max(0, childHeight - (b - t - this.getPaddingBottom() - this.getPaddingTop())); - if(this.getScrollY() > scrollRange) { - this.scrollTo(this.getScrollX(), scrollRange); - } else if(this.getScrollY() < 0) { - this.scrollTo(this.getScrollX(), 0); - } - } - - this.scrollTo(this.getScrollX(), this.getScrollY()); - this.mIsLaidOut = true; - } - - @SuppressLint("MissingSuperCall") - public void onAttachedToWindow() { - this.mIsLaidOut = false; - } - - protected void onSizeChanged(int w, int h, int oldw, int oldh) { - super.onSizeChanged(w, h, oldw, oldh); - View currentFocused = this.findFocus(); - if(null != currentFocused && this != currentFocused) { - if(this.isWithinDeltaOfScreen(currentFocused, 0, oldh)) { - currentFocused.getDrawingRect(this.mTempRect); - this.offsetDescendantRectToMyCoords(currentFocused, this.mTempRect); - int scrollDelta = this.computeScrollDeltaToGetChildRectOnScreen(this.mTempRect); - this.doScrollY(scrollDelta); - } - - } - } - - private static boolean isViewDescendantOf(View child, View parent) { - if(child == parent) { - return true; - } else { - ViewParent theParent = child.getParent(); - return theParent instanceof ViewGroup && isViewDescendantOf((View)theParent, parent); - } - } - - /** - * Adjusted from AppCompat v23.0.0 so that the function returns true if the nested fling will - * end at the top of the scroll view. Which means that it should be dispatched to the - * CoordinatorLayout/AppBarLayout - * @param velocityY - * @return - */ - public boolean fling(int velocityY) { - if(this.getChildCount() > 0) { - int height = this.getHeight() - this.getPaddingBottom() - this.getPaddingTop(); - int bottom = this.getChildAt(0).getHeight(); - this.mScroller.fling(this.getScrollX(), this.getScrollY(), 0, velocityY, 0, 0, 0, Math.max(0, bottom - height), 0, height / 2); - ViewCompat.postInvalidateOnAnimation(this); - return mScroller.getFinalY() == 0; - } - return false; - } - - private void flingWithNestedDispatch(int velocityY) { - int scrollY = this.getScrollY(); - boolean canFling = (scrollY > 0 || velocityY > 0) && (scrollY < this.getScrollRange() || velocityY < 0); - if(!this.dispatchNestedPreFling(0.0F, (float)velocityY)) { - boolean dispatchFling = true; - if (canFling) - dispatchFling = fling(velocityY); - this.dispatchNestedFling(0.0F, (float)velocityY, !dispatchFling); - } - - } - - private void endDrag() { - this.mIsBeingDragged = false; - this.recycleVelocityTracker(); - this.stopNestedScroll(); - if(this.mEdgeGlowTop != null) { - this.mEdgeGlowTop.onRelease(); - this.mEdgeGlowBottom.onRelease(); - } - - } - - public void scrollTo(int x, int y) { - if(this.getChildCount() > 0) { - View child = this.getChildAt(0); - x = clamp(x, this.getWidth() - this.getPaddingRight() - this.getPaddingLeft(), child.getWidth()); - y = clamp(y, this.getHeight() - this.getPaddingBottom() - this.getPaddingTop(), child.getHeight()); - if(x != this.getScrollX() || y != this.getScrollY()) { - super.scrollTo(x, y); - } - } - - } - - private void ensureGlows() { - if(ViewCompat.getOverScrollMode(this) != 2) { - if(this.mEdgeGlowTop == null) { - Context context = this.getContext(); - this.mEdgeGlowTop = new EdgeEffectCompat(context); - this.mEdgeGlowBottom = new EdgeEffectCompat(context); - } - } else { - this.mEdgeGlowTop = null; - this.mEdgeGlowBottom = null; - } - - } - - public void draw(Canvas canvas) { - super.draw(canvas); - if(this.mEdgeGlowTop != null) { - int scrollY = this.getScrollY(); - int restoreCount; - int width; - if(!this.mEdgeGlowTop.isFinished()) { - restoreCount = canvas.save(); - width = this.getWidth() - this.getPaddingLeft() - this.getPaddingRight(); - canvas.translate((float)this.getPaddingLeft(), (float)Math.min(0, scrollY)); - this.mEdgeGlowTop.setSize(width, this.getHeight()); - if(this.mEdgeGlowTop.draw(canvas)) { - ViewCompat.postInvalidateOnAnimation(this); - } - - canvas.restoreToCount(restoreCount); - } - - if(!this.mEdgeGlowBottom.isFinished()) { - restoreCount = canvas.save(); - width = this.getWidth() - this.getPaddingLeft() - this.getPaddingRight(); - int height = this.getHeight(); - canvas.translate((float)(-width + this.getPaddingLeft()), (float)(Math.max(this.getScrollRange(), scrollY) + height)); - canvas.rotate(180.0F, (float)width, 0.0F); - this.mEdgeGlowBottom.setSize(width, height); - if(this.mEdgeGlowBottom.draw(canvas)) { - ViewCompat.postInvalidateOnAnimation(this); - } - - canvas.restoreToCount(restoreCount); - } - } - - } - - private static int clamp(int n, int my, int child) { - return my < child && n >= 0?(my + n > child?child - my:n):0; - } - - protected void onRestoreInstanceState(Parcelable state) { - FlingNestedScrollView.SavedState ss = (FlingNestedScrollView.SavedState)state; - super.onRestoreInstanceState(ss.getSuperState()); - this.mSavedState = ss; - this.requestLayout(); - } - - protected Parcelable onSaveInstanceState() { - Parcelable superState = super.onSaveInstanceState(); - FlingNestedScrollView.SavedState ss = new FlingNestedScrollView.SavedState(superState); - ss.scrollPosition = this.getScrollY(); - return ss; - } - - static class AccessibilityDelegate extends AccessibilityDelegateCompat { - AccessibilityDelegate() { - } - - public boolean performAccessibilityAction(View host, int action, Bundle arguments) { - if(super.performAccessibilityAction(host, action, arguments)) { - return true; - } else { - FlingNestedScrollView nsvHost = (FlingNestedScrollView)host; - if(!nsvHost.isEnabled()) { - return false; - } else { - int viewportHeight; - int targetScrollY; - switch(action) { - case 4096: - viewportHeight = nsvHost.getHeight() - nsvHost.getPaddingBottom() - nsvHost.getPaddingTop(); - targetScrollY = Math.min(nsvHost.getScrollY() + viewportHeight, nsvHost.getScrollRange()); - if(targetScrollY != nsvHost.getScrollY()) { - nsvHost.smoothScrollTo(0, targetScrollY); - return true; - } - - return false; - case 8192: - viewportHeight = nsvHost.getHeight() - nsvHost.getPaddingBottom() - nsvHost.getPaddingTop(); - targetScrollY = Math.max(nsvHost.getScrollY() - viewportHeight, 0); - if(targetScrollY != nsvHost.getScrollY()) { - nsvHost.smoothScrollTo(0, targetScrollY); - return true; - } - - return false; - default: - return false; - } - } - } - } - - public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) { - super.onInitializeAccessibilityNodeInfo(host, info); - FlingNestedScrollView nsvHost = (FlingNestedScrollView)host; - info.setClassName(ScrollView.class.getName()); - if(nsvHost.isEnabled()) { - int scrollRange = nsvHost.getScrollRange(); - if(scrollRange > 0) { - info.setScrollable(true); - if(nsvHost.getScrollY() > 0) { - info.addAction(8192); - } - - if(nsvHost.getScrollY() < scrollRange) { - info.addAction(4096); - } - } - } - - } - - public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) { - super.onInitializeAccessibilityEvent(host, event); - FlingNestedScrollView nsvHost = (FlingNestedScrollView)host; - event.setClassName(ScrollView.class.getName()); - AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event); - boolean scrollable = nsvHost.getScrollRange() > 0; - record.setScrollable(scrollable); - record.setScrollX(nsvHost.getScrollX()); - record.setScrollY(nsvHost.getScrollY()); - record.setMaxScrollX(nsvHost.getScrollX()); - record.setMaxScrollY(nsvHost.getScrollRange()); - } - } - - static class SavedState extends BaseSavedState { - public int scrollPosition; - public static final Creator CREATOR = new Creator() { - public FlingNestedScrollView.SavedState createFromParcel(Parcel in) { - return new FlingNestedScrollView.SavedState(in); - } - - public FlingNestedScrollView.SavedState[] newArray(int size) { - return new FlingNestedScrollView.SavedState[size]; - } - }; - - SavedState(Parcelable superState) { - super(superState); - } - - public SavedState(Parcel source) { - super(source); - this.scrollPosition = source.readInt(); - } - - public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags); - dest.writeInt(this.scrollPosition); - } - - public String toString() { - return "HorizontalScrollView.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " scrollPosition=" + this.scrollPosition + "}"; - } - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java index a1df7832d..8febc38b9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java @@ -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); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainDatabase.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainDatabase.java index ae9fb9f0d..160005f79 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainDatabase.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainDatabase.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/NotificationChannelManager.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/NotificationChannelManager.java index 63806e577..310be32ac 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/NotificationChannelManager.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/NotificationChannelManager.java @@ -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 { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/AppCompatPreferenceActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/AppCompatPreferenceActivity.java index b77fce985..cae84150f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/AppCompatPreferenceActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/AppCompatPreferenceActivity.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java index eb550e3ef..d4144d285 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AbstractDao.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AbstractDao.java index 4500e4a75..f123c9160 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AbstractDao.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AbstractDao.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AutocryptPeerDao.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AutocryptPeerDao.java index 773ba27fd..2d4a05e67 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AutocryptPeerDao.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/AutocryptPeerDao.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/DatabaseBatchInteractor.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/DatabaseBatchInteractor.java index 67913ab53..788f77d14 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/DatabaseBatchInteractor.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/DatabaseBatchInteractor.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyRepository.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyRepository.java index 59d457b5c..4cb0b33ea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyRepository.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyRepository.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyWritableRepository.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyWritableRepository.java index 8e4c17024..cf7d3a610 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyWritableRepository.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/daos/KeyWritableRepository.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java index a054c4524..d8f01711e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/CloudSearch.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/FacebookKeyserverClient.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/FacebookKeyserverClient.java index 1ed579685..0553eb626 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/FacebookKeyserverClient.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/FacebookKeyserverClient.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverAddress.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverAddress.java index 14a088b88..75e5912f1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverAddress.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverAddress.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverClient.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverClient.java index c94854a68..f838aa757 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverClient.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/HkpKeyserverClient.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.keyimport; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import okhttp3.MediaType; import okhttp3.ResponseBody; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java index b42475861..b69e167d5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/WebKeyDirectoryClient.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/WebKeyDirectoryClient.java index c37522c59..3983789a6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/WebKeyDirectoryClient.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/WebKeyDirectoryClient.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java index 69cca2a6a..05358de4b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListCloudLoader.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListLoader.java index a53e82118..ef79ce671 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/processing/ImportKeysListLoader.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncManager.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncManager.java index fc452e133..6cd1fdc11 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncManager.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncManager.java @@ -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); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncWorker.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncWorker.java index 2d9b2fdb8..8e562769b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncWorker.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keysync/KeyserverSyncWorker.java @@ -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(); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/Certification.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/Certification.java index 391af0cc7..2a06d837f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/Certification.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/Certification.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/CustomColumnAdapters.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/CustomColumnAdapters.java index bfaa83caa..9ebcceab1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/CustomColumnAdapters.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/CustomColumnAdapters.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeyRingPublic.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeyRingPublic.java index 4f42685cb..bb1604a8c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeyRingPublic.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeyRingPublic.java @@ -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 diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeySignature.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeySignature.java index a79621e21..fe101cfb8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeySignature.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/KeySignature.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/SubKey.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/SubKey.java index 71eed7579..c963aa330 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/SubKey.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/SubKey.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/UserPacket.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/UserPacket.java index 6bd833a81..79af3633b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/UserPacket.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/model/UserPacket.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/KeyTransferInteractor.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/KeyTransferInteractor.java index 1fb9e387d..0ba4c9d96 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/KeyTransferInteractor.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/KeyTransferInteractor.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/SktUri.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/SktUri.java index 887c762aa..7186c8237 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/SktUri.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/SktUri.java @@ -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; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/TlsPskCompat.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/TlsPskCompat.java index 7a83eac34..24886557a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/TlsPskCompat.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/TlsPskCompat.java @@ -6,7 +6,7 @@ import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import android.os.Build.VERSION_CODES; -import android.support.annotation.RequiresApi; +import androidx.annotation.RequiresApi; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java index 5bb3b0e44..78bafe195 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/network/orbot/OrbotHelper.java @@ -61,8 +61,8 @@ import android.net.Uri; import android.os.Handler; import android.os.Message; import android.os.Messenger; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; import android.text.TextUtils; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java index f3c85fc0a..f870c5386 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BackupOperation.java @@ -32,8 +32,8 @@ import java.util.regex.Pattern; import android.content.Context; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java index a5cc4602d..b645dd629 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java @@ -22,8 +22,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; import org.sufficientlysecure.keychain.Constants.key; import org.sufficientlysecure.keychain.daos.KeyRepository; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BenchmarkOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BenchmarkOperation.java index 353ecc5d1..144dd215b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BenchmarkOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BenchmarkOperation.java @@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.operations; import java.util.Random; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.bouncycastle.bcpg.HashAlgorithmTags; import org.bouncycastle.bcpg.S2K; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java index 87eaccd8f..cea093a48 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/CertifyOperation.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.daos.KeyMetadataDao; import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ChangeUnlockOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ChangeUnlockOperation.java index bb14199c1..0111e55a3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ChangeUnlockOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ChangeUnlockOperation.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.operations; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.operations.results.EditKeyResult; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/DeleteOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/DeleteOperation.java index 31564146d..ab5951173 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/DeleteOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/DeleteOperation.java @@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.operations; import java.util.Collections; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.operations.results.DeleteResult; import org.sufficientlysecure.keychain.operations.results.OperationResult; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java index 053ca87b0..573fba8f2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/EditKeyOperation.java @@ -22,7 +22,7 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.daos.KeyMetadataDao; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java index 5c508e88b..833b40ec8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportOperation.java @@ -32,8 +32,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.daos.KeyMetadataDao; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java index 222e75d7a..8936d05b5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/InputDataOperation.java @@ -28,7 +28,7 @@ import java.util.ArrayList; import android.content.ClipDescription; import android.content.Context; import android.net.Uri; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.webkit.MimeTypeMap; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java index a22650e37..e2e589380 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/KeySyncOperation.java @@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.daos.KeyMetadataDao; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperation.java index b1126cf2f..a895f5509 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/PromoteKeyOperation.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java index 3df9fc4c5..36101cfa0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/RevokeOperation.java @@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.operations; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; import org.sufficientlysecure.keychain.operations.results.EditKeyResult; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/SignEncryptOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/SignEncryptOperation.java index 20bcd19e8..5f5949c9b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/SignEncryptOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/SignEncryptOperation.java @@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; import android.net.Uri; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.daos.KeyRepository; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java index f7c70e671..d5b54cc8c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/UploadOperation.java @@ -24,8 +24,8 @@ import java.net.Proxy; import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/DeleteResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/DeleteResult.java index d6475e002..4819977b6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/DeleteResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/DeleteResult.java @@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.operations.results; import android.app.Activity; import android.content.Intent; import android.os.Parcel; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputDataResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputDataResult.java index 98d2e9818..7fafe0e07 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputDataResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputDataResult.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import android.net.Uri; import android.os.Parcel; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.openintents.openpgp.OpenPgpMetadata; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java index 5f456bae8..3a3b7c8e5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/InputPendingResult.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.operations.results; import android.os.Parcel; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index 872f13ac4..98c990ca8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -22,7 +22,7 @@ import android.content.Intent; import android.content.res.Resources; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.LogDisplayActivity; import org.sufficientlysecure.keychain.ui.LogDisplayFragment; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/RevokeResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/RevokeResult.java index 4dc86c2c0..19fb0341a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/RevokeResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/RevokeResult.java @@ -21,7 +21,7 @@ import android.app.Activity; import android.content.Intent; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java index ea6436e24..5d5fd9de0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/UploadResult.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.operations.results; import android.os.Parcel; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedPublicKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedPublicKeyRing.java index a9b24b4ac..aa5a7b1f2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedPublicKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedPublicKeyRing.java @@ -24,7 +24,7 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.bouncycastle.openpgp.PGPObjectFactory; import org.bouncycastle.openpgp.PGPPublicKey; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyInputParcel.java index d21f7b1c4..efa150c5a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyInputParcel.java @@ -23,7 +23,7 @@ import java.util.List; import android.net.Uri; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java index 9fdc6362d..d5f4ba42f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java @@ -33,7 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.webkit.MimeTypeMap; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java index 666d73599..1310c654d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -21,10 +21,10 @@ package org.sufficientlysecure.keychain.pgp; import java.util.regex.Matcher; import java.util.regex.Pattern; -import android.support.annotation.CheckResult; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.CheckResult; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import timber.log.Timber; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index ede83699a..2533c626a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -35,7 +35,7 @@ import java.util.List; import java.util.Stack; import java.util.concurrent.atomic.AtomicBoolean; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.nist.NISTNamedCurves; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSecurityConstants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSecurityConstants.java index 6c0f40c77..68372eb5f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSecurityConstants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSecurityConstants.java @@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.pgp; import java.util.Arrays; import java.util.HashSet; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.bouncycastle.asn1.nist.NISTNamedCurves; import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptData.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptData.java index 294992655..e10a161a5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptData.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptData.java @@ -24,7 +24,7 @@ import java.util.Collections; import java.util.List; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java index bfe21c976..d7b54117e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptInputParcel.java @@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.pgp; import android.net.Uri; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java index 32bb301dc..855221930 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java @@ -37,7 +37,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import android.content.Context; import android.net.Uri; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.bouncycastle.bcpg.BCPGOutputStream; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/SignEncryptParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/SignEncryptParcel.java index 2bd344855..d78c794c8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/SignEncryptParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/SignEncryptParcel.java @@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.pgp; import android.net.Uri; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java index aea544be8..d2ec4125f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -36,7 +36,7 @@ import java.util.Set; import java.util.TimeZone; import java.util.TreeSet; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.VisibleForTesting; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.bouncycastle.bcpg.PublicKeyAlgorithmTags; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java index dde5ef6ab..4372190f9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java @@ -5,8 +5,8 @@ import android.content.ContentProvider; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; public class KeychainProvider extends ContentProvider { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryFileProvider.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryFileProvider.java index 18ca44a0d..ee17e925c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryFileProvider.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryFileProvider.java @@ -38,11 +38,12 @@ import android.database.sqlite.SQLiteOpenHelper; import android.net.Uri; import android.os.ParcelFileDescriptor; import android.provider.MediaStore; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import androidx.work.OneTimeWorkRequest; import androidx.work.WorkManager; import androidx.work.Worker; +import androidx.work.WorkerParameters; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.util.DatabaseUtil; import timber.log.Timber; @@ -314,18 +315,21 @@ public class TemporaryFileProvider extends ContentProvider { WorkManager.getInstance().enqueue(cleanupWork); } - public static void scheduleCleanupImmediately() { + public static void scheduleCleanupImmediately(Context context) { OneTimeWorkRequest cleanupWork = new OneTimeWorkRequest.Builder(CleanupWorker.class).build(); - WorkManager workManager = WorkManager.getInstance(); - if (workManager != null) { // it's possible this is null, if this is called in onCreate of secondary processes - workManager.enqueue(cleanupWork); - } + WorkManager workManager = WorkManager.getInstance(context); + workManager.enqueue(cleanupWork); } public static class CleanupWorker extends Worker { + public CleanupWorker(@NonNull Context context, + @NonNull WorkerParameters workerParams) { + super(context, workerParams); + } + @NonNull @Override - public WorkerResult doWork() { + public Result doWork() { Timber.d("Cleaning up temporary files…"); ContentResolver contentResolver = getApplicationContext().getContentResolver(); @@ -335,7 +339,7 @@ public class TemporaryFileProvider extends ContentProvider { new String[]{Long.toString(System.currentTimeMillis() - Constants.TEMPFILE_TTL)} ); - return WorkerResult.SUCCESS; + return Result.success(); } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/AutocryptInteractor.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/AutocryptInteractor.java index db6aaa94c..4907f47c7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/AutocryptInteractor.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/AutocryptInteractor.java @@ -2,15 +2,13 @@ package org.sufficientlysecure.keychain.remote; import java.io.IOException; -import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.Map; import android.content.Context; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.format.DateUtils; import org.openintents.openpgp.AutocryptPeerUpdate; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/KeychainExternalProvider.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/KeychainExternalProvider.java index f3a6fca2e..831a01e31 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/KeychainExternalProvider.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/KeychainExternalProvider.java @@ -31,7 +31,7 @@ import android.content.UriMatcher; import android.database.Cursor; import android.database.MatrixCursor; import android.net.Uri; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.widget.Toast; import org.sufficientlysecure.keychain.BuildConfig; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index 72075e29a..7e4514fa4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -38,8 +38,8 @@ import android.os.Messenger; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.bouncycastle.bcpg.ArmoredOutputStream; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractor.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractor.java index 106073ce9..463c1dac0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractor.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpServiceKeyIdExtractor.java @@ -27,8 +27,8 @@ import android.content.ContentResolver; import android.content.Intent; import android.database.Cursor; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import org.openintents.openpgp.util.OpenPgpApi; import org.sufficientlysecure.keychain.provider.KeychainExternalContract; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java index 1d43a0b70..fd2ba5fa5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsActivity.java @@ -27,7 +27,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.FragmentManager; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsAllowedKeysListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsAllowedKeysListFragment.java index e85806428..0e8beddcd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsAllowedKeysListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppSettingsAllowedKeysListFragment.java @@ -21,10 +21,10 @@ package org.sufficientlysecure.keychain.remote.ui; import java.util.List; import java.util.Set; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModelProviders; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppsListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppsListFragment.java index 13406266e..dae36fbf6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppsListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AppsListFragment.java @@ -20,19 +20,19 @@ package org.sufficientlysecure.keychain.remote.ui; import java.util.List; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.Adapter; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.Adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteBackupActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteBackupActivity.java index 524e8819c..f16b50b30 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteBackupActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteBackupActivity.java @@ -19,8 +19,8 @@ package org.sufficientlysecure.keychain.remote.ui; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.remote.CryptoInputParcelCacheService; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteDisplayTransferCodeActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteDisplayTransferCodeActivity.java index c15c776df..d256b2fa7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteDisplayTransferCodeActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteDisplayTransferCodeActivity.java @@ -25,9 +25,9 @@ import android.app.Activity; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteRegisterActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteRegisterActivity.java index a68cccc05..d0b020a99 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteRegisterActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteRegisterActivity.java @@ -25,9 +25,9 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java index 153d52cee..5c49fb2d0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java @@ -27,10 +27,10 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java index a98a239a9..ac22132c7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionActivity.java @@ -25,9 +25,9 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionPresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionPresenter.java index 8f45d5fb3..29a3c3e53 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionPresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RequestKeyPermissionPresenter.java @@ -23,7 +23,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectPublicKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectPublicKeyFragment.java index f696f78e3..1a8ae735c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectPublicKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectPublicKeyFragment.java @@ -24,11 +24,11 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModelProviders; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.widget.LinearLayoutManager; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdListFragment.java index 5ef3ec72e..365935bce 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdListFragment.java @@ -21,11 +21,11 @@ package org.sufficientlysecure.keychain.remote.ui; import java.util.List; import android.app.Activity; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModelProviders; import android.content.Intent; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/DialogKeyChoiceAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/DialogKeyChoiceAdapter.java index 7e3b0864f..fcbfc57cb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/DialogKeyChoiceAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/DialogKeyChoiceAdapter.java @@ -5,9 +5,9 @@ import java.util.List; import android.content.Context; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.Adapter; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.Adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicateActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicateActivity.java index 057d981a8..ad03f6360 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicateActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicateActivity.java @@ -23,19 +23,19 @@ import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.Adapter; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.Adapter; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicatePresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicatePresenter.java index 6464b4add..9b41914b2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicatePresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteDeduplicatePresenter.java @@ -20,9 +20,9 @@ package org.sufficientlysecure.keychain.remote.ui.dialog; import java.util.List; -import android.arch.lifecycle.LifecycleOwner; +import androidx.lifecycle.LifecycleOwner; import android.content.Context; -import android.support.v7.widget.RecyclerView.Adapter; +import androidx.recyclerview.widget.RecyclerView.Adapter; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyActivity.java index e320d5e1c..f91b13ff7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyActivity.java @@ -23,9 +23,9 @@ import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -33,13 +33,13 @@ import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable.ConstantState; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.content.res.ResourcesCompat; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; +import androidx.core.content.res.ResourcesCompat; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyPresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyPresenter.java index 24f93520a..e45a8ffef 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyPresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectAuthenticationKeyPresenter.java @@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.remote.ui.dialog; import java.util.List; -import android.arch.lifecycle.LifecycleOwner; +import androidx.lifecycle.LifecycleOwner; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdKeyActivity.java index 3370ebfb6..17ead0307 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdKeyActivity.java @@ -23,9 +23,9 @@ import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -34,17 +34,17 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable.ConstantState; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.transition.Fade; -import android.support.transition.Transition; -import android.support.transition.TransitionListenerAdapter; -import android.support.transition.TransitionManager; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.content.res.ResourcesCompat; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.transition.Fade; +import androidx.transition.Transition; +import androidx.transition.TransitionListenerAdapter; +import androidx.transition.TransitionManager; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; +import androidx.core.content.res.ResourcesCompat; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdentityKeyPresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdentityKeyPresenter.java index ccf865fb2..f5007522e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdentityKeyPresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/dialog/RemoteSelectIdentityKeyPresenter.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import android.arch.lifecycle.LifecycleOwner; +import androidx.lifecycle.LifecycleOwner; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java index ac67676b3..41fd2f6ef 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/NfcTransport.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.securitytoken; import android.nfc.Tag; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TokenType; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCapabilities.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCapabilities.java index 18f22e9b7..74067dfba 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCapabilities.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCapabilities.java @@ -20,8 +20,8 @@ package org.sufficientlysecure.keychain.securitytoken; import java.io.IOException; import java.nio.ByteBuffer; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCommandApduFactory.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCommandApduFactory.java index b31748de1..729a9d85e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCommandApduFactory.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/OpenPgpCommandApduFactory.java @@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.securitytoken; import java.util.ArrayList; import java.util.List; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.bouncycastle.util.Arrays; import org.bouncycastle.util.encoders.Hex; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SCP11bSecureMessaging.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SCP11bSecureMessaging.java index ce882a272..249b2af8e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SCP11bSecureMessaging.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SCP11bSecureMessaging.java @@ -55,8 +55,8 @@ import java.security.spec.InvalidParameterSpecException; import java.util.ArrayList; import android.content.Context; -import android.support.annotation.CheckResult; -import android.support.annotation.NonNull; +import androidx.annotation.CheckResult; +import androidx.annotation.NonNull; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenConnection.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenConnection.java index 0237c12fd..4215af30c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenConnection.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenConnection.java @@ -24,9 +24,9 @@ import java.util.List; import android.content.Context; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TokenType; import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.TransportType; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenInfo.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenInfo.java index 9e107371e..4320db59b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenInfo.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/SecurityTokenInfo.java @@ -28,8 +28,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; 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; import org.bouncycastle.util.encoders.Hex; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/Transport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/Transport.java index 826494fb5..5cee7126f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/Transport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/Transport.java @@ -22,7 +22,7 @@ import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo.Transport import java.io.IOException; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; /** diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/PsoDecryptTokenOp.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/PsoDecryptTokenOp.java index ceb54cfcb..20cfc041d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/PsoDecryptTokenOp.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/PsoDecryptTokenOp.java @@ -24,8 +24,8 @@ import java.security.Key; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/SecurityTokenChangeKeyTokenOp.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/SecurityTokenChangeKeyTokenOp.java index 3618731ab..6c784326d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/SecurityTokenChangeKeyTokenOp.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/operations/SecurityTokenChangeKeyTokenOp.java @@ -26,7 +26,7 @@ import java.security.interfaces.ECPublicKey; import java.security.interfaces.RSAPrivateCrtKey; import java.util.Arrays; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.VisibleForTesting; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidDescription.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidDescription.java index b0654faa2..c63c6f855 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidDescription.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidDescription.java @@ -21,8 +21,8 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.securitytoken.usb.tpdu.T0ShortApduProtocol; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransceiver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransceiver.java index 75ff2b358..518532514 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransceiver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransceiver.java @@ -24,9 +24,9 @@ import java.nio.ByteOrder; import android.hardware.usb.UsbDeviceConnection; import android.hardware.usb.UsbEndpoint; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.WorkerThread; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; import com.google.auto.value.AutoValue; import org.bouncycastle.util.Arrays; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransportProtocol.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransportProtocol.java index fd3966232..34d1c1ae3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransportProtocol.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/CcidTransportProtocol.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.securitytoken.usb; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; public interface CcidTransportProtocol { void connect(@NonNull CcidTransceiver transceiver) throws UsbTransportException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/UsbTransport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/UsbTransport.java index 9c8fd28de..18766bce5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/UsbTransport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/UsbTransport.java @@ -27,8 +27,8 @@ import android.hardware.usb.UsbDeviceConnection; import android.hardware.usb.UsbEndpoint; import android.hardware.usb.UsbInterface; import android.hardware.usb.UsbManager; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.Pair; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/RBlock.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/RBlock.java index 1536b08a0..f31e8d56f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/RBlock.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/RBlock.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.securitytoken.usb.tpdu; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.securitytoken.usb.UsbTransportException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T0ShortApduProtocol.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T0ShortApduProtocol.java index 63a15b20a..5ec055398 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T0ShortApduProtocol.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T0ShortApduProtocol.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.securitytoken.usb.tpdu; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver; import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver.CcidDataBlock; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1ShortApduProtocol.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1ShortApduProtocol.java index 073b472f4..41f659f26 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1ShortApduProtocol.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1ShortApduProtocol.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.securitytoken.usb.tpdu; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver; import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver.CcidDataBlock; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1TpduProtocol.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1TpduProtocol.java index 5cfe38e36..7fc3a73b5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1TpduProtocol.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/securitytoken/usb/tpdu/T1TpduProtocol.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.securitytoken.usb.tpdu; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.bouncycastle.util.Arrays; import org.sufficientlysecure.keychain.securitytoken.usb.CcidTransceiver; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/BackupKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/BackupKeyringParcel.java index f88580fe2..2e15ab22c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/BackupKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/BackupKeyringParcel.java @@ -22,7 +22,7 @@ import java.util.List; import android.net.Uri; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java index bf60493fe..745f773d3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java @@ -23,8 +23,8 @@ import java.util.Collection; import java.util.List; import android.os.Parcelable; -import android.support.annotation.CheckResult; -import android.support.annotation.Nullable; +import androidx.annotation.CheckResult; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ChangeUnlockParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ChangeUnlockParcel.java index fde6b5fed..9f0196e19 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ChangeUnlockParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ChangeUnlockParcel.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.service; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.util.Passphrase; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java index 00acb8952..ea5a43221 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java @@ -27,14 +27,13 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.SyncResult; -import android.content.pm.PackageManager; import android.os.Bundle; import android.os.IBinder; import android.preference.PreferenceActivity; import android.provider.ContactsContract; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.content.ContextCompat; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; +import androidx.core.content.ContextCompat; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.KeychainApplication; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ImportKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ImportKeyringParcel.java index bf8d20033..d4dac61e5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ImportKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ImportKeyringParcel.java @@ -22,7 +22,7 @@ import java.util.Collections; import java.util.List; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/InputDataParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/InputDataParcel.java index 97c29dbf7..7ea26741c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/InputDataParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/InputDataParcel.java @@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.service; import android.net.Uri; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java index 724b8ae10..9dc0a9c37 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainServiceTask.java @@ -25,7 +25,7 @@ import android.app.Activity; import android.content.Context; import android.os.AsyncTask; import android.os.Parcelable; -import android.support.v4.os.CancellationSignal; +import androidx.core.os.CancellationSignal; import org.sufficientlysecure.keychain.KeychainApplication; import org.sufficientlysecure.keychain.analytics.AnalyticsManager; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java index c0e20f568..19e89d326 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java @@ -36,10 +36,10 @@ import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationCompat.Builder; -import android.support.v4.app.NotificationCompat.InboxStyle; -import android.support.v4.util.LongSparseArray; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationCompat.Builder; +import androidx.core.app.NotificationCompat.InboxStyle; +import androidx.collection.LongSparseArray; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants.NotificationIds; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ProgressDialogManager.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ProgressDialogManager.java index d5086a4ba..1fb4d52e7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ProgressDialogManager.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ProgressDialogManager.java @@ -20,9 +20,9 @@ package org.sufficientlysecure.keychain.service; import android.app.ProgressDialog; import android.os.Handler; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; -import android.support.v4.os.CancellationSignal; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.core.os.CancellationSignal; import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PromoteKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PromoteKeyringParcel.java index c116d242f..a02a2c887 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PromoteKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PromoteKeyringParcel.java @@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.service; import java.util.List; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/RevokeKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/RevokeKeyringParcel.java index c2484f947..22b7ac295 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/RevokeKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/RevokeKeyringParcel.java @@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.service; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java index bb13973cf..703c8137c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java @@ -24,7 +24,7 @@ import java.util.Collections; import java.util.List; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.bouncycastle.bcpg.sig.KeyFlags; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/UploadKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/UploadKeyringParcel.java index 87f2b71ea..1819c333b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/UploadKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/UploadKeyringParcel.java @@ -19,8 +19,8 @@ package org.sufficientlysecure.keychain.service; 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; import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java index e9e9a31ec..7d4882a6d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java @@ -25,8 +25,8 @@ import java.util.HashMap; import java.util.Map; import android.os.Parcelable; -import android.support.annotation.CheckResult; -import android.support.annotation.Nullable; +import androidx.annotation.CheckResult; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import com.ryanharter.auto.value.parcel.ParcelAdapter; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationData.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationData.java index 644a266ee..431a16737 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationData.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationData.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ssh; import android.os.Parcelable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationOperation.java index 243bfba9b..3aad253f3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ssh/AuthenticationOperation.java @@ -21,7 +21,7 @@ package org.sufficientlysecure.keychain.ssh; import java.util.Collection; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.bouncycastle.openpgp.AuthenticationSignatureGenerator; import org.bouncycastle.openpgp.PGPException; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupActivity.java index f20120b65..9806a50bd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupActivity.java @@ -20,8 +20,8 @@ package org.sufficientlysecure.keychain.ui; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import android.view.MenuItem; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java index d8699a078..b0cd5b5ef 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java @@ -28,9 +28,9 @@ import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java index 92cde2cb9..246d7681b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupRestoreFragment.java @@ -32,9 +32,9 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java index 6b4fc964e..a75d3f68f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintActivity.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.ui; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProviders; import android.os.Bundle; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintFragment.java index 9abb2ad39..02989a7c5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyFingerprintFragment.java @@ -18,12 +18,12 @@ package org.sufficientlysecure.keychain.ui; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProviders; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java index 29ff936fb..d882ede52 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java @@ -23,12 +23,12 @@ import java.util.Date; import java.util.List; import android.app.Activity; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModelProviders; import android.content.Intent; import android.graphics.PorterDuff; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java index 90432a79c..b45a2b100 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java @@ -24,11 +24,11 @@ import java.util.ArrayList; import android.content.Intent; import android.nfc.NfcAdapter; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.support.v4.app.TaskStackBuilder; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; +import androidx.core.app.TaskStackBuilder; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.securitytoken.KeyFormat; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java index 74652e621..938a3ea62 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java @@ -23,11 +23,11 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Messenger; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v7.widget.DefaultItemAnimator; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java index 5eabe1e44..007421d2d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java @@ -26,8 +26,8 @@ import java.util.regex.Pattern; import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java index d507e9c1a..f33506f18 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java @@ -20,8 +20,8 @@ package org.sufficientlysecure.keychain.ui; import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyStartFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyStartFragment.java index 5915e051e..e24dce606 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyStartFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyStartFragment.java @@ -24,8 +24,8 @@ import android.content.Intent; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java index 31708ae04..af1201bff 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenAlgorithmFragment.java @@ -20,8 +20,8 @@ package org.sufficientlysecure.keychain.ui; import android.app.Activity; import android.content.Context; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import android.text.Html; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java index 03300baa7..8685f2bc3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenPinFragment.java @@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.ui; import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenWaitFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenWaitFragment.java index 4b300babd..98a551536 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenWaitFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateSecurityTokenWaitFragment.java @@ -21,9 +21,9 @@ package org.sufficientlysecure.keychain.ui; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DebugActionsActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DebugActionsActivity.java index b38856f5e..15cc64bf1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DebugActionsActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DebugActionsActivity.java @@ -32,8 +32,8 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Build.VERSION_CODES; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.widget.Toolbar; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.Toolbar; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 3fefd4455..c20577a13 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -29,9 +29,9 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import android.widget.Toast; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java index 97f2c847e..5982a145e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java @@ -21,11 +21,11 @@ package org.sufficientlysecure.keychain.ui; import java.util.ArrayList; import android.app.Activity; -import android.arch.lifecycle.LiveData; +import androidx.lifecycle.LiveData; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.View; import android.widget.Button; import android.widget.ImageView; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java index 9c46d2725..f944b542f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java @@ -44,11 +44,11 @@ import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; -import android.support.v7.widget.DefaultItemAnimator; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.MenuItem; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java index c4fee2953..2b0d4fedf 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DeleteKeyDialogActivity.java @@ -25,10 +25,10 @@ import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; +import androidx.appcompat.app.AlertDialog; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextActivity.java index 18f2ab0f7..4e36626f3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextActivity.java @@ -23,7 +23,7 @@ import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.widget.Toast; import org.openintents.openpgp.OpenPgpMetadata; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextFragment.java index eb1c2e0ea..c1f3c0bb9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DisplayTextFragment.java @@ -23,8 +23,8 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.util.Linkify; import android.view.LayoutInflater; import android.view.Menu; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java index f0c0ba3d3..24c037969 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java @@ -24,8 +24,8 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Messenger; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 91a646142..cb471882d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -19,8 +19,8 @@ package org.sufficientlysecure.keychain.ui; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; import android.view.Menu; import android.view.MenuItem; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptFragment.java index eb362d0f3..eb6de2883 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptDecryptFragment.java @@ -28,8 +28,8 @@ import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java index 4e0214426..2fcdf0156 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java @@ -21,7 +21,7 @@ import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; +import androidx.fragment.app.FragmentTransaction; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java index 60976b9c0..1e1d419e9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java @@ -41,12 +41,12 @@ import android.net.Uri; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; -import android.support.v4.content.ContextCompat; -import android.support.v7.widget.DefaultItemAnimator; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java index e95c7a226..ee1a690f1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java @@ -22,13 +22,13 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModel; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProviders; import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeFragment.java index 93214e46f..09d458c26 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeFragment.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ui; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import org.sufficientlysecure.keychain.util.Passphrase; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 2775ea320..a65b5271a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -23,7 +23,7 @@ import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.FragmentTransaction; +import androidx.fragment.app.FragmentTransaction; import android.widget.Toast; import org.apache.james.mime4j.util.MimeUtil; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java index 5a53d9d87..d0bdce7bd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpAboutFragment.java @@ -21,7 +21,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java index 6bf653fbf..7c4eb4355 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java @@ -20,8 +20,8 @@ package org.sufficientlysecure.keychain.ui; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.view.ViewPager; +import androidx.fragment.app.Fragment; +import androidx.viewpager.widget.ViewPager; import android.view.View; import com.astuetz.PagerSlidingTabStrip; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java index 6adb9b906..3177157d7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpMarkdownFragment.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ui; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index a5d85a93d..4db8a525a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -27,9 +27,9 @@ import android.content.Intent; import android.net.Uri; import android.nfc.NfcAdapter; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import android.text.TextUtils; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java index 853d82e6a..1b8a783be 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java @@ -25,8 +25,8 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.Menu; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index fbe2e5080..33ecdd8a9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -20,16 +20,16 @@ package org.sufficientlysecure.keychain.ui; import android.app.Activity; import android.content.Context; -import android.databinding.DataBindingUtil; +import androidx.databinding.DataBindingUtil; import android.net.Uri; import android.os.Bundle; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.LoaderManager; -import android.support.v4.content.Loader; -import android.support.v7.widget.LinearLayoutManager; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.loader.app.LoaderManager; +import androidx.loader.content.Loader; +import androidx.recyclerview.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java index 9e76ace80..f69a465af 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysProxyActivity.java @@ -25,7 +25,7 @@ import android.nfc.NfcAdapter; import android.os.Build; import android.os.Bundle; import android.os.Parcelable; -import android.support.v4.app.FragmentActivity; +import androidx.fragment.app.FragmentActivity; import android.widget.Toast; import com.google.zxing.integration.android.IntentIntegrator; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysSearchFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysSearchFragment.java index 1b60ab634..078a54eca 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysSearchFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysSearchFragment.java @@ -24,12 +24,12 @@ import android.database.MatrixCursor; import android.os.Bundle; import android.preference.PreferenceActivity; import android.provider.BaseColumns; -import android.support.v4.app.Fragment; -import android.support.v4.view.MenuItemCompat; -import android.support.v4.view.MenuItemCompat.OnActionExpandListener; -import android.support.v4.widget.CursorAdapter; -import android.support.v4.widget.SimpleCursorAdapter; -import android.support.v7.widget.SearchView; +import androidx.fragment.app.Fragment; +import androidx.core.view.MenuItemCompat; +import androidx.core.view.MenuItemCompat.OnActionExpandListener; +import androidx.cursoradapter.widget.CursorAdapter; +import androidx.cursoradapter.widget.SimpleCursorAdapter; +import androidx.appcompat.widget.SearchView; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -48,8 +48,8 @@ import org.sufficientlysecure.keychain.util.Preferences.CloudSearchPrefs; import java.util.ArrayList; import java.util.List; -import static android.support.v7.widget.SearchView.OnQueryTextListener; -import static android.support.v7.widget.SearchView.OnSuggestionListener; +import static androidx.appcompat.widget.SearchView.OnQueryTextListener; +import static androidx.appcompat.widget.SearchView.OnSuggestionListener; /** * Consists of the search bar, search button, and search settings button diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index e0855c50c..4c1c30336 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -23,17 +23,9 @@ import java.util.List; import android.animation.ObjectAnimator; import android.app.Activity; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModelProviders; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; -import android.support.annotation.WorkerThread; -import android.support.v4.app.FragmentActivity; -import android.support.v4.view.MenuItemCompat; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.SearchView; import android.view.ActionMode; import android.view.LayoutInflater; import android.view.Menu; @@ -44,6 +36,14 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.ViewAnimator; +import androidx.annotation.WorkerThread; +import androidx.appcompat.widget.SearchView; +import androidx.core.view.MenuItemCompat; +import androidx.fragment.app.FragmentActivity; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModelProviders; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import com.getbase.floatingactionbutton.FloatingActionButton; import com.getbase.floatingactionbutton.FloatingActionsMenu; import eu.davidea.fastscroller.FastScroller; @@ -514,7 +514,7 @@ public class KeyListFragment extends RecyclerFragment extends LiveData { @NonNull diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/IdentityDao.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/IdentityDao.java index 288d6d18f..b64a84f91 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/IdentityDao.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/IdentityDao.java @@ -22,14 +22,14 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import android.arch.persistence.db.SupportSQLiteDatabase; +import androidx.sqlite.db.SupportSQLiteDatabase; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.graphics.drawable.Drawable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import com.squareup.sqldelight.SqlDelightQuery; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SubkeyStatusDao.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SubkeyStatusDao.java index 2125527f7..c1ad2ed11 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SubkeyStatusDao.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SubkeyStatusDao.java @@ -25,7 +25,7 @@ import java.util.Date; import java.util.List; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.model.SubKey; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SystemContactDao.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SystemContactDao.java index 499f36347..5b0f59055 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SystemContactDao.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/loader/SystemContactDao.java @@ -28,7 +28,7 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; import android.provider.ContactsContract; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.util.ContactHelper; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/ViewKeyMvpView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/ViewKeyMvpView.java index 5898ae907..8ad9f509e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/ViewKeyMvpView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/presenter/ViewKeyMvpView.java @@ -19,8 +19,8 @@ package org.sufficientlysecure.keychain.ui.keyview.presenter; import android.content.Intent; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java index 1901f1d8c..4008d4b70 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/IdentitiesCardView.java @@ -19,10 +19,10 @@ package org.sufficientlysecure.keychain.ui.keyview.view; import android.content.Context; -import android.support.v7.widget.CardView; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.AdapterDataObserver; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyHealthView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyHealthView.java index 9b94195b3..66145bf64 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyHealthView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyHealthView.java @@ -21,10 +21,10 @@ package org.sufficientlysecure.keychain.ui.keyview.view; import java.util.Date; import android.content.Context; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.StringRes; -import android.support.v4.content.ContextCompat; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.StringRes; +import androidx.core.content.ContextCompat; import android.text.format.DateFormat; import android.util.AttributeSet; import android.view.LayoutInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyStatusList.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyStatusList.java index b4bb2669d..c5a89db89 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyStatusList.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyStatusList.java @@ -19,9 +19,9 @@ package org.sufficientlysecure.keychain.ui.keyview.view; import android.content.Context; -import android.support.annotation.ColorRes; -import android.support.annotation.StringRes; -import android.support.v4.content.ContextCompat; +import androidx.annotation.ColorRes; +import androidx.annotation.StringRes; +import androidx.core.content.ContextCompat; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyserverStatusView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyserverStatusView.java index 1b353e729..af053b41b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyserverStatusView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/KeyserverStatusView.java @@ -21,10 +21,10 @@ package org.sufficientlysecure.keychain.ui.keyview.view; import java.util.Date; import android.content.Context; -import android.support.annotation.ColorRes; -import android.support.annotation.DrawableRes; -import android.support.annotation.StringRes; -import android.support.v4.content.ContextCompat; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.StringRes; +import androidx.core.content.ContextCompat; import android.text.format.DateFormat; import android.util.AttributeSet; import android.view.LayoutInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/SystemContactCardView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/SystemContactCardView.java index 2cfd01440..1d487a8a7 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/SystemContactCardView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/keyview/view/SystemContactCardView.java @@ -20,7 +20,7 @@ package org.sufficientlysecure.keychain.ui.keyview.view; import android.content.Context; import android.graphics.Bitmap; -import android.support.v7.widget.CardView; +import androidx.cardview.widget.CardView; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ChangePinDialogHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ChangePinDialogHelper.java index 08834f99a..4f139a4da 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ChangePinDialogHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ChangePinDialogHelper.java @@ -22,9 +22,9 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnShowListener; -import android.support.annotation.CheckResult; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AlertDialog.Builder; +import androidx.annotation.CheckResult; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AlertDialog.Builder; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenFragment.java index 4b34a13c2..179d99088 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenFragment.java @@ -24,18 +24,18 @@ import java.util.Objects; import android.Manifest; import android.annotation.TargetApi; import android.app.Activity; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProviders; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build.VERSION_CODES; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.v4.app.Fragment; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AlertDialog.Builder; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.fragment.app.Fragment; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AlertDialog.Builder; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenPresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenPresenter.java index db4400711..d431578ce 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenPresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenPresenter.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ui.token; -import android.arch.lifecycle.LifecycleOwner; +import androidx.lifecycle.LifecycleOwner; import android.content.Context; import android.net.Uri; import android.os.Handler; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenViewModel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenViewModel.java index 4509e9d85..89b2d2612 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenViewModel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/ManageSecurityTokenViewModel.java @@ -1,9 +1,9 @@ package org.sufficientlysecure.keychain.ui.token; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.LiveData; -import android.arch.lifecycle.ViewModel; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; import android.content.Context; import android.net.Uri; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/PublicKeyRetriever.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/PublicKeyRetriever.java index 0a4c26740..ed4a3e532 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/PublicKeyRetriever.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/token/PublicKeyRetriever.java @@ -24,7 +24,7 @@ import java.util.List; import android.content.Context; import android.net.Uri; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.auto.value.AutoValue; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/presenter/TransferPresenter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/presenter/TransferPresenter.java index a89a61067..ff76d29db 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/presenter/TransferPresenter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/presenter/TransferPresenter.java @@ -22,8 +22,8 @@ import java.io.IOException; import java.net.URISyntaxException; import java.util.List; -import android.arch.lifecycle.LifecycleOwner; -import android.arch.lifecycle.LiveData; +import androidx.lifecycle.LifecycleOwner; +import androidx.lifecycle.LiveData; import android.content.Context; import android.graphics.Bitmap; import android.net.ConnectivityManager; @@ -34,8 +34,8 @@ import android.net.wifi.WifiManager; import android.os.Build.VERSION_CODES; import android.os.Handler; import android.os.Parcelable; -import android.support.annotation.RequiresApi; -import android.support.v7.widget.RecyclerView.Adapter; +import androidx.annotation.RequiresApi; +import androidx.recyclerview.widget.RecyclerView.Adapter; import android.view.LayoutInflater; import org.openintents.openpgp.util.OpenPgpUtils; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/ReceivedSecretKeyList.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/ReceivedSecretKeyList.java index ffa86931d..b61c9e0c4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/ReceivedSecretKeyList.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/ReceivedSecretKeyList.java @@ -22,9 +22,9 @@ import java.util.ArrayList; import java.util.List; import android.content.Context; -import android.support.annotation.Nullable; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.LayoutInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java index 262d13a8b..fe55fc432 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferFragment.java @@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.ui.transfer.view; import android.app.Activity; -import android.arch.lifecycle.ViewModelProviders; +import androidx.lifecycle.ViewModelProviders; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; @@ -32,16 +32,16 @@ import android.net.wifi.WifiManager; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentManager.OnBackStackChangedListener; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AlertDialog.Builder; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.RecyclerView.Adapter; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentManager.OnBackStackChangedListener; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AlertDialog.Builder; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView.Adapter; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.Menu; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferNotAvailableFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferNotAvailableFragment.java index 549b5f344..a45de3191 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferNotAvailableFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferNotAvailableFragment.java @@ -19,8 +19,8 @@ package org.sufficientlysecure.keychain.ui.transfer.view; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferSecretKeyList.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferSecretKeyList.java index 5cdcd8842..2f9e5b8f2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferSecretKeyList.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/transfer/view/TransferSecretKeyList.java @@ -22,10 +22,10 @@ import java.util.ArrayList; import java.util.List; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.LayoutInflater; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/InstallDialogFragmentHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/InstallDialogFragmentHelper.java index a31d6bedd..a0d3df680 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/InstallDialogFragmentHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/InstallDialogFragmentHelper.java @@ -25,7 +25,7 @@ import android.os.Bundle; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; -import android.support.v7.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; import android.view.ContextThemeWrapper; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java index 25c67634f..a26a3fe25 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyFormattingUtils.java @@ -26,7 +26,7 @@ import java.util.Locale; import android.content.Context; import android.content.res.Resources; import android.graphics.PorterDuff; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.View; import android.widget.ImageView; import android.widget.TextView; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyInfoFormatter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyInfoFormatter.java index 743a1a2c7..1aa2c9aae 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyInfoFormatter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/KeyInfoFormatter.java @@ -2,8 +2,8 @@ package org.sufficientlysecure.keychain.ui.util; import android.content.Context; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import android.text.format.DateUtils; import android.view.View; import android.widget.ImageView; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java index 44bfc03a8..6e09160d3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java @@ -18,8 +18,8 @@ package org.sufficientlysecure.keychain.ui.util; import android.app.Activity; -import android.support.annotation.CheckResult; -import android.support.v4.app.Fragment; +import androidx.annotation.CheckResult; +import androidx.fragment.app.Fragment; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java index 7b7ad504c..c002d004f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/PermissionsUtil.java @@ -25,8 +25,8 @@ import android.content.Context; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; -import android.support.v4.app.Fragment; -import android.support.v4.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; import android.widget.Toast; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/DividerItemDecoration.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/DividerItemDecoration.java index 7473f78e3..4a2e0f268 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/DividerItemDecoration.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/DividerItemDecoration.java @@ -21,8 +21,8 @@ import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.View; public class DividerItemDecoration extends RecyclerView.ItemDecoration { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperAdapter.java index c691182bf..c57606c47 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperAdapter.java @@ -16,8 +16,8 @@ package org.sufficientlysecure.keychain.ui.util.recyclerview; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.ItemTouchHelper; /** * Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}. diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperDragCallback.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperDragCallback.java index 0fd24581d..8ba77443f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperDragCallback.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperDragCallback.java @@ -16,8 +16,8 @@ package org.sufficientlysecure.keychain.ui.util.recyclerview; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; +import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.ItemTouchHelper; /** * An implementation of {@link ItemTouchHelper.Callback} that enables basic drag & drop and diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperViewHolder.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperViewHolder.java index 97e70d71e..d0c1de845 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperViewHolder.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/ItemTouchHelperViewHolder.java @@ -16,11 +16,11 @@ package org.sufficientlysecure.keychain.ui.util.recyclerview; -import android.support.v7.widget.helper.ItemTouchHelper; +import androidx.recyclerview.widget.ItemTouchHelper; /** * Interface to notify an item ViewHolder of relevant callbacks from {@link - * android.support.v7.widget.helper.ItemTouchHelper.Callback}. + * androidx.recyclerview.widget.ItemTouchHelper.Callback}. */ public interface ItemTouchHelperViewHolder { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/RecyclerItemClickListener.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/RecyclerItemClickListener.java index 6d9ca93e3..abacd00a4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/RecyclerItemClickListener.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/recyclerview/RecyclerItemClickListener.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ui.util.recyclerview; import android.content.Context; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CacheTTLSpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CacheTTLSpinner.java index 1530f4d54..bf25c528f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CacheTTLSpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CacheTTLSpinner.java @@ -21,8 +21,8 @@ package org.sufficientlysecure.keychain.ui.widget; import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; -import android.support.v4.widget.SimpleCursorAdapter; -import android.support.v7.widget.AppCompatSpinner; +import androidx.cursoradapter.widget.SimpleCursorAdapter; +import androidx.appcompat.widget.AppCompatSpinner; import android.util.AttributeSet; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ConnectionStatusView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ConnectionStatusView.java index f48f375d4..b9358fc07 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ConnectionStatusView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ConnectionStatusView.java @@ -23,7 +23,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.View; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java index bd942a64c..ad15ef62e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ui.widget; import android.content.Context; -import android.support.v7.widget.AppCompatAutoCompleteTextView; +import androidx.appcompat.widget.AppCompatAutoCompleteTextView; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyChoiceSpinnerAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyChoiceSpinnerAdapter.java index b41b7adc8..4cf64ffa3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyChoiceSpinnerAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyChoiceSpinnerAdapter.java @@ -2,7 +2,7 @@ package org.sufficientlysecure.keychain.ui.widget; import android.content.Context; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java index 8ac45c6d8..794443542 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java @@ -23,9 +23,9 @@ import java.util.List; import android.content.Context; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v7.widget.AppCompatSpinner; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.appcompat.widget.AppCompatSpinner; import android.util.AttributeSet; import android.view.View; import android.widget.AdapterView; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/NameEditText.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/NameEditText.java index 6d927d0c9..b9b266f36 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/NameEditText.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/NameEditText.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.ui.widget; import android.content.Context; -import android.support.v7.widget.AppCompatAutoCompleteTextView; +import androidx.appcompat.widget.AppCompatAutoCompleteTextView; import android.util.AttributeSet; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PrefixedEditText.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PrefixedEditText.java index cf04d346f..e5615d23a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PrefixedEditText.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PrefixedEditText.java @@ -20,8 +20,8 @@ package org.sufficientlysecure.keychain.ui.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.*; -import android.support.annotation.NonNull; -import android.support.v7.widget.AppCompatEditText; +import androidx.annotation.NonNull; +import androidx.appcompat.widget.AppCompatEditText; import android.text.Layout; import android.text.TextPaint; import android.util.AttributeSet; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ToolableViewAnimator.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ToolableViewAnimator.java index 172009d24..b8eb7b942 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ToolableViewAnimator.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ToolableViewAnimator.java @@ -27,7 +27,7 @@ package org.sufficientlysecure.keychain.ui.widget; import android.content.Context; import android.content.res.TypedArray; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java index 821117487..98b7379d2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java @@ -26,8 +26,8 @@ import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import android.content.ClipDescription; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; /** This class can be used to guess whether a stream of data is encoded in a given * charset or not. diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java index e5f67ba15..ceca99564 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java @@ -43,7 +43,7 @@ import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.CommonDataKinds.Im; import android.provider.ContactsContract.Data; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.util.Patterns; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java index 8bfe26aeb..bd5272d41 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/CountingOutputStream.java @@ -19,7 +19,7 @@ import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; public final class CountingOutputStream extends FilterOutputStream { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/DatabaseUtil.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/DatabaseUtil.java index d9cffe702..6f1ac9946 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/DatabaseUtil.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/DatabaseUtil.java @@ -18,7 +18,7 @@ package org.sufficientlysecure.keychain.util; -import android.arch.persistence.db.SupportSQLiteDatabase; +import androidx.sqlite.db.SupportSQLiteDatabase; import android.database.Cursor; import android.text.TextUtils; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java index 3dcbcf271..2441d144c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/FileHelper.java @@ -49,7 +49,7 @@ import android.os.Build.VERSION_CODES; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.OpenableColumns; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.widget.Toast; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java index 68b402124..885cf3f7c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/IntentIntegratorSupportV4.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.util; import android.content.Intent; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import com.google.zxing.integration.android.IntentIntegrator; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Numeric9x4PassphraseUtil.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Numeric9x4PassphraseUtil.java index 89d9f004e..4d540d4aa 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Numeric9x4PassphraseUtil.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Numeric9x4PassphraseUtil.java @@ -23,7 +23,7 @@ import java.security.SecureRandom; import java.util.Random; import java.util.regex.Pattern; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.VisibleForTesting; // see https://autocrypt.org/level1.html#setup-code public class Numeric9x4PassphraseUtil { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableHashMap.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableHashMap.java index 1294c1221..c9d6f7382 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableHashMap.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableHashMap.java @@ -22,7 +22,7 @@ import java.util.HashMap; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.sufficientlysecure.keychain.KeychainApplication; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java index 86429dff8..423d24dd6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ParcelableProxy.java @@ -23,7 +23,7 @@ import java.net.Proxy; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; /** * used to simply transport java.net.Proxy objects created using InetSockets between services/activities diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index c39b48b2f..de0c15306 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -29,7 +29,7 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Parcelable; import android.preference.PreferenceManager; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.sufficientlysecure.keychain.Constants; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ResourceUtils.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ResourceUtils.java index b5432ff4e..dd1cdaf03 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ResourceUtils.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ResourceUtils.java @@ -6,9 +6,9 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Drawable; -import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; public class ResourceUtils { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ShareKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ShareKeyHelper.java index 20541a7f6..12d7b8351 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ShareKeyHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ShareKeyHelper.java @@ -31,7 +31,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.ParcelFileDescriptor; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/WebKeyDirectoryUtil.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/WebKeyDirectoryUtil.java index 5dc0bd735..622a93eaf 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/WebKeyDirectoryUtil.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/WebKeyDirectoryUtil.java @@ -1,6 +1,6 @@ package org.sufficientlysecure.keychain.util; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; diff --git a/OpenKeychain/src/main/res/layout/add_keyserver_dialog.xml b/OpenKeychain/src/main/res/layout/add_keyserver_dialog.xml index feebad47f..63ee7dae2 100644 --- a/OpenKeychain/src/main/res/layout/add_keyserver_dialog.xml +++ b/OpenKeychain/src/main/res/layout/add_keyserver_dialog.xml @@ -9,7 +9,7 @@ android:paddingRight="24dp" android:paddingTop="16dp"> - - + - - + - - +