android 12 support

This commit is contained in:
Thibault Deckers 2021-08-16 09:46:57 +09:00
parent 8669f34bad
commit 8d1352d3df
9 changed files with 42 additions and 10 deletions

View file

@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
### Added ### Added
- Map & Stats from selection - Map & Stats from selection
- support Android 12/S (API 31)
## [v1.4.8] - 2021-08-08 ## [v1.4.8] - 2021-08-08
### Added ### Added

View file

@ -21,7 +21,7 @@ Aves is a gallery and metadata explorer app. It is built for Android, with Flutt
- search and filter by country, place, XMP tag, type (animated, raster, vector…) - search and filter by country, place, XMP tag, type (animated, raster, vector…)
- favorites - favorites
- statistics - statistics
- support Android API 20 ~ 30 (Lollipop ~ R) - support Android API 20 ~ 31 (Lollipop ~ S)
- Android integration (app shortcuts, handle view/pick intents) - Android integration (app shortcuts, handle view/pick intents)
## Project Setup ## Project Setup

View file

@ -43,7 +43,7 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 30 compileSdkVersion 31
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
@ -60,7 +60,7 @@ android {
// - google_maps_flutter v2.0.5: 20 // - google_maps_flutter v2.0.5: 20
// - Aves native: 19 // - Aves native: 19
minSdkVersion 20 minSdkVersion 20
targetSdkVersion 30 targetSdkVersion 31
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
manifestPlaceholders = [googleApiKey: keystoreProperties['googleApiKey']] manifestPlaceholders = [googleApiKey: keystoreProperties['googleApiKey']]
@ -115,7 +115,7 @@ repositories {
dependencies { dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.exifinterface:exifinterface:1.3.2' implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.caverock:androidsvg-aar:1.4' implementation 'com.caverock:androidsvg-aar:1.4'
implementation 'com.commonsware.cwac:document:0.4.1' implementation 'com.commonsware.cwac:document:0.4.1'

View file

@ -461,6 +461,8 @@ object StorageUtils {
val effectiveUri = getOriginalUri(context, uri) val effectiveUri = getOriginalUri(context, uri)
return try { return try {
MediaMetadataRetriever().apply { MediaMetadataRetriever().apply {
// on Android S preview, setting the data source works but yields an internal IOException
// (`Input file descriptor already original`), whether we provide the original URI or not
setDataSource(context, effectiveUri) setDataSource(context, effectiveUri)
} }
} catch (e: Exception) { } catch (e: Exception) {

View file

@ -8,7 +8,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.0' classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8' classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
} }
} }

View file

@ -238,9 +238,10 @@ class AvesEntry {
bool get canRotateAndFlip => canEdit && canEditExif; bool get canRotateAndFlip => canEdit && canEditExif;
// support for writing EXIF // support for writing EXIF
// as of androidx.exifinterface:exifinterface:1.3.0 // as of androidx.exifinterface:exifinterface:1.3.3
bool get canEditExif { bool get canEditExif {
switch (mimeType.toLowerCase()) { switch (mimeType.toLowerCase()) {
case MimeTypes.dng:
case MimeTypes.jpeg: case MimeTypes.jpeg:
case MimeTypes.png: case MimeTypes.png:
case MimeTypes.webp: case MimeTypes.webp:

View file

@ -123,17 +123,19 @@ class _AvesAppState extends State<AvesApp> {
} }
Future<void> _setup() async { Future<void> _setup() async {
await Firebase.initializeApp().then((app) { await Firebase.initializeApp().then((app) async {
FlutterError.onError = reportService.recordFlutterError; FlutterError.onError = reportService.recordFlutterError;
final now = DateTime.now(); final now = DateTime.now();
reportService.setCustomKeys({ final hasPlayServices = await availability.hasPlayServices;
'locales': window.locales.join(', '), await reportService.setCustomKeys({
'time_zone': '${now.timeZoneName} (${now.timeZoneOffset})',
'build_mode': kReleaseMode 'build_mode': kReleaseMode
? 'release' ? 'release'
: kProfileMode : kProfileMode
? 'profile' ? 'profile'
: 'debug', : 'debug',
'has_play_services': hasPlayServices,
'locales': window.locales.join(', '),
'time_zone': '${now.timeZoneName} (${now.timeZoneOffset})',
}); });
}); });
await settings.init(); await settings.init();

View file

@ -14,6 +14,8 @@ adb.exe shell setprop log.tag.AudioTrack INFO
adb.exe shell setprop log.tag.CompatibilityChangeReporter INFO adb.exe shell setprop log.tag.CompatibilityChangeReporter INFO
adb.exe shell setprop log.tag.Counters WARN adb.exe shell setprop log.tag.Counters WARN
adb.exe shell setprop log.tag.CustomizedTextParser INFO adb.exe shell setprop log.tag.CustomizedTextParser INFO
adb.exe shell setprop log.tag.EGL_emulation INFO
adb.exe shell setprop log.tag.HostConnection INFO
adb.exe shell setprop log.tag.InputMethodManager WARN adb.exe shell setprop log.tag.InputMethodManager WARN
adb.exe shell setprop log.tag.InsetsSourceConsumer INFO adb.exe shell setprop log.tag.InsetsSourceConsumer INFO
adb.exe shell setprop log.tag.InputTransport INFO adb.exe shell setprop log.tag.InputTransport INFO
@ -22,6 +24,7 @@ adb.exe shell setprop log.tag.MediaCodec WARN
adb.exe shell setprop log.tag.MediaMetadataRetriever INFO adb.exe shell setprop log.tag.MediaMetadataRetriever INFO
adb.exe shell setprop log.tag.MediaMetadataRetrieverJNI INFO adb.exe shell setprop log.tag.MediaMetadataRetrieverJNI INFO
adb.exe shell setprop log.tag.NuMediaExtractor INFO adb.exe shell setprop log.tag.NuMediaExtractor INFO
adb.exe shell setprop log.tag.skia INFO
adb.exe shell setprop log.tag.SurfaceControl WARN adb.exe shell setprop log.tag.SurfaceControl WARN
adb.exe shell setprop log.tag.SurfaceUtils INFO adb.exe shell setprop log.tag.SurfaceUtils INFO
adb.exe shell setprop log.tag.SurfaceView WARN adb.exe shell setprop log.tag.SurfaceView WARN

View file

@ -0,0 +1,23 @@
#!/bin/bash
adb shell setprop log.tag.ACodec WARN
adb shell setprop log.tag.AHierarchicalStateMachine ERROR
adb shell setprop log.tag.AudioCapabilities ERROR
adb shell setprop log.tag.AudioTrack INFO
adb shell setprop log.tag.CompatibilityChangeReporter INFO
adb shell setprop log.tag.Counters WARN
adb shell setprop log.tag.CustomizedTextParser INFO
adb shell setprop log.tag.EGL_emulation INFO
adb shell setprop log.tag.HostConnection INFO
adb shell setprop log.tag.InputMethodManager WARN
adb shell setprop log.tag.InsetsSourceConsumer INFO
adb shell setprop log.tag.InputTransport INFO
adb shell setprop log.tag.J4A INFO
adb shell setprop log.tag.MediaCodec WARN
adb shell setprop log.tag.MediaMetadataRetriever INFO
adb shell setprop log.tag.MediaMetadataRetrieverJNI INFO
adb shell setprop log.tag.NuMediaExtractor INFO
adb shell setprop log.tag.skia INFO
adb shell setprop log.tag.SurfaceControl WARN
adb shell setprop log.tag.SurfaceUtils INFO
adb shell setprop log.tag.SurfaceView WARN
adb shell setprop log.tag.VideoCapabilities ERROR