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

Commit 449d3fc1 authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Remove screenshot dismiss button

It's redundant with the ability to dismiss via back button, and
accessibility guidance is not to condition on whether accessibility is
enabled if possible.

Bug: 433457712
Test: manual (with talkback on)
Flag: EXEMPT bugfix
Change-Id: I8de475275049f40214daf0e1ec96a78ab68b8440
parent f47269c5
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -16,25 +16,22 @@

package com.android.systemui.screenshot.ui.viewmodel

import android.view.accessibility.AccessibilityManager
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock

@SmallTest
@RunWith(AndroidJUnit4::class)
class ScreenshotViewModelTest : SysuiTestCase() {
    private val accessibilityManager: AccessibilityManager = mock(AccessibilityManager::class.java)
    private val appearance = ActionButtonAppearance(null, "Label", "Description")
    private val onclick = {}

    @Test
    fun testAddAction() {
        val viewModel = ScreenshotViewModel(accessibilityManager)
        val viewModel = ScreenshotViewModel()

        assertThat(viewModel.actions.value).isEmpty()

@@ -50,7 +47,7 @@ class ScreenshotViewModelTest : SysuiTestCase() {

    @Test
    fun testRemoveAction() {
        val viewModel = ScreenshotViewModel(accessibilityManager)
        val viewModel = ScreenshotViewModel()
        val firstId = viewModel.addAction(ActionButtonAppearance(null, "", ""), false, {})
        val secondId = viewModel.addAction(appearance, false, onclick)

@@ -69,7 +66,7 @@ class ScreenshotViewModelTest : SysuiTestCase() {

    @Test
    fun testUpdateActionAppearance() {
        val viewModel = ScreenshotViewModel(accessibilityManager)
        val viewModel = ScreenshotViewModel()
        val id = viewModel.addAction(appearance, false, onclick)
        val otherAppearance = ActionButtonAppearance(null, "Other", "Other")

@@ -83,7 +80,7 @@ class ScreenshotViewModelTest : SysuiTestCase() {

    companion object {
        init {
            SysuiTestCase.waitUntilMockitoCanBeInitialized()
            waitUntilMockitoCanBeInitialized()
        }
    }
}
+0 −22
Original line number Diff line number Diff line
@@ -117,28 +117,6 @@
            android:elevation="5dp"
            app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"
            app:layout_constraintEnd_toEndOf="@id/screenshot_preview_border"/>
        <FrameLayout
            android:id="@+id/screenshot_dismiss_button"
            android:layout_width="@dimen/overlay_dismiss_button_tappable_size"
            android:layout_height="@dimen/overlay_dismiss_button_tappable_size"
            android:elevation="7dp"
            android:visibility="gone"
            app:layout_constraintStart_toEndOf="@id/screenshot_preview"
            app:layout_constraintEnd_toEndOf="@id/screenshot_preview"
            app:layout_constraintTop_toTopOf="@id/screenshot_preview"
            app:layout_constraintBottom_toTopOf="@id/screenshot_preview"
            android:contentDescription="@string/screenshot_dismiss_description">
            <ImageView
                android:id="@+id/screenshot_dismiss_image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="@dimen/overlay_dismiss_button_margin"
                android:background="@drawable/circular_background"
                android:backgroundTint="@androidprv:color/materialColorPrimary"
                android:tint="@androidprv:color/materialColorOnPrimary"
                android:padding="4dp"
                android:src="@drawable/ic_close"/>
        </FrameLayout>
        <ImageView
            android:id="@+id/screenshot_scrollable_preview"
            android:layout_width="wrap_content"
+0 −9
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.screenshot.dagger;

import android.app.Service;
import android.content.Context;
import android.view.accessibility.AccessibilityManager;

import com.android.internal.util.ScreenshotHelper;
import com.android.systemui.dagger.SysUISingleton;
@@ -38,7 +37,6 @@ import com.android.systemui.screenshot.appclips.AppClipsService;
import com.android.systemui.screenshot.message.MessageModule;
import com.android.systemui.screenshot.policy.ScreenshotPolicyModule;
import com.android.systemui.screenshot.proxy.ScreenshotProxyModule;
import com.android.systemui.screenshot.ui.viewmodel.ScreenshotViewModel;

import dagger.Binds;
import dagger.Module;
@@ -83,13 +81,6 @@ public abstract class ScreenshotModule {
    abstract ScreenshotSoundController bindScreenshotSoundController(
            ScreenshotSoundControllerImpl screenshotSoundProviderImpl);

    @Provides
    @SysUISingleton
    static ScreenshotViewModel providesScreenshotViewModel(
            AccessibilityManager accessibilityManager) {
        return new ScreenshotViewModel(accessibilityManager);
    }

    @Provides
    static InteractiveScreenshotHandler.Factory providesScreenshotController(
            ScreenshotController.Factory screenshotController) {
+0 −2
Original line number Diff line number Diff line
@@ -63,14 +63,12 @@ class ScreenshotAnimationController(
        listOf<View>(
            view.requireViewById(R.id.screenshot_preview_border),
            view.requireViewById(R.id.screenshot_badge),
            view.requireViewById(R.id.screenshot_dismiss_button),
        )
    private val fadeUI =
        listOf<View>(
            view.requireViewById(R.id.screenshot_preview_border),
            view.requireViewById(R.id.actions_container_background),
            view.requireViewById(R.id.screenshot_badge),
            view.requireViewById(R.id.screenshot_dismiss_button),
            view.requireViewById(R.id.screenshot_message_container),
        )

+0 −3
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
    private val tmpRect = Rect()
    private lateinit var actionsContainerBackground: View
    private lateinit var actionsContainer: View
    private lateinit var dismissButton: View

    // Prepare an internal `GestureDetector` to determine when we can initiate a touch-interception
    // session (with the client's provided `onTouchInterceptListener`). We delegate out to their
@@ -108,7 +107,6 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
        screenshotStatic = requireViewById(R.id.screenshot_static)
        actionsContainerBackground = requireViewById(R.id.actions_container_background)
        actionsContainer = requireViewById(R.id.actions_container)
        dismissButton = requireViewById(R.id.screenshot_dismiss_button)

        // Configure to extend the timeout during ongoing gestures (i.e. scrolls) that are already
        // being handled by our child views.
@@ -234,7 +232,6 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
        val padding = FloatingWindowUtil.dpToPx(displayMetrics, -1 * TOUCH_PADDING_DP).toInt()
        swipeRegion.addInsetView(screenshotPreview, padding)
        swipeRegion.addInsetView(actionsContainerBackground, padding)
        swipeRegion.addInsetView(dismissButton, padding)
        findViewById<View>(R.id.screenshot_message_container)?.let {
            swipeRegion.addInsetView(it, padding)
        }
Loading