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

Commit 5834df9b authored by Yao Lu's avatar Yao Lu Committed by Android (Google) Code Review
Browse files

Merge "Log Edit Raw Contacts modal (1/2)" into ub-contactsdialer-h-dev

parents 370c83f5 341d1040
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ import android.widget.Toast;
import com.android.contacts.AppCompatContactsActivity;
import com.android.contacts.R;
import com.android.contacts.common.activity.RequestPermissionsActivity;
import com.android.contacts.common.logging.EditorEvent;
import com.android.contacts.common.logging.Logger;
import com.android.contacts.common.model.AccountTypeManager;
import com.android.contacts.common.util.ImplicitIntentsUtil;
import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
@@ -108,6 +110,8 @@ public class ContactEditorSpringBoardActivity extends AppCompatContactsActivity
        // Go straight to editor if we're passed a raw contact Uri.
        if (ContactsContract.AUTHORITY.equals(authority) &&
                RawContacts.CONTENT_ITEM_TYPE.equals(type)) {
            Logger.logEditorEvent(
                    EditorEvent.EventType.SHOW_RAW_CONTACT_PICKER, /* numberRawContacts */ 0);
            final long rawContactId = ContentUris.parseId(mUri);
            startEditorAndForwardExtras(getIntentForRawContact(rawContactId));
        } else if (android.provider.Contacts.AUTHORITY.equals(authority)) {
@@ -169,6 +173,8 @@ public class ContactEditorSpringBoardActivity extends AppCompatContactsActivity
     * the editor is started normally and handles creation of a new writable raw contact.
     */
    private void loadEditor() {
        Logger.logEditorEvent(
                EditorEvent.EventType.SHOW_RAW_CONTACT_PICKER, /* numberRawContacts */ 0);
        final Intent intent;
        if (mHasWritableAccount) {
            intent = getIntentForRawContact(mResult.rawContacts.get(mWritableAccountPosition).id);
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.contacts.common.logging;

import com.google.common.base.MoreObjects;

public class EditorEvent {

    /** The editor event type that is logged. */
    public int eventType;

    /** The number of raw contacts shown in the raw contacts picker. */
    public int numberRawContacts;

    public static final class EventType {
        public static final int UNKNOWN = 0;
        public static final int SHOW_RAW_CONTACT_PICKER = 1;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("eventType", eventType)
                .add("numberRawContacts", numberRawContacts)
                .toString();
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -96,8 +96,19 @@ public abstract class Logger {
        }
    }

    public static void logEditorEvent(int eventType, int numberRawContacts) {
        final Logger logger = getInstance();
        if (logger != null) {
            final EditorEvent event = new EditorEvent();
            event.eventType = eventType;
            event.numberRawContacts = numberRawContacts;
            logger.logEditorEventImpl(event);
        }
    }

    public abstract void logScreenViewImpl(int screenType, int previousScreenType);
    public abstract void logSearchEventImpl(SearchState searchState);
    public abstract void logListEventImpl(ListEvent event);
    public abstract void logQuickContactEventImpl(QuickContactEvent event);
    public abstract void logEditorEventImpl(EditorEvent event);
}
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ import android.widget.TextView;

import com.android.contacts.R;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.logging.EditorEvent;
import com.android.contacts.common.logging.Logger;
import com.android.contacts.common.model.AccountTypeManager;
import com.android.contacts.common.model.account.AccountDisplayInfo;
import com.android.contacts.common.model.account.AccountDisplayInfoFactory;
@@ -181,6 +183,10 @@ public class PickRawContactDialogFragment extends DialogFragment {
            }
        });
        builder.setCancelable(true);
        if (savedInstanceState == null) {
            Logger.logEditorEvent(EditorEvent.EventType.SHOW_RAW_CONTACT_PICKER,
                    /* numberRawContacts */ mAdapter.getCount());
        }
        return builder.create();
    }