summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt8
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt6
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt30
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt18
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt11
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt5
6 files changed, 44 insertions, 34 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt
index e95e8e5cdaea..1b41f793311d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ManageEducationView.kt
@@ -41,9 +41,9 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
private val ANIMATE_DURATION: Long = 200
private val positioner: BubblePositioner = positioner
- private val manageView by lazy { findViewById<ViewGroup>(R.id.manage_education_view) }
- private val manageButton by lazy { findViewById<Button>(R.id.manage_button) }
- private val gotItButton by lazy { findViewById<Button>(R.id.got_it) }
+ private val manageView by lazy { requireViewById<ViewGroup>(R.id.manage_education_view) }
+ private val manageButton by lazy { requireViewById<Button>(R.id.manage_button) }
+ private val gotItButton by lazy { requireViewById<Button>(R.id.got_it) }
private var isHiding = false
private var realManageButtonRect = Rect()
@@ -122,7 +122,7 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
manageButton
.setOnClickListener {
hide()
- expandedView.findViewById<View>(R.id.manage_button).performClick()
+ expandedView.requireViewById<View>(R.id.manage_button).performClick()
}
gotItButton.setOnClickListener { hide() }
setOnClickListener { hide() }
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt
index d0598cd28582..5e3a077a3716 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt
@@ -48,9 +48,9 @@ class StackEducationView constructor(
private val positioner: BubblePositioner = positioner
private val controller: BubbleController = controller
- private val view by lazy { findViewById<View>(R.id.stack_education_layout) }
- private val titleTextView by lazy { findViewById<TextView>(R.id.stack_education_title) }
- private val descTextView by lazy { findViewById<TextView>(R.id.stack_education_description) }
+ private val view by lazy { requireViewById<View>(R.id.stack_education_layout) }
+ private val titleTextView by lazy { requireViewById<TextView>(R.id.stack_education_title) }
+ private val descTextView by lazy { requireViewById<TextView>(R.id.stack_education_description) }
var isHiding = false
private set
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt
index 91bb155d9d01..8d1433595223 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt
@@ -398,17 +398,18 @@ class DesktopTasksController(
request: TransitionRequestInfo
): WindowContainerTransaction? {
// Check if we should skip handling this transition
+ val triggerTask = request.triggerTask
val shouldHandleRequest =
when {
// Only handle open or to front transitions
request.type != TRANSIT_OPEN && request.type != TRANSIT_TO_FRONT -> false
// Only handle when it is a task transition
- request.triggerTask == null -> false
+ triggerTask == null -> false
// Only handle standard type tasks
- request.triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> false
+ triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> false
// Only handle fullscreen or freeform tasks
- request.triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
- request.triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> false
+ triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
+ triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> false
// Otherwise process it
else -> true
}
@@ -417,27 +418,30 @@ class DesktopTasksController(
return null
}
- val task: RunningTaskInfo = request.triggerTask
- val activeTasks = desktopModeTaskRepository.getActiveTasks(task.displayId)
+ if (triggerTask == null) {
+ return null
+ }
+
+ val activeTasks = desktopModeTaskRepository.getActiveTasks(triggerTask.displayId)
// Check if we should switch a fullscreen task to freeform
- if (task.windowingMode == WINDOWING_MODE_FULLSCREEN) {
+ if (triggerTask.windowingMode == WINDOWING_MODE_FULLSCREEN) {
// If there are any visible desktop tasks, switch the task to freeform
if (activeTasks.any { desktopModeTaskRepository.isVisibleTask(it) }) {
KtProtoLog.d(
WM_SHELL_DESKTOP_MODE,
"DesktopTasksController: switch fullscreen task to freeform on transition" +
" taskId=%d",
- task.taskId
+ triggerTask.taskId
)
return WindowContainerTransaction().also { wct ->
- addMoveToDesktopChanges(wct, task.token)
+ addMoveToDesktopChanges(wct, triggerTask.token)
}
}
}
// CHeck if we should switch a freeform task to fullscreen
- if (task.windowingMode == WINDOWING_MODE_FREEFORM) {
+ if (triggerTask.windowingMode == WINDOWING_MODE_FREEFORM) {
// If no visible desktop tasks, switch this task to freeform as the transition came
// outside of this controller
if (activeTasks.none { desktopModeTaskRepository.isVisibleTask(it) }) {
@@ -445,10 +449,10 @@ class DesktopTasksController(
WM_SHELL_DESKTOP_MODE,
"DesktopTasksController: switch freeform task to fullscreen oon transition" +
" taskId=%d",
- task.taskId
+ triggerTask.taskId
)
return WindowContainerTransaction().also { wct ->
- addMoveToFullscreenChanges(wct, task.token)
+ addMoveToFullscreenChanges(wct, triggerTask.token)
}
}
}
@@ -471,7 +475,7 @@ class DesktopTasksController(
token: WindowContainerToken
) {
wct.setWindowingMode(token, WINDOWING_MODE_FULLSCREEN)
- wct.setBounds(token, null)
+ wct.setBounds(token, Rect())
if (isDesktopDensityOverrideSet()) {
wct.setDensityDpi(token, getFullscreenDensityDpi())
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt
index b67acd5c15bb..1aacb4dd739c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeAppControlsWindowDecorationViewHolder.kt
@@ -23,13 +23,13 @@ internal class DesktopModeAppControlsWindowDecorationViewHolder(
appIcon: Drawable
) : DesktopModeWindowDecorationViewHolder(rootView) {
- private val captionView: View = rootView.findViewById(R.id.desktop_mode_caption)
- private val captionHandle: View = rootView.findViewById(R.id.caption_handle)
- private val openMenuButton: View = rootView.findViewById(R.id.open_menu_button)
- private val closeWindowButton: ImageButton = rootView.findViewById(R.id.close_window)
- private val expandMenuButton: ImageButton = rootView.findViewById(R.id.expand_menu_button)
- private val appNameTextView: TextView = rootView.findViewById(R.id.application_name)
- private val appIconImageView: ImageView = rootView.findViewById(R.id.application_icon)
+ private val captionView: View = rootView.requireViewById(R.id.desktop_mode_caption)
+ private val captionHandle: View = rootView.requireViewById(R.id.caption_handle)
+ private val openMenuButton: View = rootView.requireViewById(R.id.open_menu_button)
+ private val closeWindowButton: ImageButton = rootView.requireViewById(R.id.close_window)
+ private val expandMenuButton: ImageButton = rootView.requireViewById(R.id.expand_menu_button)
+ private val appNameTextView: TextView = rootView.requireViewById(R.id.application_name)
+ private val appIconImageView: ImageView = rootView.requireViewById(R.id.application_icon)
init {
captionView.setOnTouchListener(onCaptionTouchListener)
@@ -45,7 +45,9 @@ internal class DesktopModeAppControlsWindowDecorationViewHolder(
override fun bindData(taskInfo: RunningTaskInfo) {
val captionDrawable = captionView.background as GradientDrawable
- captionDrawable.setColor(taskInfo.taskDescription.statusBarColor)
+ taskInfo.taskDescription?.statusBarColor?.let {
+ captionDrawable.setColor(it)
+ }
closeWindowButton.imageTintList = ColorStateList.valueOf(
getCaptionCloseButtonColor(taskInfo))
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt
index 47a12a0cb71c..9374ac95e83d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeFocusedWindowDecorationViewHolder.kt
@@ -17,8 +17,8 @@ internal class DesktopModeFocusedWindowDecorationViewHolder(
onCaptionButtonClickListener: View.OnClickListener
) : DesktopModeWindowDecorationViewHolder(rootView) {
- private val captionView: View = rootView.findViewById(R.id.desktop_mode_caption)
- private val captionHandle: ImageButton = rootView.findViewById(R.id.caption_handle)
+ private val captionView: View = rootView.requireViewById(R.id.desktop_mode_caption)
+ private val captionHandle: ImageButton = rootView.requireViewById(R.id.caption_handle)
init {
captionView.setOnTouchListener(onCaptionTouchListener)
@@ -27,9 +27,10 @@ internal class DesktopModeFocusedWindowDecorationViewHolder(
}
override fun bindData(taskInfo: RunningTaskInfo) {
- val captionColor = taskInfo.taskDescription.statusBarColor
- val captionDrawable = captionView.background as GradientDrawable
- captionDrawable.setColor(captionColor)
+ taskInfo.taskDescription?.statusBarColor?.let { captionColor ->
+ val captionDrawable = captionView.background as GradientDrawable
+ captionDrawable.setColor(captionColor)
+ }
captionHandle.imageTintList = ColorStateList.valueOf(getCaptionHandleBarColor(taskInfo))
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt
index 514ea52cb8ae..b4ecbf5f3e32 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt
@@ -23,6 +23,9 @@ internal abstract class DesktopModeWindowDecorationViewHolder(rootView: View) {
* with the caption background color.
*/
protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean {
- return Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5
+ return taskInfo.taskDescription
+ ?.let { taskDescription ->
+ Color.valueOf(taskDescription.statusBarColor).luminance() < 0.5
+ } ?: false
}
}