Search in sources :

Example 36 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.

the class RecentsView method onReload.

/**
     * Called from RecentsActivity when it is relaunched.
     */
public void onReload(boolean isResumingFromVisible, boolean isTaskStackEmpty) {
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    if (mTaskStackView == null) {
        isResumingFromVisible = false;
        mTaskStackView = new TaskStackView(getContext());
        mTaskStackView.setSystemInsets(mSystemInsets);
        addView(mTaskStackView);
    }
    // Reset the state
    mAwaitingFirstLayout = !isResumingFromVisible;
    mLastTaskLaunchedWasFreeform = false;
    // Update the stack
    mTaskStackView.onReload(isResumingFromVisible);
    if (isResumingFromVisible) {
        // If we are already visible, then restore the background scrim
        animateBackgroundScrim(1f, DEFAULT_UPDATE_SCRIM_DURATION);
    } else {
        // the tasks for the home animation.
        if (launchState.launchedViaDockGesture || launchState.launchedFromApp || isTaskStackEmpty) {
            mBackgroundScrim.setAlpha(255);
        } else {
            mBackgroundScrim.setAlpha(0);
        }
    }
}
Also used : RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Example 37 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.

the class RecentsTvActivity method onStop.

@Override
protected void onStop() {
    super.onStop();
    mIgnoreAltTabRelease = false;
    // Notify that recents is now hidden
    EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
    // Workaround for b/22542869, if the RecentsActivity is started again, but without going
    // through SystemUI, we need to reset the config launch flags to ensure that we do not
    // wait on the system to send a signal that was never queued.
    RecentsConfiguration config = Recents.getConfiguration();
    RecentsActivityLaunchState launchState = config.getLaunchState();
    launchState.reset();
    // Workaround for b/28333917.
    finish();
}
Also used : RecentsActivityLaunchState(com.android.systemui.recents.RecentsActivityLaunchState) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) RecentsVisibilityChangedEvent(com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)

Example 38 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.

the class TaskView method updateViewPropertiesToTaskTransform.

void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform, AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
    RecentsConfiguration config = Recents.getConfiguration();
    cancelTransformAnimation();
    // Compose the animations for the transform
    mTmpAnimators.clear();
    toTransform.applyToTaskView(this, mTmpAnimators, toAnimation, !config.fakeShadows);
    if (toAnimation.isImmediate()) {
        if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
            setDimAlpha(toTransform.dimAlpha);
        }
        if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
            mViewBounds.setAlpha(toTransform.viewOutlineAlpha);
        }
        // Manually call back to the animator listener and update callback
        if (toAnimation.getListener() != null) {
            toAnimation.getListener().onAnimationEnd(null);
        }
        if (updateCallback != null) {
            updateCallback.onAnimationUpdate(null);
        }
    } else {
        // Both the progress and the update are a function of the bounds movement of the task
        if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
            mDimAnimator = ObjectAnimator.ofFloat(this, DIM_ALPHA, getDimAlpha(), toTransform.dimAlpha);
            mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mDimAnimator));
        }
        if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
            mOutlineAnimator = ObjectAnimator.ofFloat(this, VIEW_OUTLINE_ALPHA, mViewBounds.getAlpha(), toTransform.viewOutlineAlpha);
            mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mOutlineAnimator));
        }
        if (updateCallback != null) {
            ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
            updateCallbackAnim.addUpdateListener(updateCallback);
            mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, updateCallbackAnim));
        }
        // Create the animator
        mTransformAnimation = toAnimation.createAnimator(mTmpAnimators);
        mTransformAnimation.start();
        mTargetAnimationTransform.copyFrom(toTransform);
    }
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration) ValueAnimator(android.animation.ValueAnimator)

Example 39 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.

the class RecentsTaskLoader method onTrimMemory.

/**
     * Handles signals from the system, trimming memory when requested to prevent us from running
     * out of memory.
     */
