org.chromium.chrome.browser.metrics.UmaSessionStats Java Examples

The following examples show how to use org.chromium.chrome.browser.metrics.UmaSessionStats. 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: FirstRunGlueImpl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptTermsOfService(boolean allowCrashUpload) {
    UmaSessionStats.changeMetricsReportingConsent(allowCrashUpload);
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(CACHED_TOS_ACCEPTED_PREF, true)
            .apply();
    PrefServiceBridge.getInstance().setEulaAccepted();
}
 
Example #2
Source File: FirstRunGlueImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptTermsOfService(boolean allowCrashUpload) {
    UmaSessionStats.changeMetricsReportingConsent(allowCrashUpload);
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(CACHED_TOS_ACCEPTED_PREF, true)
            .apply();
    PrefServiceBridge.getInstance().setEulaAccepted();
}
 
Example #3
Source File: TabWebContentsObserver.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void renderProcessGone(boolean processWasOomProtected) {
    Log.i(TAG, "renderProcessGone() for tab id: " + mTab.getId()
            + ", oom protected: " + Boolean.toString(processWasOomProtected)
            + ", already needs reload: " + Boolean.toString(mTab.needsReload()));
    // Do nothing for subsequent calls that happen while the tab remains crashed. This
    // can occur when the tab is in the background and it shares the renderer with other
    // tabs. After the renderer crashes, the WebContents of its tabs are still around
    // and they still share the RenderProcessHost. When one of the tabs reloads spawning
    // a new renderer for the shared RenderProcessHost and the new renderer crashes
    // again, all tabs sharing this renderer will be notified about the crash (including
    // potential background tabs that did not reload yet).
    if (mTab.needsReload() || mTab.isShowingSadTab()) return;

    // This will replace TabRendererCrashStatus if numbers line up.
    int appState = ApplicationStatus.getStateForApplication();
    boolean applicationRunning = (appState == ApplicationState.HAS_RUNNING_ACTIVITIES);
    boolean applicationPaused = (appState == ApplicationState.HAS_PAUSED_ACTIVITIES);
    @TabRendererExitStatus int rendererExitStatus = TAB_RENDERER_EXIT_STATUS_MAX;
    if (processWasOomProtected) {
        if (applicationRunning) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_RUNNING_APP;
        } else if (applicationPaused) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_PAUSED_APP;
        } else {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_BACKGROUND_APP;
        }
    } else {
        if (applicationRunning) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_RUNNING_APP;
        } else if (applicationPaused) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_PAUSED_APP;
        } else {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_BACKGROUND_APP;
        }
    }
    RecordHistogram.recordEnumeratedHistogram(
            "Tab.RendererExitStatus", rendererExitStatus, TAB_RENDERER_EXIT_STATUS_MAX);

    int activityState = ApplicationStatus.getStateForActivity(
            mTab.getWindowAndroid().getActivity().get());
    int rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_MAX;
    if (!processWasOomProtected
            || activityState == ActivityState.PAUSED
            || activityState == ActivityState.STOPPED
            || activityState == ActivityState.DESTROYED) {
        // The tab crashed in background or was killed by the OS out-of-memory killer.
        //setNeedsReload(true);
        mTab.setNeedsReload(true);
        if (applicationRunning) {
            rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_HIDDEN_IN_FOREGROUND_APP;
        } else {
            rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_HIDDEN_IN_BACKGROUND_APP;
        }
    } else {
        rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_SHOWN_IN_FOREGROUND_APP;
        mTab.showSadTab();
        // This is necessary to correlate histogram data with stability counts.
        UmaSessionStats.logRendererCrash();
    }
    RecordHistogram.recordEnumeratedHistogram(
            "Tab.RendererCrashStatus", rendererCrashStatus, TAB_RENDERER_CRASH_STATUS_MAX);

    mTab.handleTabCrash();

    boolean sadTabShown = mTab.isShowingSadTab();
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onCrash(mTab, sadTabShown);
    }
}
 
