Loading media/java/android/media/projection/MediaProjectionConfig.java +34 −116 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.annotation.Nullable; import android.os.Parcelable; import com.android.internal.util.AnnotationValidations; import com.android.internal.util.DataClass; import java.lang.annotation.Retention; Loading @@ -35,36 +34,25 @@ import java.lang.annotation.Retention; * Configure the {@link MediaProjection} session requested from * {@link MediaProjectionManager#createScreenCaptureIntent(MediaProjectionConfig)}. */ @DataClass( genEqualsHashCode = true, genAidl = true, genSetters = false, genConstructor = false, genBuilder = false, genToString = false, genHiddenConstDefs = true, genHiddenGetters = true, genConstDefs = false ) public final class MediaProjectionConfig implements Parcelable { /** * The user, rather than the host app, determines which region of the display to capture. * * @hide */ public static final int CAPTURE_REGION_USER_CHOICE = 0; /** * The host app specifies a particular display to capture. * * @hide */ public static final int CAPTURE_REGION_FIXED_DISPLAY = 1; /** @hide */ @IntDef(prefix = "CAPTURE_REGION_", value = { CAPTURE_REGION_USER_CHOICE, CAPTURE_REGION_FIXED_DISPLAY }) @IntDef(prefix = "CAPTURE_REGION_", value = {CAPTURE_REGION_USER_CHOICE, CAPTURE_REGION_FIXED_DISPLAY}) @Retention(SOURCE) public @interface CaptureRegion { } Loading @@ -72,7 +60,7 @@ public final class MediaProjectionConfig implements Parcelable { /** * The particular display to capture. Only used when {@link #getRegionToCapture()} is * {@link #CAPTURE_REGION_FIXED_DISPLAY}; ignored otherwise. * * <p> * Only supports values of {@link android.view.Display#DEFAULT_DISPLAY}. */ @IntRange(from = DEFAULT_DISPLAY, to = DEFAULT_DISPLAY) Loading @@ -82,13 +70,7 @@ public final class MediaProjectionConfig implements Parcelable { * The region to capture. Defaults to the user's choice. */ @CaptureRegion private int mRegionToCapture = CAPTURE_REGION_USER_CHOICE; /** * Default instance, with region set to the user's choice. */ private MediaProjectionConfig() { } private int mRegionToCapture; /** * Customized instance, with region set to the provided value. Loading Loading @@ -129,51 +111,29 @@ public final class MediaProjectionConfig implements Parcelable { */ @NonNull private static String captureRegionToString(int value) { switch (value) { case CAPTURE_REGION_USER_CHOICE: return "CAPTURE_REGION_USERS_CHOICE"; case CAPTURE_REGION_FIXED_DISPLAY: return "CAPTURE_REGION_GIVEN_DISPLAY"; default: return Integer.toHexString(value); } return switch (value) { case CAPTURE_REGION_USER_CHOICE -> "CAPTURE_REGION_USERS_CHOICE"; case CAPTURE_REGION_FIXED_DISPLAY -> "CAPTURE_REGION_GIVEN_DISPLAY"; default -> Integer.toHexString(value); }; } @Override public String toString() { return "MediaProjectionConfig { " + "displayToCapture = " + mDisplayToCapture + ", " + "regionToCapture = " + captureRegionToString(mRegionToCapture) + " }"; return "MediaProjectionConfig { " + "displayToCapture = " + mDisplayToCapture + ", " + "regionToCapture = " + captureRegionToString(mRegionToCapture) + " }"; } // Code below generated by codegen v1.0.23. // // DO NOT MODIFY! // CHECKSTYLE:OFF Generated code // // To regenerate run: // $ codegen $ANDROID_BUILD_TOP/frameworks/base/media/java/android/media/projection/MediaProjectionConfig.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control //@formatter:off /** * The particular display to capture. Only used when {@link #getRegionToCapture()} is * {@link #CAPTURE_REGION_FIXED_DISPLAY}; ignored otherwise. * * <p> * Only supports values of {@link android.view.Display#DEFAULT_DISPLAY}. * * @hide */ @DataClass.Generated.Member public @IntRange(from = DEFAULT_DISPLAY, to = DEFAULT_DISPLAY) int getDisplayToCapture() { public int getDisplayToCapture() { return mDisplayToCapture; } Loading @@ -182,34 +142,21 @@ public final class MediaProjectionConfig implements Parcelable { * * @hide */ @DataClass.Generated.Member public @CaptureRegion int getRegionToCapture() { return mRegionToCapture; } @Override @DataClass.Generated.Member public boolean equals(@Nullable Object o) { // You can override field equality logic by defining either of the methods like: // boolean fieldNameEquals(MediaProjectionConfig other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") MediaProjectionConfig that = (MediaProjectionConfig) o; //noinspection PointlessBooleanExpression return true && mDisplayToCapture == that.mDisplayToCapture return mDisplayToCapture == that.mDisplayToCapture && mRegionToCapture == that.mRegionToCapture; } @Override @DataClass.Generated.Member public int hashCode() { // You can override field hashCode logic by defining methods like: // int fieldNameHashCode() { ... } int _hash = 1; _hash = 31 * _hash + mDisplayToCapture; _hash = 31 * _hash + mRegionToCapture; Loading @@ -217,44 +164,28 @@ public final class MediaProjectionConfig implements Parcelable { } @Override @DataClass.Generated.Member public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } dest.writeInt(mDisplayToCapture); dest.writeInt(mRegionToCapture); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ MediaProjectionConfig(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } int displayToCapture = in.readInt(); int regionToCapture = in.readInt(); this.mDisplayToCapture = displayToCapture; AnnotationValidations.validate( IntRange.class, null, mDisplayToCapture, "from", DEFAULT_DISPLAY, "to", DEFAULT_DISPLAY); this.mRegionToCapture = regionToCapture; AnnotationValidations.validate( CaptureRegion.class, null, mRegionToCapture); // onConstructed(); // You can define this method to get a callback mDisplayToCapture = displayToCapture; mRegionToCapture = regionToCapture; AnnotationValidations.validate(CaptureRegion.class, null, mRegionToCapture); } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<MediaProjectionConfig> CREATOR = new Parcelable.Creator<MediaProjectionConfig>() { public static final @NonNull Parcelable.Creator<MediaProjectionConfig> CREATOR = new Parcelable.Creator<>() { @Override public MediaProjectionConfig[] newArray(int size) { return new MediaProjectionConfig[size]; Loading @@ -265,17 +196,4 @@ public final class MediaProjectionConfig implements Parcelable { return new MediaProjectionConfig(in); } }; @DataClass.Generated( time = 1673548980960L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/media/java/android/media/projection/MediaProjectionConfig.java", inputSignatures = "public static final int CAPTURE_REGION_USER_CHOICE\npublic static final int CAPTURE_REGION_FIXED_DISPLAY\nprivate @android.annotation.IntRange int mDisplayToCapture\nprivate @android.media.projection.MediaProjectionConfig.CaptureRegion int mRegionToCapture\npublic static @android.annotation.NonNull android.media.projection.MediaProjectionConfig createConfigForDefaultDisplay()\npublic static @android.annotation.NonNull android.media.projection.MediaProjectionConfig createConfigForUserChoice()\nprivate static @android.annotation.NonNull java.lang.String captureRegionToString(int)\npublic @java.lang.Override java.lang.String toString()\nclass MediaProjectionConfig extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genSetters=false, genConstructor=false, genBuilder=false, genToString=false, genHiddenConstDefs=true, genHiddenGetters=true, genConstDefs=false)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code } Loading
media/java/android/media/projection/MediaProjectionConfig.java +34 −116 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.annotation.Nullable; import android.os.Parcelable; import com.android.internal.util.AnnotationValidations; import com.android.internal.util.DataClass; import java.lang.annotation.Retention; Loading @@ -35,36 +34,25 @@ import java.lang.annotation.Retention; * Configure the {@link MediaProjection} session requested from * {@link MediaProjectionManager#createScreenCaptureIntent(MediaProjectionConfig)}. */ @DataClass( genEqualsHashCode = true, genAidl = true, genSetters = false, genConstructor = false, genBuilder = false, genToString = false, genHiddenConstDefs = true, genHiddenGetters = true, genConstDefs = false ) public final class MediaProjectionConfig implements Parcelable { /** * The user, rather than the host app, determines which region of the display to capture. * * @hide */ public static final int CAPTURE_REGION_USER_CHOICE = 0; /** * The host app specifies a particular display to capture. * * @hide */ public static final int CAPTURE_REGION_FIXED_DISPLAY = 1; /** @hide */ @IntDef(prefix = "CAPTURE_REGION_", value = { CAPTURE_REGION_USER_CHOICE, CAPTURE_REGION_FIXED_DISPLAY }) @IntDef(prefix = "CAPTURE_REGION_", value = {CAPTURE_REGION_USER_CHOICE, CAPTURE_REGION_FIXED_DISPLAY}) @Retention(SOURCE) public @interface CaptureRegion { } Loading @@ -72,7 +60,7 @@ public final class MediaProjectionConfig implements Parcelable { /** * The particular display to capture. Only used when {@link #getRegionToCapture()} is * {@link #CAPTURE_REGION_FIXED_DISPLAY}; ignored otherwise. * * <p> * Only supports values of {@link android.view.Display#DEFAULT_DISPLAY}. */ @IntRange(from = DEFAULT_DISPLAY, to = DEFAULT_DISPLAY) Loading @@ -82,13 +70,7 @@ public final class MediaProjectionConfig implements Parcelable { * The region to capture. Defaults to the user's choice. */ @CaptureRegion private int mRegionToCapture = CAPTURE_REGION_USER_CHOICE; /** * Default instance, with region set to the user's choice. */ private MediaProjectionConfig() { } private int mRegionToCapture; /** * Customized instance, with region set to the provided value. Loading Loading @@ -129,51 +111,29 @@ public final class MediaProjectionConfig implements Parcelable { */ @NonNull private static String captureRegionToString(int value) { switch (value) { case CAPTURE_REGION_USER_CHOICE: return "CAPTURE_REGION_USERS_CHOICE"; case CAPTURE_REGION_FIXED_DISPLAY: return "CAPTURE_REGION_GIVEN_DISPLAY"; default: return Integer.toHexString(value); } return switch (value) { case CAPTURE_REGION_USER_CHOICE -> "CAPTURE_REGION_USERS_CHOICE"; case CAPTURE_REGION_FIXED_DISPLAY -> "CAPTURE_REGION_GIVEN_DISPLAY"; default -> Integer.toHexString(value); }; } @Override public String toString() { return "MediaProjectionConfig { " + "displayToCapture = " + mDisplayToCapture + ", " + "regionToCapture = " + captureRegionToString(mRegionToCapture) + " }"; return "MediaProjectionConfig { " + "displayToCapture = " + mDisplayToCapture + ", " + "regionToCapture = " + captureRegionToString(mRegionToCapture) + " }"; } // Code below generated by codegen v1.0.23. // // DO NOT MODIFY! // CHECKSTYLE:OFF Generated code // // To regenerate run: // $ codegen $ANDROID_BUILD_TOP/frameworks/base/media/java/android/media/projection/MediaProjectionConfig.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control //@formatter:off /** * The particular display to capture. Only used when {@link #getRegionToCapture()} is * {@link #CAPTURE_REGION_FIXED_DISPLAY}; ignored otherwise. * * <p> * Only supports values of {@link android.view.Display#DEFAULT_DISPLAY}. * * @hide */ @DataClass.Generated.Member public @IntRange(from = DEFAULT_DISPLAY, to = DEFAULT_DISPLAY) int getDisplayToCapture() { public int getDisplayToCapture() { return mDisplayToCapture; } Loading @@ -182,34 +142,21 @@ public final class MediaProjectionConfig implements Parcelable { * * @hide */ @DataClass.Generated.Member public @CaptureRegion int getRegionToCapture() { return mRegionToCapture; } @Override @DataClass.Generated.Member public boolean equals(@Nullable Object o) { // You can override field equality logic by defining either of the methods like: // boolean fieldNameEquals(MediaProjectionConfig other) { ... } // boolean fieldNameEquals(FieldType otherValue) { ... } if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @SuppressWarnings("unchecked") MediaProjectionConfig that = (MediaProjectionConfig) o; //noinspection PointlessBooleanExpression return true && mDisplayToCapture == that.mDisplayToCapture return mDisplayToCapture == that.mDisplayToCapture && mRegionToCapture == that.mRegionToCapture; } @Override @DataClass.Generated.Member public int hashCode() { // You can override field hashCode logic by defining methods like: // int fieldNameHashCode() { ... } int _hash = 1; _hash = 31 * _hash + mDisplayToCapture; _hash = 31 * _hash + mRegionToCapture; Loading @@ -217,44 +164,28 @@ public final class MediaProjectionConfig implements Parcelable { } @Override @DataClass.Generated.Member public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } dest.writeInt(mDisplayToCapture); dest.writeInt(mRegionToCapture); } @Override @DataClass.Generated.Member public int describeContents() { return 0; } public int describeContents() { return 0; } /** @hide */ @SuppressWarnings({"unchecked", "RedundantCast"}) @DataClass.Generated.Member /* package-private */ MediaProjectionConfig(@NonNull android.os.Parcel in) { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } int displayToCapture = in.readInt(); int regionToCapture = in.readInt(); this.mDisplayToCapture = displayToCapture; AnnotationValidations.validate( IntRange.class, null, mDisplayToCapture, "from", DEFAULT_DISPLAY, "to", DEFAULT_DISPLAY); this.mRegionToCapture = regionToCapture; AnnotationValidations.validate( CaptureRegion.class, null, mRegionToCapture); // onConstructed(); // You can define this method to get a callback mDisplayToCapture = displayToCapture; mRegionToCapture = regionToCapture; AnnotationValidations.validate(CaptureRegion.class, null, mRegionToCapture); } @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<MediaProjectionConfig> CREATOR = new Parcelable.Creator<MediaProjectionConfig>() { public static final @NonNull Parcelable.Creator<MediaProjectionConfig> CREATOR = new Parcelable.Creator<>() { @Override public MediaProjectionConfig[] newArray(int size) { return new MediaProjectionConfig[size]; Loading @@ -265,17 +196,4 @@ public final class MediaProjectionConfig implements Parcelable { return new MediaProjectionConfig(in); } }; @DataClass.Generated( time = 1673548980960L, codegenVersion = "1.0.23", sourceFile = "frameworks/base/media/java/android/media/projection/MediaProjectionConfig.java", inputSignatures = "public static final int CAPTURE_REGION_USER_CHOICE\npublic static final int CAPTURE_REGION_FIXED_DISPLAY\nprivate @android.annotation.IntRange int mDisplayToCapture\nprivate @android.media.projection.MediaProjectionConfig.CaptureRegion int mRegionToCapture\npublic static @android.annotation.NonNull android.media.projection.MediaProjectionConfig createConfigForDefaultDisplay()\npublic static @android.annotation.NonNull android.media.projection.MediaProjectionConfig createConfigForUserChoice()\nprivate static @android.annotation.NonNull java.lang.String captureRegionToString(int)\npublic @java.lang.Override java.lang.String toString()\nclass MediaProjectionConfig extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genSetters=false, genConstructor=false, genBuilder=false, genToString=false, genHiddenConstDefs=true, genHiddenGetters=true, genConstDefs=false)") @Deprecated private void __metadata() {} //@formatter:on // End of generated code }