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

Commit 74882442 authored by Jamie Gennis's avatar Jamie Gennis Committed by Android Git Automerger
Browse files

am 7b13e27e: am 6167a390: Merge "ANativeWindow: add queues-to-window-composer...

am 7b13e27e: am 6167a390: Merge "ANativeWindow: add queues-to-window-composer check." into honeycomb-mr1

* commit '7b13e27ee4a42c205b4a20d145610e8c912e7b0c':
  ANativeWindow: add queues-to-window-composer check.
parents 656492e4 90b19d71
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -138,6 +138,10 @@ public:
     * This is an ASYNCHRONOUS call.
     */
    virtual void signal() const = 0;

    /* verify that an ISurface was created by SurfaceFlinger.
     */
    virtual bool authenticateSurface(const sp<ISurface>& surface) const = 0;
};

// ----------------------------------------------------------------------------
@@ -161,7 +165,8 @@ public:
        SIGNAL,
        CAPTURE_SCREEN,
        TURN_ELECTRON_BEAM_OFF,
        TURN_ELECTRON_BEAM_ON
        TURN_ELECTRON_BEAM_ON,
        AUTHENTICATE_SURFACE,
    };

    virtual status_t    onTransact( uint32_t code,
+15 −0
Original line number Diff line number Diff line
@@ -95,6 +95,21 @@ enum {
     * 5. Queue, dequeue, queue, dequeue, ad infinitum
     */
    NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS,

    /* Check whether queueBuffer operations on the ANativeWindow send the buffer
     * to the window compositor.  The query sets the returned 'value' argument
     * to 1 if the ANativeWindow DOES send queued buffers directly to the window
     * compositor and 0 if the buffers do not go directly to the window
     * compositor.
     *
     * This can be used to determine whether protected buffer content should be
     * sent to the ANativeWindow.  Note, however, that a result of 1 does NOT
     * indicate that queued buffers will be protected from applications or users
     * capturing their contents.  If that behavior is desired then some other
     * mechanism (e.g. the GRALLOC_USAGE_PROTECTED flag) should be used in
     * conjunction with this query.
     */
    NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
};

/* valid operations for the (*perform)() hook */
+4 −0
Original line number Diff line number Diff line
@@ -156,6 +156,10 @@ int SurfaceTextureClient::query(int what, int* value) {
    case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
        *value = MIN_UNDEQUEUED_BUFFERS;
        return NO_ERROR;
    case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
        // SurfaceTextureClient currently never queues frames to SurfaceFlinger.
        *value = 0;
        return NO_ERROR;
    }
    return BAD_VALUE;
}
+53 −0
Original line number Diff line number Diff line
# Build the unit tests.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

ifneq ($(TARGET_SIMULATOR),true)

# Build the unit tests.
test_src_files := \
    SurfaceTextureClient_test.cpp \

shared_libraries := \
	libcutils \
	libutils \
	libbinder \
	libgui \
	libstlport \

static_libraries := \
	libgtest \
	libgtest_main \

c_includes := \
    bionic \
    bionic/libstdc++/include \
    external/gtest/include \
    external/stlport/stlport \

module_tags := tests

$(foreach file,$(test_src_files), \
    $(eval include $(CLEAR_VARS)) \
    $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \
    $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \
    $(eval LOCAL_C_INCLUDES := $(c_includes)) \
    $(eval LOCAL_SRC_FILES := $(file)) \
    $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
    $(eval LOCAL_MODULE_TAGS := $(module_tags)) \
    $(eval include $(BUILD_EXECUTABLE)) \
)

# Build the manual test programs.
include $(call all-subdir-makefiles)

endif

# Include subdirectory makefiles
# ============================================================

# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
# team really wants is to build the stuff defined by this makefile.
ifeq (,$(ONE_SHOT_MAKEFILE))
include $(call first-makefiles-under,$(LOCAL_PATH))
endif
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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.
 */

#include <gui/SurfaceTextureClient.h>
#include <gtest/gtest.h>

namespace android {

class SurfaceTextureClientTest : public ::testing::Test {
protected:
    virtual void SetUp() {
        mST = new SurfaceTexture(123);
        mSTC = new SurfaceTextureClient(mST);
    }

    virtual void TearDown() {
        mST.clear();
        mSTC.clear();
    }

    sp<SurfaceTexture> mST;
    sp<SurfaceTextureClient> mSTC;
};

TEST_F(SurfaceTextureClientTest, QueuesToWindowCompositorIsFalse) {
    sp<ANativeWindow> anw(mSTC);
    int result = -123;
    int err = anw->query(anw.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
            &result);
    EXPECT_EQ(NO_ERROR, err);
    EXPECT_EQ(0, result);
}

}
Loading