Loading quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +60 −56 Original line number Diff line number Diff line Loading @@ -101,8 +101,10 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas windowLayoutParams.providedInsets = if (enableTaskbarNoRecreate()) { getProvidedInsets(controllers.sharedState!!.insetsFrameProviders!!, insetsRoundedCornerFlag) getProvidedInsets( controllers.sharedState!!.insetsFrameProviders!!, insetsRoundedCornerFlag ) } else { getProvidedInsets(insetsRoundedCornerFlag) } Loading Loading @@ -164,19 +166,18 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas /** * This is for when ENABLE_TASKBAR_NO_RECREATION is enabled. We generate one instance of * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing * we need to reset is nav bar flags based on insetsRoundedCornerFlag. * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing we * need to reset is nav bar flags based on insetsRoundedCornerFlag. */ private fun getProvidedInsets(providedInsets: Array<InsetsFrameProvider>, insetsRoundedCornerFlag: Int): Array<InsetsFrameProvider> { private fun getProvidedInsets( providedInsets: Array<InsetsFrameProvider>, insetsRoundedCornerFlag: Int ): Array<InsetsFrameProvider> { val navBarsFlag = (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag for (provider in providedInsets) { if (provider.type == navigationBars()) { provider.setFlags( navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER ) provider.setFlags(navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER) } } return providedInsets Loading @@ -184,19 +185,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas /** * The inset types and number of insets provided have to match for both gesture nav and button * nav. The values and the order of the elements in array are allowed to differ. * Reason being WM does not allow types and number of insets changing for a given window once it * is added into the hierarchy for performance reasons. * nav. The values and the order of the elements in array are allowed to differ. Reason being WM * does not allow types and number of insets changing for a given window once it is added into * the hierarchy for performance reasons. */ private fun getProvidedInsets(insetsRoundedCornerFlag: Int): Array<InsetsFrameProvider> { val navBarsFlag = (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag return arrayOf( InsetsFrameProvider(insetsOwner, 0, navigationBars()) .setFlags( navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER ), .setFlags(navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER), InsetsFrameProvider(insetsOwner, 0, tappableElement()), InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures()), InsetsFrameProvider(insetsOwner, INDEX_LEFT, systemGestures()) Loading Loading @@ -228,20 +226,23 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas // When in gesture nav, report the stashed height to the IME, to allow hiding the // IME navigation bar. val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) { getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity); val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) { getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity) } else { getInsetsForGravity(taskbarHeightForIme, gravity) } val imeInsetsSizeOverride = arrayOf( InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION, InsetsFrameProvider.InsetsSizeOverride( TYPE_VOICE_INTERACTION, // No-op override to keep the size and types in sync with the // override below (insetsSizeOverrides must have the same length and // types after the window is added according to // WindowManagerService#relayoutWindow) provider.insetsSize) provider.insetsSize ) ) // Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled. val visInsetsSizeForTappableElement = Loading @@ -250,12 +251,15 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val insetsSizeOverrideForTappableElement = arrayOf( InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION, InsetsFrameProvider.InsetsSizeOverride( TYPE_VOICE_INTERACTION, visInsetsSizeForTappableElement ), ) if ((context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) && provider.type == tappableElement()) { if ( (context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) && provider.type == tappableElement() ) { provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement } else if (provider.type != systemGestures()) { // We only override insets at the bottom of the screen Loading @@ -264,8 +268,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } /** * @return [Insets] where the [inset] is either used as a bottom inset or * right/left inset if using 3 button nav * @return [Insets] where the [inset] is either used as a bottom inset or right/left inset if * using 3 button nav */ private fun getInsetsForGravity(inset: Int, gravity: Int): Insets { if ((gravity and Gravity.BOTTOM) == Gravity.BOTTOM) { Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +60 −56 Original line number Diff line number Diff line Loading @@ -101,8 +101,10 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas windowLayoutParams.providedInsets = if (enableTaskbarNoRecreate()) { getProvidedInsets(controllers.sharedState!!.insetsFrameProviders!!, insetsRoundedCornerFlag) getProvidedInsets( controllers.sharedState!!.insetsFrameProviders!!, insetsRoundedCornerFlag ) } else { getProvidedInsets(insetsRoundedCornerFlag) } Loading Loading @@ -164,19 +166,18 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas /** * This is for when ENABLE_TASKBAR_NO_RECREATION is enabled. We generate one instance of * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing * we need to reset is nav bar flags based on insetsRoundedCornerFlag. * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing we * need to reset is nav bar flags based on insetsRoundedCornerFlag. */ private fun getProvidedInsets(providedInsets: Array<InsetsFrameProvider>, insetsRoundedCornerFlag: Int): Array<InsetsFrameProvider> { private fun getProvidedInsets( providedInsets: Array<InsetsFrameProvider>, insetsRoundedCornerFlag: Int ): Array<InsetsFrameProvider> { val navBarsFlag = (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag for (provider in providedInsets) { if (provider.type == navigationBars()) { provider.setFlags( navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER ) provider.setFlags(navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER) } } return providedInsets Loading @@ -184,19 +185,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas /** * The inset types and number of insets provided have to match for both gesture nav and button * nav. The values and the order of the elements in array are allowed to differ. * Reason being WM does not allow types and number of insets changing for a given window once it * is added into the hierarchy for performance reasons. * nav. The values and the order of the elements in array are allowed to differ. Reason being WM * does not allow types and number of insets changing for a given window once it is added into * the hierarchy for performance reasons. */ private fun getProvidedInsets(insetsRoundedCornerFlag: Int): Array<InsetsFrameProvider> { val navBarsFlag = (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag return arrayOf( InsetsFrameProvider(insetsOwner, 0, navigationBars()) .setFlags( navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER ), .setFlags(navBarsFlag, FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER), InsetsFrameProvider(insetsOwner, 0, tappableElement()), InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures()), InsetsFrameProvider(insetsOwner, INDEX_LEFT, systemGestures()) Loading Loading @@ -228,20 +226,23 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas // When in gesture nav, report the stashed height to the IME, to allow hiding the // IME navigation bar. val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) { getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity); val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) { getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity) } else { getInsetsForGravity(taskbarHeightForIme, gravity) } val imeInsetsSizeOverride = arrayOf( InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION, InsetsFrameProvider.InsetsSizeOverride( TYPE_VOICE_INTERACTION, // No-op override to keep the size and types in sync with the // override below (insetsSizeOverrides must have the same length and // types after the window is added according to // WindowManagerService#relayoutWindow) provider.insetsSize) provider.insetsSize ) ) // Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled. val visInsetsSizeForTappableElement = Loading @@ -250,12 +251,15 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val insetsSizeOverrideForTappableElement = arrayOf( InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION, InsetsFrameProvider.InsetsSizeOverride( TYPE_VOICE_INTERACTION, visInsetsSizeForTappableElement ), ) if ((context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) && provider.type == tappableElement()) { if ( (context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) && provider.type == tappableElement() ) { provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement } else if (provider.type != systemGestures()) { // We only override insets at the bottom of the screen Loading @@ -264,8 +268,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } /** * @return [Insets] where the [inset] is either used as a bottom inset or * right/left inset if using 3 button nav * @return [Insets] where the [inset] is either used as a bottom inset or right/left inset if * using 3 button nav */ private fun getInsetsForGravity(inset: Int, gravity: Int): Insets { if ((gravity and Gravity.BOTTOM) == Gravity.BOTTOM) { Loading