diff options
| author | Marco Nelissen <marcone@google.com> | 2009-07-06 09:19:10 -0700 |
|---|---|---|
| committer | Marco Nelissen <marcone@google.com> | 2009-07-06 09:58:06 -0700 |
| commit | 816cf52abd8f45770f0ac922bbb819184ed4b90f (patch) | |
| tree | 8b604bed1520b662b20598540e4dad8d6b40bc1e /core/java/android/provider | |
| parent | 46841db4f2c7360d3b861a816e51f76acca0d677 (diff) | |
| download | frameworks_base-816cf52abd8f45770f0ac922bbb819184ed4b90f.zip frameworks_base-816cf52abd8f45770f0ac922bbb819184ed4b90f.tar.gz frameworks_base-816cf52abd8f45770f0ac922bbb819184ed4b90f.tar.bz2 | |
Fix the DEFAULT_SORT_ORDER value for media files. Changing this
is OK, because existing app will have the old value compiled in
as a literal, and so will continue to (not) work in the same
way as before. Add code to media key generator to give a leading
ascii \001 the special meaning of "sort first".
Diffstat (limited to 'core/java/android/provider')
| -rw-r--r-- | core/java/android/provider/MediaStore.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index bc7b5be..21e5865 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -722,9 +722,15 @@ public final class MediaStore */ public static String keyFor(String name) { if (name != null) { + boolean sortfirst = false; if (name.equals(android.media.MediaFile.UNKNOWN_STRING)) { return "\001"; } + // Check if the first character is \001. We use this to + // force sorting of certain special files, like the silent ringtone. + if (name.startsWith("\001")) { + sortfirst = true; + } name = name.trim().toLowerCase(); if (name.startsWith("the ")) { name = name.substring(4); @@ -753,7 +759,11 @@ public final class MediaStore b.append('.'); } name = b.toString(); - return DatabaseUtils.getCollationKey(name); + String key = DatabaseUtils.getCollationKey(name); + if (sortfirst) { + key = "\001" + key; + } + return key; } else { return ""; } @@ -800,7 +810,7 @@ public final class MediaStore /** * The default sort order for this table */ - public static final String DEFAULT_SORT_ORDER = TITLE; + public static final String DEFAULT_SORT_ORDER = TITLE_KEY; /** * Activity Action: Start SoundRecorder application. @@ -897,7 +907,7 @@ public final class MediaStore /** * The default sort order for this table */ - public static final String DEFAULT_SORT_ORDER = TITLE; + public static final String DEFAULT_SORT_ORDER = TITLE_KEY; /** * The ID of the audio file |
