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

Commit 98484db4 authored by Alex Chau's avatar Alex Chau
Browse files

Set DigitalWellBeingToast to GONE when there is no limit

- Surprisingly swithcing between GONE and VISIBLE doesn't cause a jank when swiping up
- Having DigitalWellBeingToast GONE should reduce the amount of time to layout RecentsView when there is no banner, which should fix b/364621823
- It might or might not reduce memory usage in b/364568201
- Also add missing accessibiltiy node for DigitalWellBeingToast

Bug: 364621823
Test: Swipe up with the app having DWB banner in different index, no jank when landing to Overivew
Flag: EXEMPT BUG_FIX
Change-Id: Ibf5a7f5318de509fe572779dd774dce71881aabe
parent 359fb55a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -27,4 +27,5 @@
    android:textColor="?attr/materialColorOnSecondaryFixed"
    android:textSize="14sp"
    android:autoSizeTextType="uniform"
    android:autoSizeMaxTextSize="14sp"/>
 No newline at end of file
    android:autoSizeMaxTextSize="14sp"
    android:visibility="gone"/>
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -49,6 +49,5 @@
        android:layout_width="wrap_content" />

    <include layout="@layout/digital_wellbeing_toast"
        android:id="@+id/digital_wellbeing_toast"
        android:visibility="invisible"/>
        android:id="@+id/digital_wellbeing_toast"/>
</com.android.quickstep.views.TaskView>
 No newline at end of file
+2 −4
Original line number Diff line number Diff line
@@ -75,10 +75,8 @@
        android:layout_width="wrap_content" />

    <include layout="@layout/digital_wellbeing_toast"
        android:id="@+id/digital_wellbeing_toast"
        android:visibility="invisible"/>
        android:id="@+id/digital_wellbeing_toast"/>

    <include layout="@layout/digital_wellbeing_toast"
        android:id="@+id/bottomRight_digital_wellbeing_toast"
        android:visibility="invisible"/>
        android:id="@+id/bottomRight_digital_wellbeing_toast"/>
</com.android.quickstep.views.GroupedTaskView>
 No newline at end of file
+7 −6
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import androidx.annotation.StringRes
import androidx.annotation.VisibleForTesting
import androidx.core.util.component1
import androidx.core.util.component2
import androidx.core.view.isVisible
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.util.Executors
@@ -108,18 +109,18 @@ constructor(
    }

    private fun setNoLimit() {
        isVisible = false
        hasLimit = false
        setContentDescription(appUsageLimitTimeMs = -1, appRemainingTimeMs = -1)
        visibility = INVISIBLE
        appRemainingTimeMs = -1
        setContentDescription(appUsageLimitTimeMs = -1, appRemainingTimeMs = -1)
    }

    private fun setLimit(appUsageLimitTimeMs: Long, appRemainingTimeMs: Long) {
        this.appRemainingTimeMs = appRemainingTimeMs
        isVisible = true
        hasLimit = true
        text = Utilities.prefixTextWithIcon(context, R.drawable.ic_hourglass_top, getBannerText())
        visibility = VISIBLE
        this.appRemainingTimeMs = appRemainingTimeMs
        setContentDescription(appUsageLimitTimeMs, appRemainingTimeMs)
        text = Utilities.prefixTextWithIcon(context, R.drawable.ic_hourglass_top, getBannerText())
    }

    private fun setContentDescription(appUsageLimitTimeMs: Long, appRemainingTimeMs: Long) {
@@ -172,7 +173,7 @@ constructor(

    /** Mark the DWB toast as destroyed and hide it. */
    fun destroy() {
        visibility = INVISIBLE
        isVisible = false
        isDestroyed = true
    }

+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ class TaskContainer(
        addAccessibleChildToList(iconView.asView(), outChildren)
        addAccessibleChildToList(snapshotView, outChildren)
        showWindowsView?.let { addAccessibleChildToList(it, outChildren) }
        digitalWellBeingToast?.let { addAccessibleChildToList(it, outChildren) }
    }

    private fun addAccessibleChildToList(view: View, outChildren: ArrayList<View>) {