diff options
| author | 2009-07-06 11:54:24 -0700 | |
|---|---|---|
| committer | 2009-07-06 11:54:24 -0700 | |
| commit | ff7d0e2bcc6ff056471863ac9aee95e93f19bfed (patch) | |
| tree | 37aa12575d7dde358211f0b7c26a551a65fff8b8 | |
| parent | c8f800edb2321fa896f1834deb82ebb4ddc75202 (diff) | |
| parent | 816cf52abd8f45770f0ac922bbb819184ed4b90f (diff) | |
am 816cf52a: 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 a
Merge commit '816cf52abd8f45770f0ac922bbb819184ed4b90f'
* commit '816cf52abd8f45770f0ac922bbb819184ed4b90f':
Fix the DEFAULT_SORT_ORDER value for media files. Changing this
| -rw-r--r-- | api/4.xml | 4 | ||||
| -rw-r--r-- | api/current.xml | 4 | ||||
| -rw-r--r-- | core/java/android/provider/MediaStore.java | 16 |
3 files changed, 17 insertions, 7 deletions
diff --git a/api/4.xml b/api/4.xml index b117a8734c98..c8a2e83fd136 100644 --- a/api/4.xml +++ b/api/4.xml @@ -88821,7 +88821,7 @@ type="java.lang.String" transient="false" volatile="false" - value=""title"" + value=""title_key"" static="true" final="true" deprecated="not deprecated" @@ -88918,7 +88918,7 @@ type="java.lang.String" transient="false" volatile="false" - value=""title"" + value=""title_key"" static="true" final="true" deprecated="not deprecated" diff --git a/api/current.xml b/api/current.xml index 2eecdbe2a463..0ca87bacdd54 100644 --- a/api/current.xml +++ b/api/current.xml @@ -108264,7 +108264,7 @@ type="java.lang.String" transient="false" volatile="false" - value=""title"" + value=""title_key"" static="true" final="true" deprecated="not deprecated" @@ -108361,7 +108361,7 @@ type="java.lang.String" transient="false" volatile="false" - value=""title"" + value=""title_key"" static="true" final="true" deprecated="not deprecated" diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index bc7b5be046f1..21e5865fef70 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 |