am 32c308a5: Merge "If media wants ASCII lowercasing, it needs to ask for it."

* commit '32c308a5f2051a62ab2fb3337d00d84e9035eb9a':
  If media wants ASCII lowercasing, it needs to ask for it.
This commit is contained in:
Elliott Hughes
2013-08-02 17:41:54 -07:00
committed by Android Git Automerger
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.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale;
/** /**
* MediaScanner helper class. * MediaScanner helper class.
@@ -276,10 +277,10 @@ public class MediaFile {
} }
public static MediaFileType getFileType(String path) { public static MediaFileType getFileType(String path) {
int lastDot = path.lastIndexOf("."); int lastDot = path.lastIndexOf('.');
if (lastDot < 0) if (lastDot < 0)
return null; 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) { public static boolean isMimeTypeMedia(String mimeType) {
@@ -325,7 +326,7 @@ public class MediaFile {
} }
int lastDot = fileName.lastIndexOf('.'); int lastDot = fileName.lastIndexOf('.');
if (lastDot > 0) { if (lastDot > 0) {
String extension = fileName.substring(lastDot + 1).toUpperCase(); String extension = fileName.substring(lastDot + 1).toUpperCase(Locale.ROOT);
Integer value = sFileTypeToFormatMap.get(extension); Integer value = sFileTypeToFormatMap.get(extension);
if (value != null) { if (value != null) {
return value.intValue(); return value.intValue();

View File

@@ -540,7 +540,7 @@ public class MediaScanner
if (noMedia) { if (noMedia) {
result = endFile(entry, false, false, false, false, false); result = endFile(entry, false, false, false, false, false);
} else { } else {
String lowpath = path.toLowerCase(); String lowpath = path.toLowerCase(Locale.ROOT);
boolean ringtones = (lowpath.indexOf(RINGTONES_DIR) > 0); boolean ringtones = (lowpath.indexOf(RINGTONES_DIR) > 0);
boolean notifications = (lowpath.indexOf(NOTIFICATIONS_DIR) > 0); boolean notifications = (lowpath.indexOf(NOTIFICATIONS_DIR) > 0);
boolean alarms = (lowpath.indexOf(ALARMS_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.core.FrameFormat;
import android.filterfw.format.ObjectFormat; import android.filterfw.format.ObjectFormat;
import java.util.Locale;
/** /**
* @hide * @hide
*/ */
@@ -47,7 +49,7 @@ public class ToUpperCase extends Filter {
String inputString = (String)input.getObjectValue(); String inputString = (String)input.getObjectValue();
Frame output = env.getFrameManager().newFrame(mOutputFormat); Frame output = env.getFrameManager().newFrame(mOutputFormat);
output.setObjectValue(inputString.toUpperCase()); output.setObjectValue(inputString.toUpperCase(Locale.getDefault()));
pushOutput("uppercase", output); pushOutput("uppercase", output);
} }

View File

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