Java Code Examples for org.chromium.base.metrics.RecordHistogram#recordEnumeratedHistogram()

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordEnumeratedHistogram() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Logs the Peek Promo Outcome.
 * @param wasPromoSeen Whether the Peek Promo was seen.
 * @param wouldHaveShownPromo Whether the Promo would have shown.
 * @param hasOpenedPanel Whether the Panel was opened.
 */
public static void logPeekPromoOutcome(boolean wasPromoSeen, boolean wouldHaveShownPromo,
        boolean hasOpenedPanel) {
    int outcome = -1;
    if (wasPromoSeen) {
        outcome = hasOpenedPanel
                ? PEEK_PROMO_OUTCOME_SEEN_OPENED : PEEK_PROMO_OUTCOME_SEEN_NOT_OPENED;
    } else if (wouldHaveShownPromo) {
        outcome = hasOpenedPanel
                ? PEEK_PROMO_OUTCOME_NOT_SEEN_OPENED : PEEK_PROMO_OUTCOME_NOT_SEEN_NOT_OPENED;
    }

    if (outcome != -1) {
        RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPeekPromoOutcome",
                outcome, PEEK_PROMO_OUTCOME_BOUNDARY);
    }
}
 
Example 2
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Log the duration of finishing loading the SERP after the panel is opened.
 * @param wasPrefetch Whether the request was prefetch-enabled or not.
 * @param durationMs The duration of loading the SERP till completely loaded, in milliseconds.
 *        Note that this value will be 0 when the SERP is prefetched and the user waits a
 *        while before opening the panel.
 */
public static void logSearchPanelLoadDuration(boolean wasPrefetch, long durationMs) {
    if (wasPrefetch) {
        RecordHistogram.recordMediumTimesHistogram("Search.ContextualSearchDurationPrefetched",
                durationMs, TimeUnit.MILLISECONDS);
    } else {
        RecordHistogram.recordMediumTimesHistogram(
                "Search.ContextualSearchDurationNonPrefetched", durationMs,
                TimeUnit.MILLISECONDS);
    }

   // Also record a summary histogram with counts for each possibility.
    int code = !wasPrefetch ? NOT_PREFETCHED
            : (durationMs == 0 ? PREFETCHED_FULLY_LOADED : PREFETCHED_PARIALLY_LOADED);
    RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefetchSummary",
            code, PREFETCH_BOUNDARY);
}
 
Example 3
Source File: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void notifyDataSetChanged() {
    mGroups.clear();
    addGroup(mRecentlyClosedTabsGroup);
    for (ForeignSession session : mRecentTabsManager.getForeignSessions()) {
        if (!mHasForeignDataRecorded) {
            RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu",
                    OtherSessionsActions.HAS_FOREIGN_DATA, OtherSessionsActions.LIMIT);
            mHasForeignDataRecorded = true;
        }
        addGroup(new ForeignSessionGroup(session));
    }
    if (mRecentTabsManager.shouldDisplaySyncPromo()) {
        addGroup(new SyncPromoGroup());
    }

    // Add separator line after the recently closed tabs group.
    int recentlyClosedIndex = mGroups.indexOf(mRecentlyClosedTabsGroup);
    if (DeviceFormFactor.isTablet()) {
        if (recentlyClosedIndex != mGroups.size() - 2) {
            mGroups.set(recentlyClosedIndex + 1, mVisibleSeparatorGroup);
        }
    } else if (recentlyClosedIndex != mGroups.size() - 1) {
        mGroups.add(recentlyClosedIndex + 1, mVisibleSeparatorGroup);
    }

    super.notifyDataSetChanged();
}
 
