Search in sources :

Example 91 with SystemServicesProxy

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

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 92 with SystemServicesProxy

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

the class RecentsActivity 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);
    // Update memory details
    mRecentsView.updateMemoryStatus();
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) RecentsTaskLoader(com.android.systemui.recents.model.RecentsTaskLoader)

Example 93 with SystemServicesProxy

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

the class RecentsActivity method onBusEvent.

public final void onBusEvent(CancelEnterRecentsWindowAnimationEvent event) {
    RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
    int launchToTaskId = launchState.launchedToTaskId;
    if (launchToTaskId != -1 && (event.launchTask == null || launchToTaskId != event.launchTask.key.id)) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        ssp.cancelWindowTransition(launchState.launchedToTaskId);
        ssp.cancelThumbnailTransition(getTaskId());
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy)

Example 94 with SystemServicesProxy

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

the class TaskViewHeader method showAppOverlay.

/**
     * Shows the application overlay.
     */
private void showAppOverlay() {
    // Skip early if the task is invalid
    SystemServicesProxy ssp = Recents.getSystemServices();
    ComponentName cn = mTask.key.getComponent();
    int userId = mTask.key.userId;
    ActivityInfo activityInfo = ssp.getActivityInfo(cn, userId);
    if (activityInfo == null) {
        return;
    }
    // Inflate the overlay if necessary
    if (mAppOverlayView == null) {
        mAppOverlayView = (FrameLayout) Utilities.findViewStubById(this, R.id.app_overlay_stub).inflate();
        mAppOverlayView.setBackground(mOverlayBackground);
        mAppIconView = (ImageView) mAppOverlayView.findViewById(R.id.app_icon);
        mAppIconView.setOnClickListener(this);
        mAppIconView.setOnLongClickListener(this);
        mAppInfoView = (ImageView) mAppOverlayView.findViewById(R.id.app_info);
        mAppInfoView.setOnClickListener(this);
        mAppTitleView = (TextView) mAppOverlayView.findViewById(R.id.app_title);
        updateLayoutParams(mAppIconView, mAppTitleView, null, mAppInfoView);
    }
    // Update the overlay contents for the current app
    mAppTitleView.setText(ssp.getBadgedApplicationLabel(activityInfo.applicationInfo, userId));
    mAppTitleView.setTextColor(mTask.useLightOnPrimaryColor ? mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
    mAppIconView.setImageDrawable(ssp.getBadgedApplicationIcon(activityInfo.applicationInfo, userId));
    mAppInfoView.setImageDrawable(mTask.useLightOnPrimaryColor ? mLightInfoIcon : mDarkInfoIcon);
    mAppOverlayView.setVisibility(View.VISIBLE);
    int x = mIconView.getLeft() + mIconView.getWidth() / 2;
    int y = mIconView.getTop() + mIconView.getHeight() / 2;
    Animator revealAnim = ViewAnimationUtils.createCircularReveal(mAppOverlayView, x, y, 0, getWidth());
    revealAnim.setDuration(OVERLAY_REVEAL_DURATION);
    revealAnim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
    revealAnim.start();
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) ActivityInfo(android.content.pm.ActivityInfo) Animator(android.animation.Animator) ComponentName(android.content.ComponentName) Paint(android.graphics.Paint)

Example 95 with SystemServicesProxy

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

the class TaskStackView method updateLayoutAlgorithm.

/**
     * Updates the layout algorithm min and max virtual scroll bounds.
     */
public void updateLayoutAlgorithm(boolean boundScrollToNewMinMax) {
    // Compute the min and max scroll values
    mLayoutAlgorithm.update(mStack, mIgnoreTasks);
    // Update the freeform workspace background
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp.hasFreeformWorkspaceSupport()) {
        mTmpRect.set(mLayoutAlgorithm.mFreeformRect);
        mFreeformWorkspaceBackground.setBounds(mTmpRect);
    }
    if (boundScrollToNewMinMax) {
        mStackScroller.boundScroll();
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy)

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