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

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

am ceb7cb14: am 02805a40: Merge "ANativeWindow: add query for the concrete...

am ceb7cb14: am 02805a40: Merge "ANativeWindow: add query for the concrete type." into honeycomb-mr1

* commit 'ceb7cb1460484eda1a3cb9cd271d7caf3a3dcbd1':
  ANativeWindow: add query for the concrete type.
parents 4ec63136 efeeec25
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -110,6 +110,14 @@ enum {
     * conjunction with this query.
     */
    NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,

    /* Get the concrete type of a ANativeWindow.  See below for the list of
     * possible return values.
     *
     * This query should not be used outside the Android framework and will
     * likely be removed in the near future.
     */
    NATIVE_WINDOW_CONCRETE_TYPE,
};

/* valid operations for the (*perform)() hook */
@@ -142,6 +150,13 @@ enum {
    NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
};

/* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */
enum {
    NATIVE_WINDOW_FRAMEBUFFER,                  // FramebufferNativeWindow
    NATIVE_WINDOW_SURFACE,                      // Surface
    NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT,       // SurfaceTextureClient
};

struct ANativeWindow 
{
#ifdef __cplusplus
+3 −0
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@ int SurfaceTextureClient::query(int what, int* value) {
        // SurfaceTextureClient currently never queues frames to SurfaceFlinger.
        *value = 0;
        return NO_ERROR;
    case NATIVE_WINDOW_CONCRETE_TYPE:
        *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT;
        return NO_ERROR;
    }
    return BAD_VALUE;
}
+8 −0
Original line number Diff line number Diff line
@@ -44,4 +44,12 @@ TEST_F(SurfaceTextureClientTest, QueuesToWindowCompositorIsFalse) {
    EXPECT_EQ(0, result);
}

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

}
+5 −1
Original line number Diff line number Diff line
@@ -712,11 +712,15 @@ int Surface::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:
    case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: {
        sp<ISurfaceComposer> sf(ComposerService::getComposerService());
        *value = sf->authenticateSurface(mSurface) ? 1 : 0;
        return NO_ERROR;
    }
    case NATIVE_WINDOW_CONCRETE_TYPE:
        *value = NATIVE_WINDOW_SURFACE;
        return NO_ERROR;
    }
    return BAD_VALUE;
}

+8 −0
Original line number Diff line number Diff line
@@ -130,4 +130,12 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersFail) {
    ASSERT_TRUE(heap != NULL);
}

TEST_F(SurfaceTest, ConcreteTypeIsSurface) {
    sp<ANativeWindow> anw(mSurface);
    int result = -123;
    int err = anw->query(anw.get(), NATIVE_WINDOW_CONCRETE_TYPE, &result);
    EXPECT_EQ(NO_ERROR, err);
    EXPECT_EQ(NATIVE_WINDOW_SURFACE, result);
}

}
Loading