diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 922cf504b4a99ed2cfc8c45fabc3e6cc925ae7e3..a4b19720a9155c7fb9eab676ac66fbb47365f7f3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,7 +28,7 @@ tools:ignore="QueryAllPackagesPermission" /> - + - + android:permission="foundation.e.accountmanager.permission.ACCOUNT_EVENTS"> - + - + android:permission="foundation.e.accountmanager.permission.ACCOUNT_EVENTS"> diff --git a/app/src/main/java/foundation/e/drive/account/receivers/AccountAddedReceiver.kt b/app/src/main/java/foundation/e/drive/account/receivers/AccountAddedReceiver.kt index 7ed75c7a128516cd4b34bd9270be7f26628e87bc..fb8a751d1367c6377e12a9aed4f04f817b398079 100644 --- a/app/src/main/java/foundation/e/drive/account/receivers/AccountAddedReceiver.kt +++ b/app/src/main/java/foundation/e/drive/account/receivers/AccountAddedReceiver.kt @@ -30,10 +30,19 @@ import timber.log.Timber * @author Vincent Bourgmayer */ class AccountAddedReceiver : BroadcastReceiver() { + + companion object { + const val ACTION_ACCOUNT_ADDED = "foundation.e.accountmanager.action.ACCOUNT_ADDED" + } + override fun onReceive(context: Context?, intent: Intent?) { Timber.d("\"Account added\" intent received") if (context == null || intent == null || intent.extras == null) return + if (intent.action != ACTION_ACCOUNT_ADDED) { + Timber.wtf("AccountAddedReceiver.onReceive is called without proper action") + return + } val extras = intent.extras!! val accountName = extras.getString(AccountManager.KEY_ACCOUNT_NAME, "") diff --git a/app/src/main/java/foundation/e/drive/account/receivers/AccountRemoveCallbackReceiver.java b/app/src/main/java/foundation/e/drive/account/receivers/AccountRemoveCallbackReceiver.java index c8f16a69000fcd2364b837f2a1e50d5caa6a1ede..c24afac7b818a40d65d1b5cee99b4624a8947d32 100644 --- a/app/src/main/java/foundation/e/drive/account/receivers/AccountRemoveCallbackReceiver.java +++ b/app/src/main/java/foundation/e/drive/account/receivers/AccountRemoveCallbackReceiver.java @@ -35,7 +35,7 @@ import timber.log.Timber; public class AccountRemoveCallbackReceiver extends BroadcastReceiver { - private static final String ACTION_ACCOUNT_REMOVED = "android.accounts.action.ACCOUNT_REMOVED"; + private static final String ACTION_ACCOUNT_REMOVED = "foundation.e.accountmanager.action.ACCOUNT_REMOVED"; @SuppressLint("UnsafeProtectedBroadcastReceiver") @Override diff --git a/lint.xml b/lint.xml index 61366ae37eb75b7e206d05d27ee0183306551c9a..405e69b842ba3e8bca32a9d740b30291af4512c2 100644 --- a/lint.xml +++ b/lint.xml @@ -5,7 +5,8 @@ - + +