summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robin Lee <rgl@google.com> 2018-11-13 18:48:19 +0100
committer Robin Lee <rgl@google.com> 2019-01-15 08:53:48 +0000
commitba3af56aaae2d920d4e1593b0c71f7f55fd47061 (patch)
treeb2eaea6de9600ecf193e7011be2c43e5f7611899
parentba058349314a2aa035dfd9799301fa082358da08 (diff)
Let low-ram devices override voice recognisers on
The top-level framework overlay already says this should (by default) be skipped if the device is low-ram (leaving the device able to turn it back on again without committing to a specific voice recognizer at build time): <feature name="android.software.voice_recognizers" notLowRam="true" /> The form factor-specific overlay for tablets does override this back to a state where the feature is always enabled regardless of low-ram: <feature name="android.software.voice_recognizers" /> But this is probably a mistake as the code before this change ignored the feature flag anyway in case of a low-ram device, using a hardcoded check. Lets Android TVs have voice recognisers working on all devices by default without needing to set katniss' package as a force override. Bug: 117630721 Test: flashall ; adb logcat | grep VoiceInteractionService Change-Id: I7816bebbc363ae0751b097fe1b6cdc2a646b20e0
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index bbf3d45d7c99..613c4ffceffc 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -371,14 +371,15 @@ public class VoiceInteractionManagerService extends SystemService {
}
private boolean shouldEnableService(Context context) {
- // VoiceInteractionService should not be enabled on any low RAM devices
- // or devices that have not declared the recognition feature, unless the
- // device's configuration has explicitly set the config flag for a fixed
+ // VoiceInteractionService should not be enabled on devices that have not declared the
+ // recognition feature (including low-ram devices where notLowRam="true" takes effect),
+ // unless the device's configuration has explicitly set the config flag for a fixed
// voice interaction service.
- return (!ActivityManager.isLowRamDeviceStatic()
- && context.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_VOICE_RECOGNIZERS)) ||
- getForceVoiceInteractionServicePackage(context.getResources()) != null;
+ if (getForceVoiceInteractionServicePackage(context.getResources()) != null) {
+ return true;
+ }
+ return context.getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS);
}
private String getForceVoiceInteractionServicePackage(Resources res) {