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

Commit 741e4aeb authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Migrate from InsetsInfo.contentInsets to...

Merge "Migrate from InsetsInfo.contentInsets to WindowManager.LayoutParams#providedInternalInsets" into tm-dev
parents a938cc27 a681cf6a
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -176,7 +176,8 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
        return revealAnim;
        return revealAnim;
    }
    }


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


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


+0 −10
Original line number Original line Diff line number Diff line
@@ -163,16 +163,6 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
            mControllers.taskbarInsetsController.updateInsetsTouchability(insetsInfo);
            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.
         * Called when a child is removed from TaskbarDragLayer.
         */
         */
+25 −3
Original line number Original line 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)
        windowLayoutParams.providedInternalImeInsets = arrayOfNulls<Insets>(ITYPE_SIZE)


        onTaskbarWindowHeightChanged()
        onTaskbarWindowHeightOrInsetsChanged()


        windowLayoutParams.insetsRoundedCornerFrame = true
        windowLayoutParams.insetsRoundedCornerFrame = true
    }
    }


    fun onTaskbarWindowHeightChanged() {
    fun onTaskbarWindowHeightOrInsetsChanged() {
        val reducingSize = Insets.of(0, windowLayoutParams.height - taskbarHeightForIme, 0, 0)
        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_EXTRA_NAVIGATION_BAR] = reducingSize
        windowLayoutParams.providedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = 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.
     * Called to update the touchable insets.
     * @see InsetsInfo.setTouchableInsets
     * @see InsetsInfo.setTouchableInsets
@@ -120,6 +138,10 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask
    override fun dumpLogs(prefix: String, pw: PrintWriter) {
    override fun dumpLogs(prefix: String, pw: PrintWriter) {
        pw.println(prefix + "TaskbarInsetsController:")
        pw.println(prefix + "TaskbarInsetsController:")
        pw.println("$prefix\twindowHeight=${windowLayoutParams.height}")
        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]=" +
        pw.println("$prefix\tprovidedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR]=" +
                "${windowLayoutParams.providedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR]}")
                "${windowLayoutParams.providedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR]}")
        pw.println("$prefix\tprovidedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT]=" +
        pw.println("$prefix\tprovidedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT]=" +
Loading