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

Commit 162280b4 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

Fixes @Nullable issues in System UI and WMShell.

Test: followed these steps:
1. Patched in https://r.android.com/2688146
2. m sysuig
3. Fix compilation issues
4. Repeat 2 and 3 until done

Fix: 294098415
Change-Id: I74cc61fd87819be7302590d788c3c230bff57544
parent b31b6675
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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() }
+3 −3
Original line number Diff line number Diff line
@@ -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
+20 −19
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ class DesktopTasksController(
            task.taskId
        )
        val wct = WindowContainerTransaction()
        wct.setBounds(task.token, null)
        wct.setBounds(task.token, Rect())

        if (Transitions.ENABLE_SHELL_TRANSITIONS) {
            enterDesktopTaskTransitionHandler.startCancelMoveToDesktopMode(wct,
@@ -533,6 +533,7 @@ class DesktopTasksController(
        )
        // Check if we should skip handling this transition
        var reason = ""
        val triggerTask = request.triggerTask
        val shouldHandleRequest =
            when {
                // Only handle open or to front transitions
@@ -541,19 +542,19 @@ class DesktopTasksController(
                    false
                }
                // Only handle when it is a task transition
                request.triggerTask == null -> {
                triggerTask == null -> {
                    reason = "triggerTask is null"
                    false
                }
                // Only handle standard type tasks
                request.triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> {
                    reason = "activityType not handled (${request.triggerTask.activityType})"
                triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> {
                    reason = "activityType not handled (${triggerTask.activityType})"
                    false
                }
                // Only handle fullscreen or freeform tasks
                request.triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
                        request.triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> {
                    reason = "windowingMode not handled (${request.triggerTask.windowingMode})"
                triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
                        triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> {
                    reason = "windowingMode not handled (${triggerTask.windowingMode})"
                    false
                }
                // Otherwise process it
@@ -569,9 +570,8 @@ class DesktopTasksController(
            return null
        }

        val task: RunningTaskInfo = request.triggerTask

        val result = when {
        val result = triggerTask?.let { task ->
            when {
                // If display has tasks stashed, handle as stashed launch
                desktopModeTaskRepository.isStashed(task.displayId) -> handleStashedTaskLaunch(task)
                // Check if fullscreen task should be updated
@@ -582,6 +582,7 @@ class DesktopTasksController(
                    null
                }
            }
        }
        KtProtoLog.v(
                WM_SHELL_DESKTOP_MODE,
                "DesktopTasksController: handleRequest result=%s",
@@ -686,7 +687,7 @@ class DesktopTasksController(
            WINDOWING_MODE_FULLSCREEN
        }
        wct.setWindowingMode(taskInfo.token, targetWindowingMode)
        wct.setBounds(taskInfo.token, null)
        wct.setBounds(taskInfo.token, Rect())
        if (isDesktopDensityOverrideSet()) {
            wct.setDensityDpi(taskInfo.token, getFullscreenDensityDpi())
        }
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ class ToggleResizeDesktopTaskTransitionHandler(
    ): Boolean {
        val change = findRelevantChange(info)
        val leash = change.leash
        val taskId = change.taskInfo.taskId
        val taskId = checkNotNull(change.taskInfo).taskId
        val startBounds = change.startAbsBounds
        val endBounds = change.endAbsBounds
        val windowDecor =
+11 −9
Original line number Diff line number Diff line
@@ -23,14 +23,14 @@ 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 maximizeWindowButton: ImageButton = rootView.findViewById(R.id.maximize_window)
    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 maximizeWindowButton: ImageButton = rootView.requireViewById(R.id.maximize_window)
    private val appNameTextView: TextView = rootView.requireViewById(R.id.application_name)
    private val appIconImageView: ImageView = rootView.requireViewById(R.id.application_icon)

    init {
        captionView.setOnTouchListener(onCaptionTouchListener)
@@ -47,7 +47,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))
Loading