Check activity state before showing phone disambig dialog
- This is a monkey bug on Crespo that happens often. The
monkey is likely tapping on a favorite contact in the Phone
app, which is trying to either dial the contact or
show a disambiguation dialog if the contact has multiple
phone numbers. There's an IllegalStateException with trying
to commit the dialog fragment transaction because the
saved state has already been called.
- After a PhoneNumberInteraction is started, a CursorLoader
is started, and when that returns, potentially we try to
commit a FragmentTransaction (showing the DialogFragment).
At this point, the activity may be long gone, so we need to
know if the activity has saved state or not. Hence,
we add a new base activity class (TransactionSafeActivity)
that keeps track of this information for us.
- The PhoneNumberInteractionTests still rely on passing in
a context to PhoneNumberInteraction (in order to check
that the queries and subsequent activities are correct),
but we typecast the static methods the app uses to
create these PhoneNumberInteraction objects.
Bug: 5132436
Change-Id: Id9d887bd55235b07133568a38d4922dc7fce24a7
diff --git a/src/com/android/contacts/ContactsActivity.java b/src/com/android/contacts/ContactsActivity.java
index 020d135..371b0b7 100644
--- a/src/com/android/contacts/ContactsActivity.java
+++ b/src/com/android/contacts/ContactsActivity.java
@@ -17,8 +17,8 @@
package com.android.contacts;
import com.android.contacts.test.InjectedServices;
+import com.android.contacts.activities.TransactionSafeActivity;
-import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
@@ -31,7 +31,7 @@
/**
* A common superclass for Contacts activities that handles application-wide services.
*/
-public abstract class ContactsActivity extends Activity
+public abstract class ContactsActivity extends TransactionSafeActivity
implements ContactSaveService.Listener
{