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

Commit 44e65099 authored by Tony Wickham's avatar Tony Wickham Committed by Automerger Merge Worker
Browse files

Merge "Migrate from InsetsInfo.contentInsets to...

Merge "Migrate from InsetsInfo.contentInsets to WindowManager.LayoutParams#providedInternalInsets" into tm-dev am: 741e4aeb

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17778392



Change-Id: I437518bf5b439cf7918ffe42d4bfdf9971207e3c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 094aba94 741e4aeb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -176,7 +176,8 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
        return revealAnim;
    }

    public void onIsStashed(boolean isStashed) {
    /** Called when taskbar is stashed or unstashed. */
    public void onIsStashedChanged(boolean isStashed) {
        mRegionSamplingHelper.setWindowVisible(isStashed);
        if (isStashed) {
            mStashedHandleView.updateSampledRegion(mStashedHandleBounds);
+1 −1
Original line number Diff line number Diff line
@@ -559,7 +559,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
            }
        }
        mWindowLayoutParams.height = height;
        mControllers.taskbarInsetsController.onTaskbarWindowHeightChanged();
        mControllers.taskbarInsetsController.onTaskbarWindowHeightOrInsetsChanged();
        mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams);
    }

+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
    private void onComputeTaskbarInsets(InsetsInfo insetsInfo) {
        if (mControllerCallbacks != null) {
            mControllerCallbacks.updateInsetsTouchability(insetsInfo);
            mControllerCallbacks.updateContentInsets(insetsInfo.contentInsets);
        }
    }

+0 −10
Original line number Diff line number Diff line
@@ -163,16 +163,6 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
            mControllers.taskbarInsetsController.updateInsetsTouchability(insetsInfo);
        }

        /**
         * Called to update the {@link InsetsInfo#contentInsets}. This is reported to apps but our
         * internal launcher will ignore these insets.
         */
        public void updateContentInsets(Rect outContentInsets) {
            int contentHeight = mControllers.taskbarStashController
                    .getContentHeightToReportToApps();
            outContentInsets.top = mTaskbarDragLayer.getHeight() - contentHeight;
        }

        /**
         * Called when a child is removed from TaskbarDragLayer.
         */
+25 −3
Original line number Diff line number Diff line
@@ -53,19 +53,37 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
            )
        )

        windowLayoutParams.providedInternalInsets = arrayOfNulls<Insets>(ITYPE_SIZE)
        windowLayoutParams.providedInternalImeInsets = arrayOfNulls<Insets>(ITYPE_SIZE)

        onTaskbarWindowHeightChanged()
        onTaskbarWindowHeightOrInsetsChanged()

        windowLayoutParams.insetsRoundedCornerFrame = true
    }

    fun onTaskbarWindowHeightChanged() {
        val reducingSize = Insets.of(0, windowLayoutParams.height - taskbarHeightForIme, 0, 0)
    fun onTaskbarWindowHeightOrInsetsChanged() {
        var reducingSize = getReducingInsetsForTaskbarInsetsHeight(
            controllers.taskbarStashController.contentHeightToReportToApps)
        windowLayoutParams.providedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize
        reducingSize = getReducingInsetsForTaskbarInsetsHeight(
            controllers.taskbarStashController.tappableHeightToReportToApps)
        windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = reducingSize

        reducingSize = getReducingInsetsForTaskbarInsetsHeight(taskbarHeightForIme)
        windowLayoutParams.providedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize
        windowLayoutParams.providedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = reducingSize
    }

    /**
     * WindowLayoutParams.providedInternal*Insets expects Insets that subtract from the window frame
     * height (i.e. WindowLayoutParams#height). So for Taskbar to report bottom insets to apps, it
     * actually provides insets from the top of its window frame.
     * @param height The number of pixels from the bottom of the screen that Taskbar insets.
     */
    private fun getReducingInsetsForTaskbarInsetsHeight(height: Int): Insets {
        return Insets.of(0, windowLayoutParams.height - height, 0, 0)
    }

    /**
     * Called to update the touchable insets.
     * @see InsetsInfo.setTouchableInsets
@@ -120,6 +138,10 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
    override fun dumpLogs(prefix: String, pw: PrintWriter) {
        pw.println(prefix + "TaskbarInsetsController:")
        pw.println("$prefix\twindowHeight=${windowLayoutParams.height}")
        pw.println("$prefix\tprovidedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR]=" +
                "${windowLayoutParams.providedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR]}")
        pw.println("$prefix\tprovidedInternalInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT]=" +
                "${windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT]}")
        pw.println("$prefix\tprovidedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR]=" +
                "${windowLayoutParams.providedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR]}")
        pw.println("$prefix\tprovidedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT]=" +
Loading