From a69f05c5f40745ccc2c370a5f766eed95e823cfe Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 9 Nov 2011 22:35:22 +0100 Subject: [PATCH] Don't call super.onBackPressed() MessageView contained code that would call super.onBackPressed() if the parent class had such a method (checked using reflection). But the bytecode verifier prevented loading of MessageView because it contained a (static) call to super.onBackPressed(). For this to work the method had to be called using reflection. I removed this code entirely since we don't do it in MessageList and FolderList either. And all the time it worked just fine. With that change we can re-enable support for Android 1.5-2.0.1 devices. --- AndroidManifest.xml | 2 +- src/com/fsck/k9/activity/MessageView.java | 25 ----------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3bd731520..f39a82b52 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -5,7 +5,7 @@ android:versionName="3.913" package="com.fsck.k9" > superClass = MessageView.class.getSuperclass(); - final Method method = superClass.getMethod("onBackPressed", new Class[] {}); - hasOnBackMethod = (method.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC; - } catch (final SecurityException e) { - if (K9.DEBUG) { - Log.v(K9.LOG_TAG, "Security exception while checking for 'onBackPressed' method", e); - } - hasOnBackMethod = false; - } catch (final NoSuchMethodException e) { - hasOnBackMethod = false; - } - HAS_SUPER_ON_BACK_METHOD = hasOnBackMethod; - } - private SingleMessageView mMessageView; private PgpData mPgpData; @@ -269,8 +246,6 @@ public class MessageView extends K9Activity implements OnClickListener { String folder = (mMessage != null) ? mMessage.getFolder().getName() : null; MessageList.actionHandleFolder(this, mAccount, folder); finish(); - } else if (HAS_SUPER_ON_BACK_METHOD) { - super.onBackPressed(); } else { finish(); }