Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94a2e1b4 authored by Marcus Hagerott's avatar Marcus Hagerott Committed by android-build-merger
Browse files

Check flag before adding observer in AccountTypeManager

am: 511504f9

Change-Id: I915dcfb1f7076aa1aa28c42462775c01d54530c3
parents 46dd3db0 511504f9
Loading
Loading
Loading
Loading
+23 −18
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.util.Log;
import android.util.TimingLogger;

import com.android.contacts.R;
import com.android.contacts.common.Experiments;
import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.list.ContactListFilterController;
import com.android.contacts.common.model.account.AccountType;
@@ -59,6 +60,7 @@ import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.util.Constants;
import com.android.contacts.common.util.DeviceLocalAccountTypeFactory;
import com.android.contactsbind.ObjectFactory;
import com.android.contactsbind.experiments.Flags;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
@@ -464,6 +466,8 @@ class AccountTypeManagerImpl extends AccountTypeManager

        ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, this);


        if (Flags.getInstance().getBoolean(Experiments.OEM_CP2_DEVICE_ACCOUNT_DETECTION_ENABLED)) {
            // Observe changes to RAW_CONTACTS so that we will update the list of "Device" accounts
            // if a new device contact is added.
            mContext.getContentResolver().registerContentObserver(
@@ -484,6 +488,7 @@ class AccountTypeManagerImpl extends AccountTypeManager
                            mListenerHandler.sendEmptyMessage(MESSAGE_LOAD_DATA);
                        }
                    });
        }

        mListenerHandler.sendEmptyMessage(MESSAGE_LOAD_DATA);
    }