Loading core/java/android/content/res/Configuration.java +51 −31 Original line number Diff line number Diff line Loading @@ -751,9 +751,15 @@ public final class Configuration implements Parcelable, Comparable<Configuration public static final int SCREEN_WIDTH_DP_UNDEFINED = 0; /** * The current width of the available screen space in dp units, excluding * the area occupied by screen decorations at the edges of the display. * Corresponds to the * The width of the available screen space in dp units excluding the area * occupied by {@link android.view.WindowInsets window insets}. * * <aside class="note"><b>Note:</b> The width measurement excludes window * insets even when the app is displayed edge to edge using * {@link android.view.Window#setDecorFitsSystemWindows(boolean) * Window#setDecorFitsSystemWindows(boolean)}.</aside> * * <p>Corresponds to the * <a href="{@docRoot}guide/topics/resources/providing-resources.html#AvailableWidthHeightQualifier"> * available width</a> resource qualifier. Defaults to * {@link #SCREEN_WIDTH_DP_UNDEFINED} if no width is specified. Loading @@ -763,21 +769,25 @@ public final class Configuration implements Parcelable, Comparable<Configuration * (for example, when apps are displayed side by side in split-screen mode * in landscape orientation). * * <p>For embedded activities, equals the width of the individual * activities, not the width of the app window or the device screen. * * <p>In multiple-screen scenarios, the width measurement can span screens. * For example, if the app is spanning both screens of a dual-screen device * (with the screens side by side), {@code screenWidthDp} represents the * width of both screens, excluding the area occupied by screen decorations. * When the app is restricted to a single screen in a multiple-screen * width of both screens excluding the area occupied by window insets. When * the app is restricted to a single screen in a multiple-screen * environment, {@code screenWidthDp} is the width of the screen on which * the app is running. * the app is displayed excluding window insets. * * <p>Differs from {@link android.view.WindowMetrics} by not including * screen decorations in the width measurement and by expressing the * measurement in dp rather than px. Use {@code screenWidthDp} to obtain the * horizontal display area available to the app, excluding the area occupied * by screen decorations. Use {@link android.view.WindowMetrics#getBounds()} * to obtain the width of the display area available to the app, including * the area occupied by screen decorations. * window insets in the width measurement and by expressing the measurement * in dp rather than px. Use {@code screenWidthDp} to obtain the width of * the display area available to an app or embedded activity excluding the * area occupied by window insets. Use * {@link android.view.WindowMetrics#getBounds()} to obtain the horizontal * display area available to an app or embedded activity including the area * occupied by window insets. */ public int screenWidthDp; Loading @@ -788,9 +798,16 @@ public final class Configuration implements Parcelable, Comparable<Configuration public static final int SCREEN_HEIGHT_DP_UNDEFINED = 0; /** * The current height of the available screen space in dp units, excluding * the area occupied by screen decorations at the edges of the display (such * as the status bar, navigation bar, and cutouts). Corresponds to the * The height of the available screen space in dp units excluding the area * occupied by {@link android.view.WindowInsets window insets}, such as the * status bar, navigation bar, and cutouts. * * <aside class="note"><b>Note:</b> The height measurement excludes window * insets even when the app is displayed edge to edge using * {@link android.view.Window#setDecorFitsSystemWindows(boolean) * Window#setDecorFitsSystemWindows(boolean)}.</aside> * * <p>Corresponds to the * <a href="{@docRoot}guide/topics/resources/providing-resources.html#AvailableWidthHeightQualifier"> * available height</a> resource qualifier. Defaults to * {@link #SCREEN_HEIGHT_DP_UNDEFINED} if no height is specified. Loading @@ -800,22 +817,25 @@ public final class Configuration implements Parcelable, Comparable<Configuration * (for example, when apps are displayed one above another in split-screen * mode in portrait orientation). * * <p>For embedded activities, equals the height of the individual * activities, not the height of the app window or the device screen. * * <p>In multiple-screen scenarios, the height measurement can span screens. * For example, if the app is spanning both screens of a dual-screen device * rotated 90 degrees (one screen above the other), {@code screenHeightDp} * represents the height of both screens, excluding the area occupied by * screen decorations. When the app is restricted to a single screen in a * represents the height of both screens excluding the area occupied by * window insets. When the app is restricted to a single screen in a * multiple-screen environment, {@code screenHeightDp} is the height of the * screen on which the app is running. * screen on which the app is displayed excluding window insets. * * <p>Differs from {@link android.view.WindowMetrics} by not including * screen decorations in the height measurement and by expressing the * measurement in dp rather than px. Use {@code screenHeightDp} to obtain * the vertical display area available to the app, excluding the area * occupied by screen decorations. Use * {@link android.view.WindowMetrics#getBounds()} to obtain the height of * the display area available to the app, including the area occupied by * screen decorations. * window insets in the height measurement and by expressing the measurement * in dp rather than px. Use {@code screenHeightDp} to obtain the height of * the display area available to an app or embedded activity excluding the * area occupied by window insets. Use * {@link android.view.WindowMetrics#getBounds()} to obtain the vertical * display area available to an app or embedded activity including the area * occupied by window insets. */ public int screenHeightDp; Loading @@ -826,12 +846,12 @@ public final class Configuration implements Parcelable, Comparable<Configuration public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0; /** * The smallest screen size an application will see in normal operation, * corresponding to * <a href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">smallest * screen width</a> resource qualifier. * This is the smallest value of both screenWidthDp and screenHeightDp * in both portrait and landscape. Set to * The smallest screen size an application will see in normal operation. * Corresponds to the * <a href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier"> * smallest width</a> resource qualifier. This is the smallest value of * {@link #screenWidthDp} and {@link #screenHeightDp} in both portrait and * landscape orientations. Defaults to * {@link #SMALLEST_SCREEN_WIDTH_DP_UNDEFINED} if no width is specified. */ public int smallestScreenWidthDp; Loading core/java/com/android/internal/app/chooser/DisplayResolveInfo.java +2 −5 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.internal.app.ResolverActivity; import com.android.internal.app.ResolverListAdapter.ResolveInfoPresentationGetter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** Loading Loading @@ -206,7 +205,7 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable { dest.writeCharSequence(mDisplayLabel); dest.writeCharSequence(mExtendedInfo); dest.writeParcelable(mResolvedIntent, 0); dest.writeParcelableArray((Intent[]) mSourceIntents.toArray(), 0); dest.writeTypedList(mSourceIntents); dest.writeBoolean(mIsSuspended); dest.writeBoolean(mPinned); dest.writeParcelable(mResolveInfo, 0); Loading @@ -227,9 +226,7 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable { mDisplayLabel = in.readCharSequence(); mExtendedInfo = in.readCharSequence(); mResolvedIntent = in.readParcelable(null /* ClassLoader */, android.content.Intent.class); mSourceIntents.addAll( Arrays.asList((Intent[]) in.readParcelableArray(null /* ClassLoader */, Intent.class))); in.readTypedList(mSourceIntents, Intent.CREATOR); mIsSuspended = in.readBoolean(); mPinned = in.readBoolean(); mResolveInfo = in.readParcelable(null /* ClassLoader */, android.content.pm.ResolveInfo.class); Loading media/java/android/media/projection/MediaProjectionManager.java +38 −23 Original line number Diff line number Diff line Loading @@ -80,33 +80,48 @@ public final class MediaProjectionManager { } /** * Retrieve the MediaProjection obtained from a succesful screen * capture request. Will be null if the result from the * startActivityForResult() is anything other than RESULT_OK. * Retrieves the {@link MediaProjection} obtained from a successful screen * capture request. The result code and data from the request are provided * by overriding {@link Activity#onActivityResult(int, int, Intent) * onActivityResult(int, int, Intent)}, which is called after starting an * activity using {@link #createScreenCaptureIntent()}. * * Starting from Android {@link android.os.Build.VERSION_CODES#R}, if your application requests * the {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission, and the * user has not explicitly denied it, the permission will be automatically granted until the * projection is stopped. This allows for user controls to be displayed on top of the screen * being captured. * <p>Starting from Android {@link android.os.Build.VERSION_CODES#R}, if * your application requests the * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW * SYSTEM_ALERT_WINDOW} permission, and the user has not explicitly denied * it, the permission will be automatically granted until the projection is * stopped. The permission allows your app to display user controls on top * of the screen being captured. * * <p> * Apps targeting SDK version {@link android.os.Build.VERSION_CODES#Q} or later should specify * the foreground service type using the attribute {@link android.R.attr#foregroundServiceType} * in the service element of the app's manifest file. * The {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION} attribute * should be specified. * </p> * <p>Apps targeting SDK version {@link android.os.Build.VERSION_CODES#Q} or * later must set the * {@link android.R.attr#foregroundServiceType foregroundServiceType} * attribute to {@code mediaProjection} in the * <a href="/guide/topics/manifest/service-element"> * <code><service></code></a> element of the app's manifest file; * {@code mediaProjection} is equivalent to * {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION * FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION}. * * @see <a href="https://developer.android.com/preview/privacy/foreground-service-types"> * Foregroud Service Types</a> * @see <a href="/guide/components/foreground-services"> * Foreground services developer guide</a> * @see <a href="/guide/topics/large-screens/media-projection"> * Media projection developer guide</a> * * @param resultCode The result code from {@link android.app.Activity#onActivityResult(int, * int, android.content.Intent)} * @param resultData The resulting data from {@link android.app.Activity#onActivityResult(int, * int, android.content.Intent)} * @throws IllegalStateException on pre-Q devices if a previously gotten MediaProjection * from the same {@code resultData} has not yet been stopped * @param resultCode The result code from * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent) * onActivityResult(int, int, Intent)}. * @param resultData The result data from * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent) * onActivityResult(int, int, Intent)}. * @return The media projection obtained from a successful screen capture * request, or null if the result of the screen capture request is not * {@link Activity#RESULT_OK RESULT_OK}. * @throws IllegalStateException On * pre-{@link android.os.Build.VERSION_CODES#Q Q} devices if a * previously obtained {@code MediaProjection} from the same * {@code resultData} has not yet been stopped. */ public MediaProjection getMediaProjection(int resultCode, @NonNull Intent resultData) { if (resultCode != Activity.RESULT_OK || resultData == null) { Loading packages/SystemUI/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -788,6 +788,7 @@ android:theme="@style/EditTextActivity" android:exported="false" android:excludeFromRecents="true" android:label="@string/clipboard_editor" /> <activity android:name=".controls.management.ControlsProviderSelectorActivity" Loading packages/SystemUI/res/layout/clipboard_overlay.xml +3 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ android:theme="@style/FloatingOverlay" android:alpha="0" android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_height="match_parent" android:contentDescription="@string/clipboard_overlay_window_name"> <ImageView android:id="@+id/actions_container_background" android:visibility="gone" Loading Loading @@ -121,6 +122,7 @@ android:id="@+id/image_preview" android:scaleType="fitCenter" android:adjustViewBounds="true" android:contentDescription="@string/clipboard_image_preview" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView Loading Loading
core/java/android/content/res/Configuration.java +51 −31 Original line number Diff line number Diff line Loading @@ -751,9 +751,15 @@ public final class Configuration implements Parcelable, Comparable<Configuration public static final int SCREEN_WIDTH_DP_UNDEFINED = 0; /** * The current width of the available screen space in dp units, excluding * the area occupied by screen decorations at the edges of the display. * Corresponds to the * The width of the available screen space in dp units excluding the area * occupied by {@link android.view.WindowInsets window insets}. * * <aside class="note"><b>Note:</b> The width measurement excludes window * insets even when the app is displayed edge to edge using * {@link android.view.Window#setDecorFitsSystemWindows(boolean) * Window#setDecorFitsSystemWindows(boolean)}.</aside> * * <p>Corresponds to the * <a href="{@docRoot}guide/topics/resources/providing-resources.html#AvailableWidthHeightQualifier"> * available width</a> resource qualifier. Defaults to * {@link #SCREEN_WIDTH_DP_UNDEFINED} if no width is specified. Loading @@ -763,21 +769,25 @@ public final class Configuration implements Parcelable, Comparable<Configuration * (for example, when apps are displayed side by side in split-screen mode * in landscape orientation). * * <p>For embedded activities, equals the width of the individual * activities, not the width of the app window or the device screen. * * <p>In multiple-screen scenarios, the width measurement can span screens. * For example, if the app is spanning both screens of a dual-screen device * (with the screens side by side), {@code screenWidthDp} represents the * width of both screens, excluding the area occupied by screen decorations. * When the app is restricted to a single screen in a multiple-screen * width of both screens excluding the area occupied by window insets. When * the app is restricted to a single screen in a multiple-screen * environment, {@code screenWidthDp} is the width of the screen on which * the app is running. * the app is displayed excluding window insets. * * <p>Differs from {@link android.view.WindowMetrics} by not including * screen decorations in the width measurement and by expressing the * measurement in dp rather than px. Use {@code screenWidthDp} to obtain the * horizontal display area available to the app, excluding the area occupied * by screen decorations. Use {@link android.view.WindowMetrics#getBounds()} * to obtain the width of the display area available to the app, including * the area occupied by screen decorations. * window insets in the width measurement and by expressing the measurement * in dp rather than px. Use {@code screenWidthDp} to obtain the width of * the display area available to an app or embedded activity excluding the * area occupied by window insets. Use * {@link android.view.WindowMetrics#getBounds()} to obtain the horizontal * display area available to an app or embedded activity including the area * occupied by window insets. */ public int screenWidthDp; Loading @@ -788,9 +798,16 @@ public final class Configuration implements Parcelable, Comparable<Configuration public static final int SCREEN_HEIGHT_DP_UNDEFINED = 0; /** * The current height of the available screen space in dp units, excluding * the area occupied by screen decorations at the edges of the display (such * as the status bar, navigation bar, and cutouts). Corresponds to the * The height of the available screen space in dp units excluding the area * occupied by {@link android.view.WindowInsets window insets}, such as the * status bar, navigation bar, and cutouts. * * <aside class="note"><b>Note:</b> The height measurement excludes window * insets even when the app is displayed edge to edge using * {@link android.view.Window#setDecorFitsSystemWindows(boolean) * Window#setDecorFitsSystemWindows(boolean)}.</aside> * * <p>Corresponds to the * <a href="{@docRoot}guide/topics/resources/providing-resources.html#AvailableWidthHeightQualifier"> * available height</a> resource qualifier. Defaults to * {@link #SCREEN_HEIGHT_DP_UNDEFINED} if no height is specified. Loading @@ -800,22 +817,25 @@ public final class Configuration implements Parcelable, Comparable<Configuration * (for example, when apps are displayed one above another in split-screen * mode in portrait orientation). * * <p>For embedded activities, equals the height of the individual * activities, not the height of the app window or the device screen. * * <p>In multiple-screen scenarios, the height measurement can span screens. * For example, if the app is spanning both screens of a dual-screen device * rotated 90 degrees (one screen above the other), {@code screenHeightDp} * represents the height of both screens, excluding the area occupied by * screen decorations. When the app is restricted to a single screen in a * represents the height of both screens excluding the area occupied by * window insets. When the app is restricted to a single screen in a * multiple-screen environment, {@code screenHeightDp} is the height of the * screen on which the app is running. * screen on which the app is displayed excluding window insets. * * <p>Differs from {@link android.view.WindowMetrics} by not including * screen decorations in the height measurement and by expressing the * measurement in dp rather than px. Use {@code screenHeightDp} to obtain * the vertical display area available to the app, excluding the area * occupied by screen decorations. Use * {@link android.view.WindowMetrics#getBounds()} to obtain the height of * the display area available to the app, including the area occupied by * screen decorations. * window insets in the height measurement and by expressing the measurement * in dp rather than px. Use {@code screenHeightDp} to obtain the height of * the display area available to an app or embedded activity excluding the * area occupied by window insets. Use * {@link android.view.WindowMetrics#getBounds()} to obtain the vertical * display area available to an app or embedded activity including the area * occupied by window insets. */ public int screenHeightDp; Loading @@ -826,12 +846,12 @@ public final class Configuration implements Parcelable, Comparable<Configuration public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0; /** * The smallest screen size an application will see in normal operation, * corresponding to * <a href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">smallest * screen width</a> resource qualifier. * This is the smallest value of both screenWidthDp and screenHeightDp * in both portrait and landscape. Set to * The smallest screen size an application will see in normal operation. * Corresponds to the * <a href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier"> * smallest width</a> resource qualifier. This is the smallest value of * {@link #screenWidthDp} and {@link #screenHeightDp} in both portrait and * landscape orientations. Defaults to * {@link #SMALLEST_SCREEN_WIDTH_DP_UNDEFINED} if no width is specified. */ public int smallestScreenWidthDp; Loading
core/java/com/android/internal/app/chooser/DisplayResolveInfo.java +2 −5 Original line number Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.internal.app.ResolverActivity; import com.android.internal.app.ResolverListAdapter.ResolveInfoPresentationGetter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** Loading Loading @@ -206,7 +205,7 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable { dest.writeCharSequence(mDisplayLabel); dest.writeCharSequence(mExtendedInfo); dest.writeParcelable(mResolvedIntent, 0); dest.writeParcelableArray((Intent[]) mSourceIntents.toArray(), 0); dest.writeTypedList(mSourceIntents); dest.writeBoolean(mIsSuspended); dest.writeBoolean(mPinned); dest.writeParcelable(mResolveInfo, 0); Loading @@ -227,9 +226,7 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable { mDisplayLabel = in.readCharSequence(); mExtendedInfo = in.readCharSequence(); mResolvedIntent = in.readParcelable(null /* ClassLoader */, android.content.Intent.class); mSourceIntents.addAll( Arrays.asList((Intent[]) in.readParcelableArray(null /* ClassLoader */, Intent.class))); in.readTypedList(mSourceIntents, Intent.CREATOR); mIsSuspended = in.readBoolean(); mPinned = in.readBoolean(); mResolveInfo = in.readParcelable(null /* ClassLoader */, android.content.pm.ResolveInfo.class); Loading
media/java/android/media/projection/MediaProjectionManager.java +38 −23 Original line number Diff line number Diff line Loading @@ -80,33 +80,48 @@ public final class MediaProjectionManager { } /** * Retrieve the MediaProjection obtained from a succesful screen * capture request. Will be null if the result from the * startActivityForResult() is anything other than RESULT_OK. * Retrieves the {@link MediaProjection} obtained from a successful screen * capture request. The result code and data from the request are provided * by overriding {@link Activity#onActivityResult(int, int, Intent) * onActivityResult(int, int, Intent)}, which is called after starting an * activity using {@link #createScreenCaptureIntent()}. * * Starting from Android {@link android.os.Build.VERSION_CODES#R}, if your application requests * the {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission, and the * user has not explicitly denied it, the permission will be automatically granted until the * projection is stopped. This allows for user controls to be displayed on top of the screen * being captured. * <p>Starting from Android {@link android.os.Build.VERSION_CODES#R}, if * your application requests the * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW * SYSTEM_ALERT_WINDOW} permission, and the user has not explicitly denied * it, the permission will be automatically granted until the projection is * stopped. The permission allows your app to display user controls on top * of the screen being captured. * * <p> * Apps targeting SDK version {@link android.os.Build.VERSION_CODES#Q} or later should specify * the foreground service type using the attribute {@link android.R.attr#foregroundServiceType} * in the service element of the app's manifest file. * The {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION} attribute * should be specified. * </p> * <p>Apps targeting SDK version {@link android.os.Build.VERSION_CODES#Q} or * later must set the * {@link android.R.attr#foregroundServiceType foregroundServiceType} * attribute to {@code mediaProjection} in the * <a href="/guide/topics/manifest/service-element"> * <code><service></code></a> element of the app's manifest file; * {@code mediaProjection} is equivalent to * {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION * FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION}. * * @see <a href="https://developer.android.com/preview/privacy/foreground-service-types"> * Foregroud Service Types</a> * @see <a href="/guide/components/foreground-services"> * Foreground services developer guide</a> * @see <a href="/guide/topics/large-screens/media-projection"> * Media projection developer guide</a> * * @param resultCode The result code from {@link android.app.Activity#onActivityResult(int, * int, android.content.Intent)} * @param resultData The resulting data from {@link android.app.Activity#onActivityResult(int, * int, android.content.Intent)} * @throws IllegalStateException on pre-Q devices if a previously gotten MediaProjection * from the same {@code resultData} has not yet been stopped * @param resultCode The result code from * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent) * onActivityResult(int, int, Intent)}. * @param resultData The result data from * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent) * onActivityResult(int, int, Intent)}. * @return The media projection obtained from a successful screen capture * request, or null if the result of the screen capture request is not * {@link Activity#RESULT_OK RESULT_OK}. * @throws IllegalStateException On * pre-{@link android.os.Build.VERSION_CODES#Q Q} devices if a * previously obtained {@code MediaProjection} from the same * {@code resultData} has not yet been stopped. */ public MediaProjection getMediaProjection(int resultCode, @NonNull Intent resultData) { if (resultCode != Activity.RESULT_OK || resultData == null) { Loading
packages/SystemUI/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -788,6 +788,7 @@ android:theme="@style/EditTextActivity" android:exported="false" android:excludeFromRecents="true" android:label="@string/clipboard_editor" /> <activity android:name=".controls.management.ControlsProviderSelectorActivity" Loading
packages/SystemUI/res/layout/clipboard_overlay.xml +3 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ android:theme="@style/FloatingOverlay" android:alpha="0" android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_height="match_parent" android:contentDescription="@string/clipboard_overlay_window_name"> <ImageView android:id="@+id/actions_container_background" android:visibility="gone" Loading Loading @@ -121,6 +122,7 @@ android:id="@+id/image_preview" android:scaleType="fitCenter" android:adjustViewBounds="true" android:contentDescription="@string/clipboard_image_preview" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView Loading