Example 4
Source File: PaymentRequestMetrics.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
public static void recordRequestedInformationHistogram(boolean requestEmail,
        boolean requestPhone, boolean requestShipping, boolean requestName) {
    int requestInformation =
            (requestEmail ? REQUESTED_INFORMATION_EMAIL : 0)
            | (requestPhone ? REQUESTED_INFORMATION_PHONE : 0)
            | (requestShipping ? REQUESTED_INFORMATION_SHIPPING : 0)
            | (requestName ? REQUESTED_INFORMATION_NAME : 0);
    RecordHistogram.recordEnumeratedHistogram("PaymentRequest.RequestedInformation",
            requestInformation, REQUESTED_INFORMATION_MAX);
}
 
Example 5
Source File: NewTabPage.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadingComplete(MostVisitedItem[] items) {
    if (mIsDestroyed) return;

    long loadTimeMs = (System.nanoTime() - mConstructedTimeNs) / 1000000;
    RecordHistogram.recordTimesHistogram(
            "Tab.NewTabOnload", loadTimeMs, TimeUnit.MILLISECONDS);
    mIsLoaded = true;
    StartupMetrics.getInstance().recordOpenedNTP();
    NewTabPageUma.recordNTPImpression(NewTabPageUma.NTP_IMPRESSION_REGULAR);
    // If not visible when loading completes, wait until onShown is received.
    if (!mTab.isHidden()) recordNTPShown();

    int tileTypes[] = new int[items.length];
    for (int i = 0; i < items.length; i++) {
        tileTypes[i] = items[i].getTileType();
    }
    mMostVisitedSites.recordTileTypeMetrics(tileTypes);

    if (isNtpOfflinePagesEnabled()) {
        final int maxNumTiles = 12;
        for (int i = 0; i < items.length; i++) {
            if (items[i].isOfflineAvailable()) {
                RecordHistogram.recordEnumeratedHistogram(
                        "NewTabPage.TileOfflineAvailable", i, maxNumTiles);
            }
        }
    }
    SyncSessionsMetrics.recordYoungestForeignTabAgeOnNTP();
}
 
Example 6
Source File: UndoBarController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Shows an undo bar. Based on user actions, this will cause a call to either
 * {@link TabModel#commitTabClosure(int)} or {@link TabModel#cancelTabClosure(int)} to be called
 * for {@code tabId}.
 *
 * @param tabId The id of the tab.
 * @param content The title of the tab.
 */
private void showUndoBar(int tabId, String content) {
    RecordHistogram.recordEnumeratedHistogram("AndroidTabCloseUndo.Toast",
            mSnackbarManager.isShowing() ? TAB_CLOSE_UNDO_TOAST_SHOWN_WARM
                                         : TAB_CLOSE_UNDO_TOAST_SHOWN_COLD,
            TAB_CLOSE_UNDO_TOAST_COUNT);
    mSnackbarManager.showSnackbar(
            Snackbar.make(content, this, Snackbar.TYPE_ACTION, Snackbar.UMA_TAB_CLOSE_UNDO)
                    .setTemplateText(mContext.getString(R.string.undo_bar_close_message))
                    .setAction(mContext.getString(R.string.undo), tabId));
}
 
Example 7
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs how a state was entered for the first time within a Contextual Search.
 * @param fromState The state to transition from.
 * @param toState The state to transition to.
 * @param reason The reason for the state transition.
 */
public static void logFirstStateEntry(PanelState fromState, PanelState toState,
        StateChangeReason reason) {
    int code;
    switch (toState) {
        case CLOSED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_CLOSED_STATE_CHANGE_CODES, ENTER_CLOSED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterClosed",
                    code, ENTER_CLOSED_FROM_BOUNDARY);
            break;
        case PEEKED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_PEEKED_STATE_CHANGE_CODES, ENTER_PEEKED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterPeeked",
                    code, ENTER_PEEKED_FROM_BOUNDARY);
            break;
        case EXPANDED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_EXPANDED_STATE_CHANGE_CODES, ENTER_EXPANDED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterExpanded",
                    code, ENTER_EXPANDED_FROM_BOUNDARY);
            break;
        case MAXIMIZED:
            code = getStateChangeCode(fromState, reason,
                    ENTER_MAXIMIZED_STATE_CHANGE_CODES, ENTER_MAXIMIZED_FROM_OTHER);
            RecordHistogram.recordEnumeratedHistogram(
                    "Search.ContextualSearchEnterMaximized",
                    code, ENTER_MAXIMIZED_FROM_BOUNDARY);
            break;
        default:
            break;
    }
}
 
