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

Commit b505e775 authored by Matt Casey's avatar Matt Casey
Browse files

Structure for screenshot detection notification.

The notification itself won't be hooked up until android U.

- The message container now has two (View.GONE) children, one for work
  profile first run, the other for screenshot detection.
- All interactions with this space go through
  MessageContainerController.
- Populating the message space has two phases: figuring out which
  messages want to be shown, then showing no more than one. These are
  implemented as separate methods on each of
  ScreenshotDetectionController and WorkProfileMessageController.
  MessageContainerController no longer knows the details of these views.
- ScreenshotDetectionController doesn't do the actual detection yet, but
  the UI bits have been manually tested.
- Moved the MessageContainerController.onScreenshotTaken calls to right
  after the entrance animation completes in ScreenshotController.

Flags: Added a new SCREENSHOT_DETECTION flag. The detection and relevant
       display code are protected by this. All other changes to the
       message space are protected by the work profile flag.
Test: atest com.android.systemui.screenshot
Bug: 265937777
Change-Id: Id1e51ffcb322839badf4f1d81a5aafceb0b67a06
parent 6ce85f69
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/screenshot_detection_notice"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:padding="12dp"
    android:visibility="gone">

    <TextView
        android:id="@+id/screenshot_detection_notice_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:lineHeight="24sp"
        android:textSize="18sp" />
</FrameLayout>
+5 −3
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@
        android:orientation="horizontal"
        app:layout_constraintGuide_end="0dp" />

    <androidx.constraintlayout.widget.ConstraintLayout
    <FrameLayout
        android:id="@+id/screenshot_message_container"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
@@ -145,10 +145,12 @@
        android:paddingVertical="@dimen/overlay_action_container_padding_vertical"
        android:elevation="4dp"
        android:background="@drawable/action_chip_container_background"
        android:visibility="invisible"
        android:visibility="gone"
        app:layout_constraintTop_toBottomOf="@id/guideline"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        >
    </androidx.constraintlayout.widget.ConstraintLayout>
        <include layout="@layout/screenshot_work_profile_first_run" />
        <include layout="@layout/screenshot_detection_notice" />
    </FrameLayout>
</com.android.systemui.screenshot.DraggableConstraintLayout>
+9 −17
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<merge
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    android:id="@+id/work_profile_first_run"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:visibility="gone">
    <ImageView
        android:id="@+id/screenshot_message_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:paddingEnd="4dp"
        android:src="@drawable/ic_work_app_badge"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@id/screenshot_message_content"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>
        android:src="@drawable/ic_work_app_badge"/>

    <TextView
        android:id="@+id/screenshot_message_content"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="start"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@id/screenshot_message_icon"
        app:layout_constraintEnd_toStartOf="@id/message_dismiss_button"/>
        android:layout_weight="1"
        android:layout_gravity="start"/>

    <FrameLayout
        android:id="@+id/message_dismiss_button"
        android:layout_width="@dimen/overlay_dismiss_button_tappable_size"
        android:layout_height="@dimen/overlay_dismiss_button_tappable_size"
        app:layout_constraintStart_toEndOf="@id/screenshot_message_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:contentDescription="@string/screenshot_dismiss_work_profile">
        <ImageView
            android:layout_width="match_parent"
@@ -38,4 +30,4 @@
            android:layout_margin="@dimen/overlay_dismiss_button_margin"
            android:src="@drawable/overlay_cancel"/>
    </FrameLayout>
</merge>
</LinearLayout>
+4 −0
Original line number Diff line number Diff line
@@ -243,6 +243,10 @@
    <string name="screenshot_work_profile_notification">Work screenshots are saved in the <xliff:g id="app" example="Work Files">%1$s</xliff:g> app</string>
    <!-- Default name referring to the app on the device that lets the user browse stored files. [CHAR LIMIT=NONE] -->
    <string name="screenshot_default_files_app_name">Files</string>
    <!-- A notice shown to the user to indicate that an app has detected the screenshot that the user has just taken. [CHAR LIMIT=75] -->
    <string name="screenshot_detected_template"><xliff:g id="appName" example="Google Chrome">%1$s</xliff:g> detected this screenshot.</string>
    <!-- A notice shown to the user to indicate that multiple apps have detected the screenshot that the user has just taken. [CHAR LIMIT=75] -->
    <string name="screenshot_detected_multiple_template"><xliff:g id="appName" example="Google Chrome">%1$s</xliff:g> and other open apps detected this screenshot.</string>

    <!-- Notification title displayed for screen recording [CHAR LIMIT=50]-->
    <string name="screenrecord_name">Screen Recorder</string>
+3 −0
Original line number Diff line number Diff line
@@ -516,6 +516,9 @@ object Flags {
    // TODO(b/264916608): Tracking Bug
    @JvmField val SCREENSHOT_METADATA = unreleasedFlag(1302, "screenshot_metadata")

    // TODO(b/266955521): Tracking bug
    @JvmField val SCREENSHOT_DETECTION = unreleasedFlag(1303, "screenshot_detection")

    // 1400 - columbus
    // TODO(b/254512756): Tracking Bug
    val QUICK_TAP_IN_PCC = releasedFlag(1400, "quick_tap_in_pcc")
Loading