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

Commit 80a9cb51 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8944446 from 4786aafa to tm-qpr1-release

Change-Id: Ib2fba97823ea561d248b1e45d0bd0b94d834afa3
parents f8b0aaa1 4786aafa
Loading
Loading
Loading
Loading
+48 −31
Original line number Diff line number Diff line
package com.android.internal.util;

import static android.content.Intent.ACTION_USER_SWITCHED;
import static android.view.WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -27,7 +28,6 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;
import android.view.WindowManager;
import android.view.WindowManager.ScreenshotSource;
import android.view.WindowManager.ScreenshotType;

@@ -42,10 +42,15 @@ public class ScreenshotHelper {
    public static final int SCREENSHOT_MSG_PROCESS_COMPLETE = 2;

    /**
     * Describes a screenshot request (to make it easier to pass data through to the handler).
     * Describes a screenshot request.
     */
    public static class ScreenshotRequest implements Parcelable {
        @ScreenshotType
        private final int mType;

        @ScreenshotSource
        private final int mSource;

        private final Bundle mBitmapBundle;
        private final Rect mBoundsInScreen;
        private final Insets mInsets;
@@ -53,20 +58,27 @@ public class ScreenshotHelper {
        private final int mUserId;
        private final ComponentName mTopComponent;

        @VisibleForTesting
        public ScreenshotRequest(int source) {
            mSource = source;
            mBitmapBundle = null;
            mBoundsInScreen = null;
            mInsets = null;
            mTaskId = -1;
            mUserId = -1;
            mTopComponent = null;

        public ScreenshotRequest(@ScreenshotType int type, @ScreenshotSource int source) {
            this(type, source, /* topComponent */ null);
        }

        @VisibleForTesting
        public ScreenshotRequest(int source, Bundle bitmapBundle, Rect boundsInScreen,
                Insets insets, int taskId, int userId, ComponentName topComponent) {
        public ScreenshotRequest(@ScreenshotType int type, @ScreenshotSource int source,
                ComponentName topComponent) {
            this(type,
                source,
                /* bitmapBundle*/ null,
                /* boundsInScreen */ null,
                /* insets */ null,
                /* taskId */ -1,
                /* userId */ -1,
                topComponent);
        }

        public ScreenshotRequest(@ScreenshotType int type, @ScreenshotSource int source,
                Bundle bitmapBundle, Rect boundsInScreen, Insets insets, int taskId, int userId,
                ComponentName topComponent) {
            mType = type;
            mSource = source;
            mBitmapBundle = bitmapBundle;
            mBoundsInScreen = boundsInScreen;
@@ -77,6 +89,7 @@ public class ScreenshotHelper {
        }

        ScreenshotRequest(Parcel in) {
            mType = in.readInt();
            mSource = in.readInt();
            if (in.readInt() == 1) {
                mBitmapBundle = in.readBundle(getClass().getClassLoader());
@@ -96,6 +109,12 @@ public class ScreenshotHelper {
            }
        }

        @ScreenshotType
        public int getType() {
            return mType;
        }

        @ScreenshotSource
        public int getSource() {
            return mSource;
        }
@@ -131,6 +150,7 @@ public class ScreenshotHelper {

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(mType);
            dest.writeInt(mSource);
            if (mBitmapBundle == null) {
                dest.writeInt(0);
@@ -208,8 +228,7 @@ public class ScreenshotHelper {
         * Extracts the Bitmap added to a Bundle with {@link #hardwareBitmapToBundle(Bitmap)} .}
         *
         * <p>This Bitmap contains the HardwareBuffer from the original caller, be careful passing
         * this
         * Bitmap on to any other source.
         * this Bitmap on to any other source.
         *
         * @param bundle containing the bitmap
         * @return a hardware Bitmap
@@ -261,16 +280,16 @@ public class ScreenshotHelper {
     * Added to support reducing unit test duration; the method variant without a timeout argument
     * is recommended for general use.
     *
     * @param screenshotType The type of screenshot, defined by {@link ScreenshotType}
     * @param type The type of screenshot, defined by {@link ScreenshotType}
     * @param source The source of the screenshot request, defined by {@link ScreenshotSource}
     * @param handler used to process messages received from the screenshot service
     * @param completionConsumer receives the URI of the captured screenshot, once saved or
     *         null if no screenshot was saved
     */
    public void takeScreenshot(@ScreenshotType int screenshotType, @ScreenshotSource int source,
    public void takeScreenshot(@ScreenshotType int type, @ScreenshotSource int source,
            @NonNull Handler handler, @Nullable Consumer<Uri> completionConsumer) {
        ScreenshotRequest screenshotRequest = new ScreenshotRequest(source);
        takeScreenshot(screenshotType, handler, screenshotRequest, SCREENSHOT_TIMEOUT_MS,
        ScreenshotRequest screenshotRequest = new ScreenshotRequest(type, source);
        takeScreenshot(handler, screenshotRequest, SCREENSHOT_TIMEOUT_MS,
                completionConsumer);
    }

@@ -280,7 +299,7 @@ public class ScreenshotHelper {
     * Added to support reducing unit test duration; the method variant without a timeout argument
     * is recommended for general use.
     *
     * @param screenshotType The type of screenshot, defined by {@link ScreenshotType}
     * @param type The type of screenshot, defined by {@link ScreenshotType}
     * @param source The source of the screenshot request, defined by {@link ScreenshotSource}
     * @param handler used to process messages received from the screenshot service
     * @param timeoutMs time limit for processing, intended only for testing
@@ -288,10 +307,10 @@ public class ScreenshotHelper {
     *         null if no screenshot was saved
     */
    @VisibleForTesting
    public void takeScreenshot(@ScreenshotType int screenshotType, @ScreenshotSource int source,
    public void takeScreenshot(@ScreenshotType int type, @ScreenshotSource int source,
            @NonNull Handler handler, long timeoutMs, @Nullable Consumer<Uri> completionConsumer) {
        ScreenshotRequest screenshotRequest = new ScreenshotRequest(source);
        takeScreenshot(screenshotType, handler, screenshotRequest, timeoutMs, completionConsumer);
        ScreenshotRequest screenshotRequest = new ScreenshotRequest(type, source);
        takeScreenshot(handler, screenshotRequest, timeoutMs, completionConsumer);
    }

    /**
@@ -312,14 +331,12 @@ public class ScreenshotHelper {
            @NonNull Insets insets, int taskId, int userId, ComponentName topComponent,
            @ScreenshotSource int source, @NonNull Handler handler,
            @Nullable Consumer<Uri> completionConsumer) {
        ScreenshotRequest screenshotRequest = new ScreenshotRequest(source, screenshotBundle,
                boundsInScreen, insets, taskId, userId, topComponent);
        takeScreenshot(WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE, handler, screenshotRequest,
                SCREENSHOT_TIMEOUT_MS,
                completionConsumer);
        ScreenshotRequest screenshotRequest = new ScreenshotRequest(TAKE_SCREENSHOT_PROVIDED_IMAGE,
                source, screenshotBundle, boundsInScreen, insets, taskId, userId, topComponent);
        takeScreenshot(handler, screenshotRequest, SCREENSHOT_TIMEOUT_MS, completionConsumer);
    }

    private void takeScreenshot(@ScreenshotType int screenshotType, @NonNull Handler handler,
    private void takeScreenshot(@NonNull Handler handler,
            ScreenshotRequest screenshotRequest, long timeoutMs,
            @Nullable Consumer<Uri> completionConsumer) {
        synchronized (mScreenshotLock) {
@@ -337,7 +354,7 @@ public class ScreenshotHelper {
                }
            };

            Message msg = Message.obtain(null, screenshotType, screenshotRequest);
            Message msg = Message.obtain(null, 0, screenshotRequest);

            Handler h = new Handler(handler.getLooper()) {
                @Override
+20 −4
Original line number Diff line number Diff line
@@ -85,10 +85,26 @@
    <item msgid="7073042887003102964">"map13"</item>
    <item msgid="8147982633566548515">"map14"</item>
  </string-array>
    <!-- no translation found for bluetooth_a2dp_codec_titles:6 (328951785723550863) -->
    <!-- no translation found for bluetooth_a2dp_codec_titles:7 (506175145534048710) -->
    <!-- no translation found for bluetooth_a2dp_codec_summaries:6 (3940992993241040716) -->
    <!-- no translation found for bluetooth_a2dp_codec_summaries:7 (7940970833006181407) -->
  <string-array name="bluetooth_a2dp_codec_titles">
    <item msgid="2494959071796102843">"Gebruik stelselkeuse (verstek)"</item>
    <item msgid="4055460186095649420">"SBC"</item>
    <item msgid="720249083677397051">"AAC"</item>
    <item msgid="1049450003868150455">"<xliff:g id="QUALCOMM">Qualcomm®</xliff:g> <xliff:g id="APTX">aptX™</xliff:g>-oudio"</item>
    <item msgid="2908219194098827570">"<xliff:g id="QUALCOMM">Qualcomm®</xliff:g> <xliff:g id="APTX_HD">aptX™ HD</xliff:g>-oudio"</item>
    <item msgid="3825367753087348007">"LDAC"</item>
    <item msgid="328951785723550863">"LC3"</item>
    <item msgid="506175145534048710">"Opus"</item>
  </string-array>
  <string-array name="bluetooth_a2dp_codec_summaries">
    <item msgid="8868109554557331312">"Gebruik stelselkeuse (verstek)"</item>
    <item msgid="9024885861221697796">"SBC"</item>
    <item msgid="4688890470703790013">"AAC"</item>
    <item msgid="8627333814413492563">"<xliff:g id="QUALCOMM">Qualcomm®</xliff:g> <xliff:g id="APTX">aptX™</xliff:g>-oudio"</item>
    <item msgid="3517061573669307965">"<xliff:g id="QUALCOMM">Qualcomm®</xliff:g> <xliff:g id="APTX_HD">aptX™ HD</xliff:g>-oudio"</item>
    <item msgid="2553206901068987657">"LDAC"</item>
    <item msgid="3940992993241040716">"LC3"</item>
    <item msgid="7940970833006181407">"Opus"</item>
  </string-array>
  <string-array name="bluetooth_a2dp_codec_sample_rate_titles">
    <item msgid="926809261293414607">"Gebruik stelselkeuse (verstek)"</item>
    <item msgid="8003118270854840095">"44,1 kHz"</item>
+2 −2
Original line number Diff line number Diff line
@@ -660,8 +660,8 @@
    <string name="dream_complication_title_weather" msgid="598609151677172783">"Weer"</string>
    <string name="dream_complication_title_aqi" msgid="4587552608957834110">"Luggehalte"</string>
    <string name="dream_complication_title_cast_info" msgid="4038776652841885084">"Uitsaai-inligting"</string>
    <!-- no translation found for dream_complication_title_home_controls (9153381632476738811) -->
    <skip />
    <string name="dream_complication_title_home_controls" msgid="9153381632476738811">"Huiskontroles"</string>
    <string name="dream_complication_title_smartspace" msgid="4197829945636051120">"Smartspace"</string>
    <string name="avatar_picker_title" msgid="8492884172713170652">"Kies \'n profielprent"</string>
    <string name="default_user_icon_description" msgid="6554047177298972638">"Verstekgebruikerikoon"</string>
    <string name="physical_keyboard_title" msgid="4811935435315835220">"Fisieke sleutelbord"</string>
+2 −1
Original line number Diff line number Diff line
@@ -660,7 +660,8 @@
    <string name="dream_complication_title_weather" msgid="598609151677172783">"የአየር ሁኔታ"</string>
    <string name="dream_complication_title_aqi" msgid="4587552608957834110">"የአየር ጥራት"</string>
    <string name="dream_complication_title_cast_info" msgid="4038776652841885084">"የCast መረጃ"</string>
    <!-- no translation found for dream_complication_title_home_controls (9153381632476738811) -->
    <string name="dream_complication_title_home_controls" msgid="9153381632476738811">"የቤት ውስጥ ቁጥጥሮች"</string>
    <!-- no translation found for dream_complication_title_smartspace (4197829945636051120) -->
    <skip />
    <string name="avatar_picker_title" msgid="8492884172713170652">"የመገለጫ ሥዕል ይምረጡ"</string>
    <string name="default_user_icon_description" msgid="6554047177298972638">"ነባሪ የተጠቃሚ አዶ"</string>
+2 −1
Original line number Diff line number Diff line
@@ -660,7 +660,8 @@
    <string name="dream_complication_title_weather" msgid="598609151677172783">"الطقس"</string>
    <string name="dream_complication_title_aqi" msgid="4587552608957834110">"جودة الهواء"</string>
    <string name="dream_complication_title_cast_info" msgid="4038776652841885084">"معلومات البث"</string>
    <!-- no translation found for dream_complication_title_home_controls (9153381632476738811) -->
    <string name="dream_complication_title_home_controls" msgid="9153381632476738811">"إدارة آلية للمنزل"</string>
    <!-- no translation found for dream_complication_title_smartspace (4197829945636051120) -->
    <skip />
    <string name="avatar_picker_title" msgid="8492884172713170652">"اختيار صورة الملف الشخصي"</string>
    <string name="default_user_icon_description" msgid="6554047177298972638">"رمز المستخدم التلقائي"</string>
Loading