org.chromium.base.metrics.RecordHistogram Java Examples
The following examples show how to use
org.chromium.base.metrics.RecordHistogram.
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: ClearBrowsingDataPreferences.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Called when clearing browsing data completes. * Implements the ChromePreferences.OnClearBrowsingDataListener interface. */ @Override public void onBrowsingDataCleared() { if (getActivity() == null) return; // If the user deleted their browsing history, the dialog about other forms of history // is enabled, and it has never been shown before, show it. Note that opening a new // DialogFragment is only possible if the Activity is visible. // // If conditions to show the dialog about other forms of history are not met, just close // this preference screen. if (MultiWindowUtils.isActivityVisible(getActivity()) && getSelectedOptions().contains(DialogOption.CLEAR_HISTORY) && mIsDialogAboutOtherFormsOfBrowsingHistoryEnabled && !OtherFormsOfHistoryDialogFragment.wasDialogShown(getActivity())) { mDialogAboutOtherFormsOfBrowsingHistory = new OtherFormsOfHistoryDialogFragment(); mDialogAboutOtherFormsOfBrowsingHistory.show(getActivity()); dismissProgressDialog(); RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, true); } else { dismissProgressDialog(); getActivity().finish(); RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, false); } }
Example #2
Source File: ContextualSearchUma.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Logs the outcome of the Promo. * Logs multiple histograms; with and without the originating gesture. * @param wasTap Whether the gesture that originally caused the panel to show was a Tap. * @param wasMandatory Whether the Promo was mandatory. */ public static void logPromoOutcome(boolean wasTap, boolean wasMandatory) { int preferenceCode = getPreferenceValue(); RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchFirstRunFlowOutcome", preferenceCode, PREFERENCE_HISTOGRAM_BOUNDARY); int preferenceByGestureCode = getPromoByGestureStateCode(preferenceCode, wasTap); if (wasMandatory) { RecordHistogram.recordEnumeratedHistogram( "Search.ContextualSearchMandatoryPromoOutcomeByGesture", preferenceByGestureCode, PROMO_BY_GESTURE_BOUNDARY); } else { RecordHistogram.recordEnumeratedHistogram( "Search.ContextualSearchPromoOutcomeByGesture", preferenceByGestureCode, PROMO_BY_GESTURE_BOUNDARY); } }
Example #3
Source File: WebappDirectoryManager.java From 365browser with Apache License 2.0 | 6 votes |
/** * Returns the directory for a web app, creating it if necessary. * @param webappId ID for the web app. Used as a subdirectory name. * @return File for storing information about the web app. */ File getWebappDirectory(Context context, String webappId) { // Temporarily allowing disk access while fixing. TODO: http://crbug.com/525781 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); try { long time = SystemClock.elapsedRealtime(); File webappDirectory = new File(getBaseWebappDirectory(context), webappId); if (!webappDirectory.exists() && !webappDirectory.mkdir()) { Log.e(TAG, "Failed to create web app directory."); } RecordHistogram.recordTimesHistogram("Android.StrictMode.WebappDir", SystemClock.elapsedRealtime() - time, TimeUnit.MILLISECONDS); return webappDirectory; } finally { StrictMode.setThreadPolicy(oldPolicy); } }
Example #4
Source File: ReaderModeManager.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void onClosed(StateChangeReason reason) { if (mReaderModePanel == null || mTabModelSelector == null) return; restoreInfobars(); // Only dismiss the panel if the close was a result of user interaction. if (reason != StateChangeReason.FLING && reason != StateChangeReason.SWIPE && reason != StateChangeReason.CLOSE_BUTTON) { return; } // Record close button usage. if (reason == StateChangeReason.CLOSE_BUTTON) { RecordHistogram.recordBooleanHistogram("DomDistiller.BarCloseButtonUsage", mReaderModePanel.getPanelState() == PanelState.EXPANDED || mReaderModePanel.getPanelState() == PanelState.MAXIMIZED); } int currentTabId = mTabModelSelector.getCurrentTabId(); if (!mTabStatusMap.containsKey(currentTabId)) return; mTabStatusMap.get(currentTabId).setIsDismissed(true); }
Example #5
Source File: ChromeBluetoothDevice.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onCharacteristicRead( final Wrappers.BluetoothGattCharacteristicWrapper characteristic, final int status) { Wrappers.ThreadUtilsWrapper.getInstance().runOnUiThread(new Runnable() { @Override public void run() { ChromeBluetoothRemoteGattCharacteristic chromeCharacteristic = mWrapperToChromeCharacteristicsMap.get(characteristic); if (chromeCharacteristic == null) { // Android events arriving with no Chrome object is expected rarely: only // when the event races object destruction. Log.v(TAG, "onCharacteristicRead when chromeCharacteristic == null."); } else { RecordHistogram.recordSparseSlowlyHistogram( "Bluetooth.Web.Android.onCharacteristicRead.Status", status); chromeCharacteristic.onCharacteristicRead(status); } } }); }
Example #6
Source File: ClearBrowsingDataPreferences.java From 365browser with Apache License 2.0 | 6 votes |
/** * Called when clearing browsing data completes. * Implements the ChromePreferences.OnClearBrowsingDataListener interface. */ @Override public void onBrowsingDataCleared() { if (getActivity() == null) return; // If the user deleted their browsing history, the dialog about other forms of history // is enabled, and it has never been shown before, show it. Note that opening a new // DialogFragment is only possible if the Activity is visible. // // If conditions to show the dialog about other forms of history are not met, just close // this preference screen. if (MultiWindowUtils.isActivityVisible(getActivity()) && getSelectedOptions().contains(DialogOption.CLEAR_HISTORY) && mIsDialogAboutOtherFormsOfBrowsingHistoryEnabled && !OtherFormsOfHistoryDialogFragment.wasDialogShown(getActivity())) { mDialogAboutOtherFormsOfBrowsingHistory = new OtherFormsOfHistoryDialogFragment(); mDialogAboutOtherFormsOfBrowsingHistory.show(getActivity()); dismissProgressDialog(); RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, true); } else { dismissProgressDialog(); getActivity().finish(); RecordHistogram.recordBooleanHistogram(DIALOG_HISTOGRAM, false); } }
Example #7
Source File: PrecacheUMA.java From delion with Apache License 2.0 | 6 votes |
/** * Record the precache event. The event is persisted in shared preferences if the native library * is not loaded. If library is loaded, the event will be recorded as UMA metric, and any prior * persisted events are recorded to UMA as well. * @param event the precache event. */ public static void record(int event) { SharedPreferences sharedPreferences = ContextUtils.getAppSharedPreferences(); long persistent_metric = sharedPreferences.getLong(PREF_PERSISTENCE_METRICS, 0); Editor preferencesEditor = sharedPreferences.edit(); if (LibraryLoader.isInitialized()) { RecordHistogram.recordEnumeratedHistogram( EVENTS_HISTOGRAM, Event.getBitPosition(event), Event.EVENT_END); for (int e : Event.getEventsFromBitMask(persistent_metric)) { RecordHistogram.recordEnumeratedHistogram( EVENTS_HISTOGRAM, Event.getBitPosition(e), Event.EVENT_END); } preferencesEditor.remove(PREF_PERSISTENCE_METRICS); } else { // Save the metric in preferences. persistent_metric = Event.addEventToBitMask(persistent_metric, event); preferencesEditor.putLong(PREF_PERSISTENCE_METRICS, persistent_metric); } preferencesEditor.apply(); }
Example #8
Source File: ChromeActivity.java From delion with Apache License 2.0 | 6 votes |
/** * All deferred startup tasks that require the activity rather than the app should go here. */ private void onDeferredStartupForActivity() { BeamController.registerForBeam(this, new BeamProvider() { @Override public String getTabUrlForBeam() { if (isOverlayVisible()) return null; if (getActivityTab() == null) return null; return getActivityTab().getUrl(); } }); UpdateMenuItemHelper.getInstance().checkForUpdateOnBackgroundThread(this); if (mToolbarManager != null) { String simpleName = getClass().getSimpleName(); RecordHistogram.recordTimesHistogram("MobileStartup.ToolbarInflationTime." + simpleName, mInflateInitialLayoutDurationMs, TimeUnit.MILLISECONDS); mToolbarManager.onDeferredStartup(getOnCreateTimestampMs(), simpleName); } if (MultiWindowUtils.getInstance().isInMultiWindowMode(this)) { onDeferredStartupForMultiWindowMode(); } }
Example #9
Source File: ClientManager.java From 365browser with Apache License 2.0 | 6 votes |
/** * Registers that a client has launched a URL inside a Custom Tab. */ public synchronized void registerLaunch(CustomTabsSessionToken session, String url) { int outcome = getPredictionOutcome(session, url); RecordHistogram.recordEnumeratedHistogram( "CustomTabs.PredictionStatus", outcome, PREDICTION_STATUS_COUNT); SessionParams params = mSessionParams.get(session); if (outcome == GOOD_PREDICTION) { long elapsedTimeMs = SystemClock.elapsedRealtime() - params.getLastMayLaunchUrlTimestamp(); RequestThrottler.getForUid(mContext, params.uid).registerSuccess( params.mPredictedUrl); RecordHistogram.recordCustomTimesHistogram("CustomTabs.PredictionToLaunch", elapsedTimeMs, 1, TimeUnit.MINUTES.toMillis(3), TimeUnit.MILLISECONDS, 100); } RecordHistogram.recordEnumeratedHistogram( "CustomTabs.WarmupStateOnLaunch", getWarmupState(session), SESSION_WARMUP_COUNT); if (params == null) return; int value = (params.lowConfidencePrediction ? LOW_CONFIDENCE : 0) + (params.highConfidencePrediction ? HIGH_CONFIDENCE : 0); RecordHistogram.recordEnumeratedHistogram( "CustomTabs.MayLaunchUrlType", value, MAY_LAUNCH_URL_TYPE_COUNT); params.resetPredictionMetrics(); }
Example #10
Source File: WebappActivity.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Saves the tab data out to a file. */ void saveState(File activityDirectory) { String tabFileName = TabState.getTabStateFilename(getActivityTab().getId(), false); File tabFile = new File(activityDirectory, tabFileName); // Temporarily allowing disk access while fixing. TODO: http://crbug.com/525781 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); StrictMode.allowThreadDiskWrites(); try { long time = SystemClock.elapsedRealtime(); TabState.saveState(tabFile, getActivityTab().getState(), false); RecordHistogram.recordTimesHistogram("Android.StrictMode.WebappSaveState", SystemClock.elapsedRealtime() - time, TimeUnit.MILLISECONDS); } finally { StrictMode.setThreadPolicy(oldPolicy); } }
Example #11
Source File: CustomTabActivity.java From 365browser with Apache License 2.0 | 6 votes |
/** * Encapsulates CustomTabsConnection#takeHiddenTab() * with additional initialization logic. */ private Tab getHiddenTab(CustomTabsConnection connection) { String url = getUrlToLoad(); String referrerUrl = connection.getReferrer(mSession, getIntent()); Tab tab = connection.takeHiddenTab(mSession, url, referrerUrl); mUsingHiddenTab = tab != null; if (!mUsingHiddenTab) return null; RecordHistogram.recordEnumeratedHistogram("CustomTabs.WebContentsStateOnLaunch", WEBCONTENTS_STATE_PRERENDERED_WEBCONTENTS, WEBCONTENTS_STATE_MAX); tab.setAppAssociatedWith(connection.getClientPackageNameForSession(mSession)); if (mIntentDataProvider.shouldEnableEmbeddedMediaExperience()) { tab.enableEmbeddedMediaExperience(true); } initializeMainTab(tab); return tab; }
Example #12
Source File: ToolbarManager.java From delion with Apache License 2.0 | 6 votes |
/** * Handle all necessary tasks that can be delayed until initialization completes. * @param activityCreationTimeMs The time of creation for the activity this toolbar belongs to. * @param activityName Simple class name for the activity this toolbar belongs to. */ public void onDeferredStartup(final long activityCreationTimeMs, final String activityName) { // Record startup performance statistics long elapsedTime = SystemClock.elapsedRealtime() - activityCreationTimeMs; if (elapsedTime < RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS) { ThreadUtils.postOnUiThreadDelayed(new Runnable() { @Override public void run() { onDeferredStartup(activityCreationTimeMs, activityName); } }, RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS - elapsedTime); } RecordHistogram.recordTimesHistogram("MobileStartup.ToolbarFirstDrawTime." + activityName, mToolbar.getFirstDrawTime() - activityCreationTimeMs, TimeUnit.MILLISECONDS); long firstFocusTime = mToolbar.getLocationBar().getFirstUrlBarFocusTime(); if (firstFocusTime != 0) { RecordHistogram.recordCustomTimesHistogram( "MobileStartup.ToolbarFirstFocusTime." + activityName, firstFocusTime - activityCreationTimeMs, MIN_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS, MAX_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS, TimeUnit.MILLISECONDS, 50); } }
Example #13
Source File: ChromeActivitySessionTracker.java From 365browser with Apache License 2.0 | 6 votes |
/** * Called when last of Chrome activities is stopped, ending the foreground session. This will * not be called when a Chrome activity is stopped because another Chrome activity takes over. * This is ensured by ActivityStatus, which switches to track new activity when its started and * will not report the old one being stopped (see createStateListener() below). */ private void onForegroundSessionEnd() { if (!mIsStarted) return; UmaUtils.recordBackgroundTime(); ChromeApplication.flushPersistentData(); mIsStarted = false; mPowerBroadcastReceiver.onForegroundSessionEnd(); ChildProcessLauncher.onSentToBackground(); IntentHandler.clearPendingReferrer(); IntentHandler.clearPendingIncognitoUrl(); int totalTabCount = 0; for (WeakReference<Activity> reference : ApplicationStatus.getRunningActivities()) { Activity activity = reference.get(); if (activity instanceof ChromeActivity) { TabModelSelector tabModelSelector = ((ChromeActivity) activity).getTabModelSelector(); if (tabModelSelector != null) { totalTabCount += tabModelSelector.getTotalTabCount(); } } } RecordHistogram.recordCountHistogram( "Tab.TotalTabCount.BeforeLeavingApp", totalTabCount); }
Example #14
Source File: ContextualSearchUma.java From 365browser with Apache License 2.0 | 6 votes |
/** * Logs whether results were seen and whether any tap suppression heuristics were satisfied. * @param wasSearchContentViewSeen If the panel was opened. * @param wasAnySuppressionHeuristicSatisfied Whether any of the implemented suppression * heuristics were satisfied. */ public static void logAnyTapSuppressionHeuristicSatisfied(boolean wasSearchContentViewSeen, boolean wasAnySuppressionHeuristicSatisfied) { int code; if (wasAnySuppressionHeuristicSatisfied) { code = wasSearchContentViewSeen ? RESULTS_SEEN_SUPPRESSION_HEURSTIC_SATISFIED : RESULTS_NOT_SEEN_SUPPRESSION_HEURSTIC_SATISFIED; } else { code = wasSearchContentViewSeen ? RESULTS_SEEN_SUPPRESSION_HEURSTIC_NOT_SATISFIED : RESULTS_NOT_SEEN_SUPPRESSION_HEURSTIC_NOT_SATISFIED; } RecordHistogram.recordEnumeratedHistogram( "Search.ContextualSearchTapSuppressionSeen.AnyHeuristicSatisfied", code, RESULTS_SEEN_SUPPRESSION_BOUNDARY); }
Example #15
Source File: CustomTabObserver.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onPageLoadFinished(Tab tab) { long pageLoadFinishedTimestamp = SystemClock.elapsedRealtime(); if (mCustomTabsConnection != null) { mCustomTabsConnection.notifyNavigationEvent( mSession, CustomTabsCallback.NAVIGATION_FINISHED); } // Both histograms (commit and PLT) are reported here, to make sure // that they are always recorded together, and that we only record // commits for successful navigations. if (mCurrentState == STATE_WAITING_LOAD_FINISH && mIntentReceivedTimestamp > 0) { long timeToPageLoadStartedMs = mPageLoadStartedTimestamp - mIntentReceivedTimestamp; long timeToPageLoadFinishedMs = pageLoadFinishedTimestamp - mIntentReceivedTimestamp; String histogramPrefix = mOpenedByChrome ? "ChromeGeneratedCustomTab" : "CustomTabs"; RecordHistogram.recordCustomTimesHistogram( histogramPrefix + ".IntentToFirstCommitNavigationTime2.ZoomedOut", timeToPageLoadStartedMs, 50, TimeUnit.MINUTES.toMillis(10), TimeUnit.MILLISECONDS, 50); RecordHistogram.recordCustomTimesHistogram( histogramPrefix + ".IntentToFirstCommitNavigationTime2.ZoomedIn", timeToPageLoadStartedMs, 200, 1000, TimeUnit.MILLISECONDS, 100); // Same bounds and bucket count as PLT histograms. RecordHistogram.recordCustomTimesHistogram(histogramPrefix + ".IntentToPageLoadedTime", timeToPageLoadFinishedMs, 10, TimeUnit.MINUTES.toMillis(10), TimeUnit.MILLISECONDS, 100); } resetPageLoadTracking(); captureNavigationInfo(tab); }
Example #16
Source File: PhysicalWebUma.java From AndroidChromium with Apache License 2.0 | 5 votes |
private static void handleTime(Context context, String key, long duration, TimeUnit tu) { if (LibraryLoader.isInitialized()) { RecordHistogram.recordTimesHistogram(key, duration, tu); } else { storeValue(context, key, duration); } }
Example #17
Source File: SpellCheckerSessionBridge.java From 365browser with Apache License 2.0 | 5 votes |
/** * Checks for typos and sends results back to native through a JNI call. * @param results Results returned by the Android spellchecker. */ @Override public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) { mStopMs = SystemClock.elapsedRealtime(); if (mNativeSpellCheckerSessionBridge == 0) { return; } ArrayList<Integer> offsets = new ArrayList<Integer>(); ArrayList<Integer> lengths = new ArrayList<Integer>(); for (SentenceSuggestionsInfo result : results) { if (result == null) { // In some cases null can be returned by the selected spellchecking service, // see crbug.com/651458. In this case skip to next result to avoid a // NullPointerException later on. continue; } for (int i = 0; i < result.getSuggestionsCount(); i++) { // If a word looks like a typo, record its offset and length. if ((result.getSuggestionsInfoAt(i).getSuggestionsAttributes() & SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO) == SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO) { offsets.add(result.getOffsetAt(i)); lengths.add(result.getLengthAt(i)); } } } nativeProcessSpellCheckResults(mNativeSpellCheckerSessionBridge, convertListToArray(offsets), convertListToArray(lengths)); RecordHistogram.recordTimesHistogram("SpellCheck.Android.Latency", mStopMs - mStartMs, TimeUnit.MILLISECONDS); }
Example #18
Source File: RecentTabsRowAdapter.java From 365browser with Apache License 2.0 | 5 votes |
/** * Creates an RecentTabsRowAdapter used to populate an ExpandableList with other * devices and foreign tab cells. * * @param activity The Android activity this adapter will work in. * @param recentTabsManager The RecentTabsManager that will act as the data source. */ public RecentTabsRowAdapter(Activity activity, RecentTabsManager recentTabsManager) { mActivity = activity; mRecentTabsManager = recentTabsManager; mGroups = new ArrayList<>(); mFaviconCache = new FaviconCache(MAX_NUM_FAVICONS_TO_CACHE); Resources resources = activity.getResources(); mDefaultFavicon = ApiCompatibilityUtils.getDrawable(resources, R.drawable.default_favicon); mFaviconSize = resources.getDimensionPixelSize(R.dimen.default_favicon_size); RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu", OtherSessionsActions.MENU_INITIALIZED, OtherSessionsActions.LIMIT); }
Example #19
Source File: TabUma.java From AndroidChromium with Apache License 2.0 | 5 votes |
void onDestroy() { updateTabState(TAB_STATE_CLOSED); if (mTabCreationState == TabCreationState.LIVE_IN_BACKGROUND || mTabCreationState == TabCreationState.FROZEN_FOR_LAZY_LOAD) { RecordHistogram.recordBooleanHistogram( "Tab.BackgroundTabShown", mLastShownTimestamp != -1); } recordNumBackgroundTabsOpened(); }
Example #20
Source File: SnippetArticle.java From delion with Apache License 2.0 | 5 votes |
private static void recordAge(String histogramName, int ageInMinutes) { // Negative values (when the time of the device is set inappropriately) provide no value. if (ageInMinutes >= 0) { // If the max value below (72 hours) were to be changed, the histogram should be renamed // since it will change the shape of buckets. RecordHistogram.recordCustomCountHistogram(histogramName, ageInMinutes, 1, 72 * 60, 50); } }
Example #21
Source File: ContextualSearchUma.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * 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 #22
Source File: OfflinePageUtils.java From 365browser with Apache License 2.0 | 5 votes |
/** * Records UMA data when the Offline Pages Background Load service awakens. * @param context android context */ public static void recordWakeupUMA(Context context, long taskScheduledTimeMillis) { DeviceConditions deviceConditions = DeviceConditions.getCurrentConditions(context); if (deviceConditions == null) return; // Report charging state. RecordHistogram.recordBooleanHistogram( "OfflinePages.Wakeup.ConnectedToPower", deviceConditions.isPowerConnected()); // Report battery percentage. RecordHistogram.recordPercentageHistogram( "OfflinePages.Wakeup.BatteryPercentage", deviceConditions.getBatteryPercentage()); // Report the default network found (or none, if we aren't connected). int connectionType = deviceConditions.getNetConnectionType(); Log.d(TAG, "Found default network of type " + connectionType); RecordHistogram.recordEnumeratedHistogram("OfflinePages.Wakeup.NetworkAvailable", connectionType, ConnectionType.CONNECTION_LAST + 1); // Collect UMA on the time since the request started. long nowMillis = System.currentTimeMillis(); long delayInMilliseconds = nowMillis - taskScheduledTimeMillis; if (delayInMilliseconds <= 0) { return; } RecordHistogram.recordLongTimesHistogram( "OfflinePages.Wakeup.DelayTime", delayInMilliseconds, TimeUnit.MILLISECONDS); }
Example #23
Source File: ContextualSearchUma.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Logs the number of impressions and CTR for previous 28-day period for the current user. * @param previous28DayImpressions The number of times the user saw the Contextual Search Bar. * @param previous28DayCtr The CTR expressed as a percentage. */ public static void logPrevious28DayCtr(int previous28DayImpressions, int previous28DayCtr) { RecordHistogram.recordCountHistogram( "Search.ContextualSearchPrevious28DayImpressions", previous28DayImpressions); RecordHistogram.recordPercentageHistogram( "Search.ContextualSearchPrevious28DayCtr", previous28DayCtr); }
Example #24
Source File: TabUma.java From 365browser with Apache License 2.0 | 5 votes |
/** * Records the number of background tabs which were opened from this tab's * current URL. Does not record anything if no background tabs were opened. */ private void recordNumBackgroundTabsOpened() { if (mNumBackgroundTabsOpened > 0) { RecordHistogram.recordCount100Histogram( "Tab.BackgroundTabsOpenedViaContextMenuCount", mNumBackgroundTabsOpened); } mNumBackgroundTabsOpened = 0; mChildBackgroundTabShowObserver = null; }
Example #25
Source File: PhysicalWebUma.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void uploadTimes(final String key, final TimeUnit tu) { String jsonTimesStr = mPrefs.getString(key, "[]"); removePref(key); Long[] times = parseJsonLongArray(jsonTimesStr); if (times == null) { Log.e(TAG, "Error reporting " + key + " with values: " + jsonTimesStr); return; } for (Long time : times) { RecordHistogram.recordTimesHistogram(key, time, TimeUnit.MILLISECONDS); } }
Example #26
Source File: SadTabViewFactory.java From 365browser with Apache License 2.0 | 5 votes |
/** * Records enumerated histograms for {@link SadTabEvent}. * @param sendFeedbackView Whether the event is for the "send feedback" version of the Sad Tab. * @param event The {@link SadTabEvent} to record. */ private static void recordEvent(boolean sendFeedbackView, int event) { if (sendFeedbackView) { RecordHistogram.recordEnumeratedHistogram( "Tabs.SadTab.Feedback.Event", event, SadTabEvent.MAX_SAD_TAB_EVENT); } else { RecordHistogram.recordEnumeratedHistogram( "Tabs.SadTab.Reload.Event", event, SadTabEvent.MAX_SAD_TAB_EVENT); } }
Example #27
Source File: NewTabPage.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void openMostVisitedItem(int windowDisposition, Tile tile) { if (mIsDestroyed) return; super.openMostVisitedItem(windowDisposition, tile); if (windowDisposition != WindowOpenDisposition.NEW_WINDOW) { RecordHistogram.recordMediumTimesHistogram("NewTabPage.MostVisitedTime", System.nanoTime() - mLastShownTimeNs, TimeUnit.NANOSECONDS); } }
Example #28
Source File: RecordCastAction.java From delion with Apache License 2.0 | 5 votes |
/** * Record if the remotely played media element is alive when the * {@link ExpandedControllerActivity} is shown. * * @param isMediaElementAlive if the media element is alive. */ public static void recordFullscreenControlsShown(boolean isMediaElementAlive) { if (LibraryLoader.isInitialized()) { RecordHistogram.recordBooleanHistogram( "Cast.Sender.MediaElementPresentWhenShowFullscreenControls", isMediaElementAlive); } }
Example #29
Source File: ContextualSearchUma.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Logs whether a certain category of a blacklisted term resulted in the search results * being seen. * @param reason The given reason. * @param wasSeen Whether the search results were seen. */ public static void logBlacklistSeen(BlacklistReason reason, boolean wasSeen) { if (reason == null) reason = BlacklistReason.NONE; int code = ContextualSearchBlacklist.getBlacklistMetricsCode(reason, wasSeen); RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchBlacklistSeen", code, ContextualSearchBlacklist.BLACKLIST_BOUNDARY); }
Example #30
Source File: ContextualSearchUma.java From delion with Apache License 2.0 | 5 votes |
/** * Logs to a seen-by-gesture histogram of the given name. * @param wasPanelSeen Whether the panel was seen. * @param wasTap Whether the gesture that originally caused the panel to show was a Tap. * @param histogramName The full name of the histogram to log to. */ private static void logHistogramByGesture(boolean wasPanelSeen, boolean wasTap, String histogramName) { RecordHistogram.recordEnumeratedHistogram(histogramName, getPanelSeenByGestureStateCode(wasPanelSeen, wasTap), RESULTS_BY_GESTURE_BOUNDARY); }