From: Dan Albert Date: Wed, 27 Jul 2016 18:42:26 +0000 (+0000) Subject: Merge \"Cleanup warnings in jni.\" X-Git-Tag: android-x86-8.1-r1~17^2~4^2^2~2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2388de31e9;hp=685d1d8acc8e8a8d618daafd086415a634c1bcd6;p=android-x86%2Fpackages-apps-Gallery2.git Merge \"Cleanup warnings in jni.\" am: 685d1d8acc Change-Id: I616f745e67bd1355b9c4933e32fa3b0e97f42c38 --- diff --git a/Android.mk b/Android.mk index 596b86eda..670cc4cc9 100644 --- a/Android.mk +++ b/Android.mk @@ -8,11 +8,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 LOCAL_STATIC_JAVA_LIBRARIES += com.android.gallery3d.common2 LOCAL_STATIC_JAVA_LIBRARIES += xmp_toolkit LOCAL_STATIC_JAVA_LIBRARIES += mp4parser -LOCAL_STATIC_JAVA_LIBRARIES += android-support-v8-renderscript - -LOCAL_RENDERSCRIPT_TARGET_API := 18 -LOCAL_RENDERSCRIPT_COMPATIBILITY := 18 -LOCAL_RENDERSCRIPT_FLAGS := -rs-package-name=android.support.v8.renderscript LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ @@ -29,7 +24,7 @@ LOCAL_OVERRIDES_PACKAGES := Gallery Gallery3D GalleryNew3D LOCAL_SDK_VERSION := current -LOCAL_JNI_SHARED_LIBRARIES := libjni_eglfence libjni_filtershow_filters librsjni libjni_jpegstream +LOCAL_JNI_SHARED_LIBRARIES := libjni_eglfence libjni_filtershow_filters libjni_jpegstream LOCAL_PROGUARD_FLAG_FILES := proguard.flags diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2aea5699c..43a2b3f61 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -7,7 +7,7 @@ - + @@ -137,13 +137,7 @@ - - - - - - - + diff --git a/proguard.flags b/proguard.flags index ae83baa00..c8ba2ffad 100644 --- a/proguard.flags +++ b/proguard.flags @@ -40,8 +40,6 @@ # Disable the warnings of using dynamic method calls in EffectsRecorder -dontnote com.android.camera.EffectsRecorder --keep class android.support.v8.renderscript.** { *; } - # Required for ActionBarSherlock -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } diff --git a/res/values-ar/filtershow_strings.xml b/res/values-ar/filtershow_strings.xml index 416906f5c..f865db38e 100644 --- a/res/values-ar/filtershow_strings.xml +++ b/res/values-ar/filtershow_strings.xml @@ -56,8 +56,8 @@ "4:3" "3:4" "4:6" - "5:7" - "7:5" + "۵:۷" + "۷:۵" "16:9" "لا شيء" diff --git a/res/values-b+sr+Latn/filtershow_strings.xml b/res/values-b+sr+Latn/filtershow_strings.xml new file mode 100644 index 000000000..c6f84eaf1 --- /dev/null +++ b/res/values-b+sr+Latn/filtershow_strings.xml @@ -0,0 +1,156 @@ + + + + + "Uređivač slika" + "Nije moguće učitati sliku!" + "Nije moguće izmeniti original" + + + "Podešavanje pozadine" + "Nije moguće preuzeti sliku. Mreža nije dostupna." + "Originalna" + "Ivice" + "Prilagođeno" + "Opozovi" + "Ponovi" + "Prikaži primenjene efekte" + "Sakrij primenjene efekte" + "Izvezi" + "Štampaj" + "Izvezi jednoslojnu sliku" + "Izvezena slika biće kopija bez istorije." + "Kvalitet" + "Veličina" + "x" + "Podešavanja" + "Postoje nesačuvane izmene ove slike." + "Želite li da sačuvate pre nego što izađete?" + "Sačuvaj i izađi" + "Obrađivanje slike u punoj rezoluciji..." + "Izađi" + "Istorija" + "Ponovo postavi" + + + "Primenjeni efekti" + "Uporedi" + "Primeni" + "Ponovo postavi" + "Razmera" + "1:1" + "4:3" + "3:4" + "4:6" + "5:7" + "7:5" + "16:9" + "Nijedno" + + + "Fiksno" + "Mala planeta" + "Ekspozicija" + "Oštrina" + "Kontrast" + "Živost boja" + "Zasićenje" + "Crno-beli filter" + "Automatska boja" + "Nijansa" + "Senke" + "Isticanja" + "Krive" + "Vinjeta" + "Vinjeta" + "Ekspozicija" + "Zasićenost boja" + "Kontrast" + "Slab. svetlosti" + "Crvene oči" + "Crtanje" + "Ispravljanje" + "Opsecanje" + "Rotiraj" + "Ogledalo" + "Negativ" + "Nijedno" + "Ivice" + "Posterizuj" + "Smanji" + "Gradacija" + "Osvetljenost" + "Kontrast" + "Zasićenost boja" + "Glavno" + "Crvena" + "Žuta" + "Zelena" + "Cijan" + "Plava" + "Magenta" + "Stil" + "novo" + "RGB" + "Crvena" + "Zelena" + "Plava" + "Stil" + "Veličina" + "Nijansa" + "Zasićen. boja" + "Osvetljenost" + "Boja" + "Linije" + "Označivač" + "Prskanje" + "Obriši" + "Debljina" + "Veličina ugla" + "Boja" + "Obriši" + "Izaberi prilagođenu boju" + "Izbor boje" + "Izbor veličine" + "Potvrdi" + "Originalna" + "Rezultat" + "Čuvanje slike" + "Obrađuje se..." + "Sačuvaj aktuelna podešavanja" + "Upravljaj korisničkim podeš." + "Novo unapred određeno podešav." + "Naziv unapred odr. podešavanja" + "Informacije" + "Naziv slike" + "Veličina slike" + "Histogram" + "EXIF podaci" + "Unapred podešeno" + "Verzija" + "Original" + "Aktuelno" + "Model" + "Otvor blende" + "Žižna daljina" + "ISO" + "Udaljenost subjekta" + "Datum snimanja" + "Žižni broj" + "Vreme ekspozicije" + "Autorska prava" + diff --git a/res/values-ca/filtershow_strings.xml b/res/values-ca/filtershow_strings.xml index dfedadc8b..e2fe5dc2e 100644 --- a/res/values-ca/filtershow_strings.xml +++ b/res/values-ca/filtershow_strings.xml @@ -131,16 +131,16 @@ "Resultat" "S\'està desant la imatge" "S\'està processant..." - "Desa config. predet. actual" - "Gestiona config. pred. usuari" - "Configuració predet. nova" - "Nom de la configuració pred." + "Desa valor predefinit" + "Gestiona els valors predefinits de l\'usuari" + "Nou valor predefinit" + "Nom de valors predefinits" "Informació" "Nom de la imatge" "Mida de la imatge" "Histograma" "Dades EXIF" - "Configuració predeterminada" + "Valors predefinits" "Versió" "Original" "Actual" diff --git a/res/values-gu-rIN/filtershow_strings.xml b/res/values-gu-rIN/filtershow_strings.xml index 1348f59cc..95707241a 100644 --- a/res/values-gu-rIN/filtershow_strings.xml +++ b/res/values-gu-rIN/filtershow_strings.xml @@ -126,7 +126,7 @@ "કસ્ટમ રંગ પસંદ કરો" "રંગ પસંદ કરો" "કદ પસંદ કરો" - "ઑકે" + "ઓકે" "મૂળભૂત" "પરિણામ" "ચિત્ર સાચવી રહ્યું છે" diff --git a/res/values-ml-rIN/filtershow_strings.xml b/res/values-ml-rIN/filtershow_strings.xml index 777519afd..10bbd3edd 100644 --- a/res/values-ml-rIN/filtershow_strings.xml +++ b/res/values-ml-rIN/filtershow_strings.xml @@ -152,5 +152,5 @@ "എടുത്ത തീയതി" "F നിർത്തുക" "എക്‌സ്പോഷർ സമയം" - "പകര്‍പ്പവകാശം" + "പകർപ്പവകാശം" diff --git a/res/values-mn-rMN/filtershow_strings.xml b/res/values-mn-rMN/filtershow_strings.xml index 310c63d86..aca5d44d9 100644 --- a/res/values-mn-rMN/filtershow_strings.xml +++ b/res/values-mn-rMN/filtershow_strings.xml @@ -126,7 +126,7 @@ "Өнгө тохируулж сонгох" "Өнгө сонгох" "Хэмжээ сонгох" - "Тийм" + "OK" "Эх хувь" "Үр дүн" "Зургийг хадгалж байна" diff --git a/res/values-my-rMM/filtershow_strings.xml b/res/values-my-rMM/filtershow_strings.xml index e2eb5b316..14c87147d 100644 --- a/res/values-my-rMM/filtershow_strings.xml +++ b/res/values-my-rMM/filtershow_strings.xml @@ -44,13 +44,13 @@ "ကြည်လင်မှုအပြည့်ပုံအား လုပ်ဆောင်နေစဉ်..." "ထွက်ပေါက်" "မှတ်တမ်း" - "ပြန်လည်စတင်စေရန်" + "ပြန်လည်သတ်မှတ်ရန်" "လုပ်ထားသော အထူးပြုလုပ်ချက်များ" "နှိုင်းယှဉ်ရန်" "လုပ်ဆောင်ရန်" - "ပြန်လည်စတင်စေရန်" + "ပြန်လည်သတ်မှတ်ရန်" "အလိုက်သင့်" "၁:၁" "၄:၃" @@ -118,11 +118,11 @@ "စာကြောင်းများ" "မှတ်သားမှု" "Spatter" - "ရှင်းလင်းရန်" + "ဖယ်ရှားရန်" "အထူ" "ထောင့်အရွယ်" "ရောင်စုံ" - "ရှင်းလင်းရန်" + "ဖယ်ရှားရန်" "မိမိစိတ်ကြိုက်အရောင်းရွေးရန်" "အရောင်ရွေးရန်" "အရွယ်အစားရွေးရန်" diff --git a/res/values-ne-rNP/filtershow_strings.xml b/res/values-ne-rNP/filtershow_strings.xml index fc6ef136e..477971b18 100644 --- a/res/values-ne-rNP/filtershow_strings.xml +++ b/res/values-ne-rNP/filtershow_strings.xml @@ -16,13 +16,13 @@ - "फोटो सम्पादक" + "तस्बिर सम्पादक" "तस्बिर लोड गर्न सकेन!" "मूल सम्पादन गर्न सक्दैन" "सेटिङ वालपेपर" - "फोटो डाउनलोड गर्न सकेन। नेटवर्क उपलब्ध छैन।" + "तस्बिर डाउनलोड गर्न सकेन। नेटवर्क उपलब्ध छैन।" "मूल" "किनाराहरू" "अनुकूलन" @@ -126,7 +126,7 @@ "कस्टम रङ्ग छान्नुहोस्" "रङ्ग छान्नुहोस्" "साइज चयन गर्नुहोस्" - "ठिक छ" + "ठीक छ" "मूल" "परिणाम" "चित्र सुरक्षित गर्दै" diff --git a/res/values-pa-rIN/filtershow_strings.xml b/res/values-pa-rIN/filtershow_strings.xml index 0c9604196..bfb205e18 100644 --- a/res/values-pa-rIN/filtershow_strings.xml +++ b/res/values-pa-rIN/filtershow_strings.xml @@ -22,11 +22,11 @@ "ਵਾਲਪੇਪਰ ਸੈਟ ਕਰ ਰਿਹਾ ਹੈ" - "ਫੋਟੋ ਡਾਊਨਲੋਡ ਨਹੀਂ ਕਰ ਸਕਿਆ। ਨੈਟਵਰਕ ਅਣਉਪਲਬਧ।" + "ਫੋਟੋ ਡਾਊਨਲੋਡ ਨਹੀਂ ਕਰ ਸਕਿਆ। ਨੈੱਟਵਰਕ ਅਣਉਪਲਬਧ।" "ਮੂਲ" "ਬੌਰਡਰਸ" "ਕਸਟਮ" - "ਪਹਿਲਾਂ ਵਰਗਾ ਕਰੋ" + "ਅਣਕੀਤਾ ਕਰੋ" "ਰੀਡੂ ਕਰੋ" "ਲਾਗੂ ਕੀਤੇ ਇਫੈਕਟ ਦਿਖਾਓ" "ਲਾਗੂ ਕੀਤੇ ਇਫੈਕਟਸ ਲੁਕਾਓ" @@ -40,17 +40,17 @@ "ਸੈਟਿੰਗਾਂ" "ਇਸ ਚਿੱਤਰ ਵਿੱਚ ਬਿਨਾਂ ਸੁਰੱਖਿਅਤ ਕੀਤੇ ਬਦਲਾਵ ਹਨ।" "ਕੀ ਤੁਸੀਂ ਬਾਹਰ ਜਾਣ ਤੋਂ ਪਹਿਲਾਂ ਸੁਰੱਖਿਅਤ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ?" - "ਸੁਰੱਖਿਅਤ ਕਰੋ ਅਤੇ ਬਾਹਰ ਜਾਓ" - "ਪੂਰੇ ਰਿਜ਼ੋਲੂਸ਼ਨ ਚਿੱਤਰ ਦੀ ਪ੍ਰਕਿਰਿਆ ਕਰ ਰਿਹਾ ਹੈ..." + "ਰੱਖਿਅਤ ਕਰੋ ਅਤੇ ਬਾਹਰ ਜਾਓ" + "ਪੂਰੇ ਰੈਜ਼ੋਲਿਊਸ਼ਨ ਚਿੱਤਰ ਦੀ ਪ੍ਰਕਿਰਿਆ ਕਰ ਰਿਹਾ ਹੈ..." "ਬਾਹਰ ਜਾਓ" "ਇਤਿਹਾਸ" - "ਰੀਸੈਟ ਕਰੋ" + "ਰੀਸੈੱਟ ਕਰੋ" "ਲਾਗੂ ਕੀਤੇ ਇਫੈਕਟ" "ਤੁਲਨਾ ਕਰੋ" "ਲਾਗੂ ਕਰੋ" - "ਰੀਸੈਟ ਕਰੋ" + "ਰੀਸੈੱਟ ਕਰੋ" "ਅਸਪੈਕਟ" "1:1" "4:3" @@ -131,7 +131,7 @@ "ਨਤੀਜਾ" "ਚਿੱਤਰ ਸੁਰੱਖਿਅਤ ਕਰ ਰਿਹਾ ਹੈ" "ਪ੍ਰਕਿਰਿਆ ਕਰ ਰਿਹਾ ਹੈ..." - "ਮੌਜੂਦਾ ਪ੍ਰੀਸੈਟ ਸੁਰੱਖਿਅਤ ਕਰੋ" + "ਮੌਜੂਦਾ ਪ੍ਰੀਸੈਟ ਰੱਖਿਅਤ ਕਰੋ" "ਉਪਭੋਗਤਾ ਪ੍ਰੀਸੈਟਸ ਵਿਵਸਥਿਤ ਕਰੋੇ" "ਨਵਾਂ ਪ੍ਰੀਸੈਟ" "ਨਾਮ ਪ੍ਰੀਸੈਟ ਕਰੋ" @@ -139,7 +139,7 @@ "ਚਿੱਤਰ ਨਾਮ" "ਚਿੱਤਰ ਆਕਾਰ" "ਹਿਸਟੋਗ੍ਰਾਮ" - "EXIF ਡਾਟਾ" + "EXIF ਡੈਟਾ" "ਪ੍ਰੀਸੈਟ" "ਵਰਜਨ" "ਮੂਲ" diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java index 437137416..1fcd3008c 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java @@ -19,7 +19,7 @@ package com.android.gallery3d.filtershow.filters; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import android.widget.Toast; import com.android.gallery3d.filtershow.imageshow.GeometryMathUtils; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java index 5d3856ebc..8482eac32 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java @@ -18,11 +18,11 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script.LaunchOptions; +import android.renderscript.Type; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java index 0a615afd4..4d5a79c04 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java @@ -26,11 +26,11 @@ import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script.LaunchOptions; +import android.renderscript.Type; import android.util.Log; import com.android.gallery3d.R; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java index e94e2a63a..3c54456b6 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.support.v8.renderscript.*; +import android.renderscript.*; import android.util.Log; import android.content.res.Resources; import com.android.gallery3d.R; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java index e0b4cf687..0d0dd3b08 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java @@ -24,11 +24,11 @@ import android.graphics.Rect; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.imageshow.MasterImage; import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script.LaunchOptions; +import android.renderscript.Type; import android.util.Log; public class ImageFilterVignette extends ImageFilterRS { diff --git a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java index c378eb994..a487a5d8d 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java +++ b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java @@ -18,8 +18,8 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; import android.util.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; import com.android.gallery3d.filtershow.imageshow.MasterImage; diff --git a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java index 8ae9a7c7b..2923e3bbb 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java +++ b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java @@ -24,8 +24,8 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; import android.util.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; diff --git a/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java b/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java index ebf83b720..0b84f5203 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java +++ b/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import com.android.gallery3d.app.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java index 4765a5990..9166ee3be 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Rect; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import android.util.JsonReader; import android.util.JsonWriter; import android.util.Log; diff --git a/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java b/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java index d53768c95..ad59e0c44 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java +++ b/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java @@ -18,8 +18,8 @@ package com.android.gallery3d.filtershow.pipeline; import android.content.res.Resources; import android.graphics.Bitmap; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; public interface PipelineInterface { public String getName(); diff --git a/src/com/android/gallery3d/ingest/data/MtpDeviceIndex.java b/src/com/android/gallery3d/ingest/data/MtpDeviceIndex.java index b21ad8355..ebfbc9227 100644 --- a/src/com/android/gallery3d/ingest/data/MtpDeviceIndex.java +++ b/src/com/android/gallery3d/ingest/data/MtpDeviceIndex.java @@ -3,10 +3,15 @@ package com.android.gallery3d.ingest.data; import android.annotation.TargetApi; import android.mtp.MtpConstants; import android.mtp.MtpDevice; +import android.mtp.MtpObjectInfo; import android.os.Build; +import android.webkit.MimeTypeMap; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; +import java.util.Locale; +import java.util.Map; import java.util.Set; /** @@ -84,12 +89,18 @@ public class MtpDeviceIndex { supportedImageFormats.add(MtpConstants.FORMAT_PNG); supportedImageFormats.add(MtpConstants.FORMAT_GIF); supportedImageFormats.add(MtpConstants.FORMAT_BMP); + supportedImageFormats.add(MtpConstants.FORMAT_TIFF); + supportedImageFormats.add(MtpConstants.FORMAT_TIFF_EP); + if (Build.VERSION.SDK_INT >= 24) { + supportedImageFormats.add(MtpConstants.FORMAT_DNG); + } SUPPORTED_IMAGE_FORMATS = Collections.unmodifiableSet(supportedImageFormats); Set supportedVideoFormats = new HashSet(); supportedVideoFormats.add(MtpConstants.FORMAT_3GP_CONTAINER); supportedVideoFormats.add(MtpConstants.FORMAT_AVI); supportedVideoFormats.add(MtpConstants.FORMAT_MP4_CONTAINER); + supportedVideoFormats.add(MtpConstants.FORMAT_MP2); supportedVideoFormats.add(MtpConstants.FORMAT_MPEG); // TODO(georgescu): add FORMAT_MOV once Android Media Scanner supports .mov files SUPPORTED_VIDEO_FORMATS = Collections.unmodifiableSet(supportedVideoFormats); @@ -104,6 +115,8 @@ public class MtpDeviceIndex { private static final MtpDeviceIndex sInstance = new MtpDeviceIndex( MtpDeviceIndexRunnable.getFactory()); + private static final Map sCachedSupportedExtenstions = new HashMap<>(); + public static MtpDeviceIndex getInstance() { return sInstance; } @@ -121,12 +134,41 @@ public class MtpDeviceIndex { } /** - * @param format Media format from {@link MtpConstants} + * @param mtpObjectInfo MTP object info * @return Whether the format is supported by this index. */ - public boolean isFormatSupported(int format) { - return SUPPORTED_IMAGE_FORMATS.contains(format) - || SUPPORTED_VIDEO_FORMATS.contains(format); + public boolean isFormatSupported(MtpObjectInfo mtpObjectInfo) { + // Checks whether the format is supported or not. + final int format = mtpObjectInfo.getFormat(); + if (SUPPORTED_IMAGE_FORMATS.contains(format) + || SUPPORTED_VIDEO_FORMATS.contains(format)) { + return true; + } + + // Checks whether the extension is supported or not. + final String name = mtpObjectInfo.getName(); + if (name == null) { + return false; + } + final int lastDot = name.lastIndexOf('.'); + if (lastDot >= 0) { + final String extension = name.substring(lastDot + 1); + + Boolean result = sCachedSupportedExtenstions.get(extension); + if (result != null) { + return result; + } + final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension( + extension.toLowerCase(Locale.US)); + if (mime != null) { + // This will also accept the newly added mimetypes for images and videos. + result = mime.startsWith("image/") || mime.startsWith("video/"); + sCachedSupportedExtenstions.put(extension, result); + return result; + } + } + + return false; } /** diff --git a/src/com/android/gallery3d/ingest/data/MtpDeviceIndexRunnable.java b/src/com/android/gallery3d/ingest/data/MtpDeviceIndexRunnable.java index 32275898e..fe558157a 100644 --- a/src/com/android/gallery3d/ingest/data/MtpDeviceIndexRunnable.java +++ b/src/com/android/gallery3d/ingest/data/MtpDeviceIndexRunnable.java @@ -171,10 +171,9 @@ public class MtpDeviceIndexRunnable implements Runnable { if (mtpObjectInfo == null) { throw new IndexingException(); } - int format = mtpObjectInfo.getFormat(); - if (format == MtpConstants.FORMAT_ASSOCIATION) { + if (mtpObjectInfo.getFormat() == MtpConstants.FORMAT_ASSOCIATION) { pendingDirectories.add(objectHandle); - } else if (mIndex.isFormatSupported(format)) { + } else if (mIndex.isFormatSupported(mtpObjectInfo)) { numObjects++; addObject(new IngestObjectInfo(mtpObjectInfo), bucketsTemp, numObjects); }