diff options
| author | Harsh Shandilya <msfjarvis@gmail.com> | 2020-07-08 01:25:55 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-08 01:25:55 +0530 |
| commit | 616992087846fe76555080baf131637924b67507 (patch) | |
| tree | 3130913ac749c3d765af3a38aa13208fefbf6400 /app/src/main/java/com/zeapo/pwdstore/autofill | |
| parent | 4657185dc6f161418ce7e8e4f9dd2976fc54427a (diff) | |
| download | HardenedPass-616992087846fe76555080baf131637924b67507.tar.gz HardenedPass-616992087846fe76555080baf131637924b67507.zip | |
global: set an import order rule and reformat with it (#924)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/autofill')
18 files changed, 45 insertions, 21 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.kt index 30766021..3d040f13 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.kt @@ -90,6 +90,7 @@ class AutofillActivity : AppCompatActivity() { } companion object { + const val REQUEST_CODE_DECRYPT_AND_VERIFY = 9913 const val REQUEST_CODE_PICK = 777 const val REQUEST_CODE_PICK_MATCH_WITH = 778 diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt index 5effb32f..87721ad2 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt @@ -34,6 +34,7 @@ import com.zeapo.pwdstore.utils.resolveAttribute import com.zeapo.pwdstore.utils.splitLines class AutofillFragment : DialogFragment() { + private var adapter: ArrayAdapter<String>? = null private var isWeb: Boolean = false @@ -225,6 +226,7 @@ class AutofillFragment : DialogFragment() { } companion object { + private const val MATCH_WITH = 777 } } diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt index 1841aa06..feef77a5 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt @@ -22,9 +22,9 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton import com.zeapo.pwdstore.R import com.zeapo.pwdstore.databinding.AutofillRecyclerViewBinding import com.zeapo.pwdstore.utils.viewBinding -import me.zhanghai.android.fastscroll.FastScrollerBuilder import java.lang.ref.WeakReference import java.util.ArrayList +import me.zhanghai.android.fastscroll.FastScrollerBuilder class AutofillPreferenceActivity : AppCompatActivity() { diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.kt index 937c0e1a..ac53d32a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillRecyclerAdapter.kt @@ -20,9 +20,9 @@ import androidx.recyclerview.widget.SortedList import androidx.recyclerview.widget.SortedListAdapterCallback import com.zeapo.pwdstore.R import com.zeapo.pwdstore.utils.splitLines -import me.zhanghai.android.fastscroll.PopupTextProvider import java.util.ArrayList import java.util.Locale +import me.zhanghai.android.fastscroll.PopupTextProvider internal class AutofillRecyclerAdapter( allApps: List<AppInfo>, @@ -161,6 +161,7 @@ internal class AutofillRecyclerAdapter( } internal inner class ViewHolder(var view: View) : RecyclerView.ViewHolder(view), View.OnClickListener { + var name: AppCompatTextView = view.findViewById(R.id.app_name) var icon: AppCompatImageView = view.findViewById(R.id.app_icon) var secondary: AppCompatTextView = view.findViewById(R.id.secondary_text) diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt index da774882..1d3086f9 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt @@ -35,15 +35,6 @@ import com.zeapo.pwdstore.model.PasswordEntry import com.zeapo.pwdstore.utils.PasswordRepository import com.zeapo.pwdstore.utils.PreferenceKeys import com.zeapo.pwdstore.utils.splitLines -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.cancel -import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext -import me.msfjarvis.openpgpktx.util.OpenPgpApi -import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection -import org.openintents.openpgp.IOpenPgpService2 -import org.openintents.openpgp.OpenPgpError import java.io.ByteArrayOutputStream import java.io.File import java.io.IOException @@ -53,8 +44,18 @@ import java.net.MalformedURLException import java.net.URL import java.util.ArrayList import java.util.Locale +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.cancel +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import me.msfjarvis.openpgpktx.util.OpenPgpApi +import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection +import org.openintents.openpgp.IOpenPgpService2 +import org.openintents.openpgp.OpenPgpError class AutofillService : AccessibilityService(), CoroutineScope by CoroutineScope(Dispatchers.Default) { + private var serviceConnection: OpenPgpServiceConnection? = null private var settings: SharedPreferences? = null private var info: AccessibilityNodeInfo? = null // the original source of the event (the edittext field) @@ -560,10 +561,12 @@ class AutofillService : AccessibilityService(), CoroutineScope by CoroutineScope } internal object Constants { + const val TAG = "Keychain" } private inner class OnBoundListener : OpenPgpServiceConnection.OnBound { + override fun onBound(service: IOpenPgpService2) { decryptAndVerify() } @@ -574,6 +577,7 @@ class AutofillService : AccessibilityService(), CoroutineScope by CoroutineScope } companion object { + var instance: AutofillService? = null private set } diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillHelper.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillHelper.kt index e9b2c630..361f2fee 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillHelper.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillHelper.kt @@ -89,6 +89,7 @@ val AssistStructure.ViewNode.webOrigin: String? data class Credentials(val username: String?, val password: String?, val otp: String?) { companion object { + fun fromStoreEntry( context: Context, file: File, diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillMatcher.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillMatcher.kt index d64e80a4..b22833a5 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillMatcher.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillMatcher.kt @@ -43,6 +43,7 @@ class AutofillPublisherChangedException(val formOrigin: FormOrigin) : class AutofillMatcher { companion object { + private const val MAX_NUM_MATCHES = 10 private const val PREFERENCE_PREFIX_TOKEN = "token;" diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillPreferences.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillPreferences.kt index a08fc424..38bd375e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillPreferences.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillPreferences.kt @@ -110,6 +110,7 @@ enum class DirectoryStructure(val value: String) { } companion object { + const val PREFERENCE = "oreo_autofill_directory_structure" private val DEFAULT = FileBased diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillScenario.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillScenario.kt index ee8e3602..daa2db45 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillScenario.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillScenario.kt @@ -27,6 +27,7 @@ enum class AutofillAction { sealed class AutofillScenario<out T : Any> { companion object { + const val BUNDLE_KEY_USERNAME_ID = "usernameId" const val BUNDLE_KEY_FILL_USERNAME = "fillUsername" const val BUNDLE_KEY_OTP_ID = "otpId" @@ -64,6 +65,7 @@ sealed class AutofillScenario<out T : Any> { } class Builder<T : Any> { + var username: T? = null var fillUsername = false var otp: T? = null diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt index 5e6f460e..ec333bec 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/AutofillStrategyDsl.kt @@ -174,6 +174,7 @@ class AutofillRule private constructor( ) { companion object { + private var ruleId = 1 } diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/Form.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/Form.kt index e4ae1f75..85164f8f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/Form.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/Form.kt @@ -37,6 +37,7 @@ sealed class FormOrigin(open val identifier: String) { data class App(override val identifier: String) : FormOrigin(identifier) companion object { + private const val BUNDLE_KEY_WEB_IDENTIFIER = "webIdentifier" private const val BUNDLE_KEY_APP_IDENTIFIER = "appIdentifier" @@ -74,6 +75,7 @@ sealed class FormOrigin(open val identifier: String) { private class Form(context: Context, structure: AssistStructure, isManualRequest: Boolean) { companion object { + private val SUPPORTED_SCHEMES = listOf("http", "https") } @@ -202,6 +204,7 @@ class FillableForm private constructor( ) { companion object { + fun makeFillInDataset( context: Context, credentials: Credentials, diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt index cdf9a8ff..b6404c6e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/OreoAutofillService.kt @@ -24,6 +24,7 @@ import com.zeapo.pwdstore.utils.hasFlag class OreoAutofillService : AutofillService() { companion object { + // TODO: Provide a user-configurable denylist private val DENYLISTED_PACKAGES = listOf( BuildConfig.APPLICATION_ID, diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/PublicSuffixListCache.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/PublicSuffixListCache.kt index 349f0a1b..ab4f134a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/PublicSuffixListCache.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/PublicSuffixListCache.kt @@ -12,6 +12,7 @@ import kotlinx.coroutines.runBlocking import mozilla.components.lib.publicsuffixlist.PublicSuffixList private object PublicSuffixListCache { + private lateinit var publicSuffixList: PublicSuffixList fun getOrCachePublicSuffixList(context: Context): PublicSuffixList { diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt index c5e47544..eabd24c0 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt @@ -24,16 +24,6 @@ import com.zeapo.pwdstore.autofill.oreo.Credentials import com.zeapo.pwdstore.autofill.oreo.DirectoryStructure import com.zeapo.pwdstore.autofill.oreo.FillableForm import com.zeapo.pwdstore.model.PasswordEntry -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.cancelChildren -import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext -import me.msfjarvis.openpgpktx.util.OpenPgpApi -import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection -import org.openintents.openpgp.IOpenPgpService2 -import org.openintents.openpgp.OpenPgpError import java.io.ByteArrayOutputStream import java.io.File import java.io.FileNotFoundException @@ -44,11 +34,22 @@ import kotlin.coroutines.Continuation import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException import kotlin.coroutines.suspendCoroutine +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.cancelChildren +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import me.msfjarvis.openpgpktx.util.OpenPgpApi +import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection +import org.openintents.openpgp.IOpenPgpService2 +import org.openintents.openpgp.OpenPgpError @RequiresApi(Build.VERSION_CODES.O) class AutofillDecryptActivity : AppCompatActivity(), CoroutineScope { companion object { + private const val EXTRA_FILE_PATH = "com.zeapo.pwdstore.autofill.oreo.EXTRA_FILE_PATH" private const val EXTRA_SEARCH_ACTION = "com.zeapo.pwdstore.autofill.oreo.EXTRA_SEARCH_ACTION" diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillFilterActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillFilterActivity.kt index 7467b9c9..a1d2fa59 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillFilterActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillFilterActivity.kt @@ -43,6 +43,7 @@ import com.zeapo.pwdstore.utils.viewBinding class AutofillFilterView : AppCompatActivity() { companion object { + private const val HEIGHT_PERCENTAGE = 0.9 private const val WIDTH_PERCENTAGE = 0.75 diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt index 8ac980cc..d71d6f2d 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillPublisherChangedActivity.kt @@ -28,6 +28,7 @@ import com.zeapo.pwdstore.utils.viewBinding class AutofillPublisherChangedActivity : AppCompatActivity() { companion object { + private const val EXTRA_APP_PACKAGE = "com.zeapo.pwdstore.autofill.oreo.ui.EXTRA_APP_PACKAGE" private var publisherChangedRequestCode = 1 diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt index 87359333..4661716f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt @@ -32,6 +32,7 @@ import java.io.File class AutofillSaveActivity : AppCompatActivity() { companion object { + private const val EXTRA_FOLDER_NAME = "com.zeapo.pwdstore.autofill.oreo.ui.EXTRA_FOLDER_NAME" private const val EXTRA_PASSWORD = "com.zeapo.pwdstore.autofill.oreo.ui.EXTRA_PASSWORD" diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/PasswordViewHolder.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/PasswordViewHolder.kt index 71c7cf46..162362f6 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/PasswordViewHolder.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/PasswordViewHolder.kt @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView import com.zeapo.pwdstore.R class PasswordViewHolder(view: View) : RecyclerView.ViewHolder(view) { + val title: TextView = itemView.findViewById(R.id.title) val subtitle: TextView = itemView.findViewById(R.id.subtitle) } |
