Merge "Updaing the database version"
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
index 56f029f..57f9e15 100644
--- a/include/gui/SurfaceTextureClient.h
+++ b/include/gui/SurfaceTextureClient.h
@@ -135,24 +135,12 @@
// a timestamp is auto-generated when queueBuffer is called.
int64_t mTimestamp;
- // mQueryWidth is the width returned by query(). It is set to width
- // of the last dequeued buffer or to mReqWidth if no buffer was dequeued.
- uint32_t mQueryWidth;
-
- // mQueryHeight is the height returned by query(). It is set to height
- // of the last dequeued buffer or to mReqHeight if no buffer was dequeued.
- uint32_t mQueryHeight;
-
- // mQueryFormat is the format returned by query(). It is set to the last
- // dequeued format or to mReqFormat if no buffer was dequeued.
- uint32_t mQueryFormat;
-
// mDefaultWidth is default width of the window, regardless of the
- // set_dimension call
+ // native_window_set_buffers_dimensions call
uint32_t mDefaultWidth;
// mDefaultHeight is default width of the window, regardless of the
- // set_dimension call
+ // native_window_set_buffers_dimensions call
uint32_t mDefaultHeight;
// mTransformHint is the transform probably applied to buffers of this
diff --git a/include/utils/ZipFileRO.h b/include/utils/ZipFileRO.h
index 3a99979..547e36a 100644
--- a/include/utils/ZipFileRO.h
+++ b/include/utils/ZipFileRO.h
@@ -38,6 +38,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <time.h>
namespace android {
@@ -174,6 +175,20 @@
size_t uncompLen, size_t compLen);
/*
+ * Utility function to convert ZIP's time format to a timespec struct.
+ */
+ static inline void zipTimeToTimespec(long when, struct tm* timespec) {
+ const long date = when >> 16;
+ timespec->tm_year = ((date >> 9) & 0x7F) + 80; // Zip is years since 1980
+ timespec->tm_mon = (date >> 5) & 0x0F;
+ timespec->tm_mday = date & 0x1F;
+
+ timespec->tm_hour = (when >> 11) & 0x1F;
+ timespec->tm_min = (when >> 5) & 0x3F;
+ timespec->tm_sec = (when & 0x1F) << 1;
+ }
+
+ /*
* Some basic functions for raw data manipulation. "LE" means
* Little Endian.
*/
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 8d19957..16755ad 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -196,11 +196,14 @@
status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
{
- Mutex::Autolock lock(mMutex);
- if ((w != mDefaultWidth) || (h != mDefaultHeight)) {
- mDefaultWidth = w;
- mDefaultHeight = h;
+ if (!w || !h) {
+ LOGE("setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)", w, h);
+ return BAD_VALUE;
}
+
+ Mutex::Autolock lock(mMutex);
+ mDefaultWidth = w;
+ mDefaultHeight = h;
return OK;
}
@@ -885,13 +888,9 @@
switch (what) {
case NATIVE_WINDOW_WIDTH:
value = mDefaultWidth;
- if (!mDefaultWidth && !mDefaultHeight && mCurrentTextureBuf!=0)
- value = mCurrentTextureBuf->width;
break;
case NATIVE_WINDOW_HEIGHT:
value = mDefaultHeight;
- if (!mDefaultWidth && !mDefaultHeight && mCurrentTextureBuf!=0)
- value = mCurrentTextureBuf->height;
break;
case NATIVE_WINDOW_FORMAT:
value = mPixelFormat;
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index df0ad5a..e6837ea 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -52,9 +52,6 @@
mReqFormat = 0;
mReqUsage = 0;
mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO;
- mQueryWidth = 0;
- mQueryHeight = 0;
- mQueryFormat = 0;
mDefaultWidth = 0;
mDefaultHeight = 0;
mTransformHint = 0;
@@ -154,9 +151,6 @@
result);
return result;
}
- mQueryWidth = gbuf->width;
- mQueryHeight = gbuf->height;
- mQueryFormat = gbuf->format;
}
*buffer = gbuf.get();
return OK;
diff --git a/libs/ui/tests/Android.mk b/libs/ui/tests/Android.mk
index 693a32a..700b604 100644
--- a/libs/ui/tests/Android.mk
+++ b/libs/ui/tests/Android.mk
@@ -45,4 +45,4 @@
)
# Build the manual test programs.
-include $(call all-subdir-makefiles)
+include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index cb6c246..6cf01c8 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -4346,7 +4346,8 @@
| (0x0000ffff & (entryIndex));
resource_name resName;
if (!this->getResourceName(resID, &resName)) {
- return UNKNOWN_ERROR;
+ LOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID);
+ continue;
}
const String16 overlayType(resName.type, resName.typeLen);
diff --git a/libs/utils/tests/Android.mk b/libs/utils/tests/Android.mk
index 8726a53..b97f52f 100644
--- a/libs/utils/tests/Android.mk
+++ b/libs/utils/tests/Android.mk
@@ -8,7 +8,8 @@
ObbFile_test.cpp \
Looper_test.cpp \
String8_test.cpp \
- Unicode_test.cpp
+ Unicode_test.cpp \
+ ZipFileRO_test.cpp \
shared_libraries := \
libz \
diff --git a/libs/utils/tests/ZipFileRO_test.cpp b/libs/utils/tests/ZipFileRO_test.cpp
new file mode 100644
index 0000000..7a1d0bd
--- /dev/null
+++ b/libs/utils/tests/ZipFileRO_test.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "ZipFileRO_test"
+#include <utils/Log.h>
+#include <utils/ZipFileRO.h>
+
+#include <gtest/gtest.h>
+
+#include <fcntl.h>
+#include <string.h>
+
+namespace android {
+
+class ZipFileROTest : public testing::Test {
+protected:
+ virtual void SetUp() {
+ }
+
+ virtual void TearDown() {
+ }
+};
+
+TEST_F(ZipFileROTest, ZipTimeConvertSuccess) {
+ struct tm t;
+
+ // 2011-06-29 14:40:40
+ long when = 0x3EDD7514;
+
+ ZipFileRO::zipTimeToTimespec(when, &t);
+
+ EXPECT_EQ(2011, t.tm_year + 1900)
+ << "Year was improperly converted.";
+
+ EXPECT_EQ(6, t.tm_mon)
+ << "Month was improperly converted.";
+
+ EXPECT_EQ(29, t.tm_mday)
+ << "Day was improperly converted.";
+
+ EXPECT_EQ(14, t.tm_hour)
+ << "Hour was improperly converted.";
+
+ EXPECT_EQ(40, t.tm_min)
+ << "Minute was improperly converted.";
+
+ EXPECT_EQ(40, t.tm_sec)
+ << "Second was improperly converted.";
+}
+
+}
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index e0268fa..7d6a14d 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -352,12 +352,13 @@
if (sizeChanged) {
// the size changed, we need to ask our client to request a new buffer
LOGD_IF(DEBUG_RESIZE,
+ "doTransaction: "
"resize (layer=%p), requested (%dx%d), drawing (%d,%d), "
- "fixedSize=%d",
+ "scalingMode=%d",
this,
int(temp.requested_w), int(temp.requested_h),
int(front.requested_w), int(front.requested_h),
- isFixedSize());
+ mCurrentScalingMode);
if (!isFixedSize()) {
// we're being resized and there is a freeze display request,
@@ -492,6 +493,14 @@
// we now have the correct size, unfreeze the screen
mFreezeLock.clear();
}
+
+ LOGD_IF(DEBUG_RESIZE,
+ "lockPageFlip : "
+ " (layer=%p), buffer (%ux%u, tr=%02x), "
+ "requested (%dx%d)",
+ this,
+ bufWidth, bufHeight, mCurrentTransform,
+ front.requested_w, front.requested_h);
}
}
}
diff --git a/services/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp
index 24d5f9a..05b7527 100644
--- a/services/surfaceflinger/Transform.cpp
+++ b/services/surfaceflinger/Transform.cpp
@@ -308,7 +308,7 @@
bool Transform::preserveRects() const
{
- return (type() & ROT_INVALID) ? false : true;
+ return (getOrientation() & ROT_INVALID) ? false : true;
}
void Transform::dump(const char* name) const