summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2017-08-31 18:31:24 +0000
committer android-build-merger <android-build-merger@google.com> 2017-08-31 18:31:24 +0000
commit477c36481912734f497ce41d53bdac50a2d6a714 (patch)
tree7d9355ac3147535eddb8951271b712fdc8a1b464
parentd509c56d4520e9d6749f53e7d44abccfb05634c6 (diff)
parent7bba64935214555f51adce48020827d0ad09ada9 (diff)
Merge "Fix issue #65055576: VoiceInteractionManagerService sets..." into oc-mr1-dev am: 9d484f015f
am: 7bba649352 Change-Id: I8c97bc1d29dcff6c2a4cafe0ff649d725b1f2266
-rw-r--r--services/java/com/android/server/SystemServer.java12
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java15
2 files changed, 17 insertions, 10 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 1620df11f86f..57271fa10950 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1331,11 +1331,13 @@ public final class SystemServer {
traceEnd();
}
- if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS)) {
- traceBeginAndSlog("StartVoiceRecognitionManager");
- mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS);
- traceEnd();
- }
+ // We need to always start this service, regardless of whether the
+ // FEATURE_VOICE_RECOGNIZERS feature is set, because it needs to take care
+ // of initializing various settings. It will internally modify its behavior
+ // based on that feature.
+ traceBeginAndSlog("StartVoiceRecognitionManager");
+ mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS);
+ traceEnd();
if (GestureLauncherService.isGestureLauncherEnabled(context.getResources())) {
traceBeginAndSlog("StartGestureLauncher");
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 4ffacfd7056a..1569ac32128b 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -183,7 +183,7 @@ public class VoiceInteractionManagerService extends SystemService {
private final boolean mEnableService;
VoiceInteractionManagerServiceStub() {
- mEnableService = shouldEnableService(mContext.getResources());
+ mEnableService = shouldEnableService(mContext);
}
// TODO: VI Make sure the caller is the current user or profile
@@ -348,10 +348,15 @@ public class VoiceInteractionManagerService extends SystemService {
}
}
- private boolean shouldEnableService(Resources res) {
- // VoiceInteractionService should not be enabled on low ram devices unless it has the config flag.
- return !ActivityManager.isLowRamDeviceStatic() ||
- getForceVoiceInteractionServicePackage(res) != null;
+ 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
+ // voice interaction service.
+ return (!ActivityManager.isLowRamDeviceStatic()
+ && context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_VOICE_RECOGNIZERS)) ||
+ getForceVoiceInteractionServicePackage(context.getResources()) != null;
}
private String getForceVoiceInteractionServicePackage(Resources res) {