Merge "If media wants ASCII lowercasing, it needs to ask for it."

This commit is contained in:
Elliott Hughes
2013-08-02 17:24:41 +00:00
committed by Gerrit Code Review
4 changed files with 10 additions and 6 deletions

View File

@@ -28,6 +28,7 @@ import android.mtp.MtpConstants;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
/**
* MediaScanner helper class.
@@ -276,10 +277,10 @@ public class MediaFile {
}
public static MediaFileType getFileType(String path) {
int lastDot = path.lastIndexOf(".");
int lastDot = path.lastIndexOf('.');
if (lastDot < 0)
return null;
return sFileTypeMap.get(path.substring(lastDot + 1).toUpperCase());
return sFileTypeMap.get(path.substring(lastDot + 1).toUpperCase(Locale.ROOT));
}
public static boolean isMimeTypeMedia(String mimeType) {
@@ -325,7 +326,7 @@ public class MediaFile {
}
int lastDot = fileName.lastIndexOf('.');
if (lastDot > 0) {
String extension = fileName.substring(lastDot + 1).toUpperCase();
String extension = fileName.substring(lastDot + 1).toUpperCase(Locale.ROOT);
Integer value = sFileTypeToFormatMap.get(extension);
if (value != null) {
return value.intValue();

View File

@@ -540,7 +540,7 @@ public class MediaScanner
if (noMedia) {
result = endFile(entry, false, false, false, false, false);
} else {
String lowpath = path.toLowerCase();
String lowpath = path.toLowerCase(Locale.ROOT);
boolean ringtones = (lowpath.indexOf(RINGTONES_DIR) > 0);
boolean notifications = (lowpath.indexOf(NOTIFICATIONS_DIR) > 0);
boolean alarms = (lowpath.indexOf(ALARMS_DIR) > 0);

View File

@@ -23,6 +23,8 @@ import android.filterfw.core.Frame;
import android.filterfw.core.FrameFormat;
import android.filterfw.format.ObjectFormat;
import java.util.Locale;
/**
* @hide
*/
@@ -47,7 +49,7 @@ public class ToUpperCase extends Filter {
String inputString = (String)input.getObjectValue();
Frame output = env.getFrameManager().newFrame(mOutputFormat);
output.setObjectValue(inputString.toUpperCase());
output.setObjectValue(inputString.toUpperCase(Locale.getDefault()));
pushOutput("uppercase", output);
}

View File

@@ -37,6 +37,7 @@ import android.widget.Toast;
import java.io.File;
import java.util.Date;
import java.util.Locale;
/**
* A view to display the properties of an object.
@@ -120,7 +121,7 @@ public class ObjectViewer extends Activity implements View.OnClickListener {
mFileName = info.getName();
view.setText(mFileName);
view = (TextView)findViewById(R.id.format);
view.setText(Integer.toHexString(info.getFormat()).toUpperCase());
view.setText(Integer.toHexString(info.getFormat()).toUpperCase(Locale.ROOT));
view = (TextView)findViewById(R.id.size);
view.setText(Long.toString(info.getCompressedSize()));
view = (TextView)findViewById(R.id.thumb_width);