Search in sources :

Example 16 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

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)

Example 17 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class RecentsTaskLoader method getAndUpdateActivityInfo.

/**
     * Returns the activity info for the given task key, retrieving one from the system if the
     * task key is expired.
     */
ActivityInfo getAndUpdateActivityInfo(Task.TaskKey taskKey) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    ComponentName cn = taskKey.getComponent();
    ActivityInfo activityInfo = mActivityInfoCache.get(cn);
    if (activityInfo == null) {
        activityInfo = ssp.getActivityInfo(cn, taskKey.userId);
        if (cn == null || activityInfo == null) {
            Log.e(TAG, "Unexpected null component name or activity info: " + cn + ", " + activityInfo);
            return null;
        }
        mActivityInfoCache.put(cn, activityInfo);
    }
    return activityInfo;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) ActivityInfo(android.content.pm.ActivityInfo) ComponentName(android.content.ComponentName)

Example 18 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class TaskStack method computeComponentsRemoved.

/**
     * Computes the components of tasks in this stack that have been removed as a result of a change
     * in the specified package.
     */
public ArraySet<ComponentName> computeComponentsRemoved(String packageName, int userId) {
    // Identify all the tasks that should be removed as a result of the package being removed.
    // Using a set to ensure that we callback once per unique component.
    SystemServicesProxy ssp = Recents.getSystemServices();
    ArraySet<ComponentName> existingComponents = new ArraySet<>();
    ArraySet<ComponentName> removedComponents = new ArraySet<>();
    ArrayList<Task.TaskKey> taskKeys = getTaskKeys();
    int taskKeyCount = taskKeys.size();
    for (int i = 0; i < taskKeyCount; i++) {
        Task.TaskKey t = taskKeys.get(i);
        // Skip if this doesn't apply to the current user
        if (t.userId != userId)
            continue;
        ComponentName cn = t.getComponent();
        if (cn.getPackageName().equals(packageName)) {
            if (existingComponents.contains(cn)) {
                // If we know that the component still exists in the package, then skip
                continue;
            }
            if (ssp.getActivityInfo(cn, userId) != null) {
                existingComponents.add(cn);
            } else {
                removedComponents.add(cn);
            }
        }
    }
    return removedComponents;
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) ArraySet(android.util.ArraySet) ComponentName(android.content.ComponentName) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 19 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class Divider method start.

@Override
public void start() {
    mWindowManager = new DividerWindowManager(mContext);
    update(mContext.getResources().getConfiguration());
    putComponent(Divider.class, this);
    mDockDividerVisibilityListener = new DockDividerVisibilityListener();
    SystemServicesProxy ssp = Recents.getSystemServices();
    ssp.registerDockedStackListener(mDockDividerVisibilityListener);
    mForcedResizableController = new ForcedResizableInfoActivityController(mContext);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy)

Example 20 with SystemServicesProxy

use of com.android.systemui.recents.misc.SystemServicesProxy in project android_frameworks_base by ResurrectionRemix.

the class Recents method dockTopTask.

@Override
public boolean dockTopTask(int dragMode, int stackCreateMode, Rect initialBounds, int metricsDockAction) {
    // recents
    if (!isUserSetup()) {
        return false;
    }
    Point realSize = new Point();
    if (initialBounds == null) {
        mContext.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY).getRealSize(realSize);
        initialBounds = new Rect(0, 0, realSize.x, realSize.y);
    }
    int currentUser = sSystemServicesProxy.getCurrentUser();
    SystemServicesProxy ssp = Recents.getSystemServices();
    ActivityManager.RunningTaskInfo runningTask = ssp.getRunningTask();
    boolean screenPinningActive = ssp.isScreenPinningActive();
    boolean isRunningTaskInHomeStack = runningTask != null && SystemServicesProxy.isHomeStack(runningTask.stackId);
    if (runningTask != null && !isRunningTaskInHomeStack && !screenPinningActive) {
        logDockAttempt(mContext, runningTask.topActivity, runningTask.resizeMode);
        if (runningTask.isDockable) {
            if (metricsDockAction != -1) {
                MetricsLogger.action(mContext, metricsDockAction, runningTask.topActivity.flattenToShortString());
            }
            if (sSystemServicesProxy.isSystemUser(currentUser)) {
                mImpl.dockTopTask(runningTask.id, dragMode, stackCreateMode, initialBounds);
            } else {
                if (mSystemToUserCallbacks != null) {
                    IRecentsNonSystemUserCallbacks callbacks = mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
                    if (callbacks != null) {
                        try {
                            callbacks.dockTopTask(runningTask.id, dragMode, stackCreateMode, initialBounds);
                        } catch (RemoteException e) {
                            Log.e(TAG, "Callback failed", e);
                        }
                    } else {
                        Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
                    }
                }
            }
            mDraggingInRecentsCurrentUser = currentUser;
            return true;
        } else {
            EventBus.getDefault().send(new ShowUserToastEvent(R.string.recents_incompatible_app_message, Toast.LENGTH_SHORT));
            return false;
        }
    } else {
        return false;
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) ShowUserToastEvent(com.android.systemui.recents.events.component.ShowUserToastEvent) Point(android.graphics.Point) ActivityManager(android.app.ActivityManager) RemoteException(android.os.RemoteException) Point(android.graphics.Point)

Aggregations

SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)243 Rect (android.graphics.Rect)45 ActivityManager (android.app.ActivityManager)35 ActivityInfo (android.content.pm.ActivityInfo)34 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)30 TaskStack (com.android.systemui.recents.model.TaskStack)30 Task (com.android.systemui.recents.model.Task)25 Drawable (android.graphics.drawable.Drawable)19 Point (android.graphics.Point)16 ActivityOptions (android.app.ActivityOptions)15 ComponentName (android.content.ComponentName)15 RemoteException (android.os.RemoteException)15 MutableBoolean (android.util.MutableBoolean)15 RecentsActivityLaunchState (com.android.systemui.recents.RecentsActivityLaunchState)15 RecentsConfiguration (com.android.systemui.recents.RecentsConfiguration)15 Bitmap (android.graphics.Bitmap)14 ArrayList (java.util.ArrayList)14 BitmapDrawable (android.graphics.drawable.BitmapDrawable)12 ActivityNotFoundException (android.content.ActivityNotFoundException)10 Intent (android.content.Intent)10