summaryrefslogtreecommitdiffstats
path: root/drm
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-03-12 23:20:29 -0700
committerJames Dong <jdong@google.com>2012-03-13 14:54:02 -0700
commitad6ec91c0bca37587e28bf72dfc38cde1b90544f (patch)
tree3bfd1f4840a7230a517284c3c1a35405877545b7 /drm
parentaa4397f07c43bd83bc3100b749401dc3d15e7622 (diff)
downloadframeworks_av-ad6ec91c0bca37587e28bf72dfc38cde1b90544f.zip
frameworks_av-ad6ec91c0bca37587e28bf72dfc38cde1b90544f.tar.gz
frameworks_av-ad6ec91c0bca37587e28bf72dfc38cde1b90544f.tar.bz2
make sure that lower-case mime and file suffix is used to check against the supported ones
Change-Id: I6a20832f6a2dfb8554dbddef0dee87cc21c05c80
Diffstat (limited to 'drm')
-rw-r--r--drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index 5ee41e6..4b1b40e 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -159,11 +159,13 @@ android::status_t FwdLockEngine::onTerminate(int uniqueId) {
return DRM_NO_ERROR;
}
+// make sure that lower-case letters are used.
const String8 FwdLockEngine::FileSuffixes[] = {
String8(".fl"),
String8(".dm"),
};
+// make sure that lower-case letters are used.
const String8 FwdLockEngine::MimeTypes[] = {
String8("application/x-android-drm-fl"),
String8("application/vnd.oma.drm.message"),
@@ -184,8 +186,10 @@ void FwdLockEngine::AddSupportedFileSuffixes(DrmSupportInfo *info) {
}
bool FwdLockEngine::IsMimeTypeSupported(const String8& mime) {
+ String8 tmp(mime);
+ tmp.toLower();
for (size_t i = 0, n = sizeof(MimeTypes)/sizeof(MimeTypes[0]); i < n; ++i) {
- if (mime == MimeTypes[i]) {
+ if (tmp == MimeTypes[i]) {
return true;
}
}
@@ -193,8 +197,10 @@ bool FwdLockEngine::IsMimeTypeSupported(const String8& mime) {
}
bool FwdLockEngine::IsFileSuffixSupported(const String8& suffix) {
+ String8 tmp(suffix);
+ tmp.toLower();
for (size_t i = 0, n = sizeof(FileSuffixes)/sizeof(FileSuffixes[0]); i < n; ++i) {
- if (suffix == FileSuffixes[i]) {
+ if (tmp == FileSuffixes[i]) {
return true;
}
}
@@ -220,7 +226,6 @@ bool FwdLockEngine::onCanHandle(int uniqueId, const String8& path) {
bool result = false;
String8 extString = path.getPathExtension();
- extString.toLower();
return IsFileSuffixSupported(extString);
}
@@ -331,8 +336,6 @@ int FwdLockEngine::onGetDrmObjectType(int uniqueId,
LOG_VERBOSE("FwdLockEngine::onGetDrmObjectType");
- mimeStr.toLower();
-
/* Checks whether
* 1. path and mime type both are not empty strings (meaning unavailable) else content is unknown
* 2. if one of them is empty string and if other is known then its a DRM Content Object.