Java Code Examples for org.chromium.base.metrics.RecordUserAction#record()
The following examples show how to use
org.chromium.base.metrics.RecordUserAction#record() .
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: BookmarkAddActivity.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void finishNativeInitialization() { RecordUserAction.record("MobileAddBookmarkViaIntent"); final String title = getIntent().getStringExtra(EXTRA_TITLE); final String url = getIntent().getStringExtra(EXTRA_URL); // Partner bookmarks need to be loaded explicitly. PartnerBookmarksShim.kickOffReading(this); // Store mModel as a member variable so it can't be garbage collected. Otherwise the // Runnable might never be run. mModel = new BookmarkModel(); mModel.runAfterBookmarkModelLoaded(new Runnable() { @Override public void run() { BookmarkId bookmarkId = BookmarkUtils.addBookmarkSilently( BookmarkAddActivity.this, mModel, title, url); if (bookmarkId != null) { BookmarkUtils.startEditActivity(BookmarkAddActivity.this, bookmarkId); } finish(); } }); }
Example 2
Source File: ChromeActivity.java From delion with Apache License 2.0 | 6 votes |
@Override public final void onBackPressed() { RecordUserAction.record("SystemBack"); if (mCompositorViewHolder != null) { LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager(); if (layoutManager != null && layoutManager.onBackPressed()) return; } ContentViewCore contentViewCore = getContentViewCore(); if (contentViewCore != null && contentViewCore.isSelectActionBarShowing()) { contentViewCore.clearSelection(); return; } if (mContextualSearchManager != null && mContextualSearchManager.onBackPressed()) return; if (handleBackPressed()) return; super.onBackPressed(); }
Example 3
Source File: MinidumpDirectoryObserver.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * When a minidump is detected, upload it to Google crash server */ @Override public void onEvent(int event, String path) { // This is executed on a thread dedicated to FileObserver. if (CrashFileManager.isMinidumpMIMEFirstTry(path)) { Context appContext = ContextUtils.getApplicationContext(); try { Intent intent = MinidumpUploadService.createFindAndUploadLastCrashIntent(appContext); appContext.startService(intent); Log.i(TAG, "Detects a new minidump %s send intent to MinidumpUploadService", path); RecordUserAction.record("MobileBreakpadUploadAttempt"); } catch (SecurityException e) { // For KitKat and below, there was a framework bug which cause us to not be able to // find our own crash uploading service. Ignore a SecurityException here on older // OS versions since the crash will eventually get uploaded on next start. // crbug/542533 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { throw e; } } } }
Example 4
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public final void onBackPressed() { RecordUserAction.record("SystemBack"); if (mCompositorViewHolder != null) { LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager(); if (layoutManager != null && layoutManager.onBackPressed()) return; } ContentViewCore contentViewCore = getContentViewCore(); if (contentViewCore != null && contentViewCore.isSelectActionBarShowing()) { contentViewCore.clearSelection(); return; } if (mContextualSearchManager != null && mContextualSearchManager.onBackPressed()) return; if (handleBackPressed()) return; super.onBackPressed(); }
Example 5
Source File: AppMenuButtonHelper.java From delion with Apache License 2.0 | 6 votes |
/** * Shows the app menu if it is not already shown. * @param view View that initiated showing this menu. Normally it is a menu button. * @param startDragging Whether dragging is started. * @return Whether or not if the app menu is successfully shown. */ private boolean showAppMenu(View view, boolean startDragging) { if (!mMenuHandler.isAppMenuShowing() && mMenuHandler.showAppMenu(view, startDragging)) { // Initial start dragging can be canceled in case if it was just single tap. // So we only record non-dragging here, and will deal with those dragging cases in // AppMenuDragHelper class. if (!startDragging) RecordUserAction.record("MobileUsingMenuBySwButtonTap"); if (mOnAppMenuShownListener != null) { mOnAppMenuShownListener.run(); } return true; } return false; }
Example 6
Source File: ToolbarTablet.java From delion with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { if (mHomeButton == v) { openHomepage(); } else if (mBackButton == v) { if (!back()) return; RecordUserAction.record("MobileToolbarBack"); RecordUserAction.record("MobileTabClobbered"); } else if (mForwardButton == v) { forward(); RecordUserAction.record("MobileToolbarForward"); RecordUserAction.record("MobileTabClobbered"); } else if (mReloadButton == v) { stopOrReloadCurrentTab(); } else if (mBookmarkButton == v) { if (mBookmarkListener != null) { mBookmarkListener.onClick(mBookmarkButton); RecordUserAction.record("MobileToolbarToggleBookmark"); } } else if (mAccessibilitySwitcherButton == v) { if (mTabSwitcherListener != null) { cancelAppMenuUpdateBadgeAnimation(); mTabSwitcherListener.onClick(mAccessibilitySwitcherButton); } } }
Example 7
Source File: TapSuppression.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Constructs a heuristic to decide if a Tap should be suppressed or not. * Combines various signals to determine suppression, including whether the previous * Tap was suppressed for any reason. * @param controller The Selection Controller. * @param previousTapState The specifics regarding the previous Tap. * @param x The x coordinate of the current tap. * @param y The y coordinate of the current tap. * @param tapsSinceOpen the number of Tap gestures since the last open of the panel. */ TapSuppression(ContextualSearchSelectionController controller, ContextualSearchTapState previousTapState, int x, int y, int tapsSinceOpen) { mIsTapSuppressionEnabled = ContextualSearchFieldTrial.isTapSuppressionEnabled(); mExperimentThresholdTaps = ContextualSearchFieldTrial.getSuppressionTaps(); mPxToDp = controller.getPxToDp(); mTapsSinceOpen = tapsSinceOpen; mIsSecondTap = previousTapState != null && previousTapState.wasSuppressed() && !shouldHandleFirstTap(); if (mIsSecondTap) { boolean shouldHandle = shouldHandleSecondTap(previousTapState, x, y); mIsConditionSatisfied = !shouldHandle; } else { mIsConditionSatisfied = !shouldHandleFirstTap(); if (mIsConditionSatisfied && mIsTapSuppressionEnabled) { RecordUserAction.record("ContextualSearch.TapSuppressed.TapThresholdExceeded"); } } }
Example 8
Source File: DownloadManagerToolbar.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void onSelectionStateChange(List<DownloadHistoryItemWrapper> selectedItems) { boolean wasSelectionEnabled = mIsSelectionEnabled; super.onSelectionStateChange(selectedItems); if (!mIsSelectionEnabled) { updateTitle(); } else { int numSelected = mSelectionDelegate.getSelectedItems().size(); findViewById(R.id.selection_mode_share_menu_id).setContentDescription( getResources().getQuantityString(R.plurals.accessibility_share_selected_items, numSelected, numSelected)); findViewById(R.id.selection_mode_delete_menu_id).setContentDescription( getResources().getQuantityString(R.plurals.accessibility_remove_selected_items, numSelected, numSelected)); if (!wasSelectionEnabled) { RecordUserAction.record("Android.DownloadManager.SelectionEstablished"); } } }
Example 9
Source File: ChromeTabbedActivity2.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override protected void recordMultiWindowModeChangedUserAction(boolean isInMultiWindowMode) { // Record separate user actions for entering/exiting multi-window mode to avoid recording // the same action twice when two instances are running. if (isInMultiWindowMode) { RecordUserAction.record("Android.MultiWindowMode.Enter-SecondInstance"); } else { RecordUserAction.record("Android.MultiWindowMode.Exit-SecondInstance"); } }
Example 10
Source File: ManageSpaceActivity.java From delion with Apache License 2.0 | 5 votes |
/** @see BrowserParts#finishNativeInitialization */ public void finishNativeInitialization() { mIsNativeInitialized = true; mManageSiteDataButton.setEnabled(true); mClearUnimportantButton.setEnabled(true); RecordUserAction.record("Android.ManageSpace"); refreshStorageNumbers(); }
Example 11
Source File: BeamCallback.java From delion with Apache License 2.0 | 5 votes |
/** * Trigger an error about NFC if we don't want to send anything. Also * records a UMA stat. On ICS we only show the error if they attempt to * beam, since the recipient will receive the market link. On JB we'll * always show the error, since the beam animation won't trigger, which * could be confusing to the user. * * @param errorStringId The resid of the string to display as error. */ private void onInvalidBeam(final int errorStringId) { RecordUserAction.record("MobileBeamInvalidAppState"); Runnable errorRunnable = new Runnable() { @Override public void run() { Toast.makeText(mActivity, errorStringId, Toast.LENGTH_SHORT).show(); } }; if (NFC_BUGS_ACTIVE) { mErrorRunnableIfBeamSent = errorRunnable; } else { ThreadUtils.runOnUiThread(errorRunnable); } }
Example 12
Source File: ChromeActivity.java From delion with Apache License 2.0 | 5 votes |
@Override public void onResumeWithNative() { super.onResumeWithNative(); markSessionResume(); RecordUserAction.record("MobileComeToForeground"); if (getActivityTab() != null) { LaunchMetrics.commitLaunchMetrics(getActivityTab().getWebContents()); } FeatureUtilities.setCustomTabVisible(isCustomTab()); FeatureUtilities.setIsInMultiWindowMode( MultiWindowUtils.getInstance().isInMultiWindowMode(this)); }
Example 13
Source File: ChromeActivity.java From delion with Apache License 2.0 | 5 votes |
/** * Triggered when the share menu item is selected. * This creates and shows a share intent picker dialog or starts a share intent directly. * @param shareDirectly Whether it should share directly with the activity that was most * recently used to share. * @param isIncognito Whether currentTab is incognito. */ public void onShareMenuItemSelected(final boolean shareDirectly, boolean isIncognito) { final Tab currentTab = getActivityTab(); if (currentTab == null) return; final Activity mainActivity = this; ContentBitmapCallback callback = new ContentBitmapCallback() { @Override public void onFinishGetBitmap(Bitmap bitmap, int response) { // Check whether this page is an offline page, and use its online URL if so. String url = currentTab.getOfflinePageOriginalUrl(); RecordHistogram.recordBooleanHistogram( "OfflinePages.SharedPageWasOffline", url != null); // If there is no entry in the offline pages DB for this tab, use the tab's // URL directly. if (url == null) url = currentTab.getUrl(); ShareHelper.share( shareDirectly, mainActivity, currentTab.getTitle(), url, bitmap); if (shareDirectly) { RecordUserAction.record("MobileMenuDirectShare"); } else { RecordUserAction.record("MobileMenuShare"); } } }; if (isIncognito || currentTab.getWebContents() == null) { callback.onFinishGetBitmap(null, ReadbackResponse.SURFACE_UNAVAILABLE); } else { currentTab.getWebContents().getContentBitmapAsync( Bitmap.Config.ARGB_8888, 1.f, EMPTY_RECT, callback); } }
Example 14
Source File: ChromeTabbedActivity2.java From delion with Apache License 2.0 | 5 votes |
@Override protected void recordMultiWindowModeChangedUserAction(boolean isInMultiWindowMode) { // Record separate user actions for entering/exiting multi-window mode to avoid recording // the same action twice when two instances are running. if (isInMultiWindowMode) { RecordUserAction.record("Android.MultiWindowMode.Enter-SecondInstance"); } else { RecordUserAction.record("Android.MultiWindowMode.Exit-SecondInstance"); } }
Example 15
Source File: IntentHandler.java From delion with Apache License 2.0 | 5 votes |
/** * Records an action when a user chose to handle a URL in Chrome that could have been handled * by an application installed on the phone. Also records the name of that application. * This doesn't include generic URL handlers, such as browsers. */ private void recordAppHandlersForIntent(Intent intent) { List<String> packages = IntentUtils.safeGetStringArrayListExtra(intent, IntentHandler.EXTRA_EXTERNAL_NAV_PACKAGES); if (packages != null && packages.size() > 0) { RecordUserAction.record("MobileExternalNavigationReceived"); for (String name : packages) { RapporServiceBridge.sampleString("Android.ExternalNavigationNotChosen", name); } } }
Example 16
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public boolean onMenuOrKeyboardAction(final int id, boolean fromMenu) { final Tab currentTab = getActivityTab(); if (id == R.id.move_to_other_window_menu_id) { if (currentTab != null) moveTabToOtherWindow(currentTab); } else if (id == R.id.new_tab_menu_id) { getTabModelSelector().getModel(false).commitAllTabClosures(); RecordUserAction.record("MobileMenuNewTab"); RecordUserAction.record("MobileNewTabOpened"); reportNewTabShortcutUsed(false); getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); mLocaleManager.showSearchEnginePromoIfNeeded(this); } else if (id == R.id.new_incognito_tab_menu_id) { if (PrefServiceBridge.getInstance().isIncognitoModeEnabled()) { getTabModelSelector().getModel(false).commitAllTabClosures(); // This action must be recorded before opening the incognito tab since UMA actions // are dropped when an incognito tab is open. RecordUserAction.record("MobileMenuNewIncognitoTab"); RecordUserAction.record("MobileNewTabOpened"); reportNewTabShortcutUsed(true); getTabCreator(true).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI); } } else if (id == R.id.all_bookmarks_menu_id) { if (currentTab != null) { getCompositorViewHolder().hideKeyboard(new Runnable() { @Override public void run() { StartupMetrics.getInstance().recordOpenedBookmarks(); BookmarkUtils.showBookmarkManager(ChromeTabbedActivity.this); } }); RecordUserAction.record("MobileMenuAllBookmarks"); } } else if (id == R.id.recent_tabs_menu_id) { if (currentTab != null) { currentTab.loadUrl(new LoadUrlParams( UrlConstants.RECENT_TABS_URL, PageTransition.AUTO_BOOKMARK)); RecordUserAction.record("MobileMenuOpenTabs"); } } else if (id == R.id.close_all_tabs_menu_id) { // Close both incognito and normal tabs getTabModelSelector().closeAllTabs(); RecordUserAction.record("MobileMenuCloseAllTabs"); } else if (id == R.id.close_all_incognito_tabs_menu_id) { // Close only incognito tabs getTabModelSelector().getModel(true).closeAllTabs(); // TODO(nileshagrawal) Record unique action for this. See bug http://b/5542946. RecordUserAction.record("MobileMenuCloseAllTabs"); } else if (id == R.id.find_in_page_id) { mFindToolbarManager.showToolbar(); if (getContextualSearchManager() != null) { getContextualSearchManager().hideContextualSearch(StateChangeReason.UNKNOWN); } if (fromMenu) { RecordUserAction.record("MobileMenuFindInPage"); } else { RecordUserAction.record("MobileShortcutFindInPage"); } } else if (id == R.id.focus_url_bar) { boolean isUrlBarVisible = !mLayoutManager.overviewVisible() && (!isTablet() || getCurrentTabModel().getCount() != 0); if (isUrlBarVisible) { getToolbarManager().setUrlBarFocus(true); } } else if (id == R.id.downloads_menu_id) { DownloadUtils.showDownloadManager(this, currentTab); RecordUserAction.record("MobileMenuDownloadManager"); } else if (id == R.id.open_recently_closed_tab) { TabModel currentModel = mTabModelSelectorImpl.getCurrentModel(); if (!currentModel.isIncognito()) currentModel.openMostRecentlyClosedTab(); RecordUserAction.record("MobileTabClosedUndoShortCut"); } else if (id == R.id.enter_vr_id) { mVrShellDelegate.enterVRIfNecessary(); } else { return super.onMenuOrKeyboardAction(id, fromMenu); } return true; }
Example 17
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Handles menu item selection and keyboard shortcuts. * * @param id The ID of the selected menu item (defined in main_menu.xml) or * keyboard shortcut (defined in values.xml). * @param fromMenu Whether this was triggered from the menu. * @return Whether the action was handled. */ public boolean onMenuOrKeyboardAction(int id, boolean fromMenu) { if (id == R.id.preferences_id) { PreferencesLauncher.launchSettingsPage(this, null); RecordUserAction.record("MobileMenuSettings"); } else if (id == R.id.show_menu) { showAppMenuForKeyboardEvent(); } if (id == R.id.update_menu_id) { UpdateMenuItemHelper.getInstance().onMenuItemClicked(this); return true; } // All the code below assumes currentTab is not null, so return early if it is null. final Tab currentTab = getActivityTab(); if (currentTab == null) { return false; } else if (id == R.id.forward_menu_id) { if (currentTab.canGoForward()) { currentTab.goForward(); RecordUserAction.record("MobileMenuForward"); RecordUserAction.record("MobileTabClobbered"); } } else if (id == R.id.bookmark_this_page_id) { addOrEditBookmark(currentTab); RecordUserAction.record("MobileMenuAddToBookmarks"); } else if (id == R.id.offline_page_id) { DownloadUtils.downloadOfflinePage(this, currentTab); RecordUserAction.record("MobileMenuDownloadPage"); } else if (id == R.id.reload_menu_id) { if (currentTab.isLoading()) { currentTab.stopLoading(); RecordUserAction.record("MobileMenuStop"); } else { currentTab.reload(); RecordUserAction.record("MobileMenuReload"); } } else if (id == R.id.info_menu_id) { WebsiteSettingsPopup.show( this, currentTab, null, WebsiteSettingsPopup.OPENED_FROM_MENU); } else if (id == R.id.open_history_menu_id) { currentTab.loadUrl( new LoadUrlParams(UrlConstants.HISTORY_URL, PageTransition.AUTO_TOPLEVEL)); RecordUserAction.record("MobileMenuHistory"); StartupMetrics.getInstance().recordOpenedHistory(); } else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) { onShareMenuItemSelected(id == R.id.direct_share_menu_id, getCurrentTabModel().isIncognito()); } else if (id == R.id.print_id) { PrintingController printingController = PrintingControllerImpl.getInstance(); if (printingController != null && !printingController.isBusy() && PrefServiceBridge.getInstance().isPrintingEnabled()) { printingController.startPrint(new TabPrinter(currentTab), new PrintManagerDelegateImpl(this)); RecordUserAction.record("MobileMenuPrint"); } } else if (id == R.id.add_to_homescreen_id) { AddToHomescreenManager addToHomescreenManager = new AddToHomescreenManager(this, currentTab); addToHomescreenManager.start(); RecordUserAction.record("MobileMenuAddToHomescreen"); } else if (id == R.id.request_desktop_site_id) { final boolean reloadOnChange = !currentTab.isNativePage(); final boolean usingDesktopUserAgent = currentTab.getUseDesktopUserAgent(); currentTab.setUseDesktopUserAgent(!usingDesktopUserAgent, reloadOnChange); RecordUserAction.record("MobileMenuRequestDesktopSite"); } else if (id == R.id.reader_mode_prefs_id) { if (currentTab.getWebContents() != null) { RecordUserAction.record("DomDistiller_DistilledPagePrefsOpened"); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme); builder.setView(DistilledPagePrefsView.create(this)); builder.show(); } } else if (id == R.id.help_id) { // Since reading back the compositor is asynchronous, we need to do the readback // before starting the GoogleHelp. String helpContextId = HelpAndFeedback.getHelpContextIdFromUrl( this, currentTab.getUrl(), getCurrentTabModel().isIncognito()); HelpAndFeedback.getInstance(this) .show(this, helpContextId, currentTab.getProfile(), currentTab.getUrl()); RecordUserAction.record("MobileMenuFeedback"); } else { return false; } return true; }
Example 18
Source File: ContextualSearchUma.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Logs a user action for a change to the Panel state, which allows sequencing of actions. * @param toState The state to transition to. * @param reason The reason for the state transition. */ public static void logPanelStateUserAction(PanelState toState, StateChangeReason reason) { switch (toState) { case CLOSED: if (reason == StateChangeReason.BACK_PRESS) { RecordUserAction.record("ContextualSearch.BackPressClose"); } else if (reason == StateChangeReason.CLOSE_BUTTON) { RecordUserAction.record("ContextualSearch.CloseButtonClose"); } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingClose"); } else if (reason == StateChangeReason.TAB_PROMOTION) { RecordUserAction.record("ContextualSearch.TabPromotionClose"); } else if (reason == StateChangeReason.BASE_PAGE_TAP) { RecordUserAction.record("ContextualSearch.BasePageTapClose"); } else if (reason == StateChangeReason.BASE_PAGE_SCROLL) { RecordUserAction.record("ContextualSearch.BasePageScrollClose"); } else if (reason == StateChangeReason.SEARCH_BAR_TAP) { RecordUserAction.record("ContextualSearch.SearchBarTapClose"); } else if (reason == StateChangeReason.SERP_NAVIGATION) { RecordUserAction.record("ContextualSearch.NavigationClose"); } else { RecordUserAction.record("ContextualSearch.UncommonClose"); } break; case PEEKED: if (reason == StateChangeReason.TEXT_SELECT_TAP) { RecordUserAction.record("ContextualSearch.TapPeek"); } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingPeek"); } else if (reason == StateChangeReason.TEXT_SELECT_LONG_PRESS) { RecordUserAction.record("ContextualSearch.LongpressPeek"); } break; case EXPANDED: if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingExpand"); } else if (reason == StateChangeReason.SEARCH_BAR_TAP) { RecordUserAction.record("ContextualSearch.SearchBarTapExpand"); } break; case MAXIMIZED: if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingMaximize"); } else if (reason == StateChangeReason.SERP_NAVIGATION) { RecordUserAction.record("ContextualSearch.NavigationMaximize"); } break; default: break; } }
Example 19
Source File: InterestsPage.java From delion with Apache License 2.0 | 4 votes |
@Override public void destroy() { if (mClicked) return; RecordUserAction.record("MobileNTP.Interests.Dismissed"); }
Example 20
Source File: SignInPromo.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public void onImpression() { RecordUserAction.record("Signin_Impression_FromNTPContentSuggestions"); mImpressionTracker.reset(null); }