summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author Brian Lindahl <blindahl@google.com> 2024-11-01 09:28:47 -0600
committer Brian Lindahl <blindahl@google.com> 2024-11-18 16:57:48 -0700
commitf5fdff8d956bf61afd767c829810fa93b9909b4a (patch)
treee6d16f87f3312220fab09362959c0eb9c0e8eeba /libs
parentc6102c0a29143d689f33129b9f13a302aa799bfa (diff)
Notify listeners about active picture profiles
Bug: 337330263 Test: atest ActivePictureUpdaterTest Test: atest SurfaceControlPictureProfileTest Flag: com.android.graphics.libgui.flags.apply_picture_profiles Change-Id: If08b79faf3d3c4c07248ecd7385a75cfe5357726
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp7
-rw-r--r--libs/gui/aidl/android/gui/ActivePicture.aidl32
-rw-r--r--libs/gui/aidl/android/gui/IActivePictureListener.aidl30
-rw-r--r--libs/gui/aidl/android/gui/ISurfaceComposer.aidl7
-rw-r--r--libs/gui/include/gui/SurfaceComposerClient.h2
-rw-r--r--libs/gui/tests/Surface_test.cpp5
6 files changed, 83 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 61aabaa7f6..1f7d16fccb 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -3280,6 +3280,13 @@ status_t SurfaceComposerClient::removeHdrLayerInfoListener(
return statusTFromBinderStatus(status);
}
+status_t SurfaceComposerClient::setActivePictureListener(
+ const sp<gui::IActivePictureListener>& listener) {
+ binder::Status status =
+ ComposerServiceAIDL::getComposerService()->setActivePictureListener(listener);
+ return statusTFromBinderStatus(status);
+}
+
status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) {
binder::Status status = ComposerServiceAIDL::getComposerService()->notifyPowerBoost(boostId);
return statusTFromBinderStatus(status);
diff --git a/libs/gui/aidl/android/gui/ActivePicture.aidl b/libs/gui/aidl/android/gui/ActivePicture.aidl
new file mode 100644
index 0000000000..9b83be16ca
--- /dev/null
+++ b/libs/gui/aidl/android/gui/ActivePicture.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.gui;
+
+/**
+ * Visible content that is using picture processing.
+ * @hide
+ */
+parcelable ActivePicture {
+ /** The layer ID that is using picture processing. */
+ int layerId;
+
+ /** UID that owns layer using picture processing. */
+ int ownerUid;
+
+ /** ID of the picture profile that was used to configure the picture processing. */
+ long pictureProfileId;
+}
diff --git a/libs/gui/aidl/android/gui/IActivePictureListener.aidl b/libs/gui/aidl/android/gui/IActivePictureListener.aidl
new file mode 100644
index 0000000000..ad310bbd66
--- /dev/null
+++ b/libs/gui/aidl/android/gui/IActivePictureListener.aidl
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.gui;
+
+import android.gui.ActivePicture;
+
+/**
+ * Receive callbacks whenever the visible content using picture profiles changes.
+ * @hide
+ */
+interface IActivePictureListener {
+ /**
+ * Callback reporting the visible content on the screen using picture profiles.
+ */
+ oneway void onActivePicturesChanged(in ActivePicture[] activePictures);
+}
diff --git a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
index ac14138e8c..c8bf0ef444 100644
--- a/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
+++ b/libs/gui/aidl/android/gui/ISurfaceComposer.aidl
@@ -33,6 +33,7 @@ import android.gui.FrameEvent;
import android.gui.FrameStats;
import android.gui.HdrConversionCapability;
import android.gui.HdrConversionStrategy;
+import android.gui.IActivePictureListener;
import android.gui.IDisplayEventConnection;
import android.gui.IFpsListener;
import android.gui.IHdrLayerInfoListener;
@@ -599,4 +600,10 @@ interface ISurfaceComposer {
* past the provided VSync.
*/
oneway void removeJankListener(int layerId, IJankListener listener, long afterVsync);
+
+ /**
+ * Sets the listener used to monitor visible content that is being processed with picture
+ * profiles.
+ */
+ oneway void setActivePictureListener(IActivePictureListener listener);
}
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index 0d7f8c2824..ec62ec3dfb 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -298,6 +298,8 @@ public:
static status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken,
const sp<gui::IHdrLayerInfoListener>& listener);
+ static status_t setActivePictureListener(const sp<gui::IActivePictureListener>& listener);
+
/*
* Sends a power boost to the composer. This function is asynchronous.
*
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index c74186682e..38c7f2b70a 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -21,6 +21,7 @@
#include <gtest/gtest.h>
#include <SurfaceFlingerProperties.h>
+#include <android/gui/IActivePictureListener.h>
#include <android/gui/IDisplayEventConnection.h>
#include <android/gui/ISurfaceComposer.h>
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
@@ -1015,6 +1016,10 @@ public:
return binder::Status::ok();
}
+ binder::Status setActivePictureListener(const sp<gui::IActivePictureListener>&) {
+ return binder::Status::ok();
+ }
+
protected:
IBinder* onAsBinder() override { return nullptr; }