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

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordSparseSlowlyHistogram() . 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: LogoDelegateImpl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onLogoClicked(boolean isAnimatedLogoShowing) {
    if (mIsDestroyed) return;

    if (!isAnimatedLogoShowing && mAnimatedLogoUrl != null) {
        RecordHistogram.recordSparseSlowlyHistogram(LOGO_CLICK_UMA_NAME, CTA_IMAGE_CLICKED);
        mLogoView.showLoadingView();
        mLogoBridge.getAnimatedLogo(new LogoBridge.AnimatedLogoCallback() {
            @Override
            public void onAnimatedLogoAvailable(BaseGifImage animatedLogoImage) {
                if (mIsDestroyed) return;
                mLogoView.playAnimatedLogo(animatedLogoImage);
            }
        }, mAnimatedLogoUrl);
    } else if (mOnLogoClickUrl != null) {
        RecordHistogram.recordSparseSlowlyHistogram(LOGO_CLICK_UMA_NAME,
                isAnimatedLogoShowing ? ANIMATED_LOGO_CLICKED : STATIC_LOGO_CLICKED);
        mTab.loadUrl(new LoadUrlParams(mOnLogoClickUrl, PageTransition.LINK));
    }
}
 
Example 2
Source File: LocationBarLayout.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Records a UMA action indicating that the user dismissed the suggestion list (e.g. pressed
 * the back button or the 'x' button in the Omnibox).  If there was an answer shown its type
 * is recorded.
 *
 * The action is not recorded if mSelectionInProgress is true.   This allows us to avoid
 * recording the action in the case where the user is selecting a suggestion which is not
 * considered a dismissal.
 */
private void recordSuggestionsDismissed() {
    if (mSuggestionSelectionInProgress || mSuggestionItems.size() == 0) return;

    int answerTypeShown = 0;
    for (int i = 0; i < mSuggestionItems.size(); i++) {
        OmniboxSuggestion suggestion = mSuggestionItems.get(i).getSuggestion();
        if (suggestion.hasAnswer()) {
            try {
                answerTypeShown = Integer.parseInt(suggestion.getAnswerType());
            } catch (NumberFormatException e) {
                Log.e(getClass().getSimpleName(),
                        "Answer type in dismissed suggestions is not an int: "
                        + suggestion.getAnswerType());
            }
            break;
        }
    }
    RecordHistogram.recordSparseSlowlyHistogram(
            "Omnibox.SuggestionsDismissed.AnswerType", answerTypeShown);
}
 
Example 3
Source File: NewTabPage.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onLogoClicked(boolean isAnimatedLogoShowing) {
    if (mIsDestroyed) return;

    if (!isAnimatedLogoShowing && mAnimatedLogoUrl != null) {
        RecordHistogram.recordSparseSlowlyHistogram(LOGO_CLICK_UMA_NAME, CTA_IMAGE_CLICKED);
        mNewTabPageView.showLogoLoadingView();
        mLogoBridge.getAnimatedLogo(new LogoBridge.AnimatedLogoCallback() {
            @Override
            public void onAnimatedLogoAvailable(BaseGifImage animatedLogoImage) {
                if (mIsDestroyed) return;
                mNewTabPageView.playAnimatedLogo(animatedLogoImage);
            }
        }, mAnimatedLogoUrl);
    } else if (mOnLogoClickUrl != null) {
        RecordHistogram.recordSparseSlowlyHistogram(LOGO_CLICK_UMA_NAME,
                isAnimatedLogoShowing ? ANIMATED_LOGO_CLICKED : STATIC_LOGO_CLICKED);
        mTab.loadUrl(new LoadUrlParams(mOnLogoClickUrl, PageTransition.LINK));
    }
}
 
Example 4
Source File: NewTabPage.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void getSearchProviderLogo(final LogoObserver logoObserver) {
    if (mIsDestroyed) return;
    LogoObserver wrapperCallback = new LogoObserver() {
        @Override
        public void onLogoAvailable(Logo logo, boolean fromCache) {
            if (mIsDestroyed) return;
            mOnLogoClickUrl = logo != null ? logo.onClickUrl : null;
            mAnimatedLogoUrl = logo != null ? logo.animatedLogoUrl : null;
            if (logo != null) {
                RecordHistogram.recordSparseSlowlyHistogram(LOGO_SHOWN_UMA_NAME,
                        logo.animatedLogoUrl == null ? STATIC_LOGO_SHOWN : CTA_IMAGE_SHOWN);
            }
            logoObserver.onLogoAvailable(logo, fromCache);
        }
    };
    mLogoBridge.getCurrentLogo(wrapperCallback);
}
 
