diff options
| -rw-r--r-- | Android.mk | 4 | ||||
| -rw-r--r-- | CleanSpec.mk | 1 | ||||
| -rw-r--r-- | api/current.xml | 4 | ||||
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 4 | ||||
| -rw-r--r-- | core/java/android/webkit/WebSettings.java | 12 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 21 | ||||
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 11 | ||||
| -rw-r--r-- | core/java/com/android/internal/os/SamplingProfilerIntegration.java | 73 | ||||
| -rw-r--r-- | core/java/com/android/internal/os/ZygoteInit.java | 8 | ||||
| -rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 15 | ||||
| -rw-r--r-- | graphics/java/android/renderscript/ProgramRaster.java | 4 | ||||
| -rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 16 | ||||
| -rw-r--r-- | graphics/java/android/renderscript/Type.java | 6 | ||||
| -rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 164 | ||||
| -rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 6 | ||||
| -rw-r--r-- | media/libstagefright/mpeg2ts/ATSParser.cpp | 73 | ||||
| -rw-r--r-- | media/libstagefright/rtsp/ARTPSession.cpp | 8 | ||||
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 11 |
18 files changed, 180 insertions, 261 deletions
@@ -474,6 +474,8 @@ LOCAL_DROIDDOC_OPTIONS:=\ LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk +LOCAL_UNINSTALLABLE_MODULE := true + include $(BUILD_DROIDDOC) # $(gen), i.e. framework.aidl, is also needed while building against the current stub. @@ -500,6 +502,8 @@ LOCAL_DROIDDOC_OPTIONS:=\ LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk +LOCAL_UNINSTALLABLE_MODULE := true + include $(BUILD_DROIDDOC) # $(gen), i.e. framework.aidl, is also needed while building against the current stub. diff --git a/CleanSpec.mk b/CleanSpec.mk index e961a5a..50bee9c 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -78,6 +78,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/libhwui.so) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libhwui.so) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/os/storage/*) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/IClipboard.P) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/ITelephonyRegistry.P) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST diff --git a/api/current.xml b/api/current.xml index e2e1346..0307bff 100644 --- a/api/current.xml +++ b/api/current.xml @@ -213724,7 +213724,7 @@ synchronized="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </method> @@ -214274,7 +214274,7 @@ synchronized="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="pluginsPath" type="java.lang.String"> diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 4de0b0a..fe179d1 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -850,10 +850,6 @@ public final class ActivityThread { } private final class H extends Handler { - private H() { - SamplingProfiler.getInstance().setEventThread(mLooper.getThread()); - } - public static final int LAUNCH_ACTIVITY = 100; public static final int PAUSE_ACTIVITY = 101; public static final int PAUSE_ACTIVITY_FINISHING= 102; diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 38b3e88..7519b0d 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -1102,7 +1102,11 @@ public class WebSettings { } /** - * TODO: need to add @Deprecated + * Set a custom path to plugins used by the WebView. This method is + * obsolete since each plugin is now loaded from its own package. + * @param pluginsPath String path to the directory containing plugins. + * @deprecated This method is no longer used as plugins are loaded from + * their own APK via the system's package manager. */ public synchronized void setPluginsPath(String pluginsPath) { } @@ -1286,7 +1290,11 @@ public class WebSettings { } /** - * TODO: need to add @Deprecated + * Returns the directory that contains the plugin libraries. This method is + * obsolete since each plugin is now loaded from its own package. + * @return An empty string. + * @deprecated This method is no longer used as plugins are loaded from + * their own APK via the system's package manager. */ public synchronized String getPluginsPath() { return ""; diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index d4ef0f0..0b236af 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1798,11 +1798,11 @@ public class WebView extends AbsoluteLayout /** * Returns true if private browsing is enabled in this WebView. */ - public boolean isPrivateBrowsingEnabled () { + public boolean isPrivateBrowsingEnabled() { return getSettings().isPrivateBrowsingEnabled(); } - private void startPrivateBrowsing () { + private void startPrivateBrowsing() { boolean wasPrivateBrowsingEnabled = isPrivateBrowsingEnabled(); getSettings().setPrivateBrowsingEnabled(true); @@ -1812,6 +1812,23 @@ public class WebView extends AbsoluteLayout } } + /** + * Deletes any files that were created as a part of the last private + * browsing session and clears any internal state associated with that + * session. The consequences of calling this method while a private + * browsing session is active are unspecified. + * @param context The same context which was used to create the private + * browsing WebView. + * @return True if the private browsing files were successfully deleted, + * false otherwise. + * @hide pending API council approval. + */ + public static boolean cleanupPrivateBrowsingFiles(Context context) { + return nativeCleanupPrivateBrowsingFiles(context.getFilesDir().getParent()); + } + + private static native boolean nativeCleanupPrivateBrowsingFiles(String dataDirectory); + private boolean extendScroll(int y) { int finalY = mScroller.getFinalY(); int newY = pinLocY(finalY + y); diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 197ad9ee..d87f55f 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -16,12 +16,11 @@ package android.widget; -import com.android.internal.R; - import android.content.Context; import android.content.Intent; import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; @@ -57,6 +56,8 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputMethodManager; +import com.android.internal.R; + import java.util.ArrayList; import java.util.List; @@ -4235,7 +4236,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te /** * When set to a non-zero value, the cache color hint indicates that this list is always drawn - * on top of a solid, single-color, opaque background + * on top of a solid, single-color, opaque background. + * + * Zero means that what's behind this object is translucent (non solid) or is not made of a + * single color. This hint will not affect any existing background drawable set on this view ( + * typically set via {@link #setBackgroundDrawable(Drawable)}). * * @param color The background color */ diff --git a/core/java/com/android/internal/os/SamplingProfilerIntegration.java b/core/java/com/android/internal/os/SamplingProfilerIntegration.java index 38362c1..b87ac90 100644 --- a/core/java/com/android/internal/os/SamplingProfilerIntegration.java +++ b/core/java/com/android/internal/os/SamplingProfilerIntegration.java @@ -16,16 +16,19 @@ package com.android.internal.os; -import android.content.pm.PackageInfo; import dalvik.system.SamplingProfiler; +import java.io.BufferedOutputStream; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.io.PrintStream; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; +import android.content.pm.PackageInfo; import android.util.Log; import android.os.*; @@ -41,7 +44,7 @@ public class SamplingProfilerIntegration { private static final boolean enabled; private static final Executor snapshotWriter; private static final int samplingProfilerHz; - + /** Whether or not we've created the snapshots dir. */ private static boolean dirMade = false; @@ -61,6 +64,8 @@ public class SamplingProfilerIntegration { } } + private static SamplingProfiler INSTANCE; + /** * Is profiling enabled? */ @@ -72,15 +77,22 @@ public class SamplingProfilerIntegration { * Starts the profiler if profiling is enabled. */ public static void start() { - if (!enabled) return; - SamplingProfiler.getInstance().start(samplingProfilerHz); + if (!enabled) { + return; + } + ThreadGroup group = Thread.currentThread().getThreadGroup(); + SamplingProfiler.ThreadSet threadSet = SamplingProfiler.newThreadGroupTheadSet(group); + INSTANCE = new SamplingProfiler(4, threadSet); + INSTANCE.start(samplingProfilerHz); } /** * Writes a snapshot if profiling is enabled. */ public static void writeSnapshot(final String processName, final PackageInfo packageInfo) { - if (!enabled) return; + if (!enabled) { + return; + } /* * If we're already writing a snapshot, don't bother enqueueing another @@ -122,18 +134,22 @@ public class SamplingProfilerIntegration { * Writes the zygote's snapshot to internal storage if profiling is enabled. */ public static void writeZygoteSnapshot() { - if (!enabled) return; + if (!enabled) { + return; + } writeSnapshot("zygote", null); + INSTANCE.shutdown(); + INSTANCE = null; } /** * pass in PackageInfo to retrieve various values for snapshot header */ private static void writeSnapshot(String dir, String processName, PackageInfo packageInfo) { - byte[] snapshot = SamplingProfiler.getInstance().snapshot(); - if (snapshot == null) { + if (!enabled) { return; } + INSTANCE.stop(); /* * We use the current time as a unique ID. We can't use a counter @@ -143,21 +159,22 @@ public class SamplingProfilerIntegration { long start = System.currentTimeMillis(); String name = processName.replaceAll(":", "."); String path = dir + "/" + name + "-" +System.currentTimeMillis() + ".snapshot"; - FileOutputStream out = null; + PrintStream out = null; try { - out = new FileOutputStream(path); - generateSnapshotHeader(name, packageInfo, out); - out.write(snapshot); + out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path))); } catch (IOException e) { - Log.e(TAG, "Error writing snapshot.", e); + Log.e(TAG, "Could not open " + path + ":" + e); + return; + } + try { + generateSnapshotHeader(name, packageInfo, out); + INSTANCE.writeHprofData(out); } finally { - try { - if(out != null) { - out.close(); - } - } catch (IOException ex) { - // let it go. - } + out.close(); + } + if (out.checkError()) { + Log.e(TAG, "Error writing snapshot."); + return; } // set file readable to the world so that SamplingProfilerService // can put it to dropbox @@ -179,16 +196,16 @@ public class SamplingProfilerIntegration { * <the actual snapshot content begins here...> */ private static void generateSnapshotHeader(String processName, PackageInfo packageInfo, - FileOutputStream out) throws IOException { + PrintStream out) { // profiler version - out.write("Version: 1\n".getBytes()); - out.write(("Process: " + processName + "\n").getBytes()); - if(packageInfo != null) { - out.write(("Package: " + packageInfo.packageName + "\n").getBytes()); - out.write(("Package-Version: " + packageInfo.versionCode + "\n").getBytes()); + out.println("Version: 2"); + out.println("Process: " + processName); + if (packageInfo != null) { + out.println("Package: " + packageInfo.packageName); + out.println("Package-Version: " + packageInfo.versionCode); } - out.write(("Build: " + Build.FINGERPRINT + "\n").getBytes()); + out.println("Build: " + Build.FINGERPRINT); // single blank line means the end of snapshot header. - out.write("\n".getBytes()); + out.println(); } } diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 9c84e0e..f0f3387 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -579,12 +579,8 @@ public class ZygoteInit { EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END, SystemClock.uptimeMillis()); - if (SamplingProfilerIntegration.isEnabled()) { - SamplingProfiler sp = SamplingProfiler.getInstance(); - sp.pause(); - SamplingProfilerIntegration.writeZygoteSnapshot(); - sp.shutDown(); - } + // Finish profiling the zygote initialization. + SamplingProfilerIntegration.writeZygoteSnapshot(); // Do an initial gc to clean up after startup gc(); diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index ee5dbc1..985d700 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -162,7 +162,6 @@ public class Allocation extends BaseObj { } - public void subData2D(int xoff, int yoff, int w, int h, int[] d) { mRS.validate(); mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d, d.length * 4); @@ -183,20 +182,6 @@ public class Allocation extends BaseObj { mRS.nAllocationRead(mID, d); } - public void data(Object o) { - mRS.validate(); - mRS.nAllocationSubDataFromObject(mID, mType, 0, o); - } - - public void read(Object o) { - mRS.validate(); - mRS.nAllocationSubReadFromObject(mID, mType, 0, o); - } - - public void subData(int offset, Object o) { - mRS.validate(); - mRS.nAllocationSubDataFromObject(mID, mType, offset, o); - } public class Adapter1D extends BaseObj { Adapter1D(int id, RenderScript rs) { diff --git a/graphics/java/android/renderscript/ProgramRaster.java b/graphics/java/android/renderscript/ProgramRaster.java index fd89b6e..791dac8 100644 --- a/graphics/java/android/renderscript/ProgramRaster.java +++ b/graphics/java/android/renderscript/ProgramRaster.java @@ -55,13 +55,13 @@ public class ProgramRaster extends BaseObj { mCullMode = CullMode.BACK; } - public void setLineWidth(float w) { + void setLineWidth(float w) { mRS.validate(); mLineWidth = w; mRS.nProgramRasterSetLineWidth(mID, w); } - public void setCullMode(CullMode m) { + void setCullMode(CullMode m) { mRS.validate(); mCullMode = m; mRS.nProgramRasterSetCullMode(mID, m.mID); diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index d51257b..62d70a7 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -177,14 +177,6 @@ public class RenderScript { synchronized int nTypeCreate() { return rsnTypeCreate(mContext); } - native void rsnTypeFinalDestroy(int con, Type t); - synchronized void nTypeFinalDestroy(Type t) { - rsnTypeFinalDestroy(mContext, t); - } - native void rsnTypeSetupFields(int con, Type t, int[] types, int[] bits, Field[] IDs); - synchronized void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs) { - rsnTypeSetupFields(mContext, t, types, bits, IDs); - } native void rsnTypeGetNativeData(int con, int id, int[] typeData); synchronized void nTypeGetNativeData(int id, int[] typeData) { rsnTypeGetNativeData(mContext, id, typeData); @@ -257,14 +249,6 @@ public class RenderScript { synchronized void nAllocationRead(int id, float[] d) { rsnAllocationRead(mContext, id, d); } - native void rsnAllocationSubDataFromObject(int con, int id, Type t, int offset, Object o); - synchronized void nAllocationSubDataFromObject(int id, Type t, int offset, Object o) { - rsnAllocationSubDataFromObject(mContext, id, t, offset, o); - } - native void rsnAllocationSubReadFromObject(int con, int id, Type t, int offset, Object o); - synchronized void nAllocationSubReadFromObject(int id, Type t, int offset, Object o) { - rsnAllocationSubReadFromObject(mContext, id, t, offset, o); - } native int rsnAllocationGetType(int con, int id); synchronized int nAllocationGetType(int id) { return rsnAllocationGetType(mContext, id); diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java index 21053c9..0b3db69 100644 --- a/graphics/java/android/renderscript/Type.java +++ b/graphics/java/android/renderscript/Type.java @@ -33,7 +33,6 @@ public class Type extends BaseObj { int mElementCount; Element mElement; - private int mNativeCache; Class mJavaClass; public Element getElement() { @@ -98,14 +97,9 @@ public class Type extends BaseObj { Type(int id, RenderScript rs) { super(id, rs); - mNativeCache = 0; } protected void finalize() throws Throwable { - if(mNativeCache != 0) { - mRS.nTypeFinalDestroy(this); - mNativeCache = 0; - } super.finalize(); } diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 23b71b0..c8e6656 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -70,9 +70,6 @@ static void _nInit(JNIEnv *_env, jclass _this) jclass bitmapClass = _env->FindClass("android/graphics/Bitmap"); gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "I"); - - jclass typeClass = _env->FindClass("android/renderscript/Type"); - gTypeNativeCache = _env->GetFieldID(typeClass, "mNativeCache", "I"); } static void nInitElements(JNIEnv *_env, jobject _this, jint a8, jint rgba4444, jint rgba8888, jint rgb565) @@ -360,124 +357,6 @@ nTypeGetNativeData(JNIEnv *_env, jobject _this, RsContext con, jint id, jintArra } } -static void * SF_LoadInt(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - ((int32_t *)buffer)[0] = _env->GetIntField(_obj, _field); - return ((uint8_t *)buffer) + 4; -} - -static void * SF_LoadShort(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - ((int16_t *)buffer)[0] = _env->GetShortField(_obj, _field); - return ((uint8_t *)buffer) + 2; -} - -static void * SF_LoadByte(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - ((int8_t *)buffer)[0] = _env->GetByteField(_obj, _field); - return ((uint8_t *)buffer) + 1; -} - -static void * SF_LoadFloat(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - ((float *)buffer)[0] = _env->GetFloatField(_obj, _field); - return ((uint8_t *)buffer) + 4; -} - -static void * SF_SaveInt(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - _env->SetIntField(_obj, _field, ((int32_t *)buffer)[0]); - return ((uint8_t *)buffer) + 4; -} - -static void * SF_SaveShort(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - _env->SetShortField(_obj, _field, ((int16_t *)buffer)[0]); - return ((uint8_t *)buffer) + 2; -} - -static void * SF_SaveByte(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - _env->SetByteField(_obj, _field, ((int8_t *)buffer)[0]); - return ((uint8_t *)buffer) + 1; -} - -static void * SF_SaveFloat(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer) -{ - _env->SetFloatField(_obj, _field, ((float *)buffer)[0]); - return ((uint8_t *)buffer) + 4; -} - -struct TypeFieldCache { - jfieldID field; - int bits; - void * (*ptr)(JNIEnv *, jobject, jfieldID, void *buffer); - void * (*readPtr)(JNIEnv *, jobject, jfieldID, void *buffer); -}; - -struct TypeCache { - int fieldCount; - int size; - TypeFieldCache fields[1]; -}; - -//{"nTypeFinalDestroy", "(Landroid/renderscript/Type;)V", (void*)nTypeFinalDestroy }, -static void -nTypeFinalDestroy(JNIEnv *_env, jobject _this, RsContext con, jobject _type) -{ - TypeCache *tc = (TypeCache *)_env->GetIntField(_type, gTypeNativeCache); - free(tc); -} - -// native void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs); -static void -nTypeSetupFields(JNIEnv *_env, jobject _this, RsContext con, jobject _type, jintArray _types, jintArray _bits, jobjectArray _IDs) -{ - int fieldCount = _env->GetArrayLength(_types); - size_t structSize = sizeof(TypeCache) + (sizeof(TypeFieldCache) * (fieldCount-1)); - TypeCache *tc = (TypeCache *)malloc(structSize); - memset(tc, 0, structSize); - - TypeFieldCache *tfc = &tc->fields[0]; - tc->fieldCount = fieldCount; - _env->SetIntField(_type, gTypeNativeCache, (jint)tc); - - jint *fType = _env->GetIntArrayElements(_types, NULL); - jint *fBits = _env->GetIntArrayElements(_bits, NULL); - for (int ct=0; ct < fieldCount; ct++) { - jobject field = _env->GetObjectArrayElement(_IDs, ct); - tfc[ct].field = _env->FromReflectedField(field); - tfc[ct].bits = fBits[ct]; - - switch(fType[ct]) { - case RS_TYPE_FLOAT_32: - tfc[ct].ptr = SF_LoadFloat; - tfc[ct].readPtr = SF_SaveFloat; - break; - case RS_TYPE_UNSIGNED_32: - case RS_TYPE_SIGNED_32: - tfc[ct].ptr = SF_LoadInt; - tfc[ct].readPtr = SF_SaveInt; - break; - case RS_TYPE_UNSIGNED_16: - case RS_TYPE_SIGNED_16: - tfc[ct].ptr = SF_LoadShort; - tfc[ct].readPtr = SF_SaveShort; - break; - case RS_TYPE_UNSIGNED_8: - case RS_TYPE_SIGNED_8: - tfc[ct].ptr = SF_LoadByte; - tfc[ct].readPtr = SF_SaveByte; - break; - } - tc->size += 4; - } - - _env->ReleaseIntArrayElements(_types, fType, JNI_ABORT); - _env->ReleaseIntArrayElements(_bits, fBits, JNI_ABORT); -} - - // ----------------------------------- static jint @@ -699,45 +578,6 @@ nAllocationRead_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jfloat _env->ReleaseFloatArrayElements(data, ptr, 0); } - -//{"nAllocationDataFromObject", "(ILandroid/renderscript/Type;Ljava/lang/Object;)V", (void*)nAllocationDataFromObject }, -static void -nAllocationSubDataFromObject(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jobject _type, jint offset, jobject _o) -{ - LOG_API("nAllocationDataFromObject con(%p), alloc(%p)", con, (RsAllocation)alloc); - - const TypeCache *tc = (TypeCache *)_env->GetIntField(_type, gTypeNativeCache); - - void * bufAlloc = malloc(tc->size); - void * buf = bufAlloc; - for (int ct=0; ct < tc->fieldCount; ct++) { - const TypeFieldCache *tfc = &tc->fields[ct]; - buf = tfc->ptr(_env, _o, tfc->field, buf); - } - rsAllocation1DSubData(con, (RsAllocation)alloc, offset, 1, bufAlloc, tc->size); - free(bufAlloc); -} - -static void -nAllocationSubReadFromObject(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jobject _type, jint offset, jobject _o) -{ - LOG_API("nAllocationReadFromObject con(%p), alloc(%p)", con, (RsAllocation)alloc); - - assert(offset == 0); - - const TypeCache *tc = (TypeCache *)_env->GetIntField(_type, gTypeNativeCache); - - void * bufAlloc = malloc(tc->size); - void * buf = bufAlloc; - rsAllocationRead(con, (RsAllocation)alloc, bufAlloc); - - for (int ct=0; ct < tc->fieldCount; ct++) { - const TypeFieldCache *tfc = &tc->fields[ct]; - buf = tfc->readPtr(_env, _o, tfc->field, buf); - } - free(bufAlloc); -} - static jint nAllocationGetType(JNIEnv *_env, jobject _this, RsContext con, jint a) { @@ -1397,8 +1237,6 @@ static JNINativeMethod methods[] = { {"rsnTypeBegin", "(II)V", (void*)nTypeBegin }, {"rsnTypeAdd", "(III)V", (void*)nTypeAdd }, {"rsnTypeCreate", "(I)I", (void*)nTypeCreate }, -{"rsnTypeFinalDestroy", "(ILandroid/renderscript/Type;)V", (void*)nTypeFinalDestroy }, -{"rsnTypeSetupFields", "(ILandroid/renderscript/Type;[I[I[Ljava/lang/reflect/Field;)V", (void*)nTypeSetupFields }, {"rsnTypeGetNativeData", "(II[I)V", (void*)nTypeGetNativeData }, {"rsnAllocationCreateTyped", "(II)I", (void*)nAllocationCreateTyped }, @@ -1417,8 +1255,6 @@ static JNINativeMethod methods[] = { {"rsnAllocationSubData2D", "(IIIIII[FI)V", (void*)nAllocationSubData2D_f }, {"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i }, {"rsnAllocationRead", "(II[F)V", (void*)nAllocationRead_f }, -{"rsnAllocationSubDataFromObject", "(IILandroid/renderscript/Type;ILjava/lang/Object;)V", (void*)nAllocationSubDataFromObject }, -{"rsnAllocationSubReadFromObject", "(IILandroid/renderscript/Type;ILjava/lang/Object;)V", (void*)nAllocationSubReadFromObject }, {"rsnAllocationGetType", "(II)I", (void*)nAllocationGetType}, {"rsnAdapter1DBindAllocation", "(III)V", (void*)nAdapter1DBindAllocation }, diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 085e92d..183874c 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -274,9 +274,13 @@ status_t AwesomePlayer::setDataSource_l( status_t AwesomePlayer::setDataSource( int fd, int64_t offset, int64_t length) { #if 0 + // return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/sl.m3u8"); + return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/0440.m3u8"); + // return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/0640.m3u8"); + // return setDataSource("httplive://qthttp.apple.com.edgesuite.net/1009qpeijrfn/1240_vod.m3u8"); // return setDataSource("httplive://iphoned5.akamai.com.edgesuite.net/mhbarron/nasatv/nasatv_96.m3u8"); // return setDataSource("httplive://iphoned5.akamai.com.edgesuite.net/mhbarron/nasatv/nasatv_1500.m3u8"); - return setDataSource("httplive://iphone.video.hsn.com/iPhone_high.m3u8"); + // return setDataSource("httplive://iphone.video.hsn.com/iPhone_high.m3u8"); // return setDataSource("httplive://iphoned5.akamai.com.edgesuite.net/mhbarron/iphonewebcast/webcast090209_all/webcast090209_all.m3u8"); // return setDataSource("httplive://qthttp.akamai.com.edgesuite.net/iphone_demo/Video_Content/usat/tt_062209_iphone/hi/prog_index.m3u8"); // return setDataSource("httplive://qthttp.akamai.com.edgesuite.net/iphone_demo/Video_Content/usat/tt_googmaps/hi/prog_index.m3u8"); diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp index 26a0fb3..72de8d7 100644 --- a/media/libstagefright/mpeg2ts/ATSParser.cpp +++ b/media/libstagefright/mpeg2ts/ATSParser.cpp @@ -78,6 +78,8 @@ private: unsigned PTS_DTS_flags, uint64_t PTS, uint64_t DTS, const uint8_t *data, size_t size); + void extractAACFrames(const sp<ABuffer> &buffer); + DISALLOW_EVIL_CONSTRUCTORS(Stream); }; @@ -226,7 +228,7 @@ sp<MediaSource> ATSParser::Program::getSource(SourceType type) { ATSParser::Stream::Stream(unsigned elementaryPID, unsigned streamType) : mElementaryPID(elementaryPID), mStreamType(streamType), - mBuffer(new ABuffer(65536)), + mBuffer(new ABuffer(128 * 1024)), mPayloadStarted(false) { mBuffer->setRange(0, 0); } @@ -662,7 +664,7 @@ static sp<ABuffer> FindMPEG2ADTSConfig( csd->data()[sizeof(kStaticESDS) + 1] = ((sampling_freq_index << 7) & 0x80) | (channel_configuration << 3); - hexdump(csd->data(), csd->size()); + // hexdump(csd->data(), csd->size()); return csd; } @@ -727,13 +729,76 @@ void ATSParser::Stream::onPayloadData( buffer->meta()->setInt64("time", (PTS * 100) / 9); if (mStreamType == 0x0f) { - // WHY??? - buffer->setRange(7, buffer->size() - 7); + extractAACFrames(buffer); } mSource->queueAccessUnit(buffer); } +// Disassemble one or more ADTS frames into their constituent parts and +// leave only the concatenated raw_data_blocks in the buffer. +void ATSParser::Stream::extractAACFrames(const sp<ABuffer> &buffer) { + size_t dstOffset = 0; + + size_t offset = 0; + while (offset < buffer->size()) { + CHECK_LE(offset + 7, buffer->size()); + + ABitReader bits(buffer->data() + offset, buffer->size() - offset); + + // adts_fixed_header + + CHECK_EQ(bits.getBits(12), 0xfffu); + bits.skipBits(3); // ID, layer + bool protection_absent = bits.getBits(1) != 0; + + // profile_ObjectType, sampling_frequency_index, private_bits, + // channel_configuration, original_copy, home + bits.skipBits(12); + + // adts_variable_header + + // copyright_identification_bit, copyright_identification_start + bits.skipBits(2); + + unsigned aac_frame_length = bits.getBits(13); + + bits.skipBits(11); // adts_buffer_fullness + + unsigned number_of_raw_data_blocks_in_frame = bits.getBits(2); + + if (number_of_raw_data_blocks_in_frame == 0) { + size_t scan = offset + aac_frame_length; + + offset += 7; + if (!protection_absent) { + offset += 2; + } + + CHECK_LE(scan, buffer->size()); + + LOG(VERBOSE) + << "found aac raw data block at [" + << StringPrintf("0x%08x", offset) + << " ; " + << StringPrintf("0x%08x", scan) + << ")"; + + memmove(&buffer->data()[dstOffset], &buffer->data()[offset], + scan - offset); + + dstOffset += scan - offset; + offset = scan; + } else { + // To be implemented. + TRESPASS(); + } + } + CHECK_EQ(offset, buffer->size()); + + buffer->setRange(buffer->offset(), dstOffset); +} + sp<MediaSource> ATSParser::Stream::getSource(SourceType type) { if ((type == AVC_VIDEO && mStreamType == 0x1b) || (type == MPEG2ADTS_AUDIO && mStreamType == 0x0f)) { diff --git a/media/libstagefright/rtsp/ARTPSession.cpp b/media/libstagefright/rtsp/ARTPSession.cpp index f60c1a9..8ce93b7 100644 --- a/media/libstagefright/rtsp/ARTPSession.cpp +++ b/media/libstagefright/rtsp/ARTPSession.cpp @@ -125,6 +125,14 @@ void ARTPSession::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatAccessUnitComplete: { + int32_t firstRTCP; + if (msg->findInt32("first-rtcp", &firstRTCP)) { + // There won't be an access unit here, it's just a notification + // that the data communication worked since we got the first + // rtcp packet. + break; + } + size_t trackIndex; CHECK(msg->findSize("track-index", &trackIndex)); diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 6f23805..98394d0 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -105,7 +105,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { private int mNumDnsEntries; private boolean mTestMode; - private static ConnectivityService sServiceInstance; + private static volatile ConnectivityService sServiceInstance; private Handler mHandler; @@ -174,11 +174,10 @@ public class ConnectivityService extends IConnectivityManager.Stub { Looper.loop(); } - public static ConnectivityService getServiceInstance(Context context) { - ConnectivityThread thread = new ConnectivityThread(context); - thread.start(); - - synchronized (thread) { + public static synchronized ConnectivityService getServiceInstance(Context context) { + if (sServiceInstance == null) { + ConnectivityThread thread = new ConnectivityThread(context); + thread.start(); while (sServiceInstance == null) { try { // Wait until sServiceInstance has been initialized. |
