Merge "DO NOT MERGE: Enable http-live support for https:// urls, fix a parsing issue." into honeycomb-mr1
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java
index 6be988e..f52fa66 100644
--- a/core/java/android/webkit/HTML5VideoFullScreen.java
+++ b/core/java/android/webkit/HTML5VideoFullScreen.java
@@ -209,9 +209,6 @@
// which happens when the video view is detached from its parent
// view. This happens in the WebChromeClient before this method
// is invoked.
- mTimer.cancel();
- mTimer = null;
-
pauseAndDispatch(mProxy);
mLayout.removeView(getSurfaceView());
diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java
index b9d55e0..cd2264c 100644
--- a/core/java/android/webkit/HTML5VideoView.java
+++ b/core/java/android/webkit/HTML5VideoView.java
@@ -68,6 +68,14 @@
// common Video control FUNCTIONS:
public void start() {
if (mCurrentState == STATE_PREPARED) {
+ // When replaying the same video, there is no onPrepared call.
+ // Therefore, the timer should be set up here.
+ if (mTimer == null)
+ {
+ mTimer = new Timer();
+ mTimer.schedule(new TimeupdateTask(mProxy), TIMEUPDATE_PERIOD,
+ TIMEUPDATE_PERIOD);
+ }
mPlayer.start();
}
}
@@ -76,8 +84,12 @@
if (mCurrentState == STATE_PREPARED && mPlayer.isPlaying()) {
mPlayer.pause();
}
+
+ // Delete the Timer to stop it since there is no stop call.
if (mTimer != null) {
mTimer.purge();
+ mTimer.cancel();
+ mTimer = null;
}
}
@@ -129,6 +141,7 @@
mVideoLayerId = videoLayerId;
mSaveSeekTime = position;
mAutostart = autoStart;
+ mTimer = null;
}
protected HTML5VideoView() {
@@ -153,8 +166,6 @@
// When switching players, surface texture will be reused.
mUri = uri;
mHeaders = generateHeaders(uri, proxy);
-
- mTimer = new Timer();
}
// Listeners setup FUNCTIONS:
@@ -228,11 +239,9 @@
public void onPrepared(MediaPlayer mp) {
mCurrentState = STATE_PREPARED;
seekTo(mSaveSeekTime);
- if (mProxy != null)
+ if (mProxy != null) {
mProxy.onPrepared(mp);
-
- mTimer.schedule(new TimeupdateTask(mProxy), TIMEUPDATE_PERIOD, TIMEUPDATE_PERIOD);
-
+ }
}
// Pause the play and update the play/pause button
diff --git a/core/res/res/drawable/list_selector_background.xml b/core/res/res/drawable/list_selector_background.xml
index f5eb12d..1222155 100644
--- a/core/res/res/drawable/list_selector_background.xml
+++ b/core/res/res/drawable/list_selector_background.xml
@@ -24,6 +24,6 @@
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_background_disabled" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
- <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focused" />
+ <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focus" />
</selector>
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 696e305..16f1dd0 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -37,6 +37,63 @@
using namespace android;
+static void writeDecrptHandleToParcelData(
+ const DecryptHandle* handle, Parcel* data) {
+ data->writeInt32(handle->decryptId);
+ data->writeString8(handle->mimeType);
+ data->writeInt32(handle->decryptApiType);
+ data->writeInt32(handle->status);
+
+ int size = handle->copyControlVector.size();
+ data->writeInt32(size);
+ for(int i = 0; i < size; i++) {
+ data->writeInt32(handle->copyControlVector.keyAt(i));
+ data->writeInt32(handle->copyControlVector.valueAt(i));
+ }
+
+ if (NULL != handle->decryptInfo) {
+ data->writeInt32(handle->decryptInfo->decryptBufferLength);
+ } else {
+ data->writeInt32(INVALID_BUFFER_LENGTH);
+ }
+}
+
+static void readDecryptHandleFromParcelData(
+ DecryptHandle* handle, const Parcel& data) {
+ if (0 == data.dataAvail()) {
+ return;
+ }
+
+ handle->decryptId = data.readInt32();
+ handle->mimeType = data.readString8();
+ handle->decryptApiType = data.readInt32();
+ handle->status = data.readInt32();
+
+ int size = data.readInt32();
+ for (int i = 0; i < size; i ++) {
+ handle->copyControlVector.add(
+ (DrmCopyControl)data.readInt32(), data.readInt32());
+ }
+
+ handle->decryptInfo = NULL;
+ const int bufferLen = data.readInt32();
+ if (INVALID_BUFFER_LENGTH != bufferLen) {
+ handle->decryptInfo = new DecryptInfo();
+ handle->decryptInfo->decryptBufferLength = bufferLen;
+ }
+}
+
+static void clearDecryptHandle(DecryptHandle* handle) {
+ if (handle == NULL) {
+ return;
+ }
+ if (handle->decryptInfo) {
+ delete handle->decryptInfo;
+ handle->decryptInfo = NULL;
+ }
+ handle->copyControlVector.clear();
+}
+
int BpDrmManagerService::addUniqueId(int uniqueId) {
LOGV("add uniqueid");
Parcel data, reply;
@@ -344,16 +401,7 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
-
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
+ writeDecrptHandleToParcelData(decryptHandle, &data);
data.writeInt32(action);
data.writeInt32(static_cast< int>(reserve));
@@ -370,16 +418,7 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
-
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
+ writeDecrptHandleToParcelData(decryptHandle, &data);
data.writeInt32(playbackStatus);
data.writeInt64(position);
@@ -560,15 +599,7 @@
DecryptHandle* handle = NULL;
if (0 != reply.dataAvail()) {
handle = new DecryptHandle();
- handle->decryptId = reply.readInt32();
- handle->mimeType = reply.readString8();
- handle->decryptApiType = reply.readInt32();
- handle->status = reply.readInt32();
- handle->decryptInfo = NULL;
- if (0 != reply.dataAvail()) {
- handle->decryptInfo = new DecryptInfo();
- handle->decryptInfo->decryptBufferLength = reply.readInt32();
- }
+ readDecryptHandleFromParcelData(handle, reply);
}
return handle;
}
@@ -586,15 +617,7 @@
DecryptHandle* handle = NULL;
if (0 != reply.dataAvail()) {
handle = new DecryptHandle();
- handle->decryptId = reply.readInt32();
- handle->mimeType = reply.readString8();
- handle->decryptApiType = reply.readInt32();
- handle->status = reply.readInt32();
- handle->decryptInfo = NULL;
- if (0 != reply.dataAvail()) {
- handle->decryptInfo = new DecryptInfo();
- handle->decryptInfo->decryptBufferLength = reply.readInt32();
- }
+ readDecryptHandleFromParcelData(handle, reply);
} else {
LOGV("no decryptHandle is generated in service side");
}
@@ -608,16 +631,7 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
-
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
+ writeDecrptHandleToParcelData(decryptHandle, &data);
remote()->transact(CLOSE_DECRYPT_SESSION, data, &reply);
@@ -638,16 +652,8 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
+ writeDecrptHandleToParcelData(decryptHandle, &data);
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
data.writeInt32(decryptUnitId);
data.writeInt32(headerInfo->length);
@@ -666,16 +672,7 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
-
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
+ writeDecrptHandleToParcelData(decryptHandle, &data);
data.writeInt32(decryptUnitId);
data.writeInt32((*decBuffer)->length);
@@ -708,16 +705,7 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
-
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
+ writeDecrptHandleToParcelData(decryptHandle, &data);
data.writeInt32(decryptUnitId);
@@ -735,16 +723,7 @@
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
- data.writeInt32(decryptHandle->decryptId);
- data.writeString8(decryptHandle->mimeType);
- data.writeInt32(decryptHandle->decryptApiType);
- data.writeInt32(decryptHandle->status);
-
- if (NULL != decryptHandle->decryptInfo) {
- data.writeInt32(decryptHandle->decryptInfo->decryptBufferLength);
- } else {
- data.writeInt32(INVALID_BUFFER_LENGTH);
- }
+ writeDecrptHandleToParcelData(decryptHandle, &data);
data.writeInt32(numBytes);
data.writeInt64(offset);
@@ -1069,24 +1048,14 @@
const int uniqueId = data.readInt32();
DecryptHandle handle;
- handle.decryptId = data.readInt32();
- handle.mimeType = data.readString8();
- handle.decryptApiType = data.readInt32();
- handle.status = data.readInt32();
- handle.decryptInfo = NULL;
-
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle.decryptInfo = new DecryptInfo();
- handle.decryptInfo->decryptBufferLength = bufferLength;
- }
+ readDecryptHandleFromParcelData(&handle, data);
const status_t status
= consumeRights(uniqueId, &handle, data.readInt32(),
static_cast<bool>(data.readInt32()));
reply->writeInt32(status);
- delete handle.decryptInfo; handle.decryptInfo = NULL;
+ clearDecryptHandle(&handle);
return DRM_NO_ERROR;
}
@@ -1098,23 +1067,13 @@
const int uniqueId = data.readInt32();
DecryptHandle handle;
- handle.decryptId = data.readInt32();
- handle.mimeType = data.readString8();
- handle.decryptApiType = data.readInt32();
- handle.status = data.readInt32();
- handle.decryptInfo = NULL;
-
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle.decryptInfo = new DecryptInfo();
- handle.decryptInfo->decryptBufferLength = bufferLength;
- }
+ readDecryptHandleFromParcelData(&handle, data);
const status_t status
= setPlaybackStatus(uniqueId, &handle, data.readInt32(), data.readInt64());
reply->writeInt32(status);
- delete handle.decryptInfo; handle.decryptInfo = NULL;
+ clearDecryptHandle(&handle);
return DRM_NO_ERROR;
}
@@ -1275,16 +1234,10 @@
= openDecryptSession(uniqueId, fd, data.readInt64(), data.readInt64());
if (NULL != handle) {
- reply->writeInt32(handle->decryptId);
- reply->writeString8(handle->mimeType);
- reply->writeInt32(handle->decryptApiType);
- reply->writeInt32(handle->status);
- if (NULL != handle->decryptInfo) {
- reply->writeInt32(handle->decryptInfo->decryptBufferLength);
- delete handle->decryptInfo; handle->decryptInfo = NULL;
- }
+ writeDecrptHandleToParcelData(handle, reply);
+ clearDecryptHandle(handle);
+ delete handle; handle = NULL;
}
- delete handle; handle = NULL;
return DRM_NO_ERROR;
}
@@ -1299,18 +1252,13 @@
DecryptHandle* handle = openDecryptSession(uniqueId, uri.string());
if (NULL != handle) {
- reply->writeInt32(handle->decryptId);
- reply->writeString8(handle->mimeType);
- reply->writeInt32(handle->decryptApiType);
- reply->writeInt32(handle->status);
- if (NULL != handle->decryptInfo) {
- reply->writeInt32(handle->decryptInfo->decryptBufferLength);
- delete handle->decryptInfo; handle->decryptInfo = NULL;
- }
+ writeDecrptHandleToParcelData(handle, reply);
+
+ clearDecryptHandle(handle);
+ delete handle; handle = NULL;
} else {
LOGV("NULL decryptHandle is returned");
}
- delete handle; handle = NULL;
return DRM_NO_ERROR;
}
@@ -1322,17 +1270,7 @@
const int uniqueId = data.readInt32();
DecryptHandle* handle = new DecryptHandle();
- handle->decryptId = data.readInt32();
- handle->mimeType = data.readString8();
- handle->decryptApiType = data.readInt32();
- handle->status = data.readInt32();
- handle->decryptInfo = NULL;
-
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle->decryptInfo = new DecryptInfo();
- handle->decryptInfo->decryptBufferLength = bufferLength;
- }
+ readDecryptHandleFromParcelData(handle, data);
const status_t status = closeDecryptSession(uniqueId, handle);
reply->writeInt32(status);
@@ -1347,17 +1285,8 @@
const int uniqueId = data.readInt32();
DecryptHandle handle;
- handle.decryptId = data.readInt32();
- handle.mimeType = data.readString8();
- handle.decryptApiType = data.readInt32();
- handle.status = data.readInt32();
- handle.decryptInfo = NULL;
+ readDecryptHandleFromParcelData(&handle, data);
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle.decryptInfo = new DecryptInfo();
- handle.decryptInfo->decryptBufferLength = bufferLength;
- }
const int decryptUnitId = data.readInt32();
//Filling Header info
@@ -1369,7 +1298,7 @@
= initializeDecryptUnit(uniqueId, &handle, decryptUnitId, headerInfo);
reply->writeInt32(status);
- delete handle.decryptInfo; handle.decryptInfo = NULL;
+ clearDecryptHandle(&handle);
delete headerInfo; headerInfo = NULL;
return DRM_NO_ERROR;
}
@@ -1382,17 +1311,8 @@
const int uniqueId = data.readInt32();
DecryptHandle handle;
- handle.decryptId = data.readInt32();
- handle.mimeType = data.readString8();
- handle.decryptApiType = data.readInt32();
- handle.status = data.readInt32();
- handle.decryptInfo = NULL;
+ readDecryptHandleFromParcelData(&handle, data);
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle.decryptInfo = new DecryptInfo();
- handle.decryptInfo->decryptBufferLength = bufferLength;
- }
const int decryptUnitId = data.readInt32();
const int decBufferSize = data.readInt32();
@@ -1419,7 +1339,7 @@
reply->writeInt32(size);
reply->write(decBuffer->data, size);
- delete handle.decryptInfo; handle.decryptInfo = NULL;
+ clearDecryptHandle(&handle);
delete encBuffer; encBuffer = NULL;
delete decBuffer; decBuffer = NULL;
delete [] buffer; buffer = NULL;
@@ -1435,22 +1355,12 @@
const int uniqueId = data.readInt32();
DecryptHandle handle;
- handle.decryptId = data.readInt32();
- handle.mimeType = data.readString8();
- handle.decryptApiType = data.readInt32();
- handle.status = data.readInt32();
- handle.decryptInfo = NULL;
-
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle.decryptInfo = new DecryptInfo();
- handle.decryptInfo->decryptBufferLength = bufferLength;
- }
+ readDecryptHandleFromParcelData(&handle, data);
const status_t status = finalizeDecryptUnit(uniqueId, &handle, data.readInt32());
reply->writeInt32(status);
- delete handle.decryptInfo; handle.decryptInfo = NULL;
+ clearDecryptHandle(&handle);
return DRM_NO_ERROR;
}
@@ -1462,17 +1372,7 @@
const int uniqueId = data.readInt32();
DecryptHandle handle;
- handle.decryptId = data.readInt32();
- handle.mimeType = data.readString8();
- handle.decryptApiType = data.readInt32();
- handle.status = data.readInt32();
- handle.decryptInfo = NULL;
-
- const int bufferLength = data.readInt32();
- if (INVALID_BUFFER_LENGTH != bufferLength) {
- handle.decryptInfo = new DecryptInfo();
- handle.decryptInfo->decryptBufferLength = bufferLength;
- }
+ readDecryptHandleFromParcelData(&handle, data);
const int numBytes = data.readInt32();
char* buffer = new char[numBytes];
@@ -1485,7 +1385,7 @@
reply->write(buffer, result);
}
- delete handle.decryptInfo; handle.decryptInfo = NULL;
+ clearDecryptHandle(&handle);
delete [] buffer, buffer = NULL;
return DRM_NO_ERROR;
}
diff --git a/include/drm/drm_framework_common.h b/include/drm/drm_framework_common.h
index 1758cdd..e8ec953 100644
--- a/include/drm/drm_framework_common.h
+++ b/include/drm/drm_framework_common.h
@@ -43,6 +43,17 @@
};
/**
+ * copy control settings used in DecryptHandle::copyControlVector
+ */
+enum DrmCopyControl {
+ DRM_COPY_CONTROL_BASE = 1000,
+ // the key used to set the value for HDCP
+ // if the associated value is 1, then HDCP is required
+ // otherwise, HDCP is not required
+ DRM_COPY_CONTROL_HDCP = DRM_COPY_CONTROL_BASE
+};
+
+/**
* Defines DRM Buffer
*/
class DrmBuffer {
@@ -279,6 +290,11 @@
* e.g. size of memory to be allocated to get the decrypted content.
*/
DecryptInfo* decryptInfo;
+ /**
+ * Defines a vector for the copy control settings sent from the DRM plugin
+ * to the player
+ */
+ KeyedVector<DrmCopyControl, int> copyControlVector;
public:
DecryptHandle():
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
index beb2927..a80fc13 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
@@ -16,7 +16,10 @@
package com.android.mediaframeworktest;
+import java.io.BufferedWriter;
+import java.io.File;
import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
@@ -31,28 +34,58 @@
*
*/
public class MediaTestUtil {
- private MediaTestUtil(){
- }
private static String TAG = "MediaTestUtil";
- private static final String STORAGE_PATH =
- Environment.getExternalStorageDirectory().toString();
- private static int mMediaStartMemory = 0;
- private static int mDrmStartMemory = 0;
+ private static final String STORAGE_PATH = Environment.getExternalStorageDirectory().toString();
+ private int mStartMemory = 0;
+ private int mStartPid = 0;
+ private Writer mOutput = null;
+ private String mTestName = null;
+ private String mProcessName = null;
- //Catpure the heapdump for memory leaksage analysis
- public static void getNativeHeapDump (String name) throws Exception {
+ public MediaTestUtil(String memoryOutFileName, String testName, String processName)
+ throws Exception {
+ File memoryOut = new File(memoryOutFileName);
+ mOutput = new BufferedWriter(new FileWriter(memoryOut, true));
+ mProcessName = processName;
+ mTestName = testName;
+ mStartPid = getPid();
+ mStartMemory = getVsize();
+ }
+
+ // Catpure the heapdump for memory leaksage analysis
+ public static void getNativeHeapDump(String name) throws Exception {
System.gc();
System.runFinalization();
Thread.sleep(1000);
- FileOutputStream o = new FileOutputStream(STORAGE_PATH + '/' +name + ".dump");
+ FileOutputStream o = new FileOutputStream(STORAGE_PATH + '/' + name + ".dump");
Debug.dumpNativeHeap(o.getFD());
o.close();
}
- public static String captureMemInfo(String type) {
+ private void validateProcessStatus() throws Exception {
+ int currentPid = getPid();
+ //Process crash
+ if (mStartPid != currentPid) {
+ mOutput.write(mProcessName + " died. Test failed\n");
+ }
+ }
+
+ private int getPid() {
+ String memoryUsage = null;
+ int pidvalue = 0;
+ memoryUsage = captureMemInfo();
+ String[] poList2 = memoryUsage.split("\t|\\s+");
+ String pid = poList2[1];
+ pidvalue = Integer.parseInt(pid);
+ Log.v(TAG, "PID = " + pidvalue);
+ return pidvalue;
+ }
+
+ private String captureMemInfo() {
String cm = "ps ";
- cm += type;
+ cm += mProcessName;
+ Log.v(TAG, cm);
String memoryUsage = null;
int ch;
@@ -72,8 +105,8 @@
return memusage;
}
- public static int getMediaServerVsize() {
- String memoryUsage = captureMemInfo("mediaserver");
+ private int getVsize() {
+ String memoryUsage = captureMemInfo();
String[] poList2 = memoryUsage.split("\t|\\s+");
String vsize = poList2[3];
int vsizevalue = Integer.parseInt(vsize);
@@ -81,71 +114,39 @@
return vsizevalue;
}
- public static int getDrmServerVsize() {
- String memoryUsage = captureMemInfo("drmserver");
- String[] poList2 = memoryUsage.split("\t|\\s+");
- String vsize = poList2[3];
- int vsizevalue = Integer.parseInt(vsize);
- Log.v(TAG, "VSIZE = " + vsizevalue);
- return vsizevalue;
- }
-
- // Write the ps mediaserver output to the file
- public static void getMediaServerMemoryLog(Writer output, int writeCount, int totalCount)
- throws Exception {
+ // Write the startup media memory mOutput to the file
+ public void getStartMemoryLog() throws Exception {
String memusage = null;
-
- if (writeCount == 0) {
- mMediaStartMemory = getMediaServerVsize();
- output.write("Start memory : " + mMediaStartMemory + "\n");
- }
- memusage = captureMemInfo("mediaserver");
- output.write(memusage);
+ mStartMemory = getVsize();
+ mOutput.write(mTestName + '\n');
+ mOutput.write("Start memory : " + mStartMemory + "\n");
+ memusage = captureMemInfo();
+ mOutput.write(memusage);
}
- // Write the ps drmserver output to the file
- public static void getDrmServerMemoryLog(Writer output, int writeCount, int totalCount)
- throws Exception {
+ // Write the ps mediaserver mOutput to the file
+ public void getMemoryLog() throws Exception {
String memusage = null;
-
- if (writeCount == 0) {
- mDrmStartMemory = getDrmServerVsize();
- output.write("Start memory : " + mDrmStartMemory + "\n");
- }
- memusage = captureMemInfo("drmserver");
- output.write(memusage);
+ memusage = captureMemInfo();
+ mOutput.write(memusage);
+ mOutput.flush();
}
- // Write the ps drmserver output to the file
- public static void getDrmServerMemorySummary(Writer output, String tag) throws Exception {
-
- getTestMemorySummary(output, tag, "drmMem");
- }
-
- // Write the ps drmserver output to the file
- public static void getMediaServerMemorySummary(Writer output, String tag) throws Exception {
-
- getTestMemorySummary(output, tag, "mediaMem");
- }
-
- public static void getTestMemorySummary(Writer output, String tag, String type)
- throws Exception {
-
+ public void getMemorySummary() throws Exception {
int endMemory = 0;
int memDiff = 0;
- if (type == "mediaMem") {
- endMemory = getMediaServerVsize();
- memDiff = endMemory - mMediaStartMemory;
- } else if (type == "drmMem") {
- endMemory = getDrmServerVsize();
- memDiff = endMemory - mDrmStartMemory;
- }
- output.write("End Memory :" + endMemory + "\n");
+ endMemory = getVsize();
+ memDiff = endMemory - mStartMemory;
+
+ mOutput.write("End Memory :" + endMemory + "\n");
if (memDiff < 0) {
memDiff = 0;
}
- output.write(tag + " total diff = " + memDiff);
- output.write("\n\n");
+ mOutput.write(mTestName + " total diff = " + memDiff);
+ mOutput.write("\n\n");
+ validateProcessStatus();
+ mOutput.flush();
+ mOutput.close();
}
}