diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-12-30 20:57:49 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-12-30 20:57:49 +0100 |
commit | 19082b62a985c1a73d838419e9576cdc153ed45d (patch) | |
tree | 85a117944bf18ab1857d514f81eada41b7de9263 /OpenPGP-Keychain/src | |
parent | a8cafd59e49861fdc70e10644d308f427e5fdd7a (diff) | |
download | open-keychain-19082b62a985c1a73d838419e9576cdc153ed45d.tar.gz open-keychain-19082b62a985c1a73d838419e9576cdc153ed45d.tar.bz2 open-keychain-19082b62a985c1a73d838419e9576cdc153ed45d.zip |
Inform user if signature check fails
Diffstat (limited to 'OpenPGP-Keychain/src')
3 files changed, 40 insertions, 6 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/ActionBarHelper.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/ActionBarHelper.java index c0fc4df86..dcac2df08 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/ActionBarHelper.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/ActionBarHelper.java @@ -102,8 +102,7 @@ public class ActionBarHelper { final View customActionBarView = inflater .inflate(R.layout.actionbar_custom_view_done, null); - ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text)) - .setText(R.string.api_settings_save); + ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text)).setText(doneText); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener( doneOnClickListener); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteService.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteService.java index 0f28d96f6..bc513d532 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteService.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteService.java @@ -23,6 +23,7 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeUnit; import org.sufficientlysecure.keychain.Constants; +import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.exception.WrongPackageSignatureException; @@ -140,8 +141,12 @@ public abstract class RemoteService extends Service { } } } catch (WrongPackageSignatureException e) { - // TODO: Inform user about wrong signature! - Log.e(Constants.TAG, "RemoteService", e); + Log.e(Constants.TAG, e.getMessage()); + + Bundle extras = new Bundle(); + extras.putString(RemoteServiceActivity.EXTRA_ERROR_MESSAGE, + getString(R.string.api_error_wrong_signature)); + pauseAndStartUserInteraction(RemoteServiceActivity.ACTION_ERROR_MESSAGE, null, extras); } } @@ -243,8 +248,13 @@ public abstract class RemoteService extends Service { mThreadPool.shutdownNow(); } } catch (WrongPackageSignatureException e) { - // TODO: Inform user about wrong signature! - Log.e(Constants.TAG, "RemoteService", e); + Log.e(Constants.TAG, e.getMessage()); + + Bundle extras = new Bundle(); + extras.putString(RemoteServiceActivity.EXTRA_ERROR_MESSAGE, + getString(R.string.api_error_wrong_signature)); + pauseAndStartUserInteraction(RemoteServiceActivity.ACTION_ERROR_MESSAGE, null, + extras); } } else { allowed = false; diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java index bba8176b1..de07989d8 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java @@ -48,6 +48,8 @@ public class RemoteServiceActivity extends SherlockFragmentActivity { + "API_ACTIVITY_CACHE_PASSPHRASE"; public static final String ACTION_SELECT_PUB_KEYS = Constants.INTENT_PREFIX + "API_ACTIVITY_SELECT_PUB_KEYS"; + public static final String ACTION_ERROR_MESSAGE = Constants.INTENT_PREFIX + + "API_ACTIVITY_ERROR_MESSAGE"; public static final String EXTRA_MESSENGER = "messenger"; @@ -60,6 +62,8 @@ public class RemoteServiceActivity extends SherlockFragmentActivity { public static final String EXTRA_SELECTED_MASTER_KEY_IDS = "master_key_ids"; public static final String EXTRA_MISSING_USER_IDS = "missing_user_ids"; public static final String EXTRA_DUBLICATE_USER_IDS = "dublicate_user_ids"; + // error message + public static final String EXTRA_ERROR_MESSAGE = "error_message"; private Messenger mMessenger; @@ -271,6 +275,27 @@ public class RemoteServiceActivity extends SherlockFragmentActivity { getSupportFragmentManager().beginTransaction() .add(R.id.api_select_pub_keys_fragment_container, mSelectFragment).commit(); } + } else if (ACTION_ERROR_MESSAGE.equals(action)) { + String errorMessage = intent.getStringExtra(EXTRA_ERROR_MESSAGE); + + String text = new String(); + text += "<font color=\"red\">" + errorMessage + "</font>"; + + // Inflate a "Done" custom action bar view + ActionBarHelper.setDoneView(getSupportActionBar(), R.string.btn_okay, + new View.OnClickListener() { + + @Override + public void onClick(View v) { + finish(); + } + }); + + setContentView(R.layout.api_app_error_message); + + // set text on view + HtmlTextView textView = (HtmlTextView) findViewById(R.id.api_app_error_message_text); + textView.setHtmlFromString(text); } else { Log.e(Constants.TAG, "Wrong action!"); finish(); |