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

Commit 95656678 authored by Alex Chau's avatar Alex Chau
Browse files

Convert TaksView to Kotlin

- PS1: Android Studio conversion (unformatted, cannot compile)
- PS2: Fix compilation issues and formatting
- PS3: First pass ready for review
- PS4: Minor changes (Remove Consumer, remove unnecessary null-checks)
- PS5: Removed check() around taskContainers, which is now lateinit and should always be initiailzed. Also ensure TaskView is bound before adding to parent.
- PS6: Move a bunch of getters to use .property style
- PS8: Refacoted RecentsView.applyLoadPlan bind logic, to avoid inflating TaksView, bind, add then immediatley remove
- PS10: Turned more functions to express functions; added an extension function
- PS11: Re-order functions, no code changes
- PS12: Reverted unit express function back to {} style

Bug: 339787593
Test: Manual
Flag: NONE
Change-Id: I75c06cf29718d8f258a4124997bcb054f5eb056f
parent de2e793f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -197,6 +197,8 @@ import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.unfold.progress.RemoteUnfoldTransitionReceiver;
import com.android.systemui.unfold.updates.RotationChangeProvider;

import kotlin.Unit;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -586,6 +588,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer
                        } else {
                            getStateManager().moveToRestState();
                        }
                        return Unit.INSTANCE;
                    });
                } else {
                    getStateManager().goToState(NORMAL);
+3 −0
Original line number Diff line number Diff line
@@ -152,6 +152,8 @@ import com.android.window.flags.Flags;
import com.android.wm.shell.common.TransactionPool;
import com.android.wm.shell.startingsurface.SplashScreenExitAnimationUtils;

import kotlin.Unit;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -2337,6 +2339,7 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
                            mRecentsAnimationController.finish(true /* toRecents */, null);
                        }
                    }
                    return Unit.INSTANCE;
                }, true /* freezeTaskList */);
            } else {
                mContainerInterface.onLaunchTaskFailed();
+1 −3
Original line number Diff line number Diff line
@@ -304,9 +304,7 @@ public class LauncherSwipeHandlerV2 extends
            // Disable if swiping to PIP
            return null;
        }
        if (sourceTaskView == null
                || sourceTaskView.getFirstTask() == null
                || sourceTaskView.getFirstTask().key.getComponent() == null) {
        if (sourceTaskView == null || sourceTaskView.getFirstTask().key.getComponent() == null) {
            // Disable if it's an invalid task
            return null;
        }
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ public class OverviewCommandHelper {
        RunnableList callbackList = null;
        if (taskView != null) {
            mWaitForToggleCommandComplete = true;
            taskView.setEndQuickswitchCuj(true);
            taskView.setEndQuickSwitchCuj(true);
            callbackList = taskView.launchTasks();
        }

+2 −6
Original line number Diff line number Diff line
@@ -42,10 +42,8 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Flags;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.popup.SystemShortcut.AppInfo;
import com.android.launcher3.util.InstantAppResolver;
@@ -463,8 +461,7 @@ public interface TaskShortcutFactory {
            boolean isGridOnlyOverview = isTablet && Flags.enableGridOnlyOverview();
            // Extra conditions if it's not grid-only overview
            if (!isGridOnlyOverview) {
                RecentsOrientedState orientedState =
                        taskContainer.getTaskView().getRecentsView().getPagedViewOrientedState();
                RecentsOrientedState orientedState = taskContainer.getTaskView().getOrientedState();
                boolean isFakeLandscape = !orientedState.isRecentsActivityRotationAllowed()
                        && orientedState.getTouchRotation() != ROTATION_0;
                if (!isFakeLandscape) {
@@ -493,8 +490,7 @@ public interface TaskShortcutFactory {
            boolean isGridOnlyOverview = isTablet && Flags.enableGridOnlyOverview();
            // Extra conditions if it's not grid-only overview
            if (!isGridOnlyOverview) {
                RecentsOrientedState orientedState =
                        taskContainer.getTaskView().getRecentsView().getPagedViewOrientedState();
                RecentsOrientedState orientedState = taskContainer.getTaskView().getOrientedState();
                boolean isFakeLandscape = !orientedState.isRecentsActivityRotationAllowed()
                        && orientedState.getTouchRotation() != ROTATION_0;
                if (!isFakeLandscape) {
Loading