Example 8
Source File: UndoBarController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Calls {@link TabModel#cancelTabClosure(int)} for the tab or for each tab in
 * the list of closed tabs.
 */
@SuppressWarnings("unchecked")
@Override
public void onAction(Object actionData) {
    RecordHistogram.recordEnumeratedHistogram("AndroidTabCloseUndo.Toast",
            TAB_CLOSE_UNDO_TOAST_PRESSED, TAB_CLOSE_UNDO_TOAST_COUNT);
    if (actionData instanceof Integer) {
        cancelTabClosure((Integer) actionData);
    } else {
        for (Integer id : (List<Integer>) actionData) {
            cancelTabClosure(id);
        }
    }
}
 
Example 9
Source File: RecentTabsRowAdapter.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onChildClick(int childPosition) {
    RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu",
            OtherSessionsActions.LINK_CLICKED, OtherSessionsActions.LIMIT);
    ForeignSessionTab foreignSessionTab = getChild(childPosition);
    mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
            WindowOpenDisposition.CURRENT_TAB);
    return true;
}
 
Example 10
Source File: ContextReporter.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Records the given status via UMA.
 * Use one of the STATUS_* constants above.
 */
public static void reportStatus(int status) {
    RecordHistogram.recordEnumeratedHistogram(
            "Search.IcingContextReportingStatus", status, STATUS_BOUNDARY);
}
 
Example 11
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Logs whether the SERP was fully loaded when an opened panel was closed.
 * @param fullyLoaded Whether the SERP had finished loading before the panel was closed.
 */
public static void logSerpLoadedOnClose(boolean fullyLoaded) {
    RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchSerpLoadedOnClose",
            fullyLoaded ? FULLY_LOADED : PARTIALLY_LOADED, LOADED_BOUNDARY);
}
 
Example 12
Source File: NewTabPageUma.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Records how the NewTabPageLayout fits on the user's screen.
 * @param result result key, one of {@link NTPLayoutResult}'s values.
 */
public static void recordNTPLayoutResult(@NTPLayoutResult int result) {
    RecordHistogram.recordEnumeratedHistogram(
            "NewTabPage.Layout", result, NUM_NTP_LAYOUT_RESULTS);
}
 