Example 5
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Records a UMA action indicating that the user dismissed the suggestion list (e.g. pressed
 * the back button or the 'x' button in the Omnibox).  If there was an answer shown its type
 * is recorded.
 *
 * The action is not recorded if mSelectionInProgress is true.   This allows us to avoid
 * recording the action in the case where the user is selecting a suggestion which is not
 * considered a dismissal.
 */
private void recordSuggestionsDismissed() {
    if (mSuggestionSelectionInProgress || mSuggestionItems.size() == 0) return;

    int answerTypeShown = 0;
    for (int i = 0; i < mSuggestionItems.size(); i++) {
        OmniboxSuggestion suggestion = mSuggestionItems.get(i).getSuggestion();
        if (suggestion.hasAnswer()) {
            try {
                answerTypeShown = Integer.parseInt(suggestion.getAnswerType());
            } catch (NumberFormatException e) {
                Log.e(getClass().getSimpleName(),
                        "Answer type in dismissed suggestions is not an int: "
                        + suggestion.getAnswerType());
            }
            break;
        }
    }
    RecordHistogram.recordSparseSlowlyHistogram(
            "Omnibox.SuggestionsDismissed.AnswerType", answerTypeShown);
}
 
Example 6
Source File: NewTabPage.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onLogoClicked(boolean isAnimatedLogoShowing) {
    if (mIsDestroyed) return;

    if (!isAnimatedLogoShowing && mAnimatedLogoUrl != null) {
        RecordHistogram.recordSparseSlowlyHistogram(LOGO_CLICK_UMA_NAME, CTA_IMAGE_CLICKED);
        mNewTabPageView.showLogoLoadingView();
        mLogoBridge.getAnimatedLogo(new LogoBridge.AnimatedLogoCallback() {
            @Override
            public void onAnimatedLogoAvailable(BaseGifImage animatedLogoImage) {
                if (mIsDestroyed) return;
                mNewTabPageView.playAnimatedLogo(animatedLogoImage);
            }
        }, mAnimatedLogoUrl);
    } else if (mOnLogoClickUrl != null) {
        RecordHistogram.recordSparseSlowlyHistogram(LOGO_CLICK_UMA_NAME,
                isAnimatedLogoShowing ? ANIMATED_LOGO_CLICKED : STATIC_LOGO_CLICKED);
        mTab.loadUrl(new LoadUrlParams(mOnLogoClickUrl, PageTransition.LINK));
    }
}
 
Example 7
Source File: NewTabPage.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void getSearchProviderLogo(final LogoObserver logoObserver) {
    if (mIsDestroyed) return;
    LogoObserver wrapperCallback = new LogoObserver() {
        @Override
        public void onLogoAvailable(Logo logo, boolean fromCache) {
            if (mIsDestroyed) return;
            mOnLogoClickUrl = logo != null ? logo.onClickUrl : null;
            mAnimatedLogoUrl = logo != null ? logo.animatedLogoUrl : null;
            if (logo != null) {
                RecordHistogram.recordSparseSlowlyHistogram(LOGO_SHOWN_UMA_NAME,
                        logo.animatedLogoUrl == null ? STATIC_LOGO_SHOWN : CTA_IMAGE_SHOWN);
            }
            logoObserver.onLogoAvailable(logo, fromCache);
        }
    };
    mLogoBridge.getCurrentLogo(wrapperCallback);
}
 
Example 8
Source File: SnackbarManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a snackbar at the bottom of the screen, or above the keyboard if the keyboard is
 * visible.
 */
public void showSnackbar(Snackbar snackbar) {
    if (!mActivityInForeground || mIsDisabledForTesting) return;
    RecordHistogram.recordSparseSlowlyHistogram("Snackbar.Shown", snackbar.getIdentifier());

    mSnackbars.add(snackbar);
    updateView();
    mView.announceforAccessibility();
}
 
Example 9
Source File: LogoDelegateImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void getSearchProviderLogo(final LogoObserver logoObserver) {
    if (mIsDestroyed) return;

    final long loadTimeStart = System.currentTimeMillis();

    LogoObserver wrapperCallback = new LogoObserver() {
        @Override
        public void onLogoAvailable(Logo logo, boolean fromCache) {
            if (mIsDestroyed) return;
            mOnLogoClickUrl = logo != null ? logo.onClickUrl : null;
            mAnimatedLogoUrl = logo != null ? logo.animatedLogoUrl : null;
            if (logo != null) {
                RecordHistogram.recordSparseSlowlyHistogram(LOGO_SHOWN_UMA_NAME,
                        logo.animatedLogoUrl == null ? STATIC_LOGO_SHOWN : CTA_IMAGE_SHOWN);
                if (mShouldRecordLoadTime) {
                    long loadTime = System.currentTimeMillis() - loadTimeStart;
                    RecordHistogram.recordMediumTimesHistogram(
                            LOGO_SHOWN_TIME_UMA_NAME, loadTime, TimeUnit.MILLISECONDS);
                }
            }
            // If there currently is no Doodle, don't record the time if a refresh happens
            // later.
            mShouldRecordLoadTime = false;
            logoObserver.onLogoAvailable(logo, fromCache);
        }
    };

    mLogoBridge.getCurrentLogo(wrapperCallback);
}
 
