Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1a0c6db authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ie5eee51f,I0fc7a6ee

* changes:
  libgui: Make ISurfaceComposerClient a SafeInterface
  libbinder: Add SafeInterface
parents 5f8e45a1 ee1282f4
Loading
Loading
Loading
Loading
+36 −42
Original line number Diff line number Diff line
@@ -14,30 +14,30 @@
 * limitations under the License.
 */

#ifndef ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H

#include <stdint.h>
#include <sys/types.h>

#include <utils/Errors.h>
#include <utils/RefBase.h>
#pragma once

#include <binder/IInterface.h>

#include <ui/FrameStats.h>
#include <binder/SafeInterface.h>
#include <ui/PixelFormat.h>

namespace android {
// ----------------------------------------------------------------------------

class FrameStats;
class IGraphicBufferProducer;

class ISurfaceComposerClient : public IInterface
{
class ISurfaceComposerClient : public IInterface {
public:
    DECLARE_META_INTERFACE(SurfaceComposerClient)

    enum class Tag : uint32_t {
        CreateSurface = IBinder::FIRST_CALL_TRANSACTION,
        DestroySurface,
        ClearLayerFrameStats,
        GetLayerFrameStats,
        GetTransformToDisplayInverse,
        Last,
    };

    // flags for createSurface()
    enum { // (keep in sync with Surface.java)
        eHidden = 0x00000004,
@@ -57,11 +57,9 @@ public:
    /*
     * Requires ACCESS_SURFACE_FLINGER permission
     */
    virtual status_t createSurface(
            const String8& name, uint32_t w, uint32_t h,
            PixelFormat format, uint32_t flags,
            const sp<IBinder>& parent, uint32_t windowType, uint32_t ownerUid,
            sp<IBinder>* handle,
    virtual status_t createSurface(const String8& name, uint32_t w, uint32_t h, PixelFormat format,
                                   uint32_t flags, const sp<IBinder>& parent, uint32_t windowType,
                                   uint32_t ownerUid, sp<IBinder>* handle,
                                   sp<IGraphicBufferProducer>* gbp) = 0;

    /*
@@ -83,16 +81,12 @@ public:
                                                  bool* outTransformToDisplayInverse) const = 0;
};

// ----------------------------------------------------------------------------

class BnSurfaceComposerClient: public BnInterface<ISurfaceComposerClient> {
class BnSurfaceComposerClient : public SafeBnInterface<ISurfaceComposerClient> {
public:
    virtual status_t onTransact(uint32_t code, const Parcel& data,
            Parcel* reply, uint32_t flags = 0);
};
    BnSurfaceComposerClient()
          : SafeBnInterface<ISurfaceComposerClient>("BnSurfaceComposerClient") {}

// ----------------------------------------------------------------------------

}; // namespace android
    status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) override;
};

#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H
} // namespace android
+4 −0
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@ cc_library {
        "libutils",
    ],

    export_include_dirs: [
        "include",
    ],

    clang: true,
    sanitize: {
        misc_undefined: ["integer"],
+621 −0

File added.

Preview size limit exceeded, changes collapsed.

+24 −0
Original line number Diff line number Diff line
@@ -80,3 +80,27 @@ cc_test {
        "libbase",
    ],
}

cc_test {
    name: "binderSafeInterfaceTest",
    srcs: ["binderSafeInterfaceTest.cpp"],

    cppflags: [
        "-Werror",
        "-Weverything",
        "-Wno-c++98-compat",
        "-Wno-c++98-compat-pedantic",
        "-Wno-global-constructors",
        "-Wno-padded",
        "-Wno-weak-vtables",
    ],

    cpp_std: "experimental",
    gnu_extensions: false,

    shared_libs: [
        "libbinder",
        "liblog",
        "libutils",
    ],
}
+514 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading