Update phenotype usage for GMS V4 (1/2)

Test: see ag/1555402
Bug: 31989967
Bug: 26400050
Change-Id: I806129e8593e091e2aa120e530d588efa5a0d508
diff --git a/src-bind/com/android/contactsbind/experiments/Flags.java b/src-bind/com/android/contactsbind/experiments/Flags.java
index 4c29958..3fda114 100644
--- a/src-bind/com/android/contactsbind/experiments/Flags.java
+++ b/src-bind/com/android/contactsbind/experiments/Flags.java
@@ -15,8 +15,6 @@
  */
 package com.android.contactsbind.experiments;
 
-import android.content.Context;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -30,7 +28,7 @@
 
     private Map<String, Object> mMap;
 
-    public static Flags getInstance(Context context) {
+    public static Flags getInstance() {
         if (sInstance == null) {
             sInstance = new Flags();
         }
diff --git a/src/com/android/contacts/ContactsDrawerActivity.java b/src/com/android/contacts/ContactsDrawerActivity.java
index 0892baf..caaa326 100644
--- a/src/com/android/contacts/ContactsDrawerActivity.java
+++ b/src/com/android/contacts/ContactsDrawerActivity.java
@@ -279,7 +279,7 @@
             menu.removeItem(R.id.nav_find_duplicates);
         } else {
             int id;
-            if (Flags.getInstance(this).getBoolean(Experiments.ASSISTANT)) {
+            if (Flags.getInstance().getBoolean(Experiments.ASSISTANT)) {
                 id = R.id.nav_assistant;
                 menu.removeItem(R.id.nav_find_duplicates);
             } else {
diff --git a/src/com/android/contacts/DynamicShortcuts.java b/src/com/android/contacts/DynamicShortcuts.java
index a7357b3..f5363f6 100644
--- a/src/com/android/contacts/DynamicShortcuts.java
+++ b/src/com/android/contacts/DynamicShortcuts.java
@@ -119,9 +119,9 @@
         mContentResolver = contentResolver;
         mShortcutManager = shortcutManager;
         mJobScheduler = jobScheduler;
-        mContentChangeMinUpdateDelay = Flags.getInstance(mContext)
+        mContentChangeMinUpdateDelay = Flags.getInstance()
                 .getInteger(Experiments.DYNAMIC_MIN_CONTENT_CHANGE_UPDATE_DELAY_MILLIS);
-        mContentChangeMaxUpdateDelay = Flags.getInstance(mContext)
+        mContentChangeMaxUpdateDelay = Flags.getInstance()
                 .getInteger(Experiments.DYNAMIC_MAX_CONTENT_CHANGE_UPDATE_DELAY_MILLIS);
     }
 
@@ -404,7 +404,7 @@
 
     public synchronized static void initialize(Context context) {
         if (Log.isLoggable(TAG, Log.DEBUG)) {
-            final Flags flags = Flags.getInstance(context);
+            final Flags flags = Flags.getInstance();
             Log.d(TAG, "DyanmicShortcuts.initialize\nVERSION >= N_MR1? " +
                     (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) +
                     "\n" + Experiments.DYNAMIC_SHORTCUTS + " enabled? " +
@@ -420,7 +420,7 @@
 
         final DynamicShortcuts shortcuts = new DynamicShortcuts(context);
 
-        if (!Flags.getInstance(context).getBoolean(Experiments.DYNAMIC_SHORTCUTS)) {
+        if (!Flags.getInstance().getBoolean(Experiments.DYNAMIC_SHORTCUTS)) {
             // Clear dynamic shortcuts if the flag is not enabled. This prevents shortcuts from
             // staying around if it is enabled then later disabled (due to bugs for instance).
             shortcuts.handleFlagDisabled();
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index a73d8e7..cefbe1f 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -439,7 +439,7 @@
 
         super.onPause();
 
-        if (Flags.getInstance(this).getBoolean(Experiments.PULL_TO_REFRESH)) {
+        if (Flags.getInstance().getBoolean(Experiments.PULL_TO_REFRESH)) {
             ContentResolver.removeStatusChangeListener(mStatusChangeListenerHandle);
             onSyncStateUpdated();
         }
@@ -456,7 +456,7 @@
         mProviderStatusWatcher.start();
         updateViewConfiguration(true);
 
-        if (Flags.getInstance(this).getBoolean(Experiments.PULL_TO_REFRESH)) {
+        if (Flags.getInstance().getBoolean(Experiments.PULL_TO_REFRESH)) {
             mStatusChangeListenerHandle = ContentResolver.addStatusChangeListener(
                     ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE
                             | ContentResolver.SYNC_OBSERVER_TYPE_PENDING
@@ -792,7 +792,7 @@
                     R.id.contacts_list_container, mMembersFragment, TAG_GROUP_VIEW);
         } else if(isAssistantView()) {
             String fragmentTag;
-            if (Flags.getInstance(this).getBoolean(Experiments.ASSISTANT)) {
+            if (Flags.getInstance().getBoolean(Experiments.ASSISTANT)) {
                 fragmentTag = TAG_ASSISTANT;
             } else {
                 fragmentTag = TAG_DUPLICATES;
diff --git a/src/com/android/contacts/common/list/DefaultContactListAdapter.java b/src/com/android/contacts/common/list/DefaultContactListAdapter.java
index faade9e..cea2062 100644
--- a/src/com/android/contacts/common/list/DefaultContactListAdapter.java
+++ b/src/com/android/contacts/common/list/DefaultContactListAdapter.java
@@ -116,7 +116,7 @@
                 loader.setUri(builder.build());
                 loader.setProjection(getProjection(true));
                 sortOrder = STREQUENT_SORT;
-                if (Flags.getInstance(getContext()).getBoolean(Experiments.SEARCH_YENTA)
+                if (Flags.getInstance().getBoolean(Experiments.SEARCH_YENTA)
                         && loader instanceof FavoritesAndContactsLoader
                         && directoryId == Directory.DEFAULT) {
                     final FavoritesAndContactsLoader favoritesAndContactsLoader =
diff --git a/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java b/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java
index 82440b7..e112846 100644
--- a/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java
+++ b/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java
@@ -50,7 +50,7 @@
 
     public FavoritesAndContactsLoader(Context context) {
         super(context);
-        mAutocompleteTimeout = Flags.getInstance(context).getInteger(
+        mAutocompleteTimeout = Flags.getInstance().getInteger(
                 Experiments.SEARCH_YENTA_TIMEOUT_MILLIS);
     }
 
diff --git a/src/com/android/contacts/common/util/ImplicitIntentsUtil.java b/src/com/android/contacts/common/util/ImplicitIntentsUtil.java
index 9a0eb93..d30f495 100644
--- a/src/com/android/contacts/common/util/ImplicitIntentsUtil.java
+++ b/src/com/android/contacts/common/util/ImplicitIntentsUtil.java
@@ -119,7 +119,7 @@
     private static void startQuickContact(Activity activity, Uri contactLookupUri,
             int previousScreenType, int requestCode) {
 
-        if (Flags.getInstance(activity).getBoolean(Experiments.CONTACT_SHEET)) {
+        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
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index e013da4..a6d48b4 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1545,7 +1545,7 @@
                 if (saveSucceeded && contactLookupUri != null) {
                     final Uri lookupUri = ContactEditorUtils.maybeConvertToLegacyLookupUri(
                             mContext, contactLookupUri, mLookupUri);
-                    if (Flags.getInstance(mContext).getBoolean(Experiments.CONTACT_SHEET)) {
+                    if (Flags.getInstance().getBoolean(Experiments.CONTACT_SHEET)) {
                         resultIntent = ObjectFactory.getContactSheetIntent(mContext, lookupUri);
                     }
                     if (resultIntent == null) {
diff --git a/src/com/android/contacts/group/GroupMembersFragment.java b/src/com/android/contacts/group/GroupMembersFragment.java
index 43acd0a..2f61cdd 100644
--- a/src/com/android/contacts/group/GroupMembersFragment.java
+++ b/src/com/android/contacts/group/GroupMembersFragment.java
@@ -268,7 +268,7 @@
         final boolean isGroupEditable = mGroupMetaData != null && mGroupMetaData.editable;
         final boolean isGroupReadOnly = mGroupMetaData != null && mGroupMetaData.readOnly;
         final boolean experimentFlagSet =
-                Flags.getInstance(getContext()).getBoolean(Experiments.SEND_TO_GROUP);
+                Flags.getInstance().getBoolean(Experiments.SEND_TO_GROUP);
 
         setVisible(menu, R.id.menu_multi_send_email, !mIsEditMode && !isGroupEmpty()
                 && experimentFlagSet);
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 7a99705..03933a1 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -188,7 +188,7 @@
                     setSyncOffAlert();
 
                     // Determine whether the account has pullToRefresh feature
-                    if (Flags.getInstance(getContext()).getBoolean(Experiments.PULL_TO_REFRESH)) {
+                    if (Flags.getInstance().getBoolean(Experiments.PULL_TO_REFRESH)) {
                         setSwipeRefreshLayoutEnabledOrNot(getFilter());
                     }
                     break;
@@ -462,7 +462,7 @@
     protected void onCreateView(LayoutInflater inflater, ViewGroup container) {
         super.onCreateView(inflater, container);
 
-        if (Flags.getInstance(getContext()).getBoolean(Experiments.PULL_TO_REFRESH)) {
+        if (Flags.getInstance().getBoolean(Experiments.PULL_TO_REFRESH)) {
             initSwipeRefreshLayout();
         }
         // Putting the header view inside a container will allow us to make
@@ -558,7 +558,7 @@
                 }
 
                 syncContacts(getFilter());
-                mHandler.postDelayed(mCancelRefresh, Flags.getInstance(getContext())
+                mHandler.postDelayed(mCancelRefresh, Flags.getInstance()
                         .getInteger(Experiments.PULL_TO_REFRESH_CANCEL_REFRESH_MILLIS));
             }
         });
@@ -831,7 +831,7 @@
         setSyncOffAlert();
 
         // Determine whether the account has pullToRefresh feature
-        if (Flags.getInstance(getContext()).getBoolean(Experiments.PULL_TO_REFRESH)) {
+        if (Flags.getInstance().getBoolean(Experiments.PULL_TO_REFRESH)) {
             setSwipeRefreshLayoutEnabledOrNot(filter);
         }
     }