SF: Propagate uniqueID when creating virtual displays
This is part of Trunk Stable effort to upstream SF-ARC screen record
capabiliy (undiverging http://ag/20003031) which requires mirroring
virtual displays to be associated with screen capture sessions using
the package name within the unique ID.
Creating virtual display with unique ID specified is optional such that
it doesn't affect existing consumers who don't need it (i.e. av).
Bug: 137375833
Bug: 194863377
Test: libsurfaceflinger_unittest
Change-Id: Ia3cd13df07f701593ddc94c196df0b04844cf502
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c106abd..4c53fae 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -536,15 +536,16 @@
static const size_t MAX_LAYERS = 4096;
- // Implements IBinder.
- status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override;
- status_t dump(int fd, const Vector<String16>& args) override { return priorityDump(fd, args); }
- bool callingThreadHasUnscopedSurfaceFlingerAccess(bool usePermissionCache = true)
+ static bool callingThreadHasUnscopedSurfaceFlingerAccess(bool usePermissionCache = true)
EXCLUDES(mStateLock);
- // Implements ISurfaceComposer
- sp<IBinder> createDisplay(const String8& displayName, bool secure,
- float requestedRefreshRate = 0.0f);
+ // IBinder overrides:
+ status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override;
+ status_t dump(int fd, const Vector<String16>& args) override { return priorityDump(fd, args); }
+
+ // ISurfaceComposer implementation:
+ sp<IBinder> createDisplay(const String8& displayName, bool isSecure,
+ const std::string& uniqueId, float requestedRefreshRate = 0.0f);
void destroyDisplay(const sp<IBinder>& displayToken);
std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const EXCLUDES(mStateLock) {
Mutex::Autolock lock(mStateLock);
@@ -665,7 +666,7 @@
void updateHdcpLevels(hal::HWDisplayId hwcDisplayId, int32_t connectedLevel, int32_t maxLevel);
- // Implements IBinder::DeathRecipient.
+ // IBinder::DeathRecipient overrides:
void binderDied(const wp<IBinder>& who) override;
// HWC2::ComposerCallback overrides:
@@ -1543,7 +1544,7 @@
class SurfaceComposerAIDL : public gui::BnSurfaceComposer {
public:
- SurfaceComposerAIDL(sp<SurfaceFlinger> sf) : mFlinger(std::move(sf)) {}
+ explicit SurfaceComposerAIDL(sp<SurfaceFlinger> sf) : mFlinger(std::move(sf)) {}
binder::Status bootFinished() override;
binder::Status createDisplayEventConnection(
@@ -1551,8 +1552,9 @@
const sp<IBinder>& layerHandle,
sp<gui::IDisplayEventConnection>* outConnection) override;
binder::Status createConnection(sp<gui::ISurfaceComposerClient>* outClient) override;
- binder::Status createDisplay(const std::string& displayName, bool secure,
- float requestedRefreshRate, sp<IBinder>* outDisplay) override;
+ binder::Status createDisplay(const std::string& displayName, bool isSecure,
+ const std::string& uniqueId, float requestedRefreshRate,
+ sp<IBinder>* outDisplay) override;
binder::Status destroyDisplay(const sp<IBinder>& display) override;
binder::Status getPhysicalDisplayIds(std::vector<int64_t>* outDisplayIds) override;
binder::Status getPhysicalDisplayToken(int64_t displayId, sp<IBinder>* outDisplay) override;
@@ -1675,7 +1677,7 @@
gui::DynamicDisplayInfo*& outInfo);
private:
- sp<SurfaceFlinger> mFlinger;
+ const sp<SurfaceFlinger> mFlinger;
};
} // namespace android