Merge "Fix ExtendedCameraCharacteristicsTest cts failures."
This commit is contained in:
committed by
Android (Google) Code Review
commit
57ebbce076
@@ -89,6 +89,24 @@ static sp<Surface> getSurface(JNIEnv* env, jobject surface) {
|
||||
|
||||
extern "C" {
|
||||
|
||||
static jint SurfaceUtils_nativeDetectSurfaceType(JNIEnv* env, jobject thiz, jobject surface) {
|
||||
ALOGV("nativeDetectSurfaceType");
|
||||
sp<ANativeWindow> anw;
|
||||
if ((anw = getNativeWindow(env, surface)) == NULL) {
|
||||
ALOGE("%s: Could not retrieve native window from surface.", __FUNCTION__);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
int32_t fmt = 0;
|
||||
status_t err = anw->query(anw.get(), NATIVE_WINDOW_FORMAT, &fmt);
|
||||
if (err != NO_ERROR) {
|
||||
ALOGE("%s: Error while querying surface pixel format %s (%d).", __FUNCTION__,
|
||||
strerror(-err), err);
|
||||
OVERRIDE_SURFACE_ERROR(err);
|
||||
return err;
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
||||
static jint SurfaceUtils_nativeDetectSurfaceDataspace(JNIEnv* env, jobject thiz, jobject surface) {
|
||||
ALOGV("nativeDetectSurfaceDataspace");
|
||||
sp<ANativeWindow> anw;
|
||||
@@ -107,27 +125,6 @@ static jint SurfaceUtils_nativeDetectSurfaceDataspace(JNIEnv* env, jobject thiz,
|
||||
return fmt;
|
||||
}
|
||||
|
||||
static jint SurfaceUtils_nativeDetectSurfaceType(JNIEnv* env, jobject thiz, jobject surface) {
|
||||
ALOGV("nativeDetectSurfaceType");
|
||||
sp<ANativeWindow> anw;
|
||||
if ((anw = getNativeWindow(env, surface)) == NULL) {
|
||||
ALOGE("%s: Could not retrieve native window from surface.", __FUNCTION__);
|
||||
return BAD_VALUE;
|
||||
}
|
||||
int32_t halFmt = 0;
|
||||
status_t err = anw->query(anw.get(), NATIVE_WINDOW_FORMAT, &halFmt);
|
||||
if (err != NO_ERROR) {
|
||||
ALOGE("%s: Error while querying surface pixel format %s (%d).", __FUNCTION__,
|
||||
strerror(-err), err);
|
||||
OVERRIDE_SURFACE_ERROR(err);
|
||||
return err;
|
||||
}
|
||||
int32_t dataspace = SurfaceUtils_nativeDetectSurfaceDataspace(env, thiz, surface);
|
||||
int32_t fmt = static_cast<int32_t>(
|
||||
mapHalFormatDataspaceToPublicFormat(halFmt, static_cast<android_dataspace>(dataspace)));
|
||||
return fmt;
|
||||
}
|
||||
|
||||
static jint SurfaceUtils_nativeDetectSurfaceDimens(JNIEnv* env, jobject thiz, jobject surface,
|
||||
jintArray dimens) {
|
||||
ALOGV("nativeGetSurfaceDimens");
|
||||
|
||||
@@ -264,10 +264,9 @@ public class ImageWriter implements AutoCloseable {
|
||||
if (useSurfaceImageFormatInfo) {
|
||||
// nativeInit internally overrides UNKNOWN format. So does surface format query after
|
||||
// nativeInit and before getEstimatedNativeAllocBytes().
|
||||
imageFormat = SurfaceUtils.getSurfaceFormat(surface);
|
||||
mDataSpace = dataSpace = PublicFormatUtils.getHalDataspace(imageFormat);
|
||||
mHardwareBufferFormat =
|
||||
hardwareBufferFormat = PublicFormatUtils.getHalFormat(imageFormat);
|
||||
mHardwareBufferFormat = hardwareBufferFormat = SurfaceUtils.getSurfaceFormat(surface);
|
||||
mDataSpace = dataSpace = SurfaceUtils.getSurfaceDataspace(surface);
|
||||
imageFormat = PublicFormatUtils.getPublicFormat(hardwareBufferFormat, dataSpace);
|
||||
}
|
||||
|
||||
// Estimate the native buffer allocation size and register it so it gets accounted for
|
||||
|
||||
Reference in New Issue
Block a user