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

Commit 7a07cdf4 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8656341 from a947c74b to tm-d1-release

Change-Id: I7589756e851f7f1b4aed748a0ffab7bddc9dadc0
parents 8b7e1a4a a947c74b
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import android.content.Context;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.util.Themes;
@@ -36,8 +35,6 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements
    protected final LayoutInflater mLayoutInflater;
    private final List<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();

    protected DeviceProfile mDeviceProfile;

    public BaseTaskbarContext(Context windowContext) {
        super(windowContext, Themes.getActivityThemeRes(windowContext));
        mLayoutInflater = LayoutInflater.from(this).cloneInContext(this);
@@ -48,19 +45,11 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements
        return mLayoutInflater;
    }

    @Override
    public final DeviceProfile getDeviceProfile() {
        return mDeviceProfile;
    }

    @Override
    public final List<OnDeviceProfileChangeListener> getOnDeviceProfileChangeListeners() {
        return mDPChangeListeners;
    }

    /** Updates the {@link DeviceProfile} instance to the latest representation of the screen. */
    public abstract void updateDeviceProfile(DeviceProfile dp);

    /** Callback invoked when a drag is initiated within this context. */
    public abstract void onDragStart();

+1 −1
Original line number Diff line number Diff line
@@ -522,7 +522,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
            if (button.getVisibility() == View.VISIBLE) {
                parent.getDescendantRectRelativeToSelf(button, mTempRect);
                if (mHitboxExtender.extendedHitboxEnabled()) {
                    mTempRect.bottom += mContext.mDeviceProfile.getTaskbarOffsetY();
                    mTempRect.bottom += mContext.getDeviceProfile().getTaskbarOffsetY();
                }
                outRegion.op(mTempRect, Op.UNION);
            }
+10 −4
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

    private final WindowManager mWindowManager;
    private final @Nullable RoundedCorner mLeftCorner, mRightCorner;
    private DeviceProfile mDeviceProfile;
    private WindowManager.LayoutParams mWindowLayoutParams;
    private boolean mIsFullscreen;
    // The size we should return to when we call setTaskbarWindowFullscreen(false)
@@ -135,7 +136,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
            TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider
            unfoldTransitionProgressProvider) {
        super(windowContext);
        mDeviceProfile = dp;
        mDeviceProfile = dp.copy(this);

        final Resources resources = getResources();

@@ -198,7 +199,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                new TaskbarAutohideSuspendController(this),
                new TaskbarPopupController(this),
                new TaskbarForceVisibleImmersiveController(this),
                new TaskbarAllAppsController(this),
                new TaskbarAllAppsController(this, dp),
                new TaskbarInsetsController(this));
    }

@@ -214,8 +215,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
    }

    @Override
    public DeviceProfile getDeviceProfile() {
        return mDeviceProfile;
    }

    /** Updates {@link DeviceProfile} instances for any Taskbar windows. */
    public void updateDeviceProfile(DeviceProfile dp) {
        mDeviceProfile = dp;
        mControllers.taskbarAllAppsController.updateDeviceProfile(dp);
        mDeviceProfile = dp.copy(this);
        updateIconSize(getResources());

        AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE);
@@ -230,7 +237,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mDeviceProfile.updateIconSize(1, resources);
        float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx;
        mDeviceProfile.updateIconSize(iconScale, resources);
        mDeviceProfile.updateAllAppsIconSize(1, resources); // Leave all apps unscaled.
    }

    @VisibleForTesting
+9 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES
import android.view.WindowManager
import com.android.launcher3.AbstractFloatingView
import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS
import com.android.launcher3.DeviceProfile
import com.android.launcher3.anim.AlphaUpdateListener
import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController
import com.android.quickstep.KtR
@@ -38,6 +39,9 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
    val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize(
        KtR.dimen.taskbar_ime_size)
    private val contentRegion: Region = Region()
    private val deviceProfileChangeListener = { _: DeviceProfile ->
        onTaskbarWindowHeightOrInsetsChanged()
    }

    // Initialized in init.
    private lateinit var controllers: TaskbarControllers
@@ -63,16 +67,19 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
        onTaskbarWindowHeightOrInsetsChanged()

        windowLayoutParams.insetsRoundedCornerFrame = true
        context.addOnDeviceProfileChangeListener(deviceProfileChangeListener)
    }

    fun onDestroy() {}
    fun onDestroy() {
        context.removeOnDeviceProfileChangeListener(deviceProfileChangeListener)
    }

    fun onTaskbarWindowHeightOrInsetsChanged() {
        var reducingSize = getReducingInsetsForTaskbarInsetsHeight(
            controllers.taskbarStashController.contentHeightToReportToApps)

        contentRegion.set(0, reducingSize.top,
                context.dragLayer.width, windowLayoutParams.height)
                context.deviceProfile.widthPx, windowLayoutParams.height)
        windowLayoutParams.providedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize
        windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize
        reducingSize = getReducingInsetsForTaskbarInsetsHeight(
+3 −3
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ public class TaskbarManager {
                    // Config change might be handled without re-creating the taskbar
                    if (mTaskbarActivityContext != null) {
                        if (dp != null && dp.isTaskbarPresent) {
                            mTaskbarActivityContext.updateDeviceProfile(dp.copy(mContext));
                            mTaskbarActivityContext.updateDeviceProfile(dp);
                        }
                        mTaskbarActivityContext.onConfigurationChanged(configDiff);
                    }
@@ -274,8 +274,8 @@ public class TaskbarManager {
            return;
        }

        mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp.copy(mContext),
                mNavButtonController, mUnfoldProgressProvider);
        mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController,
                mUnfoldProgressProvider);

        mTaskbarActivityContext.init(mSharedState);
        if (mActivity != null) {
Loading