public void onTrimMemory(int level) {
    RecentsConfiguration config = Recents.getConfiguration();
    switch(level) {
        case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
            // Stop the loader immediately when the UI is no longer visible
            stopLoader();
            if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) {
                mThumbnailCache.trimToSize(Math.max(mNumVisibleTasksLoaded, mMaxThumbnailCacheSize / 2));
            } else if (config.svelteLevel == RecentsConfiguration.SVELTE_LIMIT_CACHE) {
                mThumbnailCache.trimToSize(mNumVisibleThumbnailsLoaded);
            } else if (config.svelteLevel >= RecentsConfiguration.SVELTE_DISABLE_CACHE) {
                mThumbnailCache.evictAll();
            }
            mIconCache.trimToSize(Math.max(mNumVisibleTasksLoaded, mMaxIconCacheSize / 2));
            break;
        case ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE:
        case ComponentCallbacks2.TRIM_MEMORY_BACKGROUND:
            // We are leaving recents, so trim the data a bit
            mThumbnailCache.trimToSize(Math.max(1, mMaxThumbnailCacheSize / 2));
            mIconCache.trimToSize(Math.max(1, mMaxIconCacheSize / 2));
            mActivityInfoCache.trimToSize(Math.max(1, ActivityManager.getMaxRecentTasksStatic() / 2));
            break;
        case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW:
        case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
            // We are going to be low on memory
            mThumbnailCache.trimToSize(Math.max(1, mMaxThumbnailCacheSize / 4));
            mIconCache.trimToSize(Math.max(1, mMaxIconCacheSize / 4));
            mActivityInfoCache.trimToSize(Math.max(1, ActivityManager.getMaxRecentTasksStatic() / 4));
            break;
        case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL:
        case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
            // We are low on memory, so release everything
            mThumbnailCache.evictAll();
            mIconCache.evictAll();
            mActivityInfoCache.evictAll();
            // The cache is small, only clear the label cache when we are critical
            mActivityLabelCache.evictAll();
            mContentDescriptionCache.evictAll();
            break;
        default:
            break;
    }
}
Also used : RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Example 40 with RecentsConfiguration

use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.

the class RecentsTaskLoader method getAndUpdateThumbnail.

/**
     * Returns the cached thumbnail if the task key is not expired, updating the cache if it is.
     */
Bitmap getAndUpdateThumbnail(Task.TaskKey taskKey, boolean loadIfNotCached) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    // Return the cached thumbnail if it exists
    ThumbnailData thumbnailData = mThumbnailCache.getAndInvalidateIfModified(taskKey);
    if (thumbnailData != null) {
        return thumbnailData.thumbnail;
    }
    if (loadIfNotCached) {
        RecentsConfiguration config = Recents.getConfiguration();
        if (config.svelteLevel < RecentsConfiguration.SVELTE_DISABLE_LOADING) {
            // Load the thumbnail from the system
            thumbnailData = ssp.getTaskThumbnail(taskKey.id);
            if (thumbnailData.thumbnail != null) {
                mThumbnailCache.put(taskKey, thumbnailData);
                return thumbnailData.thumbnail;
            }
        }
    }
    // We couldn't load any thumbnail
    return null;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) RecentsConfiguration(com.android.systemui.recents.RecentsConfiguration)

Aggregations

RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)86 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)45 Resources (android.content.res.Resources)20 Task (com.android.systemui.recents.model.Task)20 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)15 TaskStack (com.android.systemui.recents.model.TaskStack)15 ValueAnimator (android.animation.ValueAnimator)10 RecentsVisibilityChangedEvent (com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent)10 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 ActivityOptions (android.app.ActivityOptions)5 Intent (android.content.Intent)5 ActivityInfo (android.content.pm.ActivityInfo)5 BitmapDrawable (android.graphics.drawable.BitmapDrawable)5 Drawable (android.graphics.drawable.Drawable)5 View (android.view.View)5 EnterRecentsWindowAnimationCompletedEvent (com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent)5 RecentsActivityStartingEvent (com.android.systemui.recents.events.activity.RecentsActivityStartingEvent)5 DeleteTaskDataEvent (com.android.systemui.recents.events.ui.DeleteTaskDataEvent)5 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)5