perf(android): R8, bitmap downscaling, edge-to-edge; recover device compat; publish to production
Device compatibility (regression fix): - The CAMERA permission (from zxing_barcode_scanner / image_picker) implicitly required android.hardware.camera, excluding camera-less devices — Play showed Automotive -96%, Chromebook -86%, TV -25%. Declare camera & location uses-feature required="false" to keep those devices supported. - Detect a real camera at runtime (PackageManager.FEATURE_CAMERA_ANY via the existing MethodChannel), cache it at bootstrap, and hide the QR scan button and the camera photo-source option when absent, so no broken actions are offered. Play "app optimization" recommendations: - Enable R8 (isMinifyEnabled + isShrinkResources) with keep rules for the OCR (tesseract4android), SQLCipher and notifications JNI/reflection code. - Bitmap downscaling: cacheWidth/cacheHeight (and ResizeImage for avatars) on list thumbnails and avatars so photos decode to on-screen size, not full res. - Edge-to-edge: opt in with transparent system bars in main(). Release flow: - Tagged builds now publish to the production track at 100% (was internal); add a manual deploy_internal lane as a QA safety net. - Document country/region availability as a Play Console setting (not in-repo).
This commit is contained in:
parent
f17ae7751c
commit
071be44851
17 changed files with 232 additions and 21 deletions
|
|
@ -73,6 +73,17 @@ android {
|
|||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
// R8: shrink + optimize + obfuscate the Java/Kotlin bytecode and strip
|
||||
// unused resources — Play's "app optimization" recommendation (smaller
|
||||
// download, less memory). Native .so libs are untouched, so this does
|
||||
// not change device/ABI compatibility. Keep rules for reflection/JNI
|
||||
// heavy deps (OCR, SQLCipher, notifications) live in proguard-rules.pro.
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
apps/app_seeds/android/app/proguard-rules.pro
vendored
Normal file
40
apps/app_seeds/android/app/proguard-rules.pro
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# R8/ProGuard keep rules for Tane (org.comunes.tane).
|
||||
#
|
||||
# R8 is enabled for release builds (see build.gradle.kts). It shrinks/optimizes
|
||||
# the Java/Kotlin bytecode and can break code reached only via reflection or JNI
|
||||
# — the native plugins below load their Java classes from C, so R8 can't see the
|
||||
# references and would strip/rename them. Keep them explicitly. Start
|
||||
# conservative; trim only after a release smoke test proves a class is unused.
|
||||
|
||||
# --- Flutter engine & embedding (defensive; usually handled by the plugin) ---
|
||||
-keep class io.flutter.** { *; }
|
||||
-keep class io.flutter.plugins.** { *; }
|
||||
-dontwarn io.flutter.embedding.**
|
||||
|
||||
# --- On-device OCR: tesseract4android (JNI) ---
|
||||
# libtesseract/libleptonica call back into these Java classes by name.
|
||||
-keep class com.googlecode.tesseract.android.** { *; }
|
||||
-keep class com.googlecode.leptonica.android.** { *; }
|
||||
-keep class io.paratoner.flutter_tesseract_ocr.** { *; }
|
||||
|
||||
# --- QR scanning: zxing_barcode_scanner (pure ZXing, platform view) ---
|
||||
-keep class com.shirisharyal.zxing_barcode_scanner.** { *; }
|
||||
|
||||
# --- Encrypted DB: SQLCipher / sqlite3 native loader ---
|
||||
# sqlite3 is reached over FFI (dlopen), but keep the loader plugin classes.
|
||||
-keep class eu.simonbinder.sqlite3_flutter_libs.** { *; }
|
||||
-keep class net.zetetic.** { *; }
|
||||
-dontwarn net.zetetic.**
|
||||
|
||||
# --- Local notifications ---
|
||||
# Published keep rules for flutter_local_notifications' Gson-serialized models.
|
||||
-keep class com.dexterous.** { *; }
|
||||
-keep class com.google.gson.** { *; }
|
||||
-keep class * extends com.google.gson.TypeAdapter
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-dontwarn com.google.errorprone.annotations.**
|
||||
|
||||
# --- Core library desugaring ---
|
||||
-dontwarn java.lang.invoke.**
|
||||
-dontwarn build.IgnoreJava8API
|
||||
|
|
@ -5,6 +5,19 @@
|
|||
<!-- Foreground local notifications for incoming private messages (Android 13+
|
||||
asks the user at runtime). -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<!-- The CAMERA permission (pulled in by zxing_barcode_scanner for QR scanning
|
||||
and used by image_picker) makes Android implicitly require the camera
|
||||
hardware features, which would exclude camera-less devices — Chromebooks,
|
||||
Android Automotive, many TVs — from Play. The app degrades gracefully
|
||||
without a camera (gallery import still works; the scan button hides), so
|
||||
declare these optional to keep those devices supported. Same for the
|
||||
location features implied by ACCESS_COARSE_LOCATION. -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.any" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.location" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.location.network" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
<application
|
||||
android:label="Tane"
|
||||
android:name="${applicationName}"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class MainActivity : FlutterActivity() {
|
|||
.setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"getCoarseLatLon" -> getCoarseLatLon(result)
|
||||
"hasCamera" -> result.success(hasCameraHardware())
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
|
@ -72,6 +73,15 @@ class MainActivity : FlutterActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this device has any camera. Camera-less devices (Chromebooks,
|
||||
* Android Automotive, many TVs) are supported — see AndroidManifest's
|
||||
* uses-feature required="false" — so the QR scan and camera-capture UI
|
||||
* hide themselves when this is false instead of offering broken actions.
|
||||
*/
|
||||
private fun hasCameraHardware(): Boolean =
|
||||
packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)
|
||||
|
||||
private fun hasLocationPermission(): Boolean =
|
||||
ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue