Merge "Handle revoked permissions when resuming the app (1/2)" into ub-contactsdialer-i-dev
diff --git a/src-bind/com/android/contactsbind/ObjectFactory.java b/src-bind/com/android/contactsbind/ObjectFactory.java
index e8b9ceb..1d579e6 100644
--- a/src-bind/com/android/contactsbind/ObjectFactory.java
+++ b/src-bind/com/android/contactsbind/ObjectFactory.java
@@ -15,7 +15,6 @@
 
 import android.app.Fragment;
 import android.content.Context;
-import android.content.Intent;
 import android.net.Uri;
 
 import com.android.contacts.logging.Logger;
@@ -38,10 +37,6 @@
         return null;
     }
 
-    public static Intent getContactSheetIntent(Context context, Uri contactLookupUri) {
-        return null;
-    }
-
     public static Uri getWelcomeUri() {
         return null;
     }
diff --git a/src/com/android/contacts/Experiments.java b/src/com/android/contacts/Experiments.java
index 97b0474..b6a9ae7 100644
--- a/src/com/android/contacts/Experiments.java
+++ b/src/com/android/contacts/Experiments.java
@@ -20,11 +20,6 @@
  */
 public final class Experiments {
     /**
-     * Whether to open contact sheet (aka smart profile) instead of our own QuickContact.
-     */
-    public static final String CONTACT_SHEET = "QuickContact__contact_sheet";
-
-    /**
      * Flags for maximum content update time
      */
     public static final String DYNAMIC_MAX_CONTENT_CHANGE_UPDATE_DELAY_MILLIS =
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index 8f488e1..ec49d48 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -282,13 +282,8 @@
                     if (mFinishActivityOnSaveCompleted) {
                         setResult(resultIntent == null ? RESULT_CANCELED : RESULT_OK, resultIntent);
                     } else if (resultIntent != null) {
-                        // If it's a smart profile Intent it must be started "for result"
-                        if (QuickContact.ACTION_QUICK_CONTACT.equals(resultIntent.getAction())) {
-                            ImplicitIntentsUtil.startActivityInApp(
-                                    ContactEditorActivity.this, resultIntent);
-                        } else {
-                            startActivityForResult(resultIntent, /* requestCode */ 0);
-                        }
+                        ImplicitIntentsUtil.startActivityInApp(
+                                ContactEditorActivity.this, resultIntent);
                     }
                     finish();
                 }
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index d5522dd..afe231e 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -57,7 +57,6 @@
 import android.widget.Toast;
 
 import com.android.contacts.ContactSaveService;
-import com.android.contacts.Experiments;
 import com.android.contacts.GroupMetaDataLoader;
 import com.android.contacts.R;
 import com.android.contacts.activities.ContactEditorAccountsChangedActivity;
@@ -90,8 +89,7 @@
 import com.android.contacts.util.MaterialColorMapUtils;
 import com.android.contacts.util.UiClosables;
 import com.android.contactsbind.HelpUtils;
-import com.android.contactsbind.ObjectFactory;
-import com.android.contactsbind.experiments.Flags;
+
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
@@ -1441,18 +1439,13 @@
         }
         switch (saveMode) {
             case SaveMode.CLOSE: {
-                Intent resultIntent = null;
+                final Intent resultIntent;
                 if (saveSucceeded && contactLookupUri != null) {
                     final Uri lookupUri = ContactEditorUtils.maybeConvertToLegacyLookupUri(
                             mContext, contactLookupUri, mLookupUri);
-                    if (Flags.getInstance().getBoolean(Experiments.CONTACT_SHEET)) {
-                        resultIntent = ObjectFactory.getContactSheetIntent(mContext, lookupUri);
-                    }
-                    if (resultIntent == null) {
-                        resultIntent = ImplicitIntentsUtil.composeQuickContactIntent(
-                                mContext, lookupUri, ScreenType.EDITOR);
-                        resultIntent.putExtra(QuickContactActivity.EXTRA_CONTACT_EDITED, true);
-                    }
+                    resultIntent = ImplicitIntentsUtil.composeQuickContactIntent(
+                            mContext, lookupUri, ScreenType.EDITOR);
+                    resultIntent.putExtra(QuickContactActivity.EXTRA_CONTACT_EDITED, true);
                 } else {
                     resultIntent = null;
                 }
diff --git a/src/com/android/contacts/util/ImplicitIntentsUtil.java b/src/com/android/contacts/util/ImplicitIntentsUtil.java
index 191c185..7465c96 100644
--- a/src/com/android/contacts/util/ImplicitIntentsUtil.java
+++ b/src/com/android/contacts/util/ImplicitIntentsUtil.java
@@ -30,12 +30,9 @@
 import android.provider.Settings;
 import android.text.TextUtils;
 
-import com.android.contacts.Experiments;
 import com.android.contacts.logging.ScreenEvent.ScreenType;
 import com.android.contacts.model.account.GoogleAccountType;
 import com.android.contacts.quickcontact.QuickContactActivity;
-import com.android.contactsbind.ObjectFactory;
-import com.android.contactsbind.experiments.Flags;
 
 import java.util.List;
 
@@ -118,21 +115,10 @@
 
     private static void startQuickContact(Activity activity, Uri contactLookupUri,
             int previousScreenType, int requestCode) {
-
-        if (Flags.getInstance().getBoolean(Experiments.CONTACT_SHEET)) {
-            final Intent intent = ObjectFactory.getContactSheetIntent(activity, contactLookupUri);
-            if (intent != null) {
-                // We must start ContactSheet "for result" with a requestCode that is >= 0
-                // so that ContactSheet can validate that the caller is a 1P app.
-                activity.startActivityForResult(intent, requestCode >= 0 ? requestCode : 0);
-                return;
-            }
-        }
-
         final Intent intent = ImplicitIntentsUtil.composeQuickContactIntent(
                 activity, contactLookupUri, previousScreenType);
 
-        // For the non ContactSheet case we only start "for result" if specifically requested.
+        // We only start "for result" if specifically requested.
         if (requestCode >= 0) {
             intent.setPackage(activity.getPackageName());
             activity.startActivityForResult(intent, requestCode);