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

Commit 79525d02 authored by yaolu's avatar yaolu
Browse files

Log QuickContactActivity events (1/2)

* Added loggings:
  1. when QuickContactActivity is launched, log the package name from
  where QuickContact is from, log the type of the contact viewed, log
  the type of action as START;
  2. log the type of the contact when user change it;
  3. log the type of the card when displayed for the first time;
  4. the action that the user takes, including from header options
     and from Contact card;
  5. the third party defined action that the user takes.
* Added Logger method to send QuickContactEvent to clearcut.

bug 30979088

Change-Id: I7803d2fbcccbc14ec05b34c21e25644f550cb2c0
parent 0c8c709c
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -79,7 +79,25 @@ public abstract class Logger {
        }
    }

    /**
     * Logs an event on QuickContact. See {@link QuickContactEvent} for definition of parameters.
     */
    public static void logQuickContactEvent(String referrer, int contactType, int cardType,
            int actionType, String thirdPartyAction) {
        final Logger logger = getInstance();
        if (logger != null) {
            final QuickContactEvent event = new QuickContactEvent();
            event.referrer = referrer;
            event.contactType = contactType;
            event.cardType = cardType;
            event.actionType = actionType;
            event.thirdPartyAction = thirdPartyAction;
            logger.logQuickContactEventImpl(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);
}
+89 −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.Objects;

/**
 * Describes how user views and takes action in Quick contact
 */
public final class QuickContactEvent {

    /** The package name that QuickContact is launched from. **/
    public String referrer;

    /** The type of the contact displayed in QuickContact. **/
    public int contactType;

    /** The type of the card displayed in QuickContact. **/
    public int cardType;

    /** The type of the user action in QuickContact. **/
    public int actionType;

    /** The third party action that a user takes. **/
    public String thirdPartyAction;

    // Should match ContactsExtension.QuickContactEvent values in
    // http://cs/google3/logs/proto/wireless/android/contacts/contacts_extensions.proto
    public static final class ContactType {
        public static final int UNKNOWN_TYPE = 0;
        public static final int EDITABLE = 1;
        public static final int INVISIBLE_AND_ADDABLE = 2;
        public static final int DIRECTORY = 3;
    }

    public static final class CardType {
        public static final int UNKNOWN_CARD = 0;
        public static final int NO_CONTACT = 1;
        public static final int CONTACT = 2;
        public static final int RECENT = 3;
        public static final int ABOUT = 4;
        public static final int PERMISSION = 5;
    }

    public static final class ActionType {
        public static final int UNKNOWN_ACTION = 0;
        public static final int START = 1;
        public static final int STAR = 2;
        public static final int UNSTAR = 3;
        public static final int EDIT = 4;
        public static final int ADD = 5;
        public static final int DELETE = 6;
        public static final int SHARE = 7;
        public static final int SHORTCUT = 8;
        public static final int HELP = 9;
        public static final int CALL = 10;
        public static final int SMS = 11;
        public static final int VIDEOCALL = 12;
        public static final int EMAIL = 13;
        public static final int SIPCALL = 14;
        public static final int MAP = 15;
        public static final int DIRECTIONS = 16;
        public static final int THIRD_PARTY = 17;
    }

    @Override
    public String toString() {
        return Objects.toStringHelper(this)
                .add("referrer", referrer)
                .add("contactType", contactType)
                .add("cardType", cardType)
                .add("actionType", actionType)
                .add("thirdPartyAction", thirdPartyAction)
                .toString();
    }
}
+137 −28

File changed.

Preview size limit exceeded, changes collapsed.