Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10cdc420 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove unused recents affiliated task code."

parents 8596362b a0610760
Loading
Loading
Loading
Loading
+1 −54
Original line number Diff line number Diff line
@@ -81,23 +81,15 @@ public class Recents extends SystemUI
        implements RecentsComponent, CommandQueue.Callbacks {

    private final static String TAG = "Recents";
    private final static boolean DEBUG = false;

    public final static int EVENT_BUS_PRIORITY = 1;
    public final static int BIND_TO_SYSTEM_USER_RETRY_DELAY = 5000;
    public final static int RECENTS_GROW_TARGET_INVALID = -1;

    public final static Set<String> RECENTS_ACTIVITIES = new HashSet<>();
    static {
        RECENTS_ACTIVITIES.add(RecentsImpl.RECENTS_ACTIVITY);
    }

    // Purely for experimentation
    private final static String RECENTS_OVERRIDE_SYSPROP_KEY = "persist.recents_override_pkg";
    private final static String ACTION_SHOW_RECENTS = "com.android.systemui.recents.ACTION_SHOW";
    private final static String ACTION_HIDE_RECENTS = "com.android.systemui.recents.ACTION_HIDE";
    private final static String ACTION_TOGGLE_RECENTS = "com.android.systemui.recents.ACTION_TOGGLE";

    private static final String COUNTER_WINDOW_SUPPORTED = "window_enter_supported";
    private static final String COUNTER_WINDOW_UNSUPPORTED = "window_enter_unsupported";
    private static final String COUNTER_WINDOW_INCOMPATIBLE = "window_enter_incompatible";
@@ -107,11 +99,6 @@ public class Recents extends SystemUI
    private static RecentsTaskLoader sTaskLoader;
    private static RecentsConfiguration sConfiguration;

    // For experiments only, allows another package to handle recents if it is defined in the system
    // properties.  This is limited to show/toggle/hide, and does not tie into the ActivityManager,
    // and does not reside in the home stack.
    private String mOverrideRecentsPackageName;

    private Handler mHandler;
    private RecentsImpl mImpl;
    private int mDraggingInRecentsCurrentUser;
@@ -211,14 +198,6 @@ public class Recents extends SystemUI
        mHandler = new Handler();
        mImpl = new RecentsImpl(mContext);

        // Check if there is a recents override package
        if (Build.IS_USERDEBUG || Build.IS_ENG) {
            String cnStr = SystemProperties.get(RECENTS_OVERRIDE_SYSPROP_KEY);
            if (!cnStr.isEmpty()) {
                mOverrideRecentsPackageName = cnStr;
            }
        }

        // Register with the event bus
        EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
        EventBus.getDefault().register(sSystemServicesProxy, EVENT_BUS_PRIORITY);
@@ -257,16 +236,8 @@ public class Recents extends SystemUI
            return;
        }

        if (proxyToOverridePackage(ACTION_SHOW_RECENTS)) {
            return;
        }
        try {
            ActivityManager.getService().closeSystemDialogs(SYSTEM_DIALOG_REASON_RECENT_APPS);
        } catch (RemoteException e) {
        }

        sSystemServicesProxy.sendCloseSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
        int recentsGrowTarget = getComponent(Divider.class).getView().growsRecents();

        int currentUser = sSystemServicesProxy.getCurrentUser();
        if (sSystemServicesProxy.isSystemUser(currentUser)) {
            mImpl.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
@@ -301,10 +272,6 @@ public class Recents extends SystemUI
            return;
        }

        if (proxyToOverridePackage(ACTION_HIDE_RECENTS)) {
            return;
        }

        int currentUser = sSystemServicesProxy.getCurrentUser();
        if (sSystemServicesProxy.isSystemUser(currentUser)) {
            mImpl.hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
@@ -336,12 +303,7 @@ public class Recents extends SystemUI
            return;
        }

        if (proxyToOverridePackage(ACTION_TOGGLE_RECENTS)) {
            return;
        }

        int growTarget = getComponent(Divider.class).getView().growsRecents();

        int currentUser = sSystemServicesProxy.getCurrentUser();
        if (sSystemServicesProxy.isSystemUser(currentUser)) {
            mImpl.toggleRecents(growTarget);
@@ -820,21 +782,6 @@ public class Recents extends SystemUI
                (Settings.Secure.getInt(cr, Settings.Secure.USER_SETUP_COMPLETE, 0) != 0);
    }

    /**
     * Attempts to proxy the following action to the override recents package.
     * @return whether the proxying was successful
     */
    private boolean proxyToOverridePackage(String action) {
        if (mOverrideRecentsPackageName != null) {
            Intent intent = new Intent(action);
            intent.setPackage(mOverrideRecentsPackageName);
            intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
            mContext.sendBroadcast(intent);
            return true;
        }
        return false;
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Recents");
+0 −6
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
        public static final boolean EnableTransitionThumbnailDebugMode = false;
        // This disables the bitmap and icon caches
        public static final boolean DisableBackgroundCache = false;
        // Enables the task affiliations
        public static final boolean EnableAffiliatedTaskGroups = false;
        // Enables the button above the stack
        public static final boolean EnableStackActionButton = true;
        // Overrides the Tuner flags and enables the timeout
@@ -50,10 +48,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
        public static final int MockTasksPackageCount = 3;
        // Defines the number of mock recents tasks to create
        public static final int MockTaskCount = 100;
        // Enables the simulated task affiliations
        public static final boolean EnableMockTaskGroups = false;
        // Defines the number of mock task affiliations per group
        public static final int MockTaskGroupsTaskCount = 12;
    }

    /**
+20 −26
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import com.android.systemui.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.Task.TaskKey;
import com.android.systemui.recents.model.TaskGrouping;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.model.ThumbnailData;
import com.android.systemui.recents.views.RecentsTransitionHelper;
@@ -594,34 +593,30 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        Task toTask = null;
        ActivityOptions launchOpts = null;
        int taskCount = tasks.size();
        int numAffiliatedTasks = 0;
        for (int i = 0; i < taskCount; i++) {
            Task task = tasks.get(i);
            if (task.key.id == runningTask.id) {
                TaskGrouping group = task.group;
                Task.TaskKey toTaskKey;
                if (showNextTask) {
                    toTaskKey = group.getNextTaskInGroup(task);
                    if ((i + 1) < taskCount) {
                        toTask = tasks.get(i + 1);
                        launchOpts = ActivityOptions.makeCustomAnimation(mContext,
                                R.anim.recents_launch_next_affiliated_task_target,
                                R.anim.recents_launch_next_affiliated_task_source);
                    }
                } else {
                    toTaskKey = group.getPrevTaskInGroup(task);
                    if ((i - 1) >= 0) {
                        toTask = tasks.get(i - 1);
                        launchOpts = ActivityOptions.makeCustomAnimation(mContext,
                                R.anim.recents_launch_prev_affiliated_task_target,
                                R.anim.recents_launch_prev_affiliated_task_source);
                    }
                if (toTaskKey != null) {
                    toTask = focusedStack.findTaskWithId(toTaskKey.id);
                }
                numAffiliatedTasks = group.getTaskCount();
                break;
            }
        }

        // Return early if there is no next task
        if (toTask == null) {
            if (numAffiliatedTasks > 1) {
            if (showNextTask) {
                ssp.startInPlaceAnimationOnFrontMostApplication(
                        ActivityOptions.makeCustomInPlaceAnimation(mContext,
@@ -631,7 +626,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
                        ActivityOptions.makeCustomInPlaceAnimation(mContext,
                                R.anim.recents_launch_prev_affiliated_task_bounce));
            }
            }
            return;
        }

+6 −47
Original line number Diff line number Diff line
@@ -140,7 +140,6 @@ public class SystemServicesProxy {
    UserManager mUm;
    Display mDisplay;
    String mRecentsPackage;
    ComponentName mAssistComponent;
    private int mCurrentUserId;

    boolean mIsSafeMode;
@@ -339,9 +338,6 @@ public class SystemServicesProxy {
        mBgProtectionPaint.setColor(0xFFffffff);
        mBgProtectionCanvas = new Canvas();

        // Resolve the assist intent
        mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.myUserId());

        // Since SystemServicesProxy can be accessed from a per-SysUI process component, create a
        // per-process listener to keep track of the current user id to reduce the number of binder
        // calls to fetch it.
@@ -608,7 +604,7 @@ public class SystemServicesProxy {
     */
    public boolean hasSoftNavigationBar() {
        try {
            return WindowManagerGlobal.getWindowManagerService().hasNavigationBar();
            return mIwm.hasNavigationBar();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
@@ -677,7 +673,7 @@ public class SystemServicesProxy {

        ActivityManager.TaskSnapshot snapshot = null;
        try {
            snapshot = ActivityManager.getService().getTaskSnapshot(taskId, reducedResolution);
            snapshot = mIam.getTaskSnapshot(taskId, reducedResolution);
        } catch (RemoteException e) {
            Log.w(TAG, "Failed to retrieve snapshot", e);
        }
@@ -894,22 +890,6 @@ public class SystemServicesProxy {
        return banner;
    }

    /**
     * Returns a logo used on TV for the specified Activity.
     */
    public Drawable getActivityLogo(ActivityInfo info) {
        if (mPm == null) return null;

        // If we are mocking, then return a mock logo
        if (RecentsDebugFlags.Static.EnableMockTasks) {
            return new ColorDrawable(0xFF666666);
        }

        Drawable logo = info.loadLogo(mPm);
        return logo;
    }


    /**
     * Returns the given label for a user, badging if necessary.
     */
@@ -930,24 +910,6 @@ public class SystemServicesProxy {
        return mKgm.isDeviceLocked(userId);
    }

    /** Returns the package name of the home activity. */
    public String getHomeActivityPackageName() {
        if (mPm == null) return null;
        if (RecentsDebugFlags.Static.EnableMockTasks) return null;

        ArrayList<ResolveInfo> homeActivities = new ArrayList<>();
        ComponentName defaultHomeActivity = mPm.getHomeActivities(homeActivities);
        if (defaultHomeActivity != null) {
            return defaultHomeActivity.getPackageName();
        } else if (homeActivities.size() == 1) {
            ResolveInfo info = homeActivities.get(0);
            if (info.activityInfo != null) {
                return info.activityInfo.packageName;
            }
        }
        return null;
    }

    /**
     * Returns whether the provided {@param userId} represents the system user.
     */
@@ -1157,7 +1119,7 @@ public class SystemServicesProxy {
            return;
        }
        try {
            WindowManagerGlobal.getWindowManagerService().endProlongedAnimations();
            mIwm.endProlongedAnimations();
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -1167,7 +1129,7 @@ public class SystemServicesProxy {
        if (mWm == null) return;

        try {
            WindowManagerGlobal.getWindowManagerService().registerDockedStackListener(listener);
            mIwm.registerDockedStackListener(listener);
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -1194,8 +1156,7 @@ public class SystemServicesProxy {
        if (mWm == null) return;

        try {
            WindowManagerGlobal.getWindowManagerService().getStableInsets(Display.DEFAULT_DISPLAY,
                    outStableInsets);
            mIwm.getStableInsets(Display.DEFAULT_DISPLAY, outStableInsets);
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -1205,9 +1166,7 @@ public class SystemServicesProxy {
            IAppTransitionAnimationSpecsFuture future, IRemoteCallback animStartedListener,
            boolean scaleUp) {
        try {
            WindowManagerGlobal.getWindowManagerService()
                    .overridePendingAppTransitionMultiThumbFuture(future, animStartedListener,
                            scaleUp);
            mIwm.overridePendingAppTransitionMultiThumbFuture(future, animStartedListener, scaleUp);
        } catch (RemoteException e) {
            Log.w(TAG, "Failed to override transition: " + e);
        }
+2 −6
Original line number Diff line number Diff line
@@ -112,8 +112,6 @@ public class RecentsTaskLoadPlan {
            preloadRawTasks();
        }

        SparseArray<Task.TaskKey> affiliatedTasks = new SparseArray<>();
        SparseIntArray affiliatedTaskCounts = new SparseIntArray();
        SparseBooleanArray lockedUsers = new SparseBooleanArray();
        String dismissDescFormat = mContext.getString(
                R.string.accessibility_recents_item_will_be_dismissed);
@@ -154,20 +152,18 @@ public class RecentsTaskLoadPlan {
            boolean isLocked = lockedUsers.get(t.userId);

            // Add the task to the stack
            Task task = new Task(taskKey, t.affiliatedTaskId, t.affiliatedTaskColor, icon,
            Task task = new Task(taskKey, icon,
                    thumbnail, title, titleDescription, dismissDescription, appInfoDescription,
                    activityColor, backgroundColor, isLaunchTarget, isStackTask, isSystemApp,
                    t.supportsSplitScreenMultiWindow, t.bounds, t.taskDescription, t.resizeMode,
                    t.topActivity, isLocked);

            allTasks.add(task);
            affiliatedTaskCounts.put(taskKey.id, affiliatedTaskCounts.get(taskKey.id, 0) + 1);
            affiliatedTasks.put(taskKey.id, taskKey);
        }

        // Initialize the stacks
        mStack = new TaskStack();
        mStack.setTasks(mContext, allTasks, false /* notifyStackChanges */);
        mStack.setTasks(allTasks, false /* notifyStackChanges */);
    }

    /**
Loading