Search in sources :

Example 36 with SystemServicesProxy

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

the class RecentsImpl method dockTopTask.

public void dockTopTask(int topTaskId, int dragMode, int stackCreateMode, Rect initialBounds) {
    SystemServicesProxy ssp = Recents.getSystemServices();
    // the resize mode already.
    if (ssp.moveTaskToDockedStack(topTaskId, stackCreateMode, initialBounds)) {
        EventBus.getDefault().send(new DockedTopTaskEvent(dragMode, initialBounds));
        showRecents(false, /* triggeredFromAltTab */
        dragMode == NavigationBarGestureHelper.DRAG_MODE_RECENTS, false, /* animate */
        true, /* launchedWhileDockingTask*/
        false, /* fromHome */
        DividerView.INVALID_RECENTS_GROW_TARGET);
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) DockedTopTaskEvent(com.android.systemui.recents.events.activity.DockedTopTaskEvent)

Example 37 with SystemServicesProxy

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

the class RecentsTvActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents_on_tv);
    mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPipView = findViewById(R.id.pip);
    mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
    // Place mPipView at the PIP bounds for fine tuned focus handling.
    Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
    LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
    lp.width = pipBounds.width();
    lp.height = pipBounds.height();
    lp.leftMargin = pipBounds.left;
    lp.topMargin = pipBounds.top;
    mPipView.setLayoutParams(lp);
    mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    // Create the home intent runnable
    Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
    homeIntent.addCategory(Intent.CATEGORY_HOME);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
    mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
    mPipManager.addListener(mPipListener);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) LayoutParams(android.widget.FrameLayout.LayoutParams) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 38 with SystemServicesProxy

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

the class RecentsTvActivity method onBusEvent.

public final void onBusEvent(DeleteTaskDataEvent event) {
    // Remove any stored data from the loader
    RecentsTaskLoader loader = Recents.getTaskLoader();
    loader.deleteTaskData(event.task, false);
    // Remove the task from activity manager
    SystemServicesProxy ssp = Recents.getSystemServices();
    ssp.removeTask(event.task.key.id);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader)

Example 39 with SystemServicesProxy

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

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)

Example 40 with SystemServicesProxy

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

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)

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