Merge "Fix StringIndexOutOfBoundsException in MediaDrmAPITest" into nyc-dev
This commit is contained in:
@@ -9,6 +9,8 @@ LOCAL_PACKAGE_NAME := MediaDrmAPITest
|
|||||||
|
|
||||||
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
|
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
|
||||||
|
|
||||||
|
LOCAL_DEX_PREOPT := false
|
||||||
|
|
||||||
# TODO: This test app depends on framework implementation details.
|
# TODO: This test app depends on framework implementation details.
|
||||||
# LOCAL_SDK_VERSION := current
|
# LOCAL_SDK_VERSION := current
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ public class MediaDrmAPITest extends Activity {
|
|||||||
|
|
||||||
testClearContentNoKeys();
|
testClearContentNoKeys();
|
||||||
testEncryptedContent();
|
testEncryptedContent();
|
||||||
testEncryptedAESSampleContent();
|
|
||||||
testEncryptedContentSharingKeys();
|
testEncryptedContentSharingKeys();
|
||||||
testEncryptedContentNoKeys();
|
testEncryptedContentNoKeys();
|
||||||
|
|
||||||
@@ -334,17 +333,6 @@ public class MediaDrmAPITest extends Activity {
|
|||||||
stopDrm(drm);
|
stopDrm(drm);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testEncryptedAESSampleContent() {
|
|
||||||
Log.d(TAG, "testEncryptedAESSampleContent");
|
|
||||||
MediaDrm drm = startDrm();
|
|
||||||
byte[] sessionId = openSession(drm);
|
|
||||||
if (getKeys(drm, sessionId)) {
|
|
||||||
testAESSampleDecrypt(sessionId, kRequireKey);
|
|
||||||
}
|
|
||||||
drm.closeSession(sessionId);
|
|
||||||
stopDrm(drm);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void testEncryptedContentSharingKeys() {
|
private void testEncryptedContentSharingKeys() {
|
||||||
MediaDrm drm = startDrm();
|
MediaDrm drm = startDrm();
|
||||||
drm.setPropertyString("sessionSharing", "enable");
|
drm.setPropertyString("sessionSharing", "enable");
|
||||||
@@ -653,6 +641,7 @@ public class MediaDrmAPITest extends Activity {
|
|||||||
|
|
||||||
final int kMaxSubsamplesPerSample = 10;
|
final int kMaxSubsamplesPerSample = 10;
|
||||||
final int kMaxSampleSize = 128 * 1024;
|
final int kMaxSampleSize = 128 * 1024;
|
||||||
|
final int kErrorTestMode = -2500;
|
||||||
|
|
||||||
int clearSizes[] = new int[kMaxSubsamplesPerSample];
|
int clearSizes[] = new int[kMaxSubsamplesPerSample];
|
||||||
int encryptedSizes[] = new int[kMaxSubsamplesPerSample];
|
int encryptedSizes[] = new int[kMaxSubsamplesPerSample];
|
||||||
@@ -689,6 +678,8 @@ public class MediaDrmAPITest extends Activity {
|
|||||||
if (expectNoKey) {
|
if (expectNoKey) {
|
||||||
Log.e(TAG, "MediaCrypto failed to throw ERROR_NO_KEY!");
|
Log.e(TAG, "MediaCrypto failed to throw ERROR_NO_KEY!");
|
||||||
mTestFailed = true;
|
mTestFailed = true;
|
||||||
|
codec.stop();
|
||||||
|
codec.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,12 +697,15 @@ public class MediaDrmAPITest extends Activity {
|
|||||||
Log.e(TAG, "MediaCrypto reports no key loaded!");
|
Log.e(TAG, "MediaCrypto reports no key loaded!");
|
||||||
mTestFailed = true;
|
mTestFailed = true;
|
||||||
}
|
}
|
||||||
|
codec.stop();
|
||||||
|
codec.release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// in test mode, the WV CryptoPlugin throws a CryptoException where the
|
// in test mode, the WV CryptoPlugin throws a CryptoException where the
|
||||||
// message string contains a SHA256 hash of the decrypted data, for verification
|
// message string contains a SHA256 hash of the decrypted data, for verification
|
||||||
// purposes.
|
// purposes.
|
||||||
|
if (e.getErrorCode() == kErrorTestMode) {
|
||||||
if (!e.getMessage().equals("secure")) {
|
if (!e.getMessage().equals("secure")) {
|
||||||
Log.i(TAG, "e.getMessage()='" + e.getMessage() + "'");
|
Log.i(TAG, "e.getMessage()='" + e.getMessage() + "'");
|
||||||
MessageDigest digest = null;
|
MessageDigest digest = null;
|
||||||
@@ -734,6 +728,14 @@ public class MediaDrmAPITest extends Activity {
|
|||||||
mTestFailed = true;
|
mTestFailed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// An unexpected exception occurred
|
||||||
|
e.printStackTrace();
|
||||||
|
mTestFailed = true;
|
||||||
|
codec.stop();
|
||||||
|
codec.release();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear buffers for next sample
|
// clear buffers for next sample
|
||||||
|
|||||||
Reference in New Issue
Block a user