This commit is contained in:
Dominik Schürmann 2014-09-07 18:26:43 +02:00
parent d172058150
commit 65a0a0e34f
8 changed files with 26 additions and 32 deletions

View file

@ -148,18 +148,12 @@
<!-- Keychain's own Actions -->
<!-- ENCRYPT with data Uri -->
<intent-filter>
<action android:name="org.sufficientlysecure.keychain.action.ENCRYPT" />
<action android:name="org.sufficientlysecure.keychain.action.ENCRYPT_FILES" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:scheme="content" />
<!-- everything except text/* and message/* -->
<data android:mimeType="image/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="video/*" />
<data android:mimeType="application/*" />
<data android:mimeType="multipart/*" />
</intent-filter>
<!-- Android's Send Action -->
<intent-filter android:label="@string/intent_send_encrypt">
@ -188,9 +182,6 @@
<action android:name="org.sufficientlysecure.keychain.action.ENCRYPT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
<data android:mimeType="message/*" />
</intent-filter>
<!-- Android's Send Action -->
<intent-filter android:label="@string/intent_send_encrypt">

View file

@ -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";

View file

@ -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;

View file

@ -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 */

View file

@ -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!");
}
}

View file

@ -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";

View file

@ -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);

View file

@ -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