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

Commit 19ff728b authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding support for determining split layout for launcher.

> Simulating the windo wmanager API to get available device
  profiles until final API
> When a device has multiple internal displays, and with both
  tablet and phone possibilities, it uses a split workspace layout

Bug: 186160341
Bug: 175782275
Test: Manual
Change-Id: Ieff2329acac7cdd6b9abe6f96cd459cd45bd0efe
parent 0a1b030b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherState.FLAG_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.util.DisplayController.CHANGE_SIZE;
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
@@ -240,7 +240,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
    public void onDisplayInfoChanged(Context context, DisplayController.Info info,
            int flags) {
        super.onDisplayInfoChanged(context, info, flags);
        if ((flags & CHANGE_SIZE) != 0) {
        if ((flags & CHANGE_ACTIVE_SCREEN) != 0) {
            addTaskbarIfNecessary();
        }
    }
+2 −3
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.launcher3.BubbleTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
@@ -80,9 +79,9 @@ public class PredictionRowView extends LinearLayout implements
        setOrientation(LinearLayout.HORIZONTAL);

        mFocusHelper = new SimpleFocusIndicatorHelper(this);
        mNumPredictedAppsPerRow = LauncherAppState.getIDP(context).numAllAppsColumns;
        mLauncher = Launcher.getLauncher(context);
        mLauncher.addOnDeviceProfileChangeListener(this);
        mNumPredictedAppsPerRow = mLauncher.getDeviceProfile().numShownAllAppsColumns;
        updateVisibility();
    }

@@ -174,7 +173,7 @@ public class PredictionRowView extends LinearLayout implements

    @Override
    public void onDeviceProfileChanged(DeviceProfile dp) {
        mNumPredictedAppsPerRow = dp.inv.numAllAppsColumns;
        mNumPredictedAppsPerRow = dp.numShownAllAppsColumns;
        removeAllViews();
        applyPredictionApps();
    }
+3 −3
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChange
        // TODO: Implement caching and preloading
        super.loadItems(ums, pinnedShortcuts);

        WorkspaceItemFactory allAppsFactory =
                new WorkspaceItemFactory(mApp, ums, pinnedShortcuts, mIDP.numAllAppsColumns);
        WorkspaceItemFactory allAppsFactory = new WorkspaceItemFactory(
                mApp, ums, pinnedShortcuts, mIDP.numDatabaseAllAppsColumns);
        mAllAppsState.items.setItems(
                mAllAppsState.storage.read(mApp.getContext(), allAppsFactory, ums.allUsers::get));
        mDataModel.extraItems.put(CONTAINER_PREDICTION, mAllAppsState.items);
@@ -204,7 +204,7 @@ public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChange
        registerPredictor(mAllAppsState, apm.createAppPredictionSession(
                new AppPredictionContext.Builder(context)
                        .setUiSurface("home")
                        .setPredictedTargetCount(mIDP.numAllAppsColumns)
                        .setPredictedTargetCount(mIDP.numDatabaseAllAppsColumns)
                        .build()));

        // TODO: get bundle
+10 −0
Original line number Diff line number Diff line
@@ -18,13 +18,23 @@ package com.android.launcher3.uioverrides;

import android.app.Person;
import android.content.pm.ShortcutInfo;
import android.view.Display;

import com.android.launcher3.Utilities;

public class ApiWrapper {

    public static final boolean TASKBAR_DRAWN_IN_PROCESS = true;

    public static Person[] getPersons(ShortcutInfo si) {
        Person[] persons = si.getPersons();
        return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons;
    }

    /**
     * Returns true if the display is an internal displays
     */
    public static boolean isInternalDisplay(Display display) {
        return display.getType() == Display.TYPE_INTERNAL;
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ class OrientationTouchTransformer {
     * @see #enableMultipleRegions(boolean, Info)
     */
    void createOrAddTouchRegion(Info info) {
        mCurrentDisplay = new CurrentDisplay(info.realSize, info.rotation);
        mCurrentDisplay = new CurrentDisplay(info.currentSize, info.rotation);

        if (mQuickStepStartingRotation > QUICKSTEP_ROTATION_UNINITIALIZED
                && mCurrentDisplay.rotation == mQuickStepStartingRotation) {
@@ -256,7 +256,7 @@ class OrientationTouchTransformer {
            Log.d(TAG, "clearing all regions except rotation: " + mCurrentDisplay.rotation);
        }

        mCurrentDisplay = new CurrentDisplay(region.realSize, region.rotation);
        mCurrentDisplay = new CurrentDisplay(region.currentSize, region.rotation);
        OrientationRectF regionToKeep = mSwipeTouchRegions.get(mCurrentDisplay);
        if (DEBUG) {
            Log.d(TestProtocol.NO_SWIPE_TO_HOME, "cached region: " + regionToKeep
@@ -289,7 +289,7 @@ class OrientationTouchTransformer {
            + " with mode: " + mMode + " displayRotation: " + display.rotation);
        }

        Point size = display.realSize;
        Point size = display.currentSize;
        int rotation = display.rotation;
        int touchHeight = mNavBarGesturalHeight;
        OrientationRectF orientationRectF =
Loading