fixes for older devices
This commit is contained in:
parent
1e624aebae
commit
13d10f8b0d
7 changed files with 51 additions and 8 deletions
|
@ -128,10 +128,5 @@ To run the app:
|
||||||
# flutter run -t lib/main_play.dart --flavor play
|
# flutter run -t lib/main_play.dart --flavor play
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the app on API 19 emulators:
|
|
||||||
```
|
|
||||||
# flutter run -t lib/main_play.dart --flavor play --enable-software-rendering
|
|
||||||
```
|
|
||||||
|
|
||||||
[Version badge]: https://img.shields.io/github/v/release/deckerst/aves?include_prereleases&sort=semver
|
[Version badge]: https://img.shields.io/github/v/release/deckerst/aves?include_prereleases&sort=semver
|
||||||
[Build badge]: https://img.shields.io/github/workflow/status/deckerst/aves/Quality%20check
|
[Build badge]: https://img.shields.io/github/workflow/status/deckerst/aves/Quality%20check
|
||||||
|
|
|
@ -190,8 +190,8 @@ dependencies {
|
||||||
// - https://jitpack.io/p/deckerst/mp4parser
|
// - https://jitpack.io/p/deckerst/mp4parser
|
||||||
// - https://jitpack.io/p/deckerst/pixymeta-android
|
// - https://jitpack.io/p/deckerst/pixymeta-android
|
||||||
implementation 'com.github.deckerst:Android-TiffBitmapFactory:876e53870a'
|
implementation 'com.github.deckerst:Android-TiffBitmapFactory:876e53870a'
|
||||||
implementation 'com.github.deckerst.mp4parser:isoparser:6bfa6c23f7'
|
implementation 'com.github.deckerst.mp4parser:isoparser:7b698ab674'
|
||||||
implementation 'com.github.deckerst.mp4parser:muxer:6bfa6c23f7'
|
implementation 'com.github.deckerst.mp4parser:muxer:7b698ab674'
|
||||||
implementation 'com.github.deckerst:pixymeta-android:706bd73d6e'
|
implementation 'com.github.deckerst:pixymeta-android:706bd73d6e'
|
||||||
|
|
||||||
// huawei flavor only
|
// huawei flavor only
|
||||||
|
|
|
@ -172,9 +172,10 @@ This change eventually prevents building the app with Flutter v3.3.3.
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<!-- exported for Android API 19 launcher to access this activity -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".HomeWidgetSettingsActivity"
|
android:name=".HomeWidgetSettingsActivity"
|
||||||
android:exported="false"
|
android:exported="true"
|
||||||
android:theme="@style/NormalTheme">
|
android:theme="@style/NormalTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||||
|
|
|
@ -3,12 +3,17 @@ package deckers.thibault.aves
|
||||||
import android.appwidget.AppWidgetManager
|
import android.appwidget.AppWidgetManager
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import deckers.thibault.aves.utils.FlutterUtils
|
||||||
|
import deckers.thibault.aves.utils.FlutterUtils.enableSoftwareRendering
|
||||||
import io.flutter.plugin.common.MethodChannel
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
|
||||||
class HomeWidgetSettingsActivity : MainActivity() {
|
class HomeWidgetSettingsActivity : MainActivity() {
|
||||||
private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID
|
private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID
|
||||||
|
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
if (FlutterUtils.isSoftwareRenderingRequired()) {
|
||||||
|
intent.enableSoftwareRendering()
|
||||||
|
}
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
// cancel if user does not complete widget setup
|
// cancel if user does not complete widget setup
|
||||||
|
|
|
@ -21,6 +21,8 @@ import deckers.thibault.aves.channel.calls.*
|
||||||
import deckers.thibault.aves.channel.calls.window.ActivityWindowHandler
|
import deckers.thibault.aves.channel.calls.window.ActivityWindowHandler
|
||||||
import deckers.thibault.aves.channel.calls.window.WindowHandler
|
import deckers.thibault.aves.channel.calls.window.WindowHandler
|
||||||
import deckers.thibault.aves.channel.streams.*
|
import deckers.thibault.aves.channel.streams.*
|
||||||
|
import deckers.thibault.aves.utils.FlutterUtils.enableSoftwareRendering
|
||||||
|
import deckers.thibault.aves.utils.FlutterUtils.isSoftwareRenderingRequired
|
||||||
import deckers.thibault.aves.utils.LogUtils
|
import deckers.thibault.aves.utils.LogUtils
|
||||||
import deckers.thibault.aves.utils.getParcelableExtraCompat
|
import deckers.thibault.aves.utils.getParcelableExtraCompat
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
@ -40,6 +42,14 @@ open class MainActivity : FlutterActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
Log.i(LOG_TAG, "onCreate intent=$intent")
|
Log.i(LOG_TAG, "onCreate intent=$intent")
|
||||||
|
|
||||||
|
if (isSoftwareRenderingRequired()) {
|
||||||
|
intent.enableSoftwareRendering()
|
||||||
|
// running the app from Android Studio automatically adds to the intent the `start-paused` flag
|
||||||
|
// so the IDE can connect to the app, but launching on KitKat emulators fails because of a timeout
|
||||||
|
intent.removeExtra("start-paused")
|
||||||
|
}
|
||||||
|
|
||||||
intent.extras?.takeUnless { it.isEmpty }?.let {
|
intent.extras?.takeUnless { it.isEmpty }?.let {
|
||||||
Log.i(LOG_TAG, "onCreate intent extras=$it")
|
Log.i(LOG_TAG, "onCreate intent extras=$it")
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import deckers.thibault.aves.channel.calls.*
|
||||||
import deckers.thibault.aves.channel.calls.window.ActivityWindowHandler
|
import deckers.thibault.aves.channel.calls.window.ActivityWindowHandler
|
||||||
import deckers.thibault.aves.channel.calls.window.WindowHandler
|
import deckers.thibault.aves.channel.calls.window.WindowHandler
|
||||||
import deckers.thibault.aves.channel.streams.ImageByteStreamHandler
|
import deckers.thibault.aves.channel.streams.ImageByteStreamHandler
|
||||||
|
import deckers.thibault.aves.utils.FlutterUtils
|
||||||
|
import deckers.thibault.aves.utils.FlutterUtils.enableSoftwareRendering
|
||||||
import deckers.thibault.aves.utils.LogUtils
|
import deckers.thibault.aves.utils.LogUtils
|
||||||
import deckers.thibault.aves.utils.getParcelableExtraCompat
|
import deckers.thibault.aves.utils.getParcelableExtraCompat
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
@ -24,6 +26,9 @@ class WallpaperActivity : FlutterActivity() {
|
||||||
private lateinit var intentDataMap: MutableMap<String, Any?>
|
private lateinit var intentDataMap: MutableMap<String, Any?>
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
if (FlutterUtils.isSoftwareRenderingRequired()) {
|
||||||
|
intent.enableSoftwareRendering()
|
||||||
|
}
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
Log.i(LOG_TAG, "onCreate intent=$intent")
|
Log.i(LOG_TAG, "onCreate intent=$intent")
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package deckers.thibault.aves.utils
|
package deckers.thibault.aves.utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
@ -63,4 +65,29 @@ object FlutterUtils {
|
||||||
r.run()
|
r.run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Intent.enableSoftwareRendering() {
|
||||||
|
putExtra("enable-software-rendering", true)
|
||||||
|
Log.i(LOG_TAG, "Enable software rendering")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isSoftwareRenderingRequired() = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT && isEmulator
|
||||||
|
|
||||||
|
private val isEmulator: Boolean
|
||||||
|
get() = (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")
|
||||||
|
|| Build.FINGERPRINT.startsWith("generic")
|
||||||
|
|| Build.FINGERPRINT.startsWith("unknown")
|
||||||
|
|| Build.HARDWARE.contains("goldfish")
|
||||||
|
|| Build.HARDWARE.contains("ranchu")
|
||||||
|
|| Build.MODEL.contains("google_sdk")
|
||||||
|
|| Build.MODEL.contains("Emulator")
|
||||||
|
|| Build.MODEL.contains("Android SDK built for x86")
|
||||||
|
|| Build.MANUFACTURER.contains("Genymotion")
|
||||||
|
|| Build.PRODUCT.contains("sdk_google")
|
||||||
|
|| Build.PRODUCT.contains("google_sdk")
|
||||||
|
|| Build.PRODUCT.contains("sdk")
|
||||||
|
|| Build.PRODUCT.contains("sdk_x86")
|
||||||
|
|| Build.PRODUCT.contains("vbox86p")
|
||||||
|
|| Build.PRODUCT.contains("emulator")
|
||||||
|
|| Build.PRODUCT.contains("simulator"))
|
||||||
}
|
}
|
Loading…
Reference in a new issue