Merge "Issue #17551667: Voice interaction service should be disabled..." into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
76919595f4
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.server;
|
package com.android.server;
|
||||||
|
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.content.pm.FeatureInfo;
|
import android.content.pm.FeatureInfo;
|
||||||
import android.os.*;
|
import android.os.*;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
@@ -177,6 +178,8 @@ public class SystemConfig {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean lowRam = ActivityManager.isLowRamDeviceStatic();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
XmlPullParser parser = Xml.newPullParser();
|
XmlPullParser parser = Xml.newPullParser();
|
||||||
parser.setInput(permReader);
|
parser.setInput(permReader);
|
||||||
@@ -276,10 +279,17 @@ public class SystemConfig {
|
|||||||
|
|
||||||
} else if ("feature".equals(name)) {
|
} else if ("feature".equals(name)) {
|
||||||
String fname = parser.getAttributeValue(null, "name");
|
String fname = parser.getAttributeValue(null, "name");
|
||||||
|
boolean allowed;
|
||||||
|
if (!lowRam) {
|
||||||
|
allowed = true;
|
||||||
|
} else {
|
||||||
|
String notLowRam = parser.getAttributeValue(null, "notLowRam");
|
||||||
|
allowed = !"true".equals(notLowRam);
|
||||||
|
}
|
||||||
if (fname == null) {
|
if (fname == null) {
|
||||||
Slog.w(TAG, "<feature> without name at "
|
Slog.w(TAG, "<feature> without name at "
|
||||||
+ parser.getPositionDescription());
|
+ parser.getPositionDescription());
|
||||||
} else {
|
} else if (allowed) {
|
||||||
//Log.i(TAG, "Got feature " + fname);
|
//Log.i(TAG, "Got feature " + fname);
|
||||||
FeatureInfo fi = new FeatureInfo();
|
FeatureInfo fi = new FeatureInfo();
|
||||||
fi.name = fname;
|
fi.name = fname;
|
||||||
|
|||||||
@@ -136,11 +136,14 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
Settings.Secure.VOICE_INTERACTION_SERVICE, userHandle);
|
Settings.Secure.VOICE_INTERACTION_SERVICE, userHandle);
|
||||||
ComponentName curRecognizer = getCurRecognizer(userHandle);
|
ComponentName curRecognizer = getCurRecognizer(userHandle);
|
||||||
VoiceInteractionServiceInfo curInteractorInfo = null;
|
VoiceInteractionServiceInfo curInteractorInfo = null;
|
||||||
if (curInteractorStr == null && curRecognizer != null) {
|
if (curInteractorStr == null && curRecognizer != null
|
||||||
|
&& !ActivityManager.isLowRamDeviceStatic()) {
|
||||||
// If there is no interactor setting, that means we are upgrading
|
// If there is no interactor setting, that means we are upgrading
|
||||||
// from an older platform version. If the current recognizer is not
|
// from an older platform version. If the current recognizer is not
|
||||||
// set or matches the preferred recognizer, then we want to upgrade
|
// set or matches the preferred recognizer, then we want to upgrade
|
||||||
// the user to have the default voice interaction service enabled.
|
// the user to have the default voice interaction service enabled.
|
||||||
|
// Note that we don't do this for low-RAM devices, since we aren't
|
||||||
|
// supporting voice interaction services there.
|
||||||
curInteractorInfo = findAvailInteractor(userHandle, curRecognizer);
|
curInteractorInfo = findAvailInteractor(userHandle, curRecognizer);
|
||||||
if (curInteractorInfo != null) {
|
if (curInteractorInfo != null) {
|
||||||
// Looks good! We'll apply this one. To make it happen, we clear the
|
// Looks good! We'll apply this one. To make it happen, we clear the
|
||||||
@@ -150,6 +153,15 @@ 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 (!TextUtils.isEmpty(curInteractorStr)) {
|
||||||
|
setCurInteractor(null, userHandle);
|
||||||
|
curInteractorStr = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (curRecognizer != null) {
|
if (curRecognizer != null) {
|
||||||
// If we already have at least a recognizer, then we probably want to
|
// If we already have at least a recognizer, then we probably want to
|
||||||
// leave things as they are... unless something has disappeared.
|
// leave things as they are... unless something has disappeared.
|
||||||
@@ -171,10 +183,11 @@ public class VoiceInteractionManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializing settings, look for an interactor first.
|
// Initializing settings, look for an interactor first (but only on non-svelte).
|
||||||
if (curInteractorInfo == null) {
|
if (curInteractorInfo == null && !ActivityManager.isLowRamDeviceStatic()) {
|
||||||
curInteractorInfo = findAvailInteractor(userHandle, null);
|
curInteractorInfo = findAvailInteractor(userHandle, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curInteractorInfo != null) {
|
if (curInteractorInfo != null) {
|
||||||
// Eventually it will be an error to not specify this.
|
// Eventually it will be an error to not specify this.
|
||||||
setCurInteractor(new ComponentName(curInteractorInfo.getServiceInfo().packageName,
|
setCurInteractor(new ComponentName(curInteractorInfo.getServiceInfo().packageName,
|
||||||
|
|||||||
Reference in New Issue
Block a user