Fixed
Status Update
Comments
be...@gmail.com <be...@gmail.com> #2
Android 5.0, 5.1: it shows context menu at top of screen, not as popup. See screenshots.
Android framework doesn't support floating toolbar before 23. So this is intended behavior.
The crash information suggests that this is an error from Snapshot. chuckj@ can you please take a look? I don't know what exactly caused the readError
in Snapshot, any suggestions? Thanks a lot!
vi...@google.com <vi...@google.com> #3
This looks like another instance of 193006595 which I am looking at now.
be...@gmail.com <be...@gmail.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit beeb84e7be604088ad40e080a8d0adb1bacbf695
Author: Chuck Jazdzewski <chuckj@google.com>
Date: Thu Jul 08 10:04:28 2021
Remove updating the transparent snapshot
A transparent snapshot is create for the block exeucted by
`Snapshot.observe()` which registers read and write observers
but without creating a snapshot. The code to advance the
global snapshot, however, created a new transparent snapshot in
an attempt to update it to the new global snapshot it just
created. This is not necessary, however, as the transparent
snapshot will retrieve the current global snapshot from
`currentGlobalSnapshot` instead of `previousSnapshot` if
`previousSnapshot` is `null`. With the previous code, if the
global snapshot is advanced by applying a new snapshot the
"updated" transparent snapshot will be left referring to an
older snapshot instead of the most recent global snapshot.
Any snapshot object created in the newly applied snapshot
will throw an exception when it is accessed, as reported in
the bugs. The solution is to remove the apparent vetiagal code.
Test: ./gradlew :compose:r:r:tDUT
Fixes: b/193006595 , b/192570897
Change-Id: I2c0d0b8f57bf70e5a98ea36ed141d97142a5e53e
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/Snapshot.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotTests.kt
https://android-review.googlesource.com/1760301
Branch: androidx-main
commit beeb84e7be604088ad40e080a8d0adb1bacbf695
Author: Chuck Jazdzewski <chuckj@google.com>
Date: Thu Jul 08 10:04:28 2021
Remove updating the transparent snapshot
A transparent snapshot is create for the block exeucted by
`Snapshot.observe()` which registers read and write observers
but without creating a snapshot. The code to advance the
global snapshot, however, created a new transparent snapshot in
an attempt to update it to the new global snapshot it just
created. This is not necessary, however, as the transparent
snapshot will retrieve the current global snapshot from
`currentGlobalSnapshot` instead of `previousSnapshot` if
`previousSnapshot` is `null`. With the previous code, if the
global snapshot is advanced by applying a new snapshot the
"updated" transparent snapshot will be left referring to an
older snapshot instead of the most recent global snapshot.
Any snapshot object created in the newly applied snapshot
will throw an exception when it is accessed, as reported in
the bugs. The solution is to remove the apparent vetiagal code.
Test: ./gradlew :compose:r:r:tDUT
Fixes:
Change-Id: I2c0d0b8f57bf70e5a98ea36ed141d97142a5e53e
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/Snapshot.kt
M compose/runtime/runtime/src/test/kotlin/androidx/compose/runtime/snapshots/SnapshotTests.kt
vi...@google.com <vi...@google.com> #5
Thank you for reporting this issue. We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
vi...@google.com <vi...@google.com> #6
The development team has fixed the issue that you have reported and it will be available in a future build.
sh...@gmail.com <sh...@gmail.com> #7
Hey, I tried it today on Android 10 device and onError(utteranceId: String?, errorCode: Int)
is still not getting called. Just onError(utteranceId: String?)
gets called. Can you please confirm it the fix has been released yet?
se...@gmail.com <se...@gmail.com> #8
This is still an issue over 1.5 years after it was reported "fixed". Is this future build ever going to be released?
se...@gmail.com <se...@gmail.com> #9
For those wondering, it looks like this fix was released in API 31:
@Override
public void onError(String utteranceId, int errorCode) {
UtteranceProgressListener listener = mUtteranceProgressListener;
if (listener != null) {
listener.onError(utteranceId, errorCode);
}
}
Description
abstract void onError(String utteranceId) -> This method was deprecated in API level 21. Use onError(java.lang.String, int) instead
void onError(String utteranceId, int errorCode) -> Called when an error has occurred during processing. (Added in API 21)
However, after rigorous testing I have found out that the one added in API 21 is never being called when an error occurs, only the deprecated onError function is being called. Other developers have observed the same behavior [2], [3].
I have tried to track the behavior back to android.speech.tts.TextToSpeech and I think it is explainable that the added function is never being called, see line 2140 in android.speech.tts.TextToSpeech [4].
[1]
[2]
[3]
[4]
Android version tested: Various devices ranging from API 21 to API 28, all with minSdkVersion 21 and targetSdkVersion 28
To easier test all of this, below is code that has to be pasted into any Activity and can then be experienced:
```
package com.test.mytexttospeech
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import android.util.Log
import java.util.*
class UtteranceProgressListenerActivity : AppCompatActivity() {
var textToSpeech: TextToSpeech? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
speakUtterances()
}
/**
* Initialize TextToSpeech and speak all utterances upon successful initialization
*/
fun speakUtterances() {
textToSpeech = TextToSpeech(this,
TextToSpeech.OnInitListener { status ->
if (status == TextToSpeech.SUCCESS) {
textToSpeech?.setOnUtteranceProgressListener(utteranceProgressListener)
listOfUtterances.forEach { utterance ->
textToSpeech?.language = utterance.locale
textToSpeech?.speak(utterance.text, TextToSpeech.QUEUE_ADD, null, utterance.text)
}
} else {
Log.d("OnInitL.", "--- init Error: $status")
}
},
"com.google.android.tts")
}
/**
* UtteranceProgressListener for our TextToSpeech
*/
val utteranceProgressListener = object : UtteranceProgressListener() {
override fun onStart(utteranceId: String?) {
Log.d("UtteranceP.L.", "--- onStart($utteranceId)")
}
override fun onDone(utteranceId: String?) {
Log.d("UtteranceP.L.", "--- onDone($utteranceId)")
}
override fun onError(utteranceId: String?) { // <-- THIS IS CALLED WHEN AN ERROR OCCURS!
Log.d("UtteranceP.L.", "--- onError($utteranceId)")
}
override fun onError(utteranceId: String?, errorCode: Int) { // <-- THIS IS NEVER CALLED WHEN AN ERROR OCCURS!
Log.d("UtteranceP.L.", "--- onError($utteranceId, $errorCode)")
super.onError(utteranceId, errorCode)
}
}
/**
* Helper Class
*/
data class Utterance(val text: String, val locale: Locale)
/**
* List of Utterances
*/
val listOfUtterances = listOf(
Utterance("Today is a nice day!", Locale.ENGLISH),
Utterance("Today is a nice day in India!", Locale("en", "IN")),
Utterance("Today is a nice day in Australia!", Locale("en", "AU")),
Utterance("Today is a nice day in Great Britain!", Locale("en", "GB")),
Utterance("Heute ist ein schöner Tag!", Locale.GERMAN),
Utterance("Aujourd'hui est une belle journée en france!", Locale("fr", "FR")),
Utterance("Aujourd'hui est une belle journée au canada!", Locale("fr", "CA")),
Utterance("今天是美好的一天!", Locale.SIMPLIFIED_CHINESE),
Utterance("اليوم يوم جميل", Locale("ar")), // This is not supported at all, so an error is thrown
Utterance("Sot është një ditë e bukur!", Locale("sq")),
Utterance("Danas je lijep dan u crotiau!", Locale("hr")),
Utterance("Сегодня хороший день!", Locale("ru", "RU"))
)
}
```