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

Commit 618e46f6 authored by Ajinkya Chalke's avatar Ajinkya Chalke
Browse files

Implement the new screenshot activities.

Bug: 251205791
Test: CTS test
Change-Id: I63bebff540c450c106fa48d7e9c5a221f5cd51a3
parent d263cdca
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -418,6 +418,34 @@
                 android:permission="com.android.systemui.permission.SELF"
                 android:exported="false" />

        <activity android:name=".screenshot.AppClipsTrampolineActivity"
            android:theme="@style/AppClipsTrampolineActivity"
            android:label="@string/screenshot_preview_description"
            android:permission="android.permission.LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE"
            android:exported="true">
            <intent-filter android:priority="1">
                <action android:name="android.intent.action.LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name=".screenshot.AppClipsActivity"
            android:theme="@style/AppClipsActivity"
            android:process=":appclips.screenshot"
            android:label="@string/screenshot_preview_description"
            android:permission="com.android.systemui.permission.SELF"
            android:excludeFromRecents="true"
            android:exported="false"
            android:noHistory="true" />

        <service android:name=".screenshot.appclips.AppClipsScreenshotHelperService"
            android:permission="com.android.systemui.permission.SELF"
            android:exported="false" />

        <service android:name=".screenshot.appclips.AppClipsService"
            android:permission="android.permission.LAUNCH_CAPTURE_CONTENT_ACTIVITY_FOR_NOTE"
            android:exported="true" />

        <service android:name=".screenrecord.RecordingService"
                 android:foregroundServiceType="systemExempted"/>

+105 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@null"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/save"
        style="@android:style/Widget.DeviceDefault.Button.Colored"
        android:layout_width="wrap_content"
        android:layout_height="48dp"
        android:text="@string/app_clips_save_add_to_note"
        android:layout_marginStart="8dp"
        android:background="@drawable/overlay_button_background"
        android:textColor="?android:textColorSecondary"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toTopOf="@id/preview" />

    <Button
        android:id="@+id/cancel"
        style="@android:style/Widget.DeviceDefault.Button.Colored"
        android:layout_width="wrap_content"
        android:layout_height="48dp"
        android:text="@android:string/cancel"
        android:layout_marginStart="6dp"
        android:background="@drawable/overlay_button_background"
        android:textColor="?android:textColorSecondary"
        app:layout_constraintStart_toEndOf="@id/save"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toTopOf="@id/preview" />

    <ImageView
        android:id="@+id/preview"
        android:layout_width="0px"
        android:layout_height="0px"
        android:paddingHorizontal="48dp"
        android:paddingTop="8dp"
        android:paddingBottom="42dp"
        android:contentDescription="@string/screenshot_preview_description"
        app:layout_constrainedHeight="true"
        app:layout_constrainedWidth="true"
        app:layout_constraintTop_toBottomOf="@id/save"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        tools:background="?android:colorBackground"
        tools:minHeight="100dp"
        tools:minWidth="100dp" />

    <com.android.systemui.screenshot.CropView
        android:id="@+id/crop_view"
        android:layout_width="0px"
        android:layout_height="0px"
        android:paddingTop="8dp"
        android:paddingBottom="42dp"
        app:layout_constrainedHeight="true"
        app:layout_constrainedWidth="true"
        app:layout_constraintTop_toTopOf="@id/preview"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:handleThickness="@dimen/screenshot_crop_handle_thickness"
        app:handleColor="?android:attr/colorAccent"
        app:scrimColor="?android:colorBackgroundFloating"
        app:scrimAlpha="128"
        app:containerBackgroundColor="?android:colorBackgroundFloating"
        tools:background="?android:colorBackground"
        tools:minHeight="100dp"
        tools:minWidth="100dp" />

    <com.android.systemui.screenshot.MagnifierView
        android:id="@+id/magnifier"
        android:visibility="invisible"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:elevation="2dp"
        app:layout_constraintTop_toTopOf="@id/preview"
        app:layout_constraintLeft_toLeftOf="parent"
        app:handleThickness="@dimen/screenshot_crop_handle_thickness"
        app:handleColor="?android:attr/colorAccent"
        app:scrimColor="?android:colorBackgroundFloating"
        app:scrimAlpha="128"
        app:borderThickness="4dp"
        app:borderColor="#fff" />
</androidx.constraintlayout.widget.ConstraintLayout>
+7 −0
Original line number Diff line number Diff line
@@ -445,6 +445,13 @@
         screenshot has been saved to work profile. If blank, a default icon will be shown. -->
    <string name="config_sceenshotWorkProfileFilesApp" translatable="false"></string>

    <!-- The component name of the screenshot editing activity that provides the App Clips flow.
         The App Clips flow includes taking a screenshot, showing user screenshot cropping activity
         and finally letting user send the screenshot to the calling notes app. This activity
         should not send the screenshot to the calling activity without user consent. -->
    <string name="config_screenshotAppClipsActivityComponent" translatable="false"
            >com.android.systemui/com.android.systemui.screenshot.AppClipsActivity</string>

    <!-- Remote copy default activity.  Must handle REMOTE_COPY_ACTION intents.
     This name is in the ComponentName flattened format (package/class)  -->
    <string name="config_remoteCopyPackage" translatable="false"></string>
+2 −0
Original line number Diff line number Diff line
@@ -247,6 +247,8 @@
    <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>
    <!-- Add to note button used in App Clips flow to return the saved screenshot image to notes app. [CHAR LIMIT=NONE] -->
    <string name="app_clips_save_add_to_note">Add to note</string>

    <!-- Notification title displayed for screen recording [CHAR LIMIT=50]-->
    <string name="screenrecord_name">Screen Recorder</string>
+12 −0
Original line number Diff line number Diff line
@@ -758,6 +758,18 @@
    </style>

    <!-- Screenshots -->
    <style name="AppClipsTrampolineActivity">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">true</item>
    </style>

    <style name="AppClipsActivity" parent="LongScreenshotActivity">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>

    <style name="LongScreenshotActivity" parent="@android:style/Theme.DeviceDefault.DayNight">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowLightStatusBar">true</item>
Loading