Example #4
Source File: TabWebContentsObserver.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void renderProcessGone(boolean processWasOomProtected) {
    Log.i(TAG, "renderProcessGone() for tab id: " + mTab.getId()
            + ", oom protected: " + Boolean.toString(processWasOomProtected)
            + ", already needs reload: " + Boolean.toString(mTab.needsReload()));
    // Do nothing for subsequent calls that happen while the tab remains crashed. This
    // can occur when the tab is in the background and it shares the renderer with other
    // tabs. After the renderer crashes, the WebContents of its tabs are still around
    // and they still share the RenderProcessHost. When one of the tabs reloads spawning
    // a new renderer for the shared RenderProcessHost and the new renderer crashes
    // again, all tabs sharing this renderer will be notified about the crash (including
    // potential background tabs that did not reload yet).
    if (mTab.needsReload() || mTab.isShowingSadTab()) return;

    // This will replace TabRendererCrashStatus if numbers line up.
    int appState = ApplicationStatus.getStateForApplication();
    boolean applicationRunning = (appState == ApplicationState.HAS_RUNNING_ACTIVITIES);
    boolean applicationPaused = (appState == ApplicationState.HAS_PAUSED_ACTIVITIES);
    @TabRendererExitStatus int rendererExitStatus = TAB_RENDERER_EXIT_STATUS_MAX;
    if (processWasOomProtected) {
        if (applicationRunning) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_RUNNING_APP;
        } else if (applicationPaused) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_PAUSED_APP;
        } else {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_BACKGROUND_APP;
        }
    } else {
        if (applicationRunning) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_RUNNING_APP;
        } else if (applicationPaused) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_PAUSED_APP;
        } else {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_BACKGROUND_APP;
        }
    }
    RecordHistogram.recordEnumeratedHistogram(
            "Tab.RendererExitStatus", rendererExitStatus, TAB_RENDERER_EXIT_STATUS_MAX);

    int activityState = ApplicationStatus.getStateForActivity(
            mTab.getWindowAndroid().getActivity().get());
    int rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_MAX;
    if (!processWasOomProtected
            || activityState == ActivityState.PAUSED
            || activityState == ActivityState.STOPPED
            || activityState == ActivityState.DESTROYED) {
        // The tab crashed in background or was killed by the OS out-of-memory killer.
        //setNeedsReload(true);
        mTab.setNeedsReload(true);
        if (applicationRunning) {
            rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_HIDDEN_IN_FOREGROUND_APP;
        } else {
            rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_HIDDEN_IN_BACKGROUND_APP;
        }
    } else {
        rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_SHOWN_IN_FOREGROUND_APP;
        mTab.showSadTab();
        // This is necessary to correlate histogram data with stability counts.
        UmaSessionStats.logRendererCrash();
    }
    RecordHistogram.recordEnumeratedHistogram(
            "Tab.RendererCrashStatus", rendererCrashStatus, TAB_RENDERER_CRASH_STATUS_MAX);

    mTab.handleTabCrash();

    boolean sadTabShown = mTab.isShowingSadTab();
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onCrash(mTab, sadTabShown);
    }
}
 
Example #5
Source File: TabWebContentsObserver.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void renderProcessGone(boolean processWasOomProtected) {
    Log.i(TAG, "renderProcessGone() for tab id: " + mTab.getId()
            + ", oom protected: " + Boolean.toString(processWasOomProtected)
            + ", already needs reload: " + Boolean.toString(mTab.needsReload()));
    // Do nothing for subsequent calls that happen while the tab remains crashed. This
    // can occur when the tab is in the background and it shares the renderer with other
    // tabs. After the renderer crashes, the WebContents of its tabs are still around
    // and they still share the RenderProcessHost. When one of the tabs reloads spawning
    // a new renderer for the shared RenderProcessHost and the new renderer crashes
    // again, all tabs sharing this renderer will be notified about the crash (including
    // potential background tabs that did not reload yet).
    if (mTab.needsReload() || mTab.isShowingSadTab()) return;

    // This will replace TabRendererCrashStatus if numbers line up.
    int appState = ApplicationStatus.getStateForApplication();
    boolean applicationRunning = (appState == ApplicationState.HAS_RUNNING_ACTIVITIES);
    boolean applicationPaused = (appState == ApplicationState.HAS_PAUSED_ACTIVITIES);
    @TabRendererExitStatus int rendererExitStatus = TAB_RENDERER_EXIT_STATUS_MAX;
    if (processWasOomProtected) {
        if (applicationRunning) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_RUNNING_APP;
        } else if (applicationPaused) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_PAUSED_APP;
        } else {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_OOM_PROTECTED_IN_BACKGROUND_APP;
        }
    } else {
        if (applicationRunning) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_RUNNING_APP;
        } else if (applicationPaused) {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_PAUSED_APP;
        } else {
            rendererExitStatus = TAB_RENDERER_EXIT_STATUS_NOT_PROTECTED_IN_BACKGROUND_APP;
        }
    }
    RecordHistogram.recordEnumeratedHistogram(
            "Tab.RendererExitStatus", rendererExitStatus, TAB_RENDERER_EXIT_STATUS_MAX);

    int activityState = ApplicationStatus.getStateForActivity(
            mTab.getWindowAndroid().getActivity().get());
    int rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_MAX;
    if (!processWasOomProtected
            || activityState == ActivityState.PAUSED
            || activityState == ActivityState.STOPPED
            || activityState == ActivityState.DESTROYED) {
        // The tab crashed in background or was killed by the OS out-of-memory killer.
        //setNeedsReload(true);
        mTab.setNeedsReload(true);
        if (applicationRunning) {
            rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_HIDDEN_IN_FOREGROUND_APP;
        } else {
            rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_HIDDEN_IN_BACKGROUND_APP;
        }
    } else {
        rendererCrashStatus = TAB_RENDERER_CRASH_STATUS_SHOWN_IN_FOREGROUND_APP;
        mTab.showSadTab();
        // This is necessary to correlate histogram data with stability counts.
        UmaSessionStats.logRendererCrash();
    }
    RecordHistogram.recordEnumeratedHistogram(
            "Tab.RendererCrashStatus", rendererCrashStatus, TAB_RENDERER_CRASH_STATUS_MAX);

    mTab.handleTabCrash();
}