summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/editor/ContactEditorFragment.java
diff options
context:
space:
mode:
authorGary Mai <garymai@google.com>2017-02-07 15:08:53 -0800
committerGary Mai <garymai@google.com>2017-02-08 14:48:07 -0800
commit1e899dc127a212bfd2198fe7adba5c33eb4cd751 (patch)
treecbabd992733da7369e8efbe70379c793d969b0fc /src/com/android/contacts/editor/ContactEditorFragment.java
parent7826cb2fd35ed23d7f90cc4dfbc0dad1cb2c4600 (diff)
downloadpackages_apps_Contacts-1e899dc127a212bfd2198fe7adba5c33eb4cd751.tar.gz
packages_apps_Contacts-1e899dc127a212bfd2198fe7adba5c33eb4cd751.tar.bz2
packages_apps_Contacts-1e899dc127a212bfd2198fe7adba5c33eb4cd751.zip
Handle revoked permissions when resuming the app (1/2)
The activities that create these fragments will request permissions but if these fragments were created and the permissions were revoked then Activity's super.onCreate() will recreate these fragments before the permission activity is started, which causes a bunch of issues since the original activity never finishes it's onCreate method so many things aren't initialized for the fragments. So in activities that maybe start the permission activity and have visisble fragments, instead of returning, continue initializing everything. In the case of editor, not being able to select a raw contact delta is a legit case so it should have been handled as a failure and in general we shouldn't be attempting to bind the editors if we don't have the permissions. Test: Manually verified removing permissions and going back to the app from the recent apps screen doesn't crash while viewing: * main list * groups view * first level suggestions * duplicates view * account view * editor * settings * pick group member to add view * pick phone numbers to send to from group * pick emails to send to from group The behavior is permissions get requested and will go back to the original activity (PeopleActivity with main list loaded or the editor activity). Bug: 34741297 Change-Id: Ie234b1f44e83372b9c0ad9658fa4a2e9b40572b0
Diffstat (limited to 'src/com/android/contacts/editor/ContactEditorFragment.java')
-rw-r--r--src/com/android/contacts/editor/ContactEditorFragment.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 84c2b1f7c..d5522dd4c 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -64,6 +64,7 @@ import com.android.contacts.activities.ContactEditorAccountsChangedActivity;
import com.android.contacts.activities.ContactEditorActivity;
import com.android.contacts.activities.ContactEditorActivity.ContactEditor;
import com.android.contacts.activities.ContactSelectionActivity;
+import com.android.contacts.activities.RequestPermissionsActivity;
import com.android.contacts.editor.AggregationSuggestionEngine.Suggestion;
import com.android.contacts.group.GroupUtil;
import com.android.contacts.list.UiIntentActions;
@@ -1310,7 +1311,8 @@ public class ContactEditorFragment extends Fragment implements
}
return false;
}
- return true;
+ // Don't attempt to bind anything if we have no permissions.
+ return RequestPermissionsActivity.hasRequiredPermissions(mContext);
}
/**