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

Commit b1a7f282 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Move default pip position to right above the shelf (Pt. Launcher)" into ub-launcher3-master

parents 1f447d28 a706f00d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides;

import static com.android.launcher3.Utilities.getPrefs;
import static com.android.quickstep.OverviewInteractionState.KEY_SWIPE_UP_ENABLED;
import static com.android.launcher3.LauncherState.ALL_APPS;

import android.content.Context;
import android.content.SharedPreferences;
@@ -29,6 +30,7 @@ import com.android.launcher3.util.TouchController;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.WindowManagerWrapper;

public class UiFactory {

@@ -85,6 +87,14 @@ public class UiFactory {
        }
    }

    public static void onLauncherStateOrResumeChanged(Launcher launcher) {
        WindowManagerWrapper.getInstance().setShelfHeight(
                launcher.getStateManager().getState() != ALL_APPS &&
                        launcher.isUserActive() &&
                        !launcher.getDeviceProfile().isVerticalBarLayout(),
                launcher.getDeviceProfile().hotseatBarSizePx);
    }

    public static void onTrimMemory(Context context, int level) {
        RecentsModel model = RecentsModel.getInstance(context);
        if (model != null) {
+17 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public abstract class BaseActivity extends Activity {
    protected SystemUiController mSystemUiController;

    private boolean mStarted;
    private boolean mUserActive;

    public DeviceProfile getDeviceProfile() {
        return mDeviceProfile;
@@ -84,6 +85,18 @@ public abstract class BaseActivity extends Activity {
        super.onStart();
    }

    @Override
    protected void onResume() {
        mUserActive = true;
        super.onResume();
    }

    @Override
    protected void onUserLeaveHint() {
        mUserActive = false;
        super.onUserLeaveHint();
    }

    @Override
    protected void onStop() {
        mStarted = false;
@@ -94,6 +107,10 @@ public abstract class BaseActivity extends Activity {
        return mStarted;
    }

    public boolean isUserActive() {
        return mUserActive;
    }

    public void addOnDeviceProfileChangeListener(OnDeviceProfileChangeListener listener) {
        mDPChangeListeners.add(listener);
    }
+8 −0
Original line number Diff line number Diff line
@@ -381,6 +381,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, L
        }

        mOldConfig.setTo(newConfig);
        UiFactory.onLauncherStateOrResumeChanged(this);
        super.onConfigurationChanged(newConfig);
    }

@@ -822,6 +823,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, L
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onResume();
        }
        UiFactory.onLauncherStateOrResumeChanged(this);

        TraceHelper.endSection("ON_RESUME");
    }
@@ -840,6 +842,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, L
        }
    }

    @Override
    protected void onUserLeaveHint() {
        super.onUserLeaveHint();
        UiFactory.onLauncherStateOrResumeChanged(this);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
+2 −0
Original line number Diff line number Diff line
@@ -294,6 +294,7 @@ public class LauncherStateManager {
            // Only disable clipping if needed, otherwise leave it as previous value.
            mLauncher.getWorkspace().setClipChildren(false);
        }
        UiFactory.onLauncherStateOrResumeChanged(mLauncher);
    }

    private void onStateTransitionEnd(LauncherState state) {
@@ -312,6 +313,7 @@ public class LauncherStateManager {
        }

        UiFactory.onLauncherStateOrFocusChanged(mLauncher);
        UiFactory.onLauncherStateOrResumeChanged(mLauncher);
    }

    public void onWindowFocusChanged() {
+2 −0
Original line number Diff line number Diff line
@@ -38,5 +38,7 @@ public class UiFactory {

    public static void onStart(Launcher launcher) { }

    public static void onLauncherStateOrResumeChanged(Launcher launcher) { }

    public static void onTrimMemory(Launcher launcher, int level) { }
}