diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-29 21:20:01 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-29 21:20:01 +0200 |
commit | 654d98ac2a2df847df15c72cde4af0dd99d3c180 (patch) | |
tree | 04ed8f3bc0b19293988b324ba71f1d879301e9d2 /OpenKeychain/src/main | |
parent | d20f657151b038c25dc071dd9d227380d09ff866 (diff) | |
download | open-keychain-654d98ac2a2df847df15c72cde4af0dd99d3c180.tar.gz open-keychain-654d98ac2a2df847df15c72cde4af0dd99d3c180.tar.bz2 open-keychain-654d98ac2a2df847df15c72cde4af0dd99d3c180.zip |
Fix NfcActivity task stack problem
Diffstat (limited to 'OpenKeychain/src/main')
5 files changed, 12 insertions, 8 deletions
diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index d4ff5d2d7..2c8de0372 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -620,9 +620,18 @@ <activity android:name=".ui.PassphraseDialogActivity" android:theme="@android:style/Theme.NoDisplay" /> + <!-- + NOTE: singleTop is set to get NFC foreground dispatch to work. + Then, all NFC intents will be broadcasted to onNewIntent() of this activity! + If more than one task stack of OpenKeychain exists, the broadcast + restarts the activity with onCreate() instead of calling onNewIntent(). + taskAffinity and allowTaskReparenting somehow prevents this from happening! + --> <activity android:name=".ui.NfcActivity" - android:launchMode="singleTop" /> + android:launchMode="singleTop" + android:taskAffinity=":Nfc" + android:allowTaskReparenting="true" /> <activity android:name=".ui.HelpActivity" android:label="@string/title_help" /> 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 8a115b245..10a178ae2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -194,7 +194,6 @@ public class OpenPgpService extends RemoteService { intent.putExtra(NfcActivity.EXTRA_NFC_HASH_TO_SIGN, hashToSign); intent.putExtra(NfcActivity.EXTRA_NFC_HASH_ALGO, hashAlgo); - intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); @@ -215,7 +214,6 @@ public class OpenPgpService extends RemoteService { intent.putExtra(NfcActivity.EXTRA_PIN, pin); intent.putExtra(NfcActivity.EXTRA_NFC_ENC_SESSION_KEY, encryptedSessionKey); - intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); 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 dd035c78f..c4c6c383e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java @@ -97,7 +97,6 @@ public abstract class DecryptFragment extends Fragment { intent.putExtra(NfcActivity.EXTRA_PIN, pin); intent.putExtra(NfcActivity.EXTRA_NFC_ENC_SESSION_KEY, encryptedSessionKey); - intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(intent, REQUEST_CODE_NFC_DECRYPT); } 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 9a41f4fbc..58bbcb4f5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -40,7 +40,6 @@ public abstract class EncryptActivity extends DrawerActivity { intent.putExtra(NfcActivity.EXTRA_PIN, pin); intent.putExtra(NfcActivity.EXTRA_NFC_HASH_TO_SIGN, hashToSign); intent.putExtra(NfcActivity.EXTRA_NFC_HASH_ALGO, hashAlgo); - intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(intent, REQUEST_CODE_NFC); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcActivity.java index 7aa09e801..20283fc96 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/NfcActivity.java @@ -111,9 +111,8 @@ public class NfcActivity extends ActionBarActivity { Log.d(Constants.TAG, "NfcActivity mEncryptedSessionKey as hex: " + getHex(mEncryptedSessionKey)); Log.d(Constants.TAG, "NfcActivity mServiceIntent: " + mServiceIntent.toString()); } else if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) { - Log.e(Constants.TAG, "This should not happen, but there is a bug in Android!"); - - toast("This should not happen, but there is a bug in Android! Clear all app tasks and start app from launcher again!"); + Log.e(Constants.TAG, "This should not happen! NfcActivity.onCreate() is being called instead of onNewIntent()!"); + toast("This should not happen! Please create a new bug report that the NFC screen is restarted!"); finish(); } else { Log.d(Constants.TAG, "Action not supported: " + action); |