Java Code Examples for org.chromium.base.ActivityState#RESUMED
The following examples show how to use
org.chromium.base.ActivityState#RESUMED .
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: RecentTabsPage.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Updates whether the page is in the foreground based on whether the application is in the * foreground and whether {@link #mView} is attached to the application window. If the page is * no longer in the foreground, records the time that the page spent in the foreground to UMA. */ private void updateForegroundState() { boolean inForeground = mIsAttachedToWindow && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED; if (mInForeground == inForeground) { return; } mInForeground = inForeground; if (mInForeground) { mForegroundTimeMs = SystemClock.elapsedRealtime(); StartupMetrics.getInstance().recordOpenedRecents(); } else { RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid", SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS); } }
Example 2
Source File: ChromeActivity.java From 365browser with Apache License 2.0 | 6 votes |
/** * Called by the system when the activity changes from fullscreen mode to multi-window mode * and visa-versa. * @param isInMultiWindowMode True if the activity is in multi-window mode. */ @Override public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { recordMultiWindowModeChangedUserAction(isInMultiWindowMode); if (!isInMultiWindowMode && ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) { // Start a new UMA session when exiting multi-window mode if the activity is currently // resumed. When entering multi-window Android recents gains focus, so ChromeActivity // will get a call to onPauseWithNative(), ending the current UMA session. When exiting // multi-window, however, if ChromeActivity is resumed it stays in that state. markSessionEnd(); markSessionResume(); FeatureUtilities.setIsInMultiWindowMode( MultiWindowUtils.getInstance().isInMultiWindowMode(this)); } super.onMultiWindowModeChanged(isInMultiWindowMode); }
Example 3
Source File: VrShellDelegate.java From 365browser with Apache License 2.0 | 6 votes |
private VrShellDelegate(ChromeActivity activity, VrClassesWrapper wrapper) { mActivity = activity; mVrClassesWrapper = wrapper; // If an activity isn't resumed at the point, it must have been paused. mPaused = ApplicationStatus.getStateForActivity(activity) != ActivityState.RESUMED; updateVrSupportLevel(); mNativeVrShellDelegate = nativeInit(); mFeedbackFrequency = VrFeedbackStatus.getFeedbackFrequency(); mEnterVrHandler = new Handler(); Choreographer.getInstance().postFrameCallback(new FrameCallback() { @Override public void doFrame(long frameTimeNanos) { if (mNativeVrShellDelegate == 0) return; Display display = ((WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); nativeUpdateVSyncInterval( mNativeVrShellDelegate, frameTimeNanos, 1.0d / display.getRefreshRate()); } }); ApplicationStatus.registerStateListenerForAllActivities(this); }
Example 4
Source File: OverlayPanel.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { boolean isMultiWindowMode = MultiWindowUtils.getInstance().isLegacyMultiWindow(mActivity) || MultiWindowUtils.getInstance().isInMultiWindowMode(mActivity); // In multi-window mode the activity that was interacted with last is resumed and // all others are paused. We should not close Contextual Search in this case, // because the activity may be visible even though it is paused. if (isMultiWindowMode && (newState == ActivityState.PAUSED || newState == ActivityState.RESUMED)) { return; } if (newState == ActivityState.RESUMED || newState == ActivityState.STOPPED || newState == ActivityState.DESTROYED) { closePanel(StateChangeReason.UNKNOWN, false); } }
Example 5
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Called by the system when the activity changes from fullscreen mode to multi-window mode * and visa-versa. * @param isInMultiWindowMode True if the activity is in multi-window mode. */ public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { recordMultiWindowModeChangedUserAction(isInMultiWindowMode); if (!isInMultiWindowMode && ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) { // Start a new UMA session when exiting multi-window mode if the activity is currently // resumed. When entering multi-window Android recents gains focus, so ChromeActivity // will get a call to onPauseWithNative(), ending the current UMA session. When exiting // multi-window, however, if ChromeActivity is resumed it stays in that state. markSessionEnd(); markSessionResume(); FeatureUtilities.setIsInMultiWindowMode( MultiWindowUtils.getInstance().isInMultiWindowMode(this)); } super.onMultiWindowModeChanged(isInMultiWindowMode); }
Example 6
Source File: OverlayPanel.java From delion with Apache License 2.0 | 6 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { boolean isMultiWindowMode = MultiWindowUtils.getInstance().isLegacyMultiWindow(mActivity) || MultiWindowUtils.getInstance().isInMultiWindowMode(mActivity); // In multi-window mode the activity that was interacted with last is resumed and // all others are paused. We should not close Contextual Search in this case, // because the activity may be visible even though it is paused. if (isMultiWindowMode && (newState == ActivityState.PAUSED || newState == ActivityState.RESUMED)) { return; } if (newState == ActivityState.RESUMED || newState == ActivityState.STOPPED || newState == ActivityState.DESTROYED) { closePanel(StateChangeReason.UNKNOWN, false); } }
Example 7
Source File: OverlayPanel.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { boolean isMultiWindowMode = MultiWindowUtils.getInstance().isLegacyMultiWindow(mActivity) || MultiWindowUtils.getInstance().isInMultiWindowMode(mActivity); // In multi-window mode the activity that was interacted with last is resumed and // all others are paused. We should not close Contextual Search in this case, // because the activity may be visible even though it is paused. if (isMultiWindowMode && (newState == ActivityState.PAUSED || newState == ActivityState.RESUMED)) { return; } if (newState == ActivityState.RESUMED || newState == ActivityState.STOPPED || newState == ActivityState.DESTROYED) { closePanel(StateChangeReason.UNKNOWN, false); } }
Example 8
Source File: ChromeActivity.java From delion with Apache License 2.0 | 6 votes |
/** * Called by the system when the activity changes from fullscreen mode to multi-window mode * and visa-versa. * @param isInMultiWindowMode True if the activity is in multi-window mode. */ public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { recordMultiWindowModeChangedUserAction(isInMultiWindowMode); if (!isInMultiWindowMode && ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) { // Start a new UMA session when exiting multi-window mode if the activity is currently // resumed. When entering multi-window Android recents gains focus, so ChromeActivity // will get a call to onPauseWithNative(), ending the current UMA session. When exiting // multi-window, however, if ChromeActivity is resumed it stays in that state. markSessionEnd(); markSessionResume(); FeatureUtilities.setIsInMultiWindowMode( MultiWindowUtils.getInstance().isInMultiWindowMode(this)); } }
Example 9
Source File: RecentTabsPage.java From delion with Apache License 2.0 | 6 votes |
/** * Updates whether the page is in the foreground based on whether the application is in the * foreground and whether {@link #mView} is attached to the application window. If the page is * no longer in the foreground, records the time that the page spent in the foreground to UMA. */ private void updateForegroundState() { boolean inForeground = mIsAttachedToWindow && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED; if (mInForeground == inForeground) { return; } mInForeground = inForeground; if (mInForeground) { mForegroundTimeMs = SystemClock.elapsedRealtime(); StartupMetrics.getInstance().recordOpenedRecents(); } else { RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid", SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS); } }
Example 10
Source File: MultiWindowUtils.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { if (newState == ActivityState.RESUMED && activity instanceof ChromeTabbedActivity) { mLastResumedTabbedActivity = new WeakReference<ChromeTabbedActivity>((ChromeTabbedActivity) activity); } }
Example 11
Source File: MultiWindowUtils.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * @param activity The Activity whose visibility to test. * @return True iff the given Activity is currently visible. */ public static boolean isActivityVisible(Activity activity) { if (activity == null) return false; int activityState = ApplicationStatus.getStateForActivity(activity); // In Android N multi-window mode, only one activity is resumed at a time. The other // activity visible on the screen will be in the paused state. Activities not visible on // the screen will be stopped or destroyed. return activityState == ActivityState.RESUMED || activityState == ActivityState.PAUSED; }
Example 12
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { super.onMultiWindowModeChanged(isInMultiWindowMode); if (!FeatureUtilities.isTabModelMergingEnabled()) return; if (!isInMultiWindowMode) { // If the activity is currently resumed when multi-window mode is exited, try to merge // tabs from the other activity instance. if (ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) { maybeMergeTabs(); } else { mMergeTabsOnResume = true; } } }
Example 13
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { super.onMultiWindowModeChanged(isInMultiWindowMode); if (!FeatureUtilities.isTabModelMergingEnabled()) return; if (!isInMultiWindowMode) { // If the activity is currently resumed when multi-window mode is exited, try to merge // tabs from the other activity instance. if (ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) { maybeMergeTabs(); } else { mMergeTabsOnResume = true; } } }
Example 14
Source File: MultiWindowUtils.java From delion with Apache License 2.0 | 5 votes |
private boolean isActivityVisible(Activity activity) { if (activity == null) return false; int activityState = ApplicationStatus.getStateForActivity(activity); // In Android N multi-window mode, only one activity is resumed at a time. The other // activity visible on the screen will be in the paused state. Activities not visible on // the screen will be stopped or destroyed. return activityState == ActivityState.RESUMED || activityState == ActivityState.PAUSED; }
Example 15
Source File: MultiWindowUtils.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { if (newState == ActivityState.RESUMED && activity instanceof ChromeTabbedActivity) { mLastResumedTabbedActivity = new WeakReference<ChromeTabbedActivity>((ChromeTabbedActivity) activity); } }
Example 16
Source File: MultiWindowUtils.java From 365browser with Apache License 2.0 | 5 votes |
/** * @param activity The Activity whose visibility to test. * @return True iff the given Activity is currently visible. */ public static boolean isActivityVisible(Activity activity) { if (activity == null) return false; int activityState = ApplicationStatus.getStateForActivity(activity); // In Android N multi-window mode, only one activity is resumed at a time. The other // activity visible on the screen will be in the paused state. Activities not visible on // the screen will be stopped or destroyed. return activityState == ActivityState.RESUMED || activityState == ActivityState.PAUSED; }
Example 17
Source File: SuggestionsSheetVisibilityChangeObserver.java From 365browser with Apache License 2.0 | 5 votes |
/** * Compares the current state of the bottom sheet and activity with the ones recorded at the * previous call and generates events based on the difference. * @see #onContentShown() * @see #onContentHidden() * @see #onContentStateChanged(int) */ private void onStateChange() { boolean newVisibility = mBottomSheet.isSheetOpen() && mBottomSheet.getCurrentSheetContent() == mContentObserved && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED; // As the visibility we track is the one for a specific sheet content rather than the // whole BottomSheet, we also need to reflect that in the state, marking it "peeking" here // even though the BottomSheet itself is not. @BottomSheet.SheetState int newContentState = newVisibility ? mBottomSheet.getSheetState() : BottomSheet.SHEET_STATE_PEEK; // Flag overall changes to the visible state of the content, while ignoring transient states // like |STATE_SCROLLING|. boolean hasMeaningfulStateChange = BottomSheet.isStateStable(newContentState) && (mCurrentContentState != newContentState || mCurrentVisibility != newVisibility); if (newVisibility != mCurrentVisibility) { if (newVisibility) { onContentShown(); } else { onContentHidden(); } mCurrentVisibility = newVisibility; } if (hasMeaningfulStateChange) { onContentStateChanged(newContentState); mCurrentContentState = newContentState; } }
Example 18
Source File: MultiWindowUtils.java From delion with Apache License 2.0 | 5 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { if (newState == ActivityState.RESUMED && activity instanceof ChromeTabbedActivity) { mLastResumedTabbedActivity = new WeakReference<ChromeTabbedActivity>((ChromeTabbedActivity) activity); } }
Example 19
Source File: ReaderModePanel.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { // If the activity is only resuming, don't do anything. if (newState == ActivityState.RESUMED) return; super.onActivityStateChange(activity, newState); }
Example 20
Source File: ReaderModePanel.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void onActivityStateChange(Activity activity, int newState) { // If the activity is only resuming, don't do anything. if (newState == ActivityState.RESUMED) return; super.onActivityStateChange(activity, newState); }