Example 13
Source File: GSAServiceClient.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void handleMessage(Message msg) {
    if (msg.what != RESPONSE_UPDATE_SSB) {
        super.handleMessage(msg);
        return;
    }

    if (mService == null) return;
    final Bundle bundle = (Bundle) msg.obj;
    String account = mGsaHelper.getGSAAccountFromState(bundle.getByteArray(KEY_GSA_STATE));
    RecordHistogram.recordEnumeratedHistogram(ACCOUNT_CHANGE_HISTOGRAM,
            ACCOUNT_CHANGE_SOURCE_SERVICE, ACCOUNT_CHANGE_SOURCE_COUNT);
    GSAState.getInstance(mContext.getApplicationContext()).setGsaAccount(account);
    if (sHasRecordedPss) {
        if (mOnMessageReceived != null) mOnMessageReceived.onResult(bundle);
        return;
    }

    // Getting the PSS for the GSA service process can be long, don't block the UI thread on
    // that. Also, don't process the callback before the PSS is known, since the callback
    // can lead to a service disconnect, which can lead to the framework killing the
    // process. Hence an AsyncTask (long operation), and processing the callback in
    // onPostExecute() (don't disconnect before).
    sHasRecordedPss = true;
    new AsyncTask<Void, Void, Integer>() {
        @Override
        protected Integer doInBackground(Void... params) {
            TraceEvent.begin("GSAServiceClient.getPssForservice");
            try {
                // Looking for the service process is done by component name, which is
                // inefficient. We really want the PID, which is only accessible from within
                // a Binder transaction. Since the service connection is Messenger-based,
                // the calls are not processed from a Binder thread. The alternatives are:
                // 1. Override methods in the framework to append the calling PID to the
                //    Message.
                // 2. Usse msg.callingUid to narrow down the search.
                //
                // (1) is dirty (and brittle), and (2) only works on L+, and still requires
                // to get the full list of services from ActivityManager.
                return getPssForService(mComponentName);
            } finally {
                TraceEvent.end("GSAServiceClient.getPssForservice");
            }
        }

        @Override
        protected void onPostExecute(Integer pssInKB) {
            if (pssInKB != INVALID_PSS) {
                RecordHistogram.recordMemoryKBHistogram(
                        "Search.GsaProcessMemoryPss", pssInKB);
            }
            if (mOnMessageReceived != null) mOnMessageReceived.onResult(bundle);
        }
    }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 14
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
private void recordBackPressedUma(String logMessage, @BackPressedResult int action) {
    Log.i(TAG, "Back pressed: " + logMessage);
    RecordHistogram.recordEnumeratedHistogram(
            "Android.Activity.ChromeTabbedActivity.SystemBackAction",
            action, BACK_PRESSED_COUNT);
}
 
Example 15
Source File: PopupZoomer.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void recordHistogram(int value) {
    RecordHistogram.recordEnumeratedHistogram(
            UMA_TAPDISAMBIGUATION, value, UMA_TAPDISAMBIGUATION_COUNT);
}
 
Example 16
Source File: GeolocationHeader.java    From delion with Apache License 2.0 4 votes vote down vote up
/** Records a data point for the Geolocation.HeaderSentOrNot histogram. */
private static void recordHistogram(int result) {
    RecordHistogram.recordEnumeratedHistogram("Geolocation.HeaderSentOrNot", result, UMA_MAX);
}
 
Example 17
Source File: SigninManager.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
* Log the access point when the user see the view of choosing account to sign in.
* @param accessPoint the enum value of AccessPoint defined in signin_metrics.h.
*/
public static void logSigninStartAccessPoint(int accessPoint) {
    RecordHistogram.recordEnumeratedHistogram(
            "Signin.SigninStartedAccessPoint", accessPoint, SigninAccessPoint.MAX);
    sSignInAccessPoint = accessPoint;
}
 
Example 18
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Log whether the UX was suppressed due to Bar overlap.
 * @param wasSuppressed Whether showing the UX was suppressed.
 */
public static void logBarOverlapSuppression(boolean wasSuppressed) {
    RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchBarOverlap",
            wasSuppressed ? TAP_SUPPRESSED : NOT_TAP_SUPPRESSED, TAP_SUPPRESSED_BOUNDARY);
}
 
Example 19
Source File: InputMethodUma.java    From 365browser with Apache License 2.0 4 votes vote down vote up
void recordProxyViewDetectionFailure() {
    RecordHistogram.recordEnumeratedHistogram(
            UMA_REGISTER_PROXYVIEW, UMA_PROXYVIEW_DETECTION_FAILURE, UMA_PROXYVIEW_COUNT);
}
 
Example 20
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Logs whether the promo was seen.
 * Logs multiple histograms, with and without the original triggering gesture.
 * @param wasPanelSeen Whether the panel was seen.
 * @param wasTap Whether the gesture that originally caused the panel to show was a Tap.
 */
public static void logPromoSeen(boolean wasPanelSeen, boolean wasTap) {
    RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstRunPanelSeen",
            wasPanelSeen ? RESULTS_SEEN : RESULTS_NOT_SEEN, RESULTS_SEEN_BOUNDARY);
    logHistogramByGesture(wasPanelSeen, wasTap, "Search.ContextualSearchPromoSeenByGesture");
}