Example 10
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the length of the selection in two histograms, one when results were seen and one when
 * results were not seen.
 * @param wasPanelSeen Whether the panel was seen.
 * @param selectionLength The length of the triggering selection.
 */
public static void logSelectionLengthResultsSeen(boolean wasPanelSeen, int selectionLength) {
    if (wasPanelSeen) {
        RecordHistogram.recordSparseSlowlyHistogram(
                "Search.ContextualSearchSelectionLengthSeen", selectionLength);
    } else {
        RecordHistogram.recordSparseSlowlyHistogram(
                "Search.ContextualSearchSelectionLengthNotSeen", selectionLength);
    }
}
 
Example 11
Source File: WebApkUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/** Records the current Shell APK version. */
public static void recordShellApkVersion(int shellApkVersion, String packageName) {
    String name = packageName.startsWith(WebApkConstants.WEBAPK_PACKAGE_PREFIX)
            ? "WebApk.ShellApkVersion.BrowserApk"
            : "WebApk.ShellApkVersion.UnboundApk";
    RecordHistogram.recordSparseSlowlyHistogram(name, shellApkVersion);
}
 
Example 12
Source File: SnackbarManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a snackbar at the bottom of the screen, or above the keyboard if the keyboard is
 * visible.
 */
public void showSnackbar(Snackbar snackbar) {
    if (!mActivityInForeground || mIsDisabledForTesting) return;
    RecordHistogram.recordSparseSlowlyHistogram("Snackbar.Shown", snackbar.getIdentifier());

    mSnackbars.add(snackbar);
    updateView();
    mView.announceforAccessibility();
}
 
Example 13
Source File: SnackbarManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a snackbar at the bottom of the screen, or above the keyboard if the keyboard is
 * visible.
 */
public void showSnackbar(Snackbar snackbar) {
    if (!mActivityInForeground || mIsDisabledForTesting) return;
    RecordHistogram.recordSparseSlowlyHistogram("Snackbar.Shown", snackbar.getIdentifier());

    mSnackbars.add(snackbar);
    updateView();
    mView.announceforAccessibility();
}
 
Example 14
Source File: SnippetArticle.java    From delion with Apache License 2.0 5 votes vote down vote up
/** Tracks impression of this NTP snippet. */
public void trackImpression() {
    // Track UMA only upon the first impression per life-time of this object.
    if (mImpressionTracked) return;

    RecordHistogram.recordSparseSlowlyHistogram("NewTabPage.Snippets.CardShown", mPosition);
    recordAgeAndScore("NewTabPage.Snippets.CardShown");
    mImpressionTracked = true;
}
 
Example 15
Source File: SnippetArticle.java    From delion with Apache License 2.0 5 votes vote down vote up
/** Tracks click on this NTP snippet in UMA. */
public void trackClick() {
    RecordUserAction.record("MobileNTP.Snippets.Click");
    RecordHistogram.recordSparseSlowlyHistogram("NewTabPage.Snippets.CardClicked", mPosition);
    NewTabPageUma.recordSnippetAction(NewTabPageUma.SNIPPETS_ACTION_CLICKED);
    NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_SNIPPET);
    recordAgeAndScore("NewTabPage.Snippets.CardClicked");
}
 
Example 16
Source File: ChromeTabbedActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDeferredStartup() {
    try {
        TraceEvent.begin("ChromeTabbedActivity.onDeferredStartup");
        super.onDeferredStartup();

        ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        RecordHistogram.recordSparseSlowlyHistogram(
                "MemoryAndroid.DeviceMemoryClass", am.getMemoryClass());

        AutocompleteController.nativePrefetchZeroSuggestResults();
    } finally {
        TraceEvent.end("ChromeTabbedActivity.onDeferredStartup");
    }
}
 
Example 17
Source File: LaunchMetrics.java    From delion with Apache License 2.0 4 votes vote down vote up
private void recordWithNative(int sample) {
    RecordHistogram.recordSparseSlowlyHistogram(mHistogramName, sample);
}
 
Example 18
Source File: TranslateCompactInfoBar.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void recordInfobarLanguageData(String histogram, String langCode) {
    Integer hashCode = mOptions.getUMAHashCodeFromCode(langCode);
    if (hashCode != null) {
        RecordHistogram.recordSparseSlowlyHistogram(histogram, hashCode);
    }
}