diff options
-rw-r--r-- | AndroidManifest.xml | 1 | ||||
-rw-r--r-- | res/mipmap-hdpi/ic_launcher_gallery.png | bin | 20425 -> 23319 bytes | |||
-rw-r--r-- | res/mipmap-mdpi/ic_launcher_gallery.png | bin | 17130 -> 22680 bytes | |||
-rw-r--r-- | res/mipmap-xhdpi/ic_launcher_gallery.png | bin | 24283 -> 23838 bytes | |||
-rw-r--r-- | res/mipmap-xxhdpi/ic_launcher_gallery.png | bin | 0 -> 25151 bytes | |||
-rw-r--r-- | res/mipmap-xxxhdpi/ic_launcher_gallery.png | bin | 0 -> 26425 bytes | |||
-rw-r--r-- | res/values-ast-rES/strings.xml | 28 | ||||
-rw-r--r-- | res/values-ku/strings.xml | 28 | ||||
-rw-r--r-- | res/values-lb/strings.xml | 28 | ||||
-rw-r--r-- | res/values-ug/strings.xml | 24 | ||||
-rw-r--r-- | src/com/android/providers/media/IMtpService.aidl | 1 | ||||
-rwxr-xr-x | src/com/android/providers/media/MediaProvider.java | 57 | ||||
-rw-r--r-- | src/com/android/providers/media/MtpService.java | 8 | ||||
-rw-r--r-- | src/com/android/providers/media/RingtonePickerActivity.java | 34 |
14 files changed, 203 insertions, 6 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f615b894..20e5f45c 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -15,6 +15,7 @@ <application android:process="android.process.media" android:label="@string/app_label" + android:icon="@mipmap/ic_launcher_gallery" android:supportsRtl="true"> <provider android:name="MediaProvider" android:authorities="media" android:multiprocess="false" android:exported="true"> diff --git a/res/mipmap-hdpi/ic_launcher_gallery.png b/res/mipmap-hdpi/ic_launcher_gallery.png Binary files differindex 23ea9989..65d9f3c7 100644 --- a/res/mipmap-hdpi/ic_launcher_gallery.png +++ b/res/mipmap-hdpi/ic_launcher_gallery.png diff --git a/res/mipmap-mdpi/ic_launcher_gallery.png b/res/mipmap-mdpi/ic_launcher_gallery.png Binary files differindex e1a99498..5eb1f623 100644 --- a/res/mipmap-mdpi/ic_launcher_gallery.png +++ b/res/mipmap-mdpi/ic_launcher_gallery.png diff --git a/res/mipmap-xhdpi/ic_launcher_gallery.png b/res/mipmap-xhdpi/ic_launcher_gallery.png Binary files differindex 79544a2b..aacb61b5 100644 --- a/res/mipmap-xhdpi/ic_launcher_gallery.png +++ b/res/mipmap-xhdpi/ic_launcher_gallery.png diff --git a/res/mipmap-xxhdpi/ic_launcher_gallery.png b/res/mipmap-xxhdpi/ic_launcher_gallery.png Binary files differnew file mode 100644 index 00000000..19b1750c --- /dev/null +++ b/res/mipmap-xxhdpi/ic_launcher_gallery.png diff --git a/res/mipmap-xxxhdpi/ic_launcher_gallery.png b/res/mipmap-xxxhdpi/ic_launcher_gallery.png Binary files differnew file mode 100644 index 00000000..f13b7349 --- /dev/null +++ b/res/mipmap-xxxhdpi/ic_launcher_gallery.png diff --git a/res/values-ast-rES/strings.xml b/res/values-ast-rES/strings.xml new file mode 100644 index 00000000..eb12e78c --- /dev/null +++ b/res/values-ast-rES/strings.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.com--> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="uid_label">Multimedia</string> + <string name="app_label">Almacenamientu multimedia</string> + <string name="upgrade_msg">Anovando base de datos multimedia.</string> + <string name="artist_label">Artista</string> + <string name="ringtone_default">Tonu predetermináu</string> + <string name="notification_sound_default">Soníu de notificación predetermináu</string> + <string name="alarm_sound_default">Soníu d\'alarma predetermináu</string> + <string name="root_images">Imáxenes</string> + <string name="root_videos">Vídeos</string> + <string name="root_audio">Audiu</string> +</resources> diff --git a/res/values-ku/strings.xml b/res/values-ku/strings.xml new file mode 100644 index 00000000..cce39b5a --- /dev/null +++ b/res/values-ku/strings.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.com--> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="uid_label">ڕەنگاڵە</string> + <string name="app_label">بیرگەی ڕاگەیانەکان</string> + <string name="upgrade_msg">تازەکردنەوەی داتابەیزی ڕاگەیەنەکان</string> + <string name="artist_label">هونەرمەند</string> + <string name="ringtone_default">زەنگی بنەڕەتی</string> + <string name="notification_sound_default">دەنگی ئاگادارکردنەوەی بنەڕەت</string> + <string name="alarm_sound_default">دەنگی کاژێری بنەڕەتی</string> + <string name="root_images">وێنەکان</string> + <string name="root_videos">ڤیدیۆکان</string> + <string name="root_audio">دەنگ</string> +</resources> diff --git a/res/values-lb/strings.xml b/res/values-lb/strings.xml new file mode 100644 index 00000000..e30ae66a --- /dev/null +++ b/res/values-lb/strings.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.com--> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="uid_label">Medien</string> + <string name="app_label">Mediespäicher</string> + <string name="upgrade_msg">Medien-Datebank gëtt aktualiséiert.</string> + <string name="artist_label">Kënschtler</string> + <string name="ringtone_default">Standard-Schelltoun</string> + <string name="notification_sound_default">Standard-Notifikatiounstoun</string> + <string name="alarm_sound_default">Standard-Weckertoun</string> + <string name="root_images">Biller</string> + <string name="root_videos">Videoen</string> + <string name="root_audio">Audio</string> +</resources> diff --git a/res/values-ug/strings.xml b/res/values-ug/strings.xml new file mode 100644 index 00000000..bddd61ae --- /dev/null +++ b/res/values-ug/strings.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.com--> +<!-- Copyright (C) 2009 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="uid_label">ۋاسىتە</string> + <string name="app_label">ۋاسىتە ساقلىغۇچ</string> + <string name="upgrade_msg">ۋاسىتە ساندانىنى يۈكسەلدۈرۈۋاتىدۇ.</string> + <string name="artist_label">سەنئەتكار</string> + <string name="alarm_sound_default">كۆڭۈلدىكى قوڭغۇراق ئاۋازى</string> + <string name="root_images">سۈرەتلەر</string> +</resources> diff --git a/src/com/android/providers/media/IMtpService.aidl b/src/com/android/providers/media/IMtpService.aidl index e599f7bb..f86c803e 100644 --- a/src/com/android/providers/media/IMtpService.aidl +++ b/src/com/android/providers/media/IMtpService.aidl @@ -20,4 +20,5 @@ interface IMtpService { void sendObjectAdded(int objectHandle); void sendObjectRemoved(int objectHandle); + void sendObjectUpdated(int objectHandle); } diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java index 180fbef0..351e9dd8 100755 --- a/src/com/android/providers/media/MediaProvider.java +++ b/src/com/android/providers/media/MediaProvider.java @@ -2307,7 +2307,7 @@ public class MediaProvider extends ContentProvider { // Used temporarily (until we have unique media IDs) to get an identifier // for the current sd card, so that the music app doesn't have to use the - // non-public getFatVolumeId method + // non-public getVolumeId method if (table == FS_ID) { MatrixCursor c = new MatrixCursor(new String[] {"fsid"}); c.addRow(new Integer[] {mVolumeId}); @@ -2853,6 +2853,19 @@ public class MediaProvider extends ContentProvider { } } + private void sendObjectUpdated(long objectHandle) { + synchronized (mMtpServiceConnection) { + if (mMtpService != null) { + try { + mMtpService.sendObjectUpdated((int)objectHandle); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in sendObjectUpdated", e); + mMtpService = null; + } + } + } + } + @Override public int bulkInsert(Uri uri, ContentValues values[]) { int match = URI_MATCHER.match(uri); @@ -4391,6 +4404,11 @@ public class MediaProvider extends ContentProvider { + count + " match = " + match); } } + if (count > 0) { + helper.mNumQueries++; + notifyMtpUpdated(sGetTableAndWhereParam.table, db, + sGetTableAndWhereParam.where, whereArgs); + } } break; case IMAGES_MEDIA: @@ -4435,6 +4453,11 @@ public class MediaProvider extends ContentProvider { } } } + if (count > 0) { + helper.mNumQueries++; + notifyMtpUpdated(sGetTableAndWhereParam.table, db, + sGetTableAndWhereParam.where, whereArgs); + } } break; @@ -4457,6 +4480,11 @@ public class MediaProvider extends ContentProvider { helper.mNumUpdates++; count = db.update(sGetTableAndWhereParam.table, initialValues, sGetTableAndWhereParam.where, whereArgs); + if (count > 0) { + helper.mNumQueries++; + notifyMtpUpdated(sGetTableAndWhereParam.table, db, + sGetTableAndWhereParam.where, whereArgs); + } break; } } @@ -4468,6 +4496,20 @@ public class MediaProvider extends ContentProvider { return count; } + private void notifyMtpUpdated(String table, SQLiteDatabase db, + String userWhere, String[] whereArgs) { + Cursor c = db.query(table, ID_PROJECTION, userWhere, whereArgs, null, null, null); + if (c != null) { + try { + while (c.moveToNext()) { + sendObjectUpdated(c.getLong(0)); + } + } finally { + c.close(); + } + } + } + private int movePlaylistEntry(DatabaseHelper helper, SQLiteDatabase db, long playlist, int from, int to) { if (from == to) { @@ -4858,6 +4900,9 @@ public class MediaProvider extends ContentProvider { // Extract compressed image data from the audio file itself or, if that fails, // look for a file "AlbumArt.jpg" in the containing directory. private static byte[] getCompressedAlbumArt(Context context, String[] rootPaths, String path) { + if (path == null) + return null; + byte[] compressed = null; try { @@ -5361,11 +5406,11 @@ public class MediaProvider extends ContentProvider { helper = new DatabaseHelper(context, INTERNAL_DATABASE_NAME, true, false, mObjectRemovedCallback); } else if (EXTERNAL_VOLUME.equals(volume)) { - // Only extract FAT volume ID for primary public + // Only extract volume ID for primary public final VolumeInfo vol = mStorageManager.getPrimaryPhysicalVolume(); if (vol != null) { final StorageVolume actualVolume = mStorageManager.getPrimaryVolume(); - final int volumeId = actualVolume.getFatVolumeId(); + final int volumeId = actualVolume.getVolumeId(); // Must check for failure! // If the volume is not (yet) mounted, this will create a new @@ -5378,8 +5423,8 @@ public class MediaProvider extends ContentProvider { Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // This may happen if external storage was _just_ mounted. It may also // happen if the volume ID is _actually_ 0xffffffff, in which case it - // must be changed since FileUtils::getFatVolumeId doesn't allow for - // that. It may also indicate that FileUtils::getFatVolumeId is broken + // must be changed since FileUtils::getVolumeId doesn't allow for + // that. It may also indicate that FileUtils::getVolumeId is broken // (missing ioctl), which is also impossible to disambiguate. Log.e(TAG, "Can't obtain external volume ID even though it's mounted."); } else { @@ -5542,7 +5587,7 @@ public class MediaProvider extends ContentProvider { // name of the volume currently being scanned by the media scanner (or null) private String mMediaScannerVolume; - // current FAT volume ID + // current volume ID private int mVolumeId = -1; static final String INTERNAL_VOLUME = "internal"; diff --git a/src/com/android/providers/media/MtpService.java b/src/com/android/providers/media/MtpService.java index b226f4bf..ca9c8119 100644 --- a/src/com/android/providers/media/MtpService.java +++ b/src/com/android/providers/media/MtpService.java @@ -196,6 +196,14 @@ public class MtpService extends Service { } } } + + public void sendObjectUpdated(int objectHandle) { + synchronized (mBinder) { + if (mServer != null) { + mServer.sendObjectUpdated(objectHandle); + } + } + } }; @Override diff --git a/src/com/android/providers/media/RingtonePickerActivity.java b/src/com/android/providers/media/RingtonePickerActivity.java index 9f17f9f0..c96a647b 100644 --- a/src/com/android/providers/media/RingtonePickerActivity.java +++ b/src/com/android/providers/media/RingtonePickerActivity.java @@ -18,6 +18,9 @@ package com.android.providers.media; import android.content.DialogInterface; import android.content.Intent; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; +import android.content.res.Resources.Theme; import android.database.Cursor; import android.media.AudioAttributes; import android.media.Ringtone; @@ -108,6 +111,9 @@ public final class RingtonePickerActivity extends AlertActivity implements */ private static Ringtone sPlayingRingtone; + // Whether we have tap the "OK" or "Cancel" button. + private boolean mIsHasClick = false; + private DialogInterface.OnClickListener mRingtoneClickListener = new DialogInterface.OnClickListener() { @@ -132,6 +138,21 @@ public final class RingtonePickerActivity extends AlertActivity implements Intent intent = getIntent(); + // Set custom theme + int themeExtra = intent.getIntExtra(RingtoneManager.EXTRA_RINGTONE_DIALOG_THEME, 0); + if (themeExtra != 0) { + try { + Resources resources = getPackageManager().getResourcesForApplication( + getCallingPackage()); + Theme theme = resources.newTheme(); + theme.applyStyle(themeExtra, true); + getTheme().setTo(theme); + + } catch (NameNotFoundException e) { + // Resource not available. Fall-through default theme + } + } + /* * Get whether to show the 'Default' item, and the URI to play when the * default is clicked @@ -259,6 +280,13 @@ public final class RingtonePickerActivity extends AlertActivity implements public void onClick(DialogInterface dialog, int which) { boolean positiveResult = which == DialogInterface.BUTTON_POSITIVE; + // Should't response the "OK" and "Cancel" button's click event at the + // same time. + if (mIsHasClick || (mCursor == null)) { + return; + } + mIsHasClick = true; + // Stop playing the previous ringtone mRingtoneManager.stopPreviousRingtone(); @@ -354,6 +382,12 @@ public final class RingtonePickerActivity extends AlertActivity implements } @Override + protected void onDestroy() { + super.onDestroy(); + mIsHasClick = false; + } + + @Override protected void onPause() { super.onPause(); if (!isChangingConfigurations()) { |