widget/gonk/nativewindow/FakeSurfaceComposer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gonk/nativewindow/FakeSurfaceComposer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     1.4 +/*
     1.5 + * Copyright (C) 2007 The Android Open Source Project
     1.6 + * Copyright (C) 2013 Mozilla Foundation
     1.7 + *
     1.8 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.9 + * you may not use this file except in compliance with the License.
    1.10 + * You may obtain a copy of the License at
    1.11 + *
    1.12 + *      http://www.apache.org/licenses/LICENSE-2.0
    1.13 + *
    1.14 + * Unless required by applicable law or agreed to in writing, software
    1.15 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.16 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.17 + * See the License for the specific language governing permissions and
    1.18 + * limitations under the License.
    1.19 + */
    1.20 +
    1.21 +#ifndef NATIVEWINDOW_FAKE_SURFACE_COMPOSER_H
    1.22 +#define NATIVEWINDOW_FAKE_SURFACE_COMPOSER_H
    1.23 +
    1.24 +#include <stdint.h>
    1.25 +#include <sys/types.h>
    1.26 +
    1.27 +#include <utils/Errors.h>
    1.28 +
    1.29 +#include <binder/BinderService.h>
    1.30 +
    1.31 +#include <gui/ISurfaceComposer.h>
    1.32 +#include <gui/ISurfaceComposerClient.h>
    1.33 +
    1.34 +namespace android {
    1.35 +
    1.36 +// ---------------------------------------------------------------------------
    1.37 +
    1.38 +class IGraphicBufferAlloc;
    1.39 +
    1.40 +class FakeSurfaceComposer : public BinderService<FakeSurfaceComposer>,
    1.41 +                            public BnSurfaceComposer
    1.42 +{
    1.43 +public:
    1.44 +    static char const* getServiceName() {
    1.45 +        return "FakeSurfaceComposer";
    1.46 +    }
    1.47 +
    1.48 +    // Instantiate MediaResourceManagerService and register to service manager.
    1.49 +    // If service manager is not present, wait until service manager becomes present.
    1.50 +    static  void instantiate();
    1.51 +#if ANDROID_VERSION >= 19
    1.52 +    virtual void destroyDisplay(const sp<android::IBinder>& display);
    1.53 +    virtual status_t captureScreen(const sp<IBinder>& display, const sp<IGraphicBufferProducer>& producer,
    1.54 +            uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ);
    1.55 +#endif
    1.56 +
    1.57 +private:
    1.58 +    FakeSurfaceComposer();
    1.59 +    // We're reference counted, never destroy FakeSurfaceComposer directly
    1.60 +    virtual ~FakeSurfaceComposer();
    1.61 +
    1.62 +    /* ------------------------------------------------------------------------
    1.63 +     * ISurfaceComposer interface
    1.64 +     */
    1.65 +    virtual sp<ISurfaceComposerClient> createConnection();
    1.66 +    virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc();
    1.67 +    virtual sp<IBinder> createDisplay(const String8& displayName, bool secure);
    1.68 +    virtual sp<IBinder> getBuiltInDisplay(int32_t id);
    1.69 +    virtual void setTransactionState(const Vector<ComposerState>& state,
    1.70 +            const Vector<DisplayState>& displays, uint32_t flags);
    1.71 +    virtual void bootFinished();
    1.72 +    virtual bool authenticateSurfaceTexture(
    1.73 +        const sp<IGraphicBufferProducer>& bufferProducer) const;
    1.74 +    virtual sp<IDisplayEventConnection> createDisplayEventConnection();
    1.75 +    virtual status_t captureScreen(const sp<IBinder>& display,
    1.76 +            const sp<IGraphicBufferProducer>& producer,
    1.77 +            uint32_t reqWidth, uint32_t reqHeight,
    1.78 +            uint32_t minLayerZ, uint32_t maxLayerZ, bool isCpuConsumer);
    1.79 +    // called when screen needs to turn off
    1.80 +    virtual void blank(const sp<IBinder>& display);
    1.81 +    // called when screen is turning back on
    1.82 +    virtual void unblank(const sp<IBinder>& display);
    1.83 +    virtual status_t getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info);
    1.84 +
    1.85 +};
    1.86 +
    1.87 +// ---------------------------------------------------------------------------
    1.88 +}; // namespace android
    1.89 +
    1.90 +#endif // NATIVEWINDOW_FAKE_SURFACE_COMPOSER_H

mercurial