Dbrant has uploaded a new change for review.
https://gerrit.wikimedia.org/r/167833
Change subject: Catch exception when an unknown Parcelable is in our intent.
......................................................................
Catch exception when an unknown Parcelable is in our intent.
Bug: 72283
Change-Id: Id493b8a8321621d7bb68127fdc383fa631e3d69a
---
M wikipedia/src/main/java/org/wikipedia/page/PageActivity.java
1 file changed, 13 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/33/167833/1
diff --git a/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java
b/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java
index 54a739a..5f38dbc 100644
--- a/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java
@@ -39,6 +39,7 @@
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.net.Uri;
+import android.os.BadParcelableException;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
@@ -120,10 +121,20 @@
bus = app.getBus();
bus.register(this);
+ boolean themeChanged = false;
+ try {
+ themeChanged = getIntent().hasExtra("changeTheme");
+ } catch (BadParcelableException e) {
+ // this may be thrown when an app such as Facebook puts its own
private Parcelable
+ // into the intent. Since we don't know about the class of the
Parcelable, we can't
+ // unparcel it properly, so the hasExtra method may fail.
+ Log.w("PageActivity", "Received an unknown parcelable in intent:",
e);
+ }
+
if (savedInstanceState != null) {
pausedStateOfZero =
savedInstanceState.getBoolean("pausedStateOfZero");
pausedXcsOfZero = savedInstanceState.getString("pausedXcsOfZero");
- } else if (getIntent().hasExtra("changeTheme")) {
+ } else if (themeChanged) {
// we've changed themes!
pausedStateOfZero =
getIntent().getExtras().getBoolean("pausedStateOfZero");
pausedXcsOfZero =
getIntent().getExtras().getString("pausedXcsOfZero");
@@ -142,7 +153,7 @@
// If we're coming back from a Theme change, we'll need to "restore"
our state based on
// what's given in our Intent (since there's no way to relaunch the
Activity in a way that
// forces it to save its own instance state)...
- if (getIntent().hasExtra("changeTheme")) {
+ if (themeChanged) {
String className =
getIntent().getExtras().getString(KEY_LAST_FRAGMENT);
try {
// instantiate the last fragment that was on top of the
backstack before the Activity
--
To view, visit https://gerrit.wikimedia.org/r/167833
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id493b8a8321621d7bb68127fdc383fa631e3d69a
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits