Merge "StrictMode class instance limit interface." into honeycomb
diff --git a/api/current.xml b/api/current.xml
index 3b5862e..4f566f6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -236060,6 +236060,48 @@
</parameter>
</method>
</class>
+<class name="WebStorage.Origin"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="getOrigin"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getQuota"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getUsage"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
<interface name="WebStorage.QuotaUpdater"
abstract="true"
static="true"
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 5fac525..99b686e 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -374,16 +374,18 @@
@Override
public void translate(float dx, float dy) {
- nTranslate(mRenderer, dx, dy);
+ if (dx != 0.0f || dy != 0.0f) nTranslate(mRenderer, dx, dy);
}
private native void nTranslate(int renderer, float dx, float dy);
@Override
public void skew(float sx, float sy) {
- throw new UnsupportedOperationException();
+ nSkew(mRenderer, sx, sy);
}
+ private native void nSkew(int renderer, float sx, float sy);
+
@Override
public void rotate(float degrees) {
nRotate(mRenderer, degrees);
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 5345879..257ed2a 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -75,23 +75,23 @@
private Handler mHandler = null;
private Handler mUIHandler = null;
- static class Origin {
- String mOrigin = null;
- long mQuota = 0;
- long mUsage = 0;
+ public static class Origin {
+ private String mOrigin = null;
+ private long mQuota = 0;
+ private long mUsage = 0;
- public Origin(String origin, long quota, long usage) {
+ private Origin(String origin, long quota, long usage) {
mOrigin = origin;
mQuota = quota;
mUsage = usage;
}
- public Origin(String origin, long quota) {
+ private Origin(String origin, long quota) {
mOrigin = origin;
mQuota = quota;
}
- public Origin(String origin) {
+ private Origin(String origin) {
mOrigin = origin;
}
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 40cec3e..ac491ea 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -213,6 +213,11 @@
renderer->scale(sx, sy);
}
+static void android_view_GLES20Canvas_skew(JNIEnv* env, jobject canvas,
+ OpenGLRenderer* renderer, jfloat sx, jfloat sy) {
+ renderer->skew(sx, sy);
+}
+
static void android_view_GLES20Canvas_setMatrix(JNIEnv* env, jobject canvas,
OpenGLRenderer* renderer, SkMatrix* matrix) {
renderer->setMatrix(matrix);
@@ -550,6 +555,7 @@
{ "nTranslate", "(IFF)V", (void*) android_view_GLES20Canvas_translate },
{ "nRotate", "(IF)V", (void*) android_view_GLES20Canvas_rotate },
{ "nScale", "(IFF)V", (void*) android_view_GLES20Canvas_scale },
+ { "nSkew", "(IFF)V", (void*) android_view_GLES20Canvas_skew },
{ "nSetMatrix", "(II)V", (void*) android_view_GLES20Canvas_setMatrix },
{ "nGetMatrix", "(I)I", (void*) android_view_GLES20Canvas_getNativeMatrix },
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index e3593da..ade85e5 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -268,6 +268,10 @@
renderer.scale(getFloat(), getFloat());
}
break;
+ case Skew: {
+ renderer.skew(getFloat(), getFloat());
+ }
+ break;
case SetMatrix: {
renderer.setMatrix(getMatrix());
}
@@ -508,6 +512,12 @@
OpenGLRenderer::scale(sx, sy);
}
+void DisplayListRenderer::skew(float sx, float sy) {
+ addOp(DisplayList::Skew);
+ addPoint(sx, sy);
+ OpenGLRenderer::skew(sx, sy);
+}
+
void DisplayListRenderer::setMatrix(SkMatrix* matrix) {
addOp(DisplayList::SetMatrix);
addMatrix(matrix);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 7152334..05864ec 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -98,6 +98,7 @@
Translate,
Rotate,
Scale,
+ Skew,
SetMatrix,
ConcatMatrix,
ClipRect,
@@ -250,6 +251,7 @@
void translate(float dx, float dy);
void rotate(float degrees);
void scale(float sx, float sy);
+ void skew(float sx, float sy);
void setMatrix(SkMatrix* matrix);
void concatMatrix(SkMatrix* matrix);
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index d1fbfba..c080501 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -38,8 +38,10 @@
// Font
///////////////////////////////////////////////////////////////////////////////
-Font::Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags) :
- mState(state), mFontId(fontId), mFontSize(fontSize), mFlags(flags) {
+Font::Font(FontRenderer* state, uint32_t fontId, float fontSize,
+ int flags, uint32_t italicStyle) :
+ mState(state), mFontId(fontId), mFontSize(fontSize),
+ mFlags(flags), mItalicStyle(italicStyle) {
}
@@ -275,17 +277,19 @@
return newGlyph;
}
-Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize, int flags) {
+Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize,
+ int flags, uint32_t italicStyle) {
Vector<Font*> &activeFonts = state->mActiveFonts;
for (uint32_t i = 0; i < activeFonts.size(); i++) {
Font* font = activeFonts[i];
- if (font->mFontId == fontId && font->mFontSize == fontSize && font->mFlags == flags) {
+ if (font->mFontId == fontId && font->mFontSize == fontSize &&
+ font->mFlags == flags && font->mItalicStyle == italicStyle) {
return font;
}
}
- Font* newFont = new Font(state, fontId, fontSize, flags);
+ Font* newFont = new Font(state, fontId, fontSize, flags, italicStyle);
activeFonts.push(newFont);
return newFont;
}
@@ -638,7 +642,10 @@
if (paint->isFakeBoldText()) {
flags |= Font::kFakeBold;
}
- mCurrentFont = Font::create(this, fontId, fontSize, flags);
+
+ const float skewX = paint->getTextSkewX();
+ uint32_t italicStyle = *(uint32_t*) &skewX;
+ mCurrentFont = Font::create(this, fontId, fontSize, flags, italicStyle);
const float maxPrecacheFontSize = 40.0f;
bool isNewFont = currentNumFonts != mActiveFonts.size();
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index 40572c6..1005812 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -57,7 +57,8 @@
/**
* Creates a new font associated with the specified font state.
*/
- static Font* create(FontRenderer* state, uint32_t fontId, float fontSize, int flags);
+ static Font* create(FontRenderer* state, uint32_t fontId, float fontSize,
+ int flags, uint32_t italicStyle);
protected:
friend class FontRenderer;
@@ -103,7 +104,7 @@
SkFixed mRsbDelta;
};
- Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags);
+ Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags, uint32_t italicStyle);
DefaultKeyedVector<int32_t, CachedGlyphInfo*> mCachedGlyphs;
@@ -122,6 +123,7 @@
uint32_t mFontId;
float mFontSize;
int mFlags;
+ uint32_t mItalicStyle;
};
class FontRenderer {
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index fe7f883..e7c0fe3 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -178,6 +178,24 @@
data[kScaleZ] = sz;
}
+void Matrix4::loadSkew(float sx, float sy) {
+ loadIdentity();
+
+ data[kScaleX] = 1.0f;
+ data[kSkewX] = sx;
+ data[kTranslateX] = 0.0f;
+
+ data[kSkewY] = sy;
+ data[kScaleY] = 1.0f;
+ data[kTranslateY] = 0.0f;
+
+ data[kPerspective0] = 0.0f;
+ data[kPerspective1] = 0.0f;
+ data[kPerspective2] = 1.0f;
+
+ mSimpleMatrix = false;
+}
+
void Matrix4::loadRotate(float angle, float x, float y, float z) {
data[kPerspective0] = 0.0f;
data[kPerspective1] = 0.0f;
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 23fc6c3..08f5d77 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -72,6 +72,7 @@
void loadTranslate(float x, float y, float z);
void loadScale(float sx, float sy, float sz);
+ void loadSkew(float sx, float sy);
void loadRotate(float angle, float x, float y, float z);
void loadMultiply(const Matrix4& u, const Matrix4& v);
@@ -97,6 +98,12 @@
multiply(u);
}
+ void skew(float sx, float sy) {
+ Matrix4 u;
+ u.loadSkew(sx, sy);
+ multiply(u);
+ }
+
void rotate(float angle, float x, float y, float z) {
Matrix4 u;
u.loadRotate(angle, x, y, z);
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 16a1de7..2067acc1 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -766,6 +766,10 @@
mSnapshot->transform->scale(sx, sy, 1.0f);
}
+void OpenGLRenderer::skew(float sx, float sy) {
+ mSnapshot->transform->skew(sx, sy);
+}
+
void OpenGLRenderer::setMatrix(SkMatrix* matrix) {
mSnapshot->transform->load(*matrix);
}
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 7387b92..272c5c2 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -84,6 +84,7 @@
virtual void translate(float dx, float dy);
virtual void rotate(float degrees);
virtual void scale(float sx, float sy);
+ virtual void skew(float sx, float sy);
const float* getMatrix() const;
void getMatrix(SkMatrix* matrix);
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 8929393..10c9a9a 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1177,7 +1177,8 @@
long lastModifiedSeconds = file.lastModified() / 1000;
// always scan the file, so we can return the content://media Uri for existing files
- return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),false, true);
+ return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),
+ false, true);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
return null;
@@ -1185,17 +1186,30 @@
}
public void scanMtpFile(String path, String volumeName, int objectHandle, int format) {
+ initialize(volumeName);
MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path);
int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType);
+ File file = new File(path);
+ long lastModifiedSeconds = file.lastModified() / 1000;
if (!MediaFile.isAudioFileType(fileType) && !MediaFile.isVideoFileType(fileType) &&
!MediaFile.isImageFileType(fileType) && !MediaFile.isPlayListFileType(fileType)) {
- // nothing to do
+
+ // no need to use the media scanner, but we need to update last modified and file size
+ ContentValues values = new ContentValues();
+ values.put(Files.FileColumns.SIZE, file.length());
+ values.put(Files.FileColumns.DATE_MODIFIED, lastModifiedSeconds);
+ try {
+ String[] whereArgs = new String[] { Integer.toString(objectHandle) };
+ mMediaProvider.update(Files.getMtpObjectsUri(volumeName), values, "_id=?",
+ whereArgs);
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException in scanMtpFile", e);
+ }
return;
}
mMtpObjectHandle = objectHandle;
- initialize(volumeName);
try {
if (MediaFile.isPlayListFileType(fileType)) {
// build file cache so we can look up tracks in the playlist
@@ -1213,11 +1227,6 @@
// MTP will create a file entry for us so we don't want to do it in prescan
prescan(path, false);
- File file = new File(path);
-
- // lastModified is in milliseconds on Files.
- long lastModifiedSeconds = file.lastModified() / 1000;
-
// always scan the file, so we can return the content://media Uri for existing files
mClient.doScanFile(path, mediaFileType.mimeType, lastModifiedSeconds, file.length(),
(format == MtpConstants.FORMAT_ASSOCIATION), true);
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index ac476ff..d348e8b 100644
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -185,7 +185,7 @@
}
}
- private void endSendObject(String path, int handle, int format, long actualSize, boolean succeeded) {
+ private void endSendObject(String path, int handle, int format, boolean succeeded) {
if (succeeded) {
// handle abstract playlists separately
// they do not exist in the file system so don't use the media scanner here
@@ -208,18 +208,6 @@
Log.e(TAG, "RemoteException in endSendObject", e);
}
} else {
- if (actualSize >= 0) {
- // update size if necessary
- ContentValues values = new ContentValues();
- values.put(Files.FileColumns.SIZE, actualSize);
- try {
- String[] whereArgs = new String[] { Integer.toString(handle) };
- mMediaProvider.update(mObjectsUri, values, ID_WHERE, whereArgs);
- } catch (RemoteException e) {
- Log.e(TAG, "RemoteException in mMediaProvider.update", e);
- }
- }
-
mMediaScanner.scanMtpFile(path, mVolumeName, handle, format);
}
} else {
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 8f9b8a2..9abf6a2 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -99,7 +99,6 @@
virtual void endSendObject(const char* path,
MtpObjectHandle handle,
MtpObjectFormat format,
- int64_t actualSize,
bool succeeded);
virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
@@ -236,11 +235,11 @@
}
void MyMtpDatabase::endSendObject(const char* path, MtpObjectHandle handle,
- MtpObjectFormat format, int64_t actualSize, bool succeeded) {
+ MtpObjectFormat format, bool succeeded) {
JNIEnv* env = AndroidRuntime::getJNIEnv();
jstring pathStr = env->NewStringUTF(path);
env->CallVoidMethod(mDatabase, method_endSendObject, pathStr,
- (jint)handle, (jint)format, (jlong)actualSize, (jboolean)succeeded);
+ (jint)handle, (jint)format, (jboolean)succeeded);
if (pathStr)
env->DeleteLocalRef(pathStr);
@@ -1094,7 +1093,7 @@
LOGE("Can't find beginSendObject");
return -1;
}
- method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIJZ)V");
+ method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIZ)V");
if (method_endSendObject == NULL) {
LOGE("Can't find endSendObject");
return -1;
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 4cfe28e..49d05ed 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -520,8 +520,10 @@
*durationUs = mRTSPController->getQueueDurationUs(eos);
return true;
} else if (mCachedSource != NULL && getBitrate(&bitrate)) {
- size_t cachedDataRemaining = mCachedSource->approxDataRemaining(eos);
+ status_t finalStatus;
+ size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
*durationUs = cachedDataRemaining * 8000000ll / bitrate;
+ *eos = (finalStatus != OK);
return true;
}
@@ -564,11 +566,14 @@
mBufferingEventPending = false;
if (mCachedSource != NULL) {
- bool eos;
- size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&eos);
+ status_t finalStatus;
+ size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
+ bool eos = (finalStatus != OK);
if (eos) {
- notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
+ if (finalStatus == ERROR_END_OF_STREAM) {
+ notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
+ }
if (mFlags & PREPARING) {
LOGV("cache has reached EOS, prepare is done.");
finishAsyncPrepare_l();
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 9017921..20f1655 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -393,13 +393,13 @@
return mCacheOffset + mCache->totalSize();
}
-size_t NuCachedSource2::approxDataRemaining(bool *eos) {
+size_t NuCachedSource2::approxDataRemaining(status_t *finalStatus) {
Mutex::Autolock autoLock(mLock);
- return approxDataRemaining_l(eos);
+ return approxDataRemaining_l(finalStatus);
}
-size_t NuCachedSource2::approxDataRemaining_l(bool *eos) {
- *eos = (mFinalStatus != OK);
+size_t NuCachedSource2::approxDataRemaining_l(status_t *finalStatus) {
+ *finalStatus = mFinalStatus;
off64_t lastBytePosCached = mCacheOffset + mCache->totalSize();
if (mLastAccessPos < lastBytePosCached) {
return lastBytePosCached - mLastAccessPos;
@@ -488,4 +488,3 @@
return mSource->getUri();
}
} // namespace android
-
diff --git a/media/libstagefright/include/NuCachedSource2.h b/media/libstagefright/include/NuCachedSource2.h
index aa320fc..28840be 100644
--- a/media/libstagefright/include/NuCachedSource2.h
+++ b/media/libstagefright/include/NuCachedSource2.h
@@ -43,7 +43,7 @@
////////////////////////////////////////////////////////////////////////////
size_t cachedSize();
- size_t approxDataRemaining(bool *eos);
+ size_t approxDataRemaining(status_t *finalStatus);
void resumeFetchingIfNecessary();
@@ -92,7 +92,7 @@
ssize_t readInternal(off64_t offset, void *data, size_t size);
status_t seekInternal_l(off64_t offset);
- size_t approxDataRemaining_l(bool *eos);
+ size_t approxDataRemaining_l(status_t *finalStatus);
void restartPrefetcherIfNecessary_l(bool ignoreLowWaterThreshold = false);
DISALLOW_EVIL_CONSTRUCTORS(NuCachedSource2);
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp
index 10cc88b..f0b858d 100644
--- a/media/libstagefright/rtsp/APacketSource.cpp
+++ b/media/libstagefright/rtsp/APacketSource.cpp
@@ -373,7 +373,17 @@
br.skipBits(2); // chroma_format
br.skipBits(1); // low_delay
if (br.getBits(1)) { // vbv_parameters
- TRESPASS();
+ br.skipBits(15); // first_half_bit_rate
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(15); // latter_half_bit_rate
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(15); // first_half_vbv_buffer_size
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(3); // latter_half_vbv_buffer_size
+ br.skipBits(11); // first_half_vbv_occupancy
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(15); // latter_half_vbv_occupancy
+ CHECK(br.getBits(1)); // marker_bit
}
}
unsigned video_object_layer_shape = br.getBits(2);
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index 6dcb931..4d9a1ae 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -42,7 +42,6 @@
virtual void endSendObject(const char* path,
MtpObjectHandle handle,
MtpObjectFormat format,
- int64_t size,
bool succeeded) = 0;
virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 236cd0a..b1bd145 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -700,6 +700,9 @@
if (ret && ret != -EEXIST)
return MTP_RESPONSE_GENERAL_ERROR;
chown((const char *)path, getuid(), mFileGroup);
+
+ // SendObject does not get sent for directories, so call endSendObject here instead
+ mDatabase->endSendObject(path, handle, MTP_FORMAT_ASSOCIATION, MTP_RESPONSE_OK);
} else {
mSendObjectFilePath = path;
// save the handle for the SendObject call, which should follow
@@ -718,7 +721,6 @@
MtpResponseCode result = MTP_RESPONSE_OK;
mode_t mask;
int ret;
- uint64_t actualSize = -1;
if (mSendObjectHandle == kInvalidObjectHandle) {
LOGE("Expected SendObjectInfo before SendObject");
@@ -761,18 +763,11 @@
result = MTP_RESPONSE_TRANSACTION_CANCELLED;
else
result = MTP_RESPONSE_GENERAL_ERROR;
- } else if (mSendObjectFileSize == 0xFFFFFFFF) {
- // actual size is likely > 4 gig so stat the file to compute actual length
- struct stat s;
- if (lstat(mSendObjectFilePath, &s) == 0) {
- actualSize = s.st_size;
- LOGD("actualSize: %lld\n", actualSize);
- }
}
done:
mDatabase->endSendObject(mSendObjectFilePath, mSendObjectHandle, mSendObjectFormat,
- actualSize, result == MTP_RESPONSE_OK);
+ result == MTP_RESPONSE_OK);
mSendObjectHandle = kInvalidObjectHandle;
mSendObjectFormat = 0;
return result;
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 8f2f974..4099c4c 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -272,6 +272,37 @@
}
/**
+ * @hide
+ * Control whether the EGL context is preserved when the GLSurfaceView is paused and
+ * resumed.
+ * <p>
+ * If set to true, then the EGL context may be preserved when the GLSurfaceView is paused.
+ * Whether the EGL context is actually preserved or not depends upon whether the
+ * Android device that the program is running on can support an arbitrary number of EGL
+ * contexts or not. Devices that can only support a limited number of EGL contexts must
+ * release the EGL context in order to allow multiple applications to share the GPU.
+ * <p>
+ * If set to false, the EGL context will be released when the GLSurfaceView is paused,
+ * and recreated when the GLSurfaceView is resumed.
+ * <p>
+ *
+ * The default is false.
+ *
+ * @param preserveOnPause preserve the EGL context when paused
+ */
+ public void setPreserveEGLContextOnPause(boolean preserveOnPause) {
+ mPreserveEGLContextOnPause = preserveOnPause;
+ }
+
+ /**
+ * @hide
+ * @return true if the EGL context will be preserved when paused
+ */
+ public boolean getPreserveEGLContextOnPause() {
+ return mPreserveEGLContextOnPause;
+ }
+
+ /**
* Set the renderer associated with this view. Also starts the thread that
* will call the renderer, which in turn causes the rendering to start.
* <p>This method should be called once and only once in the life-cycle of
@@ -1240,7 +1271,7 @@
Log.i("GLThread", "releasing EGL surface because paused tid=" + getId());
}
stopEglSurfaceLocked();
- if (sGLThreadManager.shouldReleaseEGLContextWhenPausing()) {
+ if (!mPreserveEGLContextOnPause || sGLThreadManager.shouldReleaseEGLContextWhenPausing()) {
stopEglContextLocked();
if (LOG_SURFACE) {
Log.i("GLThread", "releasing EGL context because paused tid=" + getId());
@@ -1705,7 +1736,7 @@
// Release the EGL context when pausing even if
// the hardware supports multiple EGL contexts.
// Otherwise the device could run out of EGL contexts.
- return true;
+ return mLimitedGLESContexts;
}
public synchronized boolean shouldTerminateEGLWhenPausing() {
@@ -1716,16 +1747,18 @@
public synchronized void checkGLDriver(GL10 gl) {
if (! mGLESDriverCheckComplete) {
checkGLESVersion();
+ String renderer = gl.glGetString(GL10.GL_RENDERER);
if (mGLESVersion < kGLES_20) {
- String renderer = gl.glGetString(GL10.GL_RENDERER);
mMultipleGLESContextsAllowed =
! renderer.startsWith(kMSM7K_RENDERER_PREFIX);
- if (LOG_SURFACE) {
- Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
- + mMultipleGLESContextsAllowed);
- }
notifyAll();
}
+ mLimitedGLESContexts = !mMultipleGLESContextsAllowed || renderer.startsWith(kADRENO);
+ if (LOG_SURFACE) {
+ Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
+ + mMultipleGLESContextsAllowed
+ + " mLimitedGLESContexts = " + mLimitedGLESContexts);
+ }
mGLESDriverCheckComplete = true;
}
}
@@ -1750,9 +1783,11 @@
private int mGLESVersion;
private boolean mGLESDriverCheckComplete;
private boolean mMultipleGLESContextsAllowed;
+ private boolean mLimitedGLESContexts;
private static final int kGLES_20 = 0x20000;
private static final String kMSM7K_RENDERER_PREFIX =
"Q3Dimension MSM7500 ";
+ private static final String kADRENO = "Adreno";
private GLThread mEglOwner;
}
@@ -1768,4 +1803,5 @@
private GLWrapper mGLWrapper;
private int mDebugFlags;
private int mEGLContextClientVersion;
+ private boolean mPreserveEGLContextOnPause;
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 6b559cf..747242f 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1965,23 +1965,29 @@
// behind it.
return false;
}
- if (mStatusBar != null && mStatusBar.isVisibleLw()) {
- Rect rect = new Rect(mStatusBar.getShownFrameLw());
- for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
- WindowState w = mStatusBarPanels.get(i);
- if (w.isVisibleLw()) {
- rect.union(w.getShownFrameLw());
+ if (false) {
+ // Don't do this on the tablet, since the system bar never completely
+ // covers the screen, and with all its transparency this will
+ // incorrectly think it does cover it when it doesn't. We'll revisit
+ // this later when we re-do the phone status bar.
+ if (mStatusBar != null && mStatusBar.isVisibleLw()) {
+ Rect rect = new Rect(mStatusBar.getShownFrameLw());
+ for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
+ WindowState w = mStatusBarPanels.get(i);
+ if (w.isVisibleLw()) {
+ rect.union(w.getShownFrameLw());
+ }
}
- }
- final int insetw = mRestrictedScreenWidth/10;
- final int inseth = mRestrictedScreenHeight/10;
- if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
- mRestrictedScreenHeight-inseth)) {
- // All of the status bar windows put together cover the
- // screen, so the app can't be seen. (Note this test doesn't
- // work if the rects of these windows are at off offsets or
- // sizes, causing gaps in the rect union we have computed.)
- return false;
+ final int insetw = mRestrictedScreenWidth/10;
+ final int inseth = mRestrictedScreenHeight/10;
+ if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
+ mRestrictedScreenHeight-inseth)) {
+ // All of the status bar windows put together cover the
+ // screen, so the app can't be seen. (Note this test doesn't
+ // work if the rects of these windows are at off offsets or
+ // sizes, causing gaps in the rect union we have computed.)
+ return false;
+ }
}
}
return true;
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 4305c358..5c878c9 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -97,10 +97,18 @@
// Ensure that all log entries have a unique timestamp
private long mLastTimestamp = 0;
+ private volatile boolean mBooted = false;
+
/** Receives events that might indicate a need to clean up files. */
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
+ if (intent != null && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+ mBooted = true;
+ return;
+ }
+
+ // Else, for ACTION_DEVICE_STORAGE_LOW:
mCachedQuotaUptimeMillis = 0; // Force a re-check of quota size
// Run the initialization in the background (not this main thread).
@@ -132,7 +140,11 @@
// Set up intent receivers
mContext = context;
mContentResolver = context.getContentResolver();
- context.registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW));
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW);
+ filter.addAction(Intent.ACTION_BOOT_COMPLETED);
+ context.registerReceiver(mReceiver, filter);
mContentResolver.registerContentObserver(
Settings.Secure.CONTENT_URI, true,
@@ -224,6 +236,9 @@
Intent dropboxIntent = new Intent(DropBoxManager.ACTION_DROPBOX_ENTRY_ADDED);
dropboxIntent.putExtra(DropBoxManager.EXTRA_TAG, tag);
dropboxIntent.putExtra(DropBoxManager.EXTRA_TIME, time);
+ if (!mBooted) {
+ dropboxIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ }
mContext.sendBroadcast(dropboxIntent, android.Manifest.permission.READ_LOGS);
} catch (IOException e) {
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 1b3725c..3e930ae 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -3031,7 +3031,7 @@
}
private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
- if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
+ (lp != null ? lp.packageName : null)
+ " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
if (lp != null && lp.windowAnimations != 0) {
@@ -3052,7 +3052,7 @@
}
private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
- if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: package="
+ packageName + " resId=0x" + Integer.toHexString(resId));
if (packageName != null) {
if ((resId&0xFF000000) == 0x01000000) {
@@ -9957,8 +9957,8 @@
// The top-most window will supply the layout params,
// and we will determine it below.
LayoutParams animLp = null;
- AppWindowToken animToken = null;
int bestAnimLayer = -1;
+ boolean fullscreenAnim = false;
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"New wallpaper target=" + mWallpaperTarget
@@ -10000,11 +10000,18 @@
// window, we will always use its anim.
if ((ws.mAttrs.flags&FLAG_COMPATIBLE_WINDOW) != 0) {
animLp = ws.mAttrs;
- animToken = ws.mAppToken;
bestAnimLayer = Integer.MAX_VALUE;
- } else if (ws.mLayer > bestAnimLayer) {
+ } else if (!fullscreenAnim || ws.mLayer > bestAnimLayer) {
animLp = ws.mAttrs;
- animToken = ws.mAppToken;
+ bestAnimLayer = ws.mLayer;
+ }
+ fullscreenAnim = true;
+ }
+ } else if (!fullscreenAnim) {
+ WindowState ws = wtoken.findMainWindow();
+ if (ws != null) {
+ if (ws.mLayer > bestAnimLayer) {
+ animLp = ws.mAttrs;
bestAnimLayer = ws.mLayer;
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 2c5aa3c..19e7fae 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -152,9 +152,16 @@
private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
- Log.i("CdmaServiceStateTracker", "Auto time state called ...");
- revertToNitz();
+ Log.i("CdmaServiceStateTracker", "Auto time state changed");
+ revertToNitzTime();
+ }
+ };
+ private ContentObserver mAutoTimeZoneObserver = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ Log.i("CdmaServiceStateTracker", "Auto time zone state changed");
+ revertToNitzTimeZone();
}
};
@@ -194,6 +201,9 @@
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
mAutoTimeObserver);
+ cr.registerContentObserver(
+ Settings.System.getUriFor(Settings.System.AUTO_TIME_ZONE), true,
+ mAutoTimeZoneObserver);
setSignalStrengthDefaultValues();
mNeedToRegForRuimLoaded = true;
@@ -212,6 +222,7 @@
cm.unSetOnSignalStrengthUpdate(this);
cm.unSetOnNITZTime(this);
cr.unregisterContentObserver(this.mAutoTimeObserver);
+ cr.unregisterContentObserver(this.mAutoTimeZoneObserver);
}
@Override
@@ -1582,20 +1593,29 @@
phone.getContext().sendStickyBroadcast(intent);
}
- private void revertToNitz() {
+ private void revertToNitzTime() {
if (Settings.System.getInt(cr, Settings.System.AUTO_TIME, 0) == 0) {
return;
}
- Log.d(LOG_TAG, "Reverting to NITZ: tz='" + mSavedTimeZone
- + "' mSavedTime=" + mSavedTime
+ Log.d(LOG_TAG, "Reverting to NITZ Time: mSavedTime=" + mSavedTime
+ " mSavedAtTime=" + mSavedAtTime);
- if (mSavedTimeZone != null && mSavedTime != 0 && mSavedAtTime != 0) {
- setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ if (mSavedTime != 0 && mSavedAtTime != 0) {
setAndBroadcastNetworkSetTime(mSavedTime
+ (SystemClock.elapsedRealtime() - mSavedAtTime));
}
}
+ private void revertToNitzTimeZone() {
+ if (Settings.System.getInt(phone.getContext().getContentResolver(),
+ Settings.System.AUTO_TIME_ZONE, 0) == 0) {
+ return;
+ }
+ Log.d(LOG_TAG, "Reverting to NITZ TimeZone: tz='" + mSavedTimeZone);
+ if (mSavedTimeZone != null) {
+ setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ }
+ }
+
private boolean isSidsAllZeros() {
if (mHomeSystemId != null) {
for (int i=0; i < mHomeSystemId.length; i++) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index b04d4b9..c107d17 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -181,7 +181,15 @@
@Override
public void onChange(boolean selfChange) {
Log.i("GsmServiceStateTracker", "Auto time state changed");
- revertToNitz();
+ revertToNitzTime();
+ }
+ };
+
+ private ContentObserver mAutoTimeZoneObserver = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ Log.i("GsmServiceStateTracker", "Auto time zone state changed");
+ revertToNitzTimeZone();
}
};
@@ -220,6 +228,10 @@
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
mAutoTimeObserver);
+ cr.registerContentObserver(
+ Settings.System.getUriFor(Settings.System.AUTO_TIME_ZONE), true,
+ mAutoTimeZoneObserver);
+
setSignalStrengthDefaultValues();
mNeedToRegForSimLoaded = true;
@@ -244,6 +256,7 @@
cm.unSetOnRestrictedStateChanged(this);
cm.unSetOnNITZTime(this);
cr.unregisterContentObserver(this.mAutoTimeObserver);
+ cr.unregisterContentObserver(this.mAutoTimeZoneObserver);
}
protected void finalize() {
@@ -1613,21 +1626,30 @@
phone.getContext().sendStickyBroadcast(intent);
}
- private void revertToNitz() {
+ private void revertToNitzTime() {
if (Settings.System.getInt(phone.getContext().getContentResolver(),
Settings.System.AUTO_TIME, 0) == 0) {
return;
}
- Log.d(LOG_TAG, "Reverting to NITZ: tz='" + mSavedTimeZone
- + "' mSavedTime=" + mSavedTime
+ Log.d(LOG_TAG, "Reverting to NITZ Time: mSavedTime=" + mSavedTime
+ " mSavedAtTime=" + mSavedAtTime);
- if (mSavedTimeZone != null && mSavedTime != 0 && mSavedAtTime != 0) {
- setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ if (mSavedTime != 0 && mSavedAtTime != 0) {
setAndBroadcastNetworkSetTime(mSavedTime
+ (SystemClock.elapsedRealtime() - mSavedAtTime));
}
}
+ private void revertToNitzTimeZone() {
+ if (Settings.System.getInt(phone.getContext().getContentResolver(),
+ Settings.System.AUTO_TIME_ZONE, 0) == 0) {
+ return;
+ }
+ Log.d(LOG_TAG, "Reverting to NITZ TimeZone: tz='" + mSavedTimeZone);
+ if (mSavedTimeZone != null) {
+ setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ }
+ }
+
/**
* Post a notification to NotificationManager for restricted state
*
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index 7099ab5..691aff28 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -166,6 +166,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+
+ <activity
+ android:name="BitmapsSkewActivity"
+ android:label="_BitmapsSkew">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
<activity
android:name="BitmapsAlphaActivity"
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java
new file mode 100644
index 0000000..099c0dd
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+package com.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.view.View;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class BitmapsSkewActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final BitmapsView view = new BitmapsView(this);
+ setContentView(view);
+ }
+
+ static class BitmapsView extends View {
+ private Paint mBitmapPaint;
+ private final Bitmap mBitmap1;
+
+ BitmapsView(Context c) {
+ super(c);
+
+ mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ canvas.translate(120.0f, 50.0f);
+ canvas.skew(0.2f, 0.3f);
+ canvas.drawBitmap(mBitmap1, 0.0f, 0.0f, mBitmapPaint);
+ }
+ }
+}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
index 1b79cb6..e7f431c 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
@@ -37,6 +37,7 @@
private final Paint mLargePaint;
private final Paint mStrikePaint;
private final Paint mScaledPaint;
+ private final Paint mSkewPaint;
CustomTextView(Context c) {
super(c);
@@ -57,6 +58,10 @@
mScaledPaint = new Paint();
mScaledPaint.setAntiAlias(true);
mScaledPaint.setTextSize(16.0f);
+
+ mSkewPaint = new Paint();
+ mSkewPaint.setAntiAlias(true);
+ mSkewPaint.setTextSize(16.0f);
}
@Override
@@ -100,11 +105,18 @@
mStrikePaint.setStrikeThruText(false);
mStrikePaint.setUnderlineText(true);
+ mSkewPaint.setTextSkewX(-0.25f);
+ canvas.drawText("Hello OpenGL renderer!", 680, 200, mSkewPaint);
+ mSkewPaint.setTextSkewX(0.5f);
+ canvas.drawText("Hello OpenGL renderer!", 680, 230, mSkewPaint);
+ mSkewPaint.setTextSkewX(0.0f);
+ canvas.drawText("Hello OpenGL renderer!", 680, 260, mSkewPaint);
+
mScaledPaint.setTextScaleX(0.5f);
canvas.drawText("Hello OpenGL renderer!", 500, 200, mScaledPaint);
- mScaledPaint.setTextScaleX(2.0f);
- canvas.drawText("Hello OpenGL renderer!", 500, 230, mScaledPaint);
mScaledPaint.setTextScaleX(1.0f);
+ canvas.drawText("Hello OpenGL renderer!", 500, 230, mScaledPaint);
+ mScaledPaint.setTextScaleX(2.0f);
canvas.drawText("Hello OpenGL renderer!", 500, 260, mScaledPaint);
canvas.save();