summaryrefslogtreecommitdiffstats
path: root/services/voiceinteraction
diff options
context:
space:
mode:
authorCedric Ho <cedricho@google.com>2015-04-27 13:16:18 -0700
committerCedric Ho <cedricho@google.com>2015-04-27 13:16:18 -0700
commit4e41767977257a2b949f95a7ecb9b7ab4d1cdf10 (patch)
tree53e56211e870c3f0bbb1d03425885603ee00cc27 /services/voiceinteraction
parent580c30a63353f67433da25ef7b90913300e0372f (diff)
parent0af3af0397cb6a92ea140736e84f7484ce029071 (diff)
downloadframeworks_base-4e41767977257a2b949f95a7ecb9b7ab4d1cdf10.zip
frameworks_base-4e41767977257a2b949f95a7ecb9b7ab4d1cdf10.tar.gz
frameworks_base-4e41767977257a2b949f95a7ecb9b7ab4d1cdf10.tar.bz2
resolved conflicts for merge of 0af3af03 to mnc-dev
Change-Id: I38f423be6dcef216cf813aa0f747be38f0ad792f
Diffstat (limited to 'services/voiceinteraction')
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index 7dce83e..81c5e6a 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -28,6 +28,8 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
+import android.content.res.Configuration;
+import android.content.res.Resources;
import android.database.ContentObserver;
import android.hardware.soundtrigger.IRecognitionStatusCallback;
import android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel;
@@ -79,6 +81,7 @@ public class VoiceInteractionManagerService extends SystemService {
mResolver = context.getContentResolver();
mDbHelper = new DatabaseHelper(context);
mSoundTriggerHelper = new SoundTriggerHelper(context);
+ mServiceStub = new VoiceInteractionManagerServiceStub();
}
@Override
@@ -104,8 +107,7 @@ public class VoiceInteractionManagerService extends SystemService {
}
// implementation entry point and binder service
- private final VoiceInteractionManagerServiceStub mServiceStub
- = new VoiceInteractionManagerServiceStub();
+ private final VoiceInteractionManagerServiceStub mServiceStub;
class VoiceInteractionManagerServiceStub extends IVoiceInteractionManagerService.Stub {
@@ -113,6 +115,11 @@ public class VoiceInteractionManagerService extends SystemService {
private boolean mSafeMode;
private int mCurUser;
+ private final boolean mEnableService;
+
+ VoiceInteractionManagerServiceStub() {
+ mEnableService = shouldEnableService(mContext.getResources());
+ }
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
@@ -138,8 +145,7 @@ public class VoiceInteractionManagerService extends SystemService {
VoiceInteractionServiceInfo curInteractorInfo = null;
if (DEBUG) Slog.d(TAG, "curInteractorStr=" + curInteractorStr
+ " curRecognizer=" + curRecognizer);
- if (curInteractorStr == null && curRecognizer != null
- && !ActivityManager.isLowRamDeviceStatic()) {
+ if (curInteractorStr == null && curRecognizer != null && mEnableService) {
// If there is no interactor setting, that means we are upgrading
// from an older platform version. If the current recognizer is not
// set or matches the preferred recognizer, then we want to upgrade
@@ -159,7 +165,7 @@ public class VoiceInteractionManagerService extends SystemService {
// If we are on a svelte device, make sure an interactor is not currently
// enabled; if it is, turn it off.
- if (ActivityManager.isLowRamDeviceStatic() && curInteractorStr != null) {
+ if (!mEnableService && curInteractorStr != null) {
if (!TextUtils.isEmpty(curInteractorStr)) {
if (DEBUG) Slog.d(TAG, "Svelte device; disabling interactor");
setCurInteractor(null, userHandle);
@@ -192,7 +198,7 @@ public class VoiceInteractionManagerService extends SystemService {
}
// Initializing settings, look for an interactor first (but only on non-svelte).
- if (curInteractorInfo == null && !ActivityManager.isLowRamDeviceStatic()) {
+ if (curInteractorInfo == null && mEnableService) {
curInteractorInfo = findAvailInteractor(userHandle, null);
}
@@ -218,6 +224,12 @@ 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()
+ || res.getBoolean(com.android.internal.R.bool.config_forceEnableVoiceInteractionService);
+ }
+
public void systemRunning(boolean safeMode) {
mSafeMode = safeMode;
@@ -740,6 +752,7 @@ public class VoiceInteractionManagerService extends SystemService {
}
synchronized (this) {
pw.println("VOICE INTERACTION MANAGER (dumpsys voiceinteraction)\n");
+ pw.println(" mEnableService: " + mEnableService);
if (mImpl == null) {
pw.println(" (No active implementation)");
return;