summaryrefslogtreecommitdiff
path: root/core/java/android/view/Surface.java
Commit message (Collapse)AuthorAgeFilesLines
* Lock in Surface#destroychaviw2022-05-101-3/+5
| | | | | | | | | | | Previously, destroy just directly called release, which was already locked. Now, destroy invokes some functions in native. This means if another thread is calling release during the destroy call, it could cause crashes. Test: Hard to repro bug Bug: 223412469 Change-Id: Ie6415f505bbc86505e3fe3ea2a0bea96a3e78ad3
* Change close guard logged messagesIoannis Ilkos2021-12-211-1/+1
| | | | | | | | | Unless we are looking at stack traces (e.g. from strict mode) it's not possible to identify which type of object is not being closed (most methods are 'close' or 'release). Change the logged text to clarify. Change-Id: Ib90eac716f43c2c2caf8d8c6fb64a7bd90562da9 Test: manual
* Surface: Release references to BlastBufferQueue and SurfaceControl on ↵Vishnu Nair2021-08-301-0/+4
| | | | | | | | | | | | | | | | | | | Surface#destroy SurfaceView clients may hold on to surface references. In S this means they would extend the lifetime of the SurfaceControl resulting in "leaking" buffers until the references are cleared or the app is terminated. Fix this by calling a new destroy function on Surface which will explicitly remove references to the SurfaceControl and BBQ it holds. This is safe because SurfaceView controls the lifecycle of the Surface and knows when the Surface will become invalid. Once invalid, the Surface cannot become valid again. Test: repro steps in bug Bug: 198133921 Change-Id: I5c7e43736f025fc0965eae2f19719ba40df3cb70
* MediaProjection captures DisplayAreaNaomi Musgrave2021-08-091-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | MediaProjection is used by apps to capture the contents of a display. Apps consume the content from a surface passed in to MediaProjection#createVirtualDisplay. The images written out to the surface can be used for saving screenshots of the current display, screen recording, or casting to a different display. MediaProjection is currently tied to capturing a physical display. This change instead captures the DisplayArea the app is launched on. This is consistent with Display API sandboxing, which returns the DisplayArea bounds rather than the physical display bounds. Note that apps use the Display APIs to size the VirtualDisplay and output surface. Verified: screenshots, screen recording, and casting Bug: 180624777 Bug: 195280234 Test: atest WmTests:DisplayContentTests Change-Id: I086fa1ae668dbdf0f25252c13614445af04d86f3
* Revert "MediaProjection captures DisplayArea"Naomi Musgrave2021-08-031-15/+0
| | | | | | | | | This reverts commit 45dd2a320205a58a44cd636aaa4ec6bed175b27b. Reason for revert: b/195280234 is blocking droidfood Bug: b/195280234 Change-Id: I09593dffb797d1e4c60cff52e7901ed6c00f719c
* MediaProjection captures DisplayAreaNaomi Musgrave2021-07-301-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | MediaProjection is used by apps to capture the contents of a display. Apps consume the content from a surface passed in to MediaProjection#createVirtualDisplay. The images written out to the surface can be used for saving screenshots of the current display, screen recording, or casting to a different display. MediaProjection is currently tied to capturing a physical display. This change instead captures the DisplayArea the app is launched on. This is consistent with Display API sandboxing, which returns the DisplayArea bounds rather than the physical display bounds. Note that apps use the Display APIs to size the VirtualDisplay and output surface. Verified: screenshots, screen recording, and casting Bug: 180624777 Test: atest WmTests:DisplayContentTests Change-Id: I909e9d32f573aec33869d9f49d6caffc8d7420aa
* Update javadoc for setFrameRateMarin Shalamanov2021-04-271-6/+9
| | | | | | | | | Explicitly state that when fps=0 the other two parameters of setFrameRate are ignored. Bug: 161776961 Test: n/a Change-Id: If5ecbbf053aa59071f19f6c7ba9ae0af9f15451b
* setFrameRate: Make shouldBeSeamless an enumMarin Shalamanov2021-03-241-13/+29
| | | | | | | | | | | | | | | Change the shouldBeSeamless parameter to an enum in order to make the API easier to understand. This changes - SurfaceControl.setFrameRate - Surface.setFrameRate - ANativeWindow_setFrameRateWithChangeStrategy - ASurfaceTransaction_setFrameRateWithChangeStrategy Bug: 179116474 Test: atest SetFrameRateTest Change-Id: I55265399238e2c95fbb90fd33a4c2513d1fc5cec
* Extend the comment for setFrameRate(..., shouldBeSeamless)Marin Shalamanov2021-02-041-1/+3
| | | | | | Bug: 179116474 Test: n/a Change-Id: Ief2886313ec3d0334e89ac2bb2bbaf06f74e60a8
* Use setFrameRate for high refresh rate deny listAdy Abraham2021-01-271-0/+9
| | | | | | | | | | | | | | | | | | | Add visibility to SurfaceFlinger into the high refresh rate deny list and let SurfaceFlinger handle it. Previously WM was setting the preferredDisplayModeId on the denied app's window. The old way prevented SurfaceFlinger to use the frame rate override feature as it didn't know that a specific app is causing the refresh rate spec to be limited. With this change, SurfaceFlinger will limit the display refresh rate based on the high refresh rate deny list, and if possible, will use the frame rate override feature to change the display rate to a multiple, allowing other animations to be smooth while the denied app remains in the low refresh rate. Bug: 170502573 Test: manual Change-Id: Ib75a3c229cea298b65aa56dc1c1b20ca016059c4 Merged-In: Ib75a3c229cea298b65aa56dc1c1b20ca016059c4
* Add shouldBeSeamless param to Surface.setFrameRateMarin Shalamanov2020-11-171-4/+22
| | | | | | | | | | | | | | This CL adds a new parameter shouldBeSeamless to the existing setFrameRate APIs. This parameter indicates whether the desired refresh rate should be achieved only seamlessly or also switches with visual interruptions for the user are allowed. The default value of the new parameter is "true". Test: atest SetFrameRateTest Test: atest RefreshRateConfigsTest Test: atest libsurfaceflinger_unittest Bug: 161776961 Change-Id: Ic2446d278e4f57fe507d30a0a18ef7b85909da4b
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-3/+4
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-4/+3
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-3/+4
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* ScreenRotationAnimation: Use Surface#setScalingModeRobert Carr2020-10-131-1/+1
| | | | | | | | | | We are the last user of SurfaceControl#setOverrideScalingMode in ScreenRotationAnimation we have no need to call it since we are the BufferProducer and we can just use Surface#setScalingMode Bug: 161937501 Test: Existing tests pass Change-Id: I049145a91fedbbca5f009648f1537b0380c5e771
* Add BlastBufferQueue adapter in SurfaceViewVishnu Nair2020-09-241-8/+34
| | | | | | | | | | | | | | | | | | | Add support for submitting buffers in SurfaceView via BLAST using BlastBufferQueue adapter. Introduce a new config wm_use_blast_adapter_sv, that is disabled by default to enable the adapter. When enabled, the blast SC is created as a child of the main SurfaceView SC and the main SC is set as a container layer. This layer will continue to handle position, visibility and transforms while the blast SC will handle buffer updates via the adapter. Test: atest SurfaceViewBufferTests Test: go/wm-smoke w/ & w/o adb shell adb shell settings set global use_blast_adapter_sv 1 Bug: b/168504870, b/168917217 Change-Id: I826eef39e03ea339df54400be0709eaba6c88797
* Wire-up colorMode="hdr"John Reck2020-07-301-1/+5
| | | | | | | | Fow now it uses a fixed white point of 150nits TBD if this is disabled or adjusted Test: Demo app Change-Id: Iac13597b3d7633fdef3feaf7ec1da0c27c87904c
* Merge "Clarify FRAME_RATE_COMPATIBILITY_* params" into rvc-dev am: ↵Steven Thomas2020-06-011-2/+5
|\ | | | | | | | | | | | | | | 061dec3e8d am: 39bdd7a712 am: edf7f828e4 am: 41807f06e3 Original change: undetermined Change-Id: I7cd900f1782c3e2d3cd3618d941ba993d1e6dac8
| * Merge "Clarify FRAME_RATE_COMPATIBILITY_* params" into rvc-dev am: ↵Steven Thomas2020-06-011-2/+5
| |\ | | | | | | | | | | | | | | | 061dec3e8d am: 39bdd7a712 Change-Id: I3d8ef49874f9d18c38bc9c99323ebb2dfce67737
| | * Clarify FRAME_RATE_COMPATIBILITY_* paramsSteven Thomas2020-05-281-2/+5
| | | | | | | | | | | | | | | | | | Bug: 155894036 Test: n/a Change-Id: I4e9f1a293c19d1d8475d1173d58637ea018c25cf
* | | Merge "Fix 'associated' javadoc typos" am: 3fd2c5c435 am: 2e789841a4 am: ↵Treehugger Robot2020-05-131-2/+2
|\| | | | | | | | | | | | | | | | | 67efc10f9d am: 881fcd8caa am: f7ec34e017 Change-Id: Ic06f8e3251b7916a66725c1b6fe1da311fe5e20d
| * | Merge "Fix 'associated' javadoc typos" am: 3fd2c5c435 am: 2e789841a4Treehugger Robot2020-05-121-2/+2
| |\ \ | | |/ | |/| | | | Change-Id: Iddb5675dced31eacb2cbffb76377eb6e3097655f
| | * Fix 'associated' javadoc typosandrewlewis2020-05-111-2/+2
| | | | | | | | | | | | Change-Id: I4ff16ec3d6bd1d98bb04b647a38f12af87286a5e
| | * Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I5be7335b23a92b8ac80d2fd890198273b66ad644 Merged-In: I5be7335b23a92b8ac80d2fd890198273b66ad644
* | | Merge "Remove old versions of attachAndQueBuffer"TreeHugger Robot2020-04-221-21/+2
|\ \ \
| * | | Remove old versions of attachAndQueBufferLeon Scroggins III2020-04-201-21/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 150395371 Bug: 153729799 Test: go/wm-smoke Once I30a02c3688e43c1cbe3cbcef0775f3f554a0370f lands, there are no callers of the old versions. Rather than creating a new Java object and waiting for its finalizer, pass the HardwareBuffer directly to native and use it to retrieve the native GraphicBuffer. Change-Id: I190bc7ba5e9ea4f2f57287471e211be1d3bfcb6d
* | | | Merge "Clean up some formatting problems in the setFrameRate sdk docs" into ↵Steven Thomas2020-03-271-8/+8
|\ \ \ \ | |/ / / |/| / / | |/ / | | | | | | rvc-dev am: b2e92b6a5a am: 7e5e1dc230 am: 7844cc3024 am: 009296cafc Change-Id: I3683f1474e07fe033324141d4f5a3574f69884bd
| * | Clean up some formatting problems in the setFrameRate sdk docsSteven Thomas2020-03-261-8/+8
| | | | | | | | | | | | | | | | | | Bug: 152413112 Test: Built the sdk docs locally, confirmed they look correct. Change-Id: Ia7286958b582e6d0eb776c4ebeff6072dabc723e
* | | App transitions/thumbnails: Switch to HardwareBufferLeon Scroggins III2020-03-101-0/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 148155907 Bug: 150395371 Test: go/wm-smoke These previously used a GraphicBuffer created from a HARDWARE Bitmap to parcel the Bitmap. As part of moving UI Rendering into a mainline module, which will not include/expose GraphicBuffer, Bitmap#createGraphicBufferHandle is being replaced by Bitmap#getHardwareBuffer. Switch over to the now public API. Change-Id: Id714a48a10fd03a03faa371e206e0c478ae1a4b7
* | Add compatibility param to setFrameRate() apiSteven Thomas2020-02-171-5/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a compatiblity param to the setFrameRate() api, so the system has more info to decide the device frame rate when there are multiple competing preferences. I also changed the plumbing for setFrameRate() to go directly to surface flinger, instead of through buffer queue. We're trying to avoid changes to buffer queue code, to avoid disturbing the prebuilts. Bug: 137287430 Test: Added new cts tests to verify behavior of the compatibility param. cts-tradefed run commandAndExit cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.SetFrameRateTest Test: /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test --gtest_filter='SetFrameRateTest.*' Change-Id: I9123afee2ba63d01ff35fb2b257a1ee0e4928ddd
* | Fix IllegalArgumentException from Surface.release()Steven Thomas2020-02-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | ag/9659388 introduced a problem where calling Surface.release() would possibly result in an IllegalArgumentException. Fix the order of deletions in release() to avoid this. Bug: 144862317 Test: Ran a cts test that was failing with the exception, confirmed it no longer fails with this CL in place. Change-Id: Ib3fa67d49457aee304512642afe34ed6a887e6eb
* | Clarify frame rate as frames per secondSteven Thomas2020-01-231-5/+6
| | | | | | | | | | | | Bug: 137287430 Test: n/a Change-Id: Ibc2327fde50cbd86025842c4bebf4e26ffe42aa3
* | Add setFrameRate() apiSteven Thomas2020-01-221-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | setFrameRate() is a new api in Android 11 that will enable apps to specify their intended frame rate. Bug: 143912624 Bug: 137287430 Test: Added a new CTS test - android.graphics.cts.SetFrameRateTest. Change-Id: I922573c0d704e2e0ce4cfc2a462f14dce8cb7a79
* | Use new UnsupportedAppUsage annotation.Artur Satayev2019-12-181-1/+1
| | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I5be7335b23a92b8ac80d2fd890198273b66ad644
* | Remove native calls to HWUI from Surface and use the public API insteadDerek Sollenberger2019-11-061-14/+14
| | | | | | | | | | | | Test: CtsGraphicsTestCases and CtsWindowManagerDeviceTestCases Bug: 137655431 Change-Id: I8427f96e4f33905e8cabb6d48a0cc29443b9ed63
* | Revert "Remove native calls to HWUI from Surface and use the public API instead"Derek Sollenberger2019-10-301-12/+14
| | | | | | | | | | | | | | | | This reverts commit 79201b16f1dbfcfd23c1bbde08fd86b078a593bf. Reason for revert: breaks wm-presubmit Change-Id: I3245e202f88b16d30b924e229cbc05fca37a3759
* | Remove native calls to HWUI from Surface and use the public API insteadDerek Sollenberger2019-10-251-14/+12
|/ | | | | | Test: CtsGraphicsTestCases Bug: 137655431 Change-Id: I1eda485282306d571ca973e179e7202958b59105
* Attach color space information when attach and queue buffer.Peiyong Lin2019-06-261-5/+24
| | | | | | | | | | Currently when calling attachAndQueueBuffer, the color space information is lost. This results in color shift if the color space doesn't match the color space of the surface. BUG: b/135002842, b/131928312 Test: boot. Manually verified on P19 Change-Id: I95ec73c24942f79197d25ee85f139b2aaf805677
* SurfaceControl, Surface: Add nullability annotations.Robert Carr2019-03-111-1/+2
| | | | | | | | | In response to API Feedback. Test: Builds Bug: 126700125 Bug: 126360307 Change-Id: I17a14fd0d1b527ee38f68935cddee73fb4d10195
* All Parcelable CREATOR fields are @NonNull.Jeff Sharkey2019-02-281-1/+1
| | | | | | | | | If they were null, then the Parcelable would fail to work. Bug: 126726802 Test: manual Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014 Exempt-From-Owner-Approval: Trivial API annotations
* Address API council feedbackJohn Reck2019-02-221-2/+2
| | | | | | | | | | | | | | | | Bug: 125027187 Bug: 125026102 Bug: 125026678 Bug: 125026234 Bug: 125027586 Bug: 125026476 Bug: 125026103 Bug: 125026237 Bug: 125027248 Bug: 125026475 Bug: 125027487 Test: RenderNodeTests Change-Id: Ic63ea7a3cfe359a7dff0c1b46e534e499f7e928b
* Prevent reallocation of Surface object in copyFromRobert Carr2019-01-291-2/+6
| | | | | | | | | | | | Previously when we sent the Surface to the client (as opposed to the SurfaceControl) Surface::readFromParcel would take care of reusing the object if the underlying IGBP had not changed. Now that we send the SC and copy it in to the Surface, we need to add similar logic in Surface::copyFrom. Bug: 122588130, 122659537 Test: Manual Change-Id: Id0c8e61a9aff9b3c37b2a783717c15df3b36f175
* Unhide parts of SurfaceControl API in SDK.Robert Carr2019-01-221-1/+12
| | | | | | | | | | | | | | | In parity with the recently exposed NDK APIs. In addition removing @hide we make a few changes to prepare the APIs for being public. 1. Use a hidden singleton SurfaceSession 2. Expose a Surface constructor for ANativeWindow inter-op 3. Mark SurfaceControl final 4. Implement setGeometry as public version of setPosition/matrix/crop. 5. Add a visibility toggle method (as opposed to show/hide methods) for parity with NDK. Bug: 111297488 Test: android.view.cts.SurfaceControlTests Change-Id: Iac043658a360a48086ef4701a6a8ba2396878e81
* Add theme & View API to control force-darkJohn Reck2018-10-241-1/+1
| | | | | | | Bug: 102591313 Test: CTS android.uirendering.cts.testclasses.ForceDarkTests Change-Id: I6ba129681aed8e2f3f1b1ac60d458bb5f5393e9b
* Rename & package shuffleJohn Reck2018-10-041-1/+3
| | | | | | | | | | Rename DisplayListCanvas -> RecordingCanvas Move RecordingCanvas to android.graphics Move RenderNode to android.graphics Bug: 112709971 Test: make & boot Change-Id: Iddeb6a89f8923ea81a1f37bbee4e9b1db8ede238
* Create plumbing for disabling force-darkJohn Reck2018-09-241-0/+1
| | | | | | | Test: sysui's rounded corners are no longer white Bug: 102591313 Change-Id: Id99ae38c354cef06b94a5fb79b5b1a9a216a514c
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-201-0/+12
| | | | | | | | | | | | | | | | | | | | | | For packages: android.view.textservice android.view.textclassifier.logging android.view.textclassifier android.view.inputmethod android.view.autofill android.view.accessibility android.view This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I4147b038ed7adf0311ee9918b44766f82a057eaf
* Unload wallpaper bitmap and release HwuiContextLucas Dupin2018-03-271-0/+12
| | | | | | | | To decrease sysui memory usage Test: adb dumpsys meminfo Fixes: 74534423 Change-Id: I3cb4a5927e8d6b20a7aeba3fda253f0ba4cc18f6
* Add lockHardwareWideColorGamutCanvas.Peiyong Lin2018-03-081-4/+48
| | | | | | | | | | | | | | | This patch adds a hidden API to return a hardware canvas with wide color gamut support. The hardware canvas returned from BaseSurfaceHolder.lockHardwareCanvas doesn't support wide color gamut, this patch makes sure that a wide color gamut canvas context is created when calling lockHardwareCanvas. Verified this approach works by building ImageWallpaper to use this API. Without this API an 8 bit logo P3 doesn't show the logo, with this API the logo is shown correctly. See b/74116826 for more info. BUG: 74116826 Test: Build ImageWallpaper using this API with an 8 bit P3 image Change-Id: Id20343fabcd7f0873d79ce72a235ea9b7c1f3e77
* Check for surface validity to avoid native crashJorim Jaggi2018-01-221-0/+1
| | | | | | | | If the surface gets destroyed, return -1 to indicate such that the client can abort the animation, instead of crashing. Test: With Launcher in multi-window Change-Id: I4ab11557c40ed843a4c2e985a53cc2247b18b5fd