diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 0406d8c66..6b1f18f60 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -148,18 +148,12 @@ - + - - - - - - @@ -188,9 +182,6 @@ - - - diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index 25f031402..db78a36c1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -49,7 +49,10 @@ public final class Constants { public static final String SC = BouncyCastleProvider.PROVIDER_NAME; public static final String BOUNCY_CASTLE_PROVIDER_NAME = SC; + // prefix packagename for exported Intents + // as described in http://developer.android.com/guide/components/intents-filters.html public static final String INTENT_PREFIX = PACKAGE_NAME + ".action."; + public static final String EXTRA_PREFIX = PACKAGE_NAME + "."; public static final String CUSTOM_CONTACT_DATA_MIME_TYPE = "vnd.android.cursor.item/vnd.org.sufficientlysecure.keychain.key"; 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 998412d0b..7eecaa6d0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -38,7 +38,7 @@ public class DecryptActivity extends DrawerActivity { public static final String ACTION_DECRYPT = Constants.INTENT_PREFIX + "DECRYPT"; /* EXTRA keys for input */ - public static final String EXTRA_TEXT = "text"; + public static final String EXTRA_TEXT = Constants.EXTRA_PREFIX + "EXTRA_TEXT"; ViewPager mViewPager; PagerTabStrip mPagerTabStrip; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileActivity.java index 49842c361..db067498b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFileActivity.java @@ -50,14 +50,14 @@ import java.util.Set; public class EncryptFileActivity extends DrawerActivity implements EncryptActivityInterface { /* Intents */ - public static final String ACTION_ENCRYPT = Constants.INTENT_PREFIX + "ENCRYPT"; + public static final String ACTION_ENCRYPT_FILES = Constants.INTENT_PREFIX + "ENCRYPT_FILES"; // enables ASCII Armor for file encryption when uri is given - public static final String EXTRA_ASCII_ARMOR = "ascii_armor"; + public static final String EXTRA_ASCII_ARMOR = Constants.EXTRA_PREFIX + "EXTRA_ASCII_ARMOR"; // preselect ids, for internal use - public static final String EXTRA_SIGNATURE_KEY_ID = "signature_key_id"; - public static final String EXTRA_ENCRYPTION_KEY_IDS = "encryption_key_ids"; + public static final String EXTRA_SIGNATURE_KEY_ID = Constants.EXTRA_PREFIX + "EXTRA_SIGNATURE_KEY_ID"; + public static final String EXTRA_ENCRYPTION_KEY_IDS = Constants.EXTRA_PREFIX + "EXTRA_ENCRYPTION_IDS"; // view private int mCurrentMode = MODE_ASYMMETRIC; @@ -370,7 +370,7 @@ public class EncryptFileActivity extends DrawerActivity implements EncryptActivi setContentView(R.layout.encrypt_file_activity); // if called with an intent action, do not init drawer navigation - if (ACTION_ENCRYPT.equals(getIntent().getAction())) { + if (ACTION_ENCRYPT_FILES.equals(getIntent().getAction())) { // lock drawer deactivateDrawerNavigation(); // TODO: back button to key? @@ -460,10 +460,10 @@ public class EncryptFileActivity extends DrawerActivity implements EncryptActivi String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); if (sharedText != null) { // handle like normal text encryption, override action and extras to later - // executeServiceMethod ACTION_ENCRYPT in main actions + // executeServiceMethod ACTION_ENCRYPT_TEXT in main actions extras.putString(EXTRA_TEXT, sharedText); extras.putBoolean(EXTRA_ASCII_ARMOR, true); - action = ACTION_ENCRYPT; + action = ACTION_ENCRYPT_TEXT; } } else */ 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 61eb9a7b1..7d84a6c5e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -49,14 +49,14 @@ import java.util.Set; public class EncryptTextActivity extends DrawerActivity implements EncryptActivityInterface { /* Intents */ - public static final String ACTION_ENCRYPT = Constants.INTENT_PREFIX + "ENCRYPT"; + public static final String ACTION_ENCRYPT_TEXT = Constants.INTENT_PREFIX + "ENCRYPT_TEXT"; /* EXTRA keys for input */ - public static final String EXTRA_TEXT = "text"; + public static final String EXTRA_TEXT = Constants.EXTRA_PREFIX + "EXTRA_TEXT"; // preselect ids, for internal use - public static final String EXTRA_SIGNATURE_KEY_ID = "signature_key_id"; - public static final String EXTRA_ENCRYPTION_KEY_IDS = "encryption_key_ids"; + public static final String EXTRA_SIGNATURE_KEY_ID = Constants.EXTRA_PREFIX + "EXTRA_SIGNATURE_KEY_ID"; + public static final String EXTRA_ENCRYPTION_KEY_IDS = Constants.EXTRA_PREFIX + "EXTRA_SIGNATURE_KEY_IDS"; // view private int mCurrentMode = MODE_ASYMMETRIC; @@ -338,7 +338,7 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi setContentView(R.layout.encrypt_text_activity); // if called with an intent action, do not init drawer navigation - if (ACTION_ENCRYPT.equals(getIntent().getAction())) { + if (ACTION_ENCRYPT_TEXT.equals(getIntent().getAction())) { // lock drawer deactivateDrawerNavigation(); // TODO: back button to key? @@ -415,9 +415,9 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi /** * Main Actions */ - if (ACTION_ENCRYPT.equals(action) && textData != null) { + if (ACTION_ENCRYPT_TEXT.equals(action) && textData != null) { mMessage = textData; - } else if (ACTION_ENCRYPT.equals(action)) { + } else if (ACTION_ENCRYPT_TEXT.equals(action)) { Log.e(Constants.TAG, "Include the extra 'text' in your Intent!"); } } 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 7ad7d1007..3d871849f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -83,12 +83,12 @@ public class ImportKeysActivity extends ActionBarActivity { public static final String EXTRA_RESULT = "result"; // only used by ACTION_IMPORT_KEY - public static final String EXTRA_KEY_BYTES = "key_bytes"; + public static final String EXTRA_KEY_BYTES = Constants.EXTRA_PREFIX + "KEY_BYTES"; // only used by ACTION_IMPORT_KEY_FROM_KEYSERVER - public static final String EXTRA_QUERY = "query"; - public static final String EXTRA_KEY_ID = "key_id"; - public static final String EXTRA_FINGERPRINT = "fingerprint"; + public static final String EXTRA_QUERY = Constants.EXTRA_PREFIX + "EXTRA_QUERY"; + public static final String EXTRA_KEY_ID = Constants.EXTRA_PREFIX + "EXTRA_KEY_ID"; + public static final String EXTRA_FINGERPRINT = Constants.EXTRA_PREFIX + "EXTRA_FINGERPRINT"; // only used by ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_TO_SERVICE when used from OpenPgpService public static final String EXTRA_PENDING_INTENT_DATA = "data"; 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 d02b23d3a..3d570bbeb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -328,7 +328,7 @@ public class KeyListFragment extends LoaderFragment @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected void encrypt(ActionMode mode, long[] masterKeyIds) { Intent intent = new Intent(getActivity(), EncryptFileActivity.class); - intent.setAction(EncryptFileActivity.ACTION_ENCRYPT); + intent.setAction(EncryptFileActivity.ACTION_ENCRYPT_FILES); intent.putExtra(EncryptFileActivity.EXTRA_ENCRYPTION_KEY_IDS, masterKeyIds); // used instead of startActivity set actionbar based on callingPackage startActivityForResult(intent, 0); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index dbe7ea1a6..796734c13 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -291,11 +291,11 @@ public class ViewKeyMainFragment extends LoaderFragment implements Intent intent; if (text) { intent = new Intent(getActivity(), EncryptTextActivity.class); - intent.setAction(EncryptTextActivity.ACTION_ENCRYPT); + intent.setAction(EncryptTextActivity.ACTION_ENCRYPT_TEXT); intent.putExtra(EncryptTextActivity.EXTRA_ENCRYPTION_KEY_IDS, encryptionKeyIds); } else { intent = new Intent(getActivity(), EncryptFileActivity.class); - intent.setAction(EncryptFileActivity.ACTION_ENCRYPT); + intent.setAction(EncryptFileActivity.ACTION_ENCRYPT_FILES); intent.putExtra(EncryptFileActivity.EXTRA_ENCRYPTION_KEY_IDS, encryptionKeyIds); } // used instead of startActivity set actionbar based on callingPackage