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

Commit f1abd1ce authored by Colin Cross's avatar Colin Cross Committed by Android (Google) Code Review
Browse files

Merge changes from topic "cherrypicker-L89500000962957882:N78800001403169312" into aosp-main-future

* changes:
  fix(non linear font scaling): fix test timeout flakiness
  Fix flaky tests
  Fixes @Nullable issues SystemUI-tests
  Fixes @Nullable issues in System UI and WMShell.
  Fix more kotlin nullable errors in services.permission
  Fix runtime kotlin nullable error in ScreenshotDetectionControllerTest
  Fix NullPointerException in ControlsRequestDialogTest
  Fix tests broken by @NonNull annotation fix
  Fixes more  @Nullable issues in System UI and WMShell.
parents 63cfd0e9 e99f90e8
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ public class FontScaleConverterActivityTest {
            );
        });

        PollingCheck.waitFor(/* timeout= */ 5000, () -> {
        PollingCheck.waitFor(/* timeout= */ 7000, () -> {
            AtomicBoolean isActivityAtCorrectScale = new AtomicBoolean(false);
            rule.getScenario().onActivity(activity ->
                    isActivityAtCorrectScale.set(
@@ -146,12 +146,7 @@ public class FontScaleConverterActivityTest {
                                .fontScale == fontScale
                    )
            );
            return isActivityAtCorrectScale.get() && InstrumentationRegistry
                    .getInstrumentation()
                    .getContext()
                    .getResources()
                    .getConfiguration()
                    .fontScale == fontScale;
            return isActivityAtCorrectScale.get();
        });
    }

+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
+17 −13
Original line number Diff line number Diff line
@@ -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())
        }
+10 −8
Original line number Diff line number Diff line
@@ -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))
Loading