Status Update
Comments
vi...@google.com <vi...@google.com>
gg...@google.com <gg...@google.com> #2
Device used -- Device Make, Model, Android OS Version
Which device did you use to reproduce this issue?
Please provide a sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
How frequently does this issue occur? (e.g 100% of the time, 10% of the time)
Steps to reproduce
What steps are needed to reproduce this issue?
What is the expected output?
What is the current output?
If relevant, share Android bug report (to be captured after reproducing the issue)
For steps to capture a bug report, please refer:
Screen record of the issue
Please capture screen record or video of the issue using following steps:
adb shell screenrecord /sdcard/video.mp4
Subsequently use following command to pull the recorded file:
adb pull /sdcard/video.mp4
Attach the file to this issue.
Note: Please avoid uploading directly to the issue using attachments. Please upload to google drive and share the folder to android-bugreport@google.com, then share the link here.
he...@gmail.com <he...@gmail.com> #3
Device used?
Any Android device since Android 6, where the now missing class file was first introduced, but that's irrelevant since it doesn't even compile.
How frequently does this issue occur?
100% of the time when compiling with compileSdkVersion 31
What steps are needed to reproduce this issue?
Try to compile with compileSdkVersion 31
the example already given, i.e. an MyVoiceInteractionService.java
file containing:
import android.service.voice.AlwaysOnHotwordDetector;
import android.service.voice.VoiceInteractionService;
public class MyVoiceInteractionService extends VoiceInteractionService {
private AlwaysOnHotwordDetector hotwordDetector;
}
What is the expected output?
A successfully compiled class
What is the current output?
Compilation failure, since the android.service.voice.AlwaysOnHotwordDetector
class is no longer available, it's been removed by an @SystemApi
.
The bug is even documented here:
gg...@google.com <gg...@google.com> #4
gg...@google.com <gg...@google.com> #5
jo...@gmail.com <jo...@gmail.com> #6
I can say that I used this in my app to activate it whenever the user said "Ok Google" instead of activating Google Assistant. This allowed me to provide a customized voice driven assistant in my own app.
It was fully usable at one point and my app worked on a normal non-rooted device and the app wasn't a system app.
Check out this video example (at this specific time):
he...@gmail.com <he...@gmail.com> #7
Your assumption is wrong. My app has been using it successfully since Android 6, where it was first introduced, if it didn't i wouldn't use it. It may not work on Android 10+, but now i'm forced to remove the feature altogether, even for users for which it still work, just because i can no longer compile my code. This is not the first time public APIs have disappeared by inconsiderate use of @removed
or @SystemApi
:
Please, just replace the @SystemApi
with @Deprecated
so we can compile, as you say, we wont be able to use it on Android 12 anyway since it will fail permission checks. The developers on the Android team seems to lack knowledge of what the @removed
or @SystemApi
annotations actually does, they break existing code by excluding the APIs from the SDK (android.jar), severely worsening the Android "fragmentation" issue.
an...@google.com <an...@google.com>
au...@google.com <au...@google.com> #8
It was a security bug that this API was usable by non-system apps:
I agree that it still should have been @Deprecated instead, but unfortunately once the API was finalized -- before this bug was filed, it became too late to fix that.
an...@webkr.de <an...@webkr.de> #9
Sure, it was a security bug that this API was usable by non-system apps, but this issue is about the class being missing completely.
This means that currently it is not possible to build an app that uses it even though the app will eventually run as a system app.
he...@gmail.com <he...@gmail.com> #10
This is nonsense, changing the @SystemApi annotation to @Deprecated is not unfeasible. The API doesn't have be functional on Android 12, it just has to be present so existing code still compile and work on older Android versions.
Luckily it's easy to work around anyway, by compiling an VoiceInteractionService
"compatibility" project using compileSdkVersion 30
. So this is just another unnecessary fragmentation of the Android API, and glaring evidence of how poorly managed it is.
au...@google.com <au...@google.com> #11
If your app is running as a system app you can compile against the system sdk.
The API for Android 12 cannot be changed now (and couldn't have been even when this bug was filed), that's why this is infeasible.
Working around the compilation issue isn't going to help anyway since the API will no longer work when devices pick up the security patch, even on older Android versions since the security patch was backported. Code using this API should be deleted instead of finding a way to exploit a security bug.
au...@google.com <au...@google.com> #12
I don't have context for why the API was changed in this way in Android 12, but now this can't be fixed.
an...@webkr.de <an...@webkr.de> #13
If your app is running as a system app you can compile against the system sdk.
How can I set that up in Android Studio?
he...@gmail.com <he...@gmail.com> #14
No, my app is not running as a system apps, that was never a requirement. There's no security exploitation here since the feature and API was public for years and used as designed/documented. Google may have found it had a security issue, but instead of fixing that the whole API was removed, that's usually not how bugs are fixed. As said, i have no problem with a feature stops working, but a public API should remain compatible. Google repeatedly proves it has no respect for backward compatibility, but it can't rewrite history.
Looking at the latest source for the
Description
Building a
VoiceInteractionService
project using aandroid.service.voice.AlwaysOnHotwordDetector
fail to compile withcompileSdkVersion 31
, since the class is gone. Example:If we're no longer supposed to use this feature then @Deprecated it and make the API calls fail, but don't make it @SystemApi since that prevents it from being used on earlier Android versions where it's still present.