| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.hardware.display; |
| 18 |
|
| 19 |
import static android.view.Display.DEFAULT_DISPLAY; |
| 20 |
|
| 21 |
import android.annotation.IntRange; |
| 22 |
import android.annotation.NonNull; |
| 23 |
import android.annotation.Nullable; |
| 24 |
import android.hardware.display.DisplayManager.VirtualDisplayFlag; |
| 25 |
import android.media.projection.MediaProjection; |
| 26 |
import android.os.Handler; |
| 27 |
import android.os.Parcel; |
| 28 |
import android.os.Parcelable; |
| 29 |
import android.view.Surface; |
| 30 |
|
| 31 |
import com.android.internal.util.DataClass; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
@DataClass(genParcelable = true, genAidl = true, genBuilder = true) |
| 40 |
public final class VirtualDisplayConfig implements Parcelable { |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
@NonNull |
| 45 |
private String mName; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
@IntRange(from = 1) |
| 51 |
private int mWidth; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
@IntRange(from = 1) |
| 57 |
private int mHeight; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
@IntRange(from = 1) |
| 63 |
private int mDensityDpi; |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
@VirtualDisplayFlag |
| 74 |
private int mFlags = 0; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
@Nullable |
| 81 |
private Surface mSurface = null; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
@Nullable |
| 88 |
private String mUniqueId = null; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
private int mDisplayIdToMirror = DEFAULT_DISPLAY; |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
private boolean mWindowManagerMirroring = false; |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
@DataClass.Generated.Member |
| 118 |
VirtualDisplayConfig( |
| 119 |
@NonNull String name, |
| 120 |
@IntRange(from = 1) int width, |
| 121 |
@IntRange(from = 1) int height, |
| 122 |
@IntRange(from = 1) int densityDpi, |
| 123 |
@VirtualDisplayFlag int flags, |
| 124 |
@Nullable Surface surface, |
| 125 |
@Nullable String uniqueId, |
| 126 |
int displayIdToMirror, |
| 127 |
boolean windowManagerMirroring) { |
| 128 |
this.mName = name; |
| 129 |
com.android.internal.util.AnnotationValidations.validate( |
| 130 |
NonNull.class, null, mName); |
| 131 |
this.mWidth = width; |
| 132 |
com.android.internal.util.AnnotationValidations.validate( |
| 133 |
IntRange.class, null, mWidth, |
| 134 |
"from", 1); |
| 135 |
this.mHeight = height; |
| 136 |
com.android.internal.util.AnnotationValidations.validate( |
| 137 |
IntRange.class, null, mHeight, |
| 138 |
"from", 1); |
| 139 |
this.mDensityDpi = densityDpi; |
| 140 |
com.android.internal.util.AnnotationValidations.validate( |
| 141 |
IntRange.class, null, mDensityDpi, |
| 142 |
"from", 1); |
| 143 |
this.mFlags = flags; |
| 144 |
com.android.internal.util.AnnotationValidations.validate( |
| 145 |
VirtualDisplayFlag.class, null, mFlags); |
| 146 |
this.mSurface = surface; |
| 147 |
this.mUniqueId = uniqueId; |
| 148 |
this.mDisplayIdToMirror = displayIdToMirror; |
| 149 |
this.mWindowManagerMirroring = windowManagerMirroring; |
| 150 |
|
| 151 |
|
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
@DataClass.Generated.Member |
| 158 |
public @NonNull String getName() { |
| 159 |
return mName; |
| 160 |
} |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
@DataClass.Generated.Member |
| 166 |
public @IntRange(from = 1) int getWidth() { |
| 167 |
return mWidth; |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
@DataClass.Generated.Member |
| 174 |
public @IntRange(from = 1) int getHeight() { |
| 175 |
return mHeight; |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
@DataClass.Generated.Member |
| 182 |
public @IntRange(from = 1) int getDensityDpi() { |
| 183 |
return mDensityDpi; |
| 184 |
} |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
@DataClass.Generated.Member |
| 195 |
public @VirtualDisplayFlag int getFlags() { |
| 196 |
return mFlags; |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
@DataClass.Generated.Member |
| 204 |
public @Nullable Surface getSurface() { |
| 205 |
return mSurface; |
| 206 |
} |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
@DataClass.Generated.Member |
| 214 |
public @Nullable String getUniqueId() { |
| 215 |
return mUniqueId; |
| 216 |
} |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
@DataClass.Generated.Member |
| 223 |
public int getDisplayIdToMirror() { |
| 224 |
return mDisplayIdToMirror; |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
@DataClass.Generated.Member |
| 232 |
public boolean isWindowManagerMirroring() { |
| 233 |
return mWindowManagerMirroring; |
| 234 |
} |
| 235 |
|
| 236 |
@Override |
| 237 |
@DataClass.Generated.Member |
| 238 |
public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
int flg = 0; |
| 243 |
if (mWindowManagerMirroring) flg |= 0x100; |
| 244 |
if (mSurface != null) flg |= 0x20; |
| 245 |
if (mUniqueId != null) flg |= 0x40; |
| 246 |
dest.writeInt(flg); |
| 247 |
dest.writeString(mName); |
| 248 |
dest.writeInt(mWidth); |
| 249 |
dest.writeInt(mHeight); |
| 250 |
dest.writeInt(mDensityDpi); |
| 251 |
dest.writeInt(mFlags); |
| 252 |
if (mSurface != null) dest.writeTypedObject(mSurface, flags); |
| 253 |
if (mUniqueId != null) dest.writeString(mUniqueId); |
| 254 |
dest.writeInt(mDisplayIdToMirror); |
| 255 |
} |
| 256 |
|
| 257 |
@Override |
| 258 |
@DataClass.Generated.Member |
| 259 |
public int describeContents() { return 0; } |
| 260 |
|
| 261 |
|
| 262 |
@SuppressWarnings({"unchecked", "RedundantCast"}) |
| 263 |
@DataClass.Generated.Member |
| 264 |
VirtualDisplayConfig(@NonNull Parcel in) { |
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
int flg = in.readInt(); |
| 269 |
boolean windowManagerMirroring = (flg & 0x100) != 0; |
| 270 |
String name = in.readString(); |
| 271 |
int width = in.readInt(); |
| 272 |
int height = in.readInt(); |
| 273 |
int densityDpi = in.readInt(); |
| 274 |
int flags = in.readInt(); |
| 275 |
Surface surface = (flg & 0x20) == 0 ? null : (Surface) in.readTypedObject(Surface.CREATOR); |
| 276 |
String uniqueId = (flg & 0x40) == 0 ? null : in.readString(); |
| 277 |
int displayIdToMirror = in.readInt(); |
| 278 |
|
| 279 |
this.mName = name; |
| 280 |
com.android.internal.util.AnnotationValidations.validate( |
| 281 |
NonNull.class, null, mName); |
| 282 |
this.mWidth = width; |
| 283 |
com.android.internal.util.AnnotationValidations.validate( |
| 284 |
IntRange.class, null, mWidth, |
| 285 |
"from", 1); |
| 286 |
this.mHeight = height; |
| 287 |
com.android.internal.util.AnnotationValidations.validate( |
| 288 |
IntRange.class, null, mHeight, |
| 289 |
"from", 1); |
| 290 |
this.mDensityDpi = densityDpi; |
| 291 |
com.android.internal.util.AnnotationValidations.validate( |
| 292 |
IntRange.class, null, mDensityDpi, |
| 293 |
"from", 1); |
| 294 |
this.mFlags = flags; |
| 295 |
com.android.internal.util.AnnotationValidations.validate( |
| 296 |
VirtualDisplayFlag.class, null, mFlags); |
| 297 |
this.mSurface = surface; |
| 298 |
this.mUniqueId = uniqueId; |
| 299 |
this.mDisplayIdToMirror = displayIdToMirror; |
| 300 |
this.mWindowManagerMirroring = windowManagerMirroring; |
| 301 |
|
| 302 |
|
| 303 |
} |
| 304 |
|
| 305 |
@DataClass.Generated.Member |
| 306 |
public static final @NonNull Parcelable.Creator<VirtualDisplayConfig> CREATOR |
| 307 |
= new Parcelable.Creator<VirtualDisplayConfig>() { |
| 308 |
@Override |
| 309 |
public VirtualDisplayConfig[] newArray(int size) { |
| 310 |
return new VirtualDisplayConfig[size]; |
| 311 |
} |
| 312 |
|
| 313 |
@Override |
| 314 |
public VirtualDisplayConfig createFromParcel(@NonNull Parcel in) { |
| 315 |
return new VirtualDisplayConfig(in); |
| 316 |
} |
| 317 |
}; |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
@SuppressWarnings("WeakerAccess") |
| 323 |
@DataClass.Generated.Member |
| 324 |
public static final class Builder { |
| 325 |
|
| 326 |
private @NonNull String mName; |
| 327 |
private @IntRange(from = 1) int mWidth; |
| 328 |
private @IntRange(from = 1) int mHeight; |
| 329 |
private @IntRange(from = 1) int mDensityDpi; |
| 330 |
private @VirtualDisplayFlag int mFlags; |
| 331 |
private @Nullable Surface mSurface; |
| 332 |
private @Nullable String mUniqueId; |
| 333 |
private int mDisplayIdToMirror; |
| 334 |
private boolean mWindowManagerMirroring; |
| 335 |
|
| 336 |
private long mBuilderFieldsSet = 0L; |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
public Builder( |
| 351 |
@NonNull String name, |
| 352 |
@IntRange(from = 1) int width, |
| 353 |
@IntRange(from = 1) int height, |
| 354 |
@IntRange(from = 1) int densityDpi) { |
| 355 |
mName = name; |
| 356 |
com.android.internal.util.AnnotationValidations.validate( |
| 357 |
NonNull.class, null, mName); |
| 358 |
mWidth = width; |
| 359 |
com.android.internal.util.AnnotationValidations.validate( |
| 360 |
IntRange.class, null, mWidth, |
| 361 |
"from", 1); |
| 362 |
mHeight = height; |
| 363 |
com.android.internal.util.AnnotationValidations.validate( |
| 364 |
IntRange.class, null, mHeight, |
| 365 |
"from", 1); |
| 366 |
mDensityDpi = densityDpi; |
| 367 |
com.android.internal.util.AnnotationValidations.validate( |
| 368 |
IntRange.class, null, mDensityDpi, |
| 369 |
"from", 1); |
| 370 |
} |
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
@DataClass.Generated.Member |
| 376 |
public @NonNull Builder setName(@NonNull String value) { |
| 377 |
checkNotUsed(); |
| 378 |
mBuilderFieldsSet |= 0x1; |
| 379 |
mName = value; |
| 380 |
return this; |
| 381 |
} |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
@DataClass.Generated.Member |
| 387 |
public @NonNull Builder setWidth(@IntRange(from = 1) int value) { |
| 388 |
checkNotUsed(); |
| 389 |
mBuilderFieldsSet |= 0x2; |
| 390 |
mWidth = value; |
| 391 |
return this; |
| 392 |
} |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
@DataClass.Generated.Member |
| 398 |
public @NonNull Builder setHeight(@IntRange(from = 1) int value) { |
| 399 |
checkNotUsed(); |
| 400 |
mBuilderFieldsSet |= 0x4; |
| 401 |
mHeight = value; |
| 402 |
return this; |
| 403 |
} |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
@DataClass.Generated.Member |
| 409 |
public @NonNull Builder setDensityDpi(@IntRange(from = 1) int value) { |
| 410 |
checkNotUsed(); |
| 411 |
mBuilderFieldsSet |= 0x8; |
| 412 |
mDensityDpi = value; |
| 413 |
return this; |
| 414 |
} |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
@DataClass.Generated.Member |
| 425 |
public @NonNull Builder setFlags(@VirtualDisplayFlag int value) { |
| 426 |
checkNotUsed(); |
| 427 |
mBuilderFieldsSet |= 0x10; |
| 428 |
mFlags = value; |
| 429 |
return this; |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
@DataClass.Generated.Member |
| 437 |
public @NonNull Builder setSurface(@NonNull Surface value) { |
| 438 |
checkNotUsed(); |
| 439 |
mBuilderFieldsSet |= 0x20; |
| 440 |
mSurface = value; |
| 441 |
return this; |
| 442 |
} |
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
@DataClass.Generated.Member |
| 450 |
public @NonNull Builder setUniqueId(@NonNull String value) { |
| 451 |
checkNotUsed(); |
| 452 |
mBuilderFieldsSet |= 0x40; |
| 453 |
mUniqueId = value; |
| 454 |
return this; |
| 455 |
} |
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
@DataClass.Generated.Member |
| 462 |
public @NonNull Builder setDisplayIdToMirror(int value) { |
| 463 |
checkNotUsed(); |
| 464 |
mBuilderFieldsSet |= 0x80; |
| 465 |
mDisplayIdToMirror = value; |
| 466 |
return this; |
| 467 |
} |
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
@DataClass.Generated.Member |
| 474 |
public @NonNull Builder setWindowManagerMirroring(boolean value) { |
| 475 |
checkNotUsed(); |
| 476 |
mBuilderFieldsSet |= 0x100; |
| 477 |
mWindowManagerMirroring = value; |
| 478 |
return this; |
| 479 |
} |
| 480 |
|
| 481 |
|
| 482 |
public @NonNull VirtualDisplayConfig build() { |
| 483 |
checkNotUsed(); |
| 484 |
mBuilderFieldsSet |= 0x200; |
| 485 |
|
| 486 |
if ((mBuilderFieldsSet & 0x10) == 0) { |
| 487 |
mFlags = 0; |
| 488 |
} |
| 489 |
if ((mBuilderFieldsSet & 0x20) == 0) { |
| 490 |
mSurface = null; |
| 491 |
} |
| 492 |
if ((mBuilderFieldsSet & 0x40) == 0) { |
| 493 |
mUniqueId = null; |
| 494 |
} |
| 495 |
if ((mBuilderFieldsSet & 0x80) == 0) { |
| 496 |
mDisplayIdToMirror = DEFAULT_DISPLAY; |
| 497 |
} |
| 498 |
if ((mBuilderFieldsSet & 0x100) == 0) { |
| 499 |
mWindowManagerMirroring = false; |
| 500 |
} |
| 501 |
VirtualDisplayConfig o = new VirtualDisplayConfig( |
| 502 |
mName, |
| 503 |
mWidth, |
| 504 |
mHeight, |
| 505 |
mDensityDpi, |
| 506 |
mFlags, |
| 507 |
mSurface, |
| 508 |
mUniqueId, |
| 509 |
mDisplayIdToMirror, |
| 510 |
mWindowManagerMirroring); |
| 511 |
return o; |
| 512 |
} |
| 513 |
|
| 514 |
private void checkNotUsed() { |
| 515 |
if ((mBuilderFieldsSet & 0x200) != 0) { |
| 516 |
throw new IllegalStateException( |
| 517 |
"This Builder should not be reused. Use a new Builder instance instead"); |
| 518 |
} |
| 519 |
} |
| 520 |
} |
| 521 |
|
| 522 |
@DataClass.Generated( |
| 523 |
time = 1646227247934L, |
| 524 |
codegenVersion = "1.0.23", |
| 525 |
sourceFile = "frameworks/base/core/java/android/hardware/display/VirtualDisplayConfig.java", |
| 526 |
inputSignatures = "private @android.annotation.NonNull java.lang.String mName\nprivate @android.annotation.IntRange int mWidth\nprivate @android.annotation.IntRange int mHeight\nprivate @android.annotation.IntRange int mDensityDpi\nprivate @android.hardware.display.DisplayManager.VirtualDisplayFlag int mFlags\nprivate @android.annotation.Nullable android.view.Surface mSurface\nprivate @android.annotation.Nullable java.lang.String mUniqueId\nprivate int mDisplayIdToMirror\nprivate boolean mWindowManagerMirroring\nclass VirtualDisplayConfig extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genAidl=true, genBuilder=true)") |
| 527 |
@Deprecated |
| 528 |
private void __metadata() {} |
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
} |