Merge "Add setting to disable assist data (1/2)" into mnc-dev
This commit is contained in:
@@ -5416,6 +5416,14 @@ public final class Settings {
|
||||
*/
|
||||
public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
|
||||
|
||||
/**
|
||||
* Specifies whether the current app context on scren (assist data) will be sent to the
|
||||
* assist application (active voice interaction service).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
|
||||
|
||||
/**
|
||||
* Names of the packages that the current user has explicitly allowed to
|
||||
* see all of the user's notifications, separated by ':'.
|
||||
|
||||
@@ -208,6 +208,7 @@ public interface MetricsConstants {
|
||||
public static final int APPLICATIONS_USAGE_ACCESS_DETAIL = 183;
|
||||
public static final int APPLICATIONS_HIGH_POWER_APPS = 184;
|
||||
public static final int FUELGAUGE_HIGH_POWER_DETAILS = 185;
|
||||
public static final int APPLICATIONS_MANAGE_ASSIST = 186;
|
||||
|
||||
//aliases
|
||||
public static final int DEVICEINFO_STORAGE = DEVICEINFO_MEMORY;
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.service.voice.IVoiceInteractionSession;
|
||||
import android.service.voice.IVoiceInteractionSessionService;
|
||||
import android.service.voice.VoiceInteractionService;
|
||||
@@ -192,7 +193,8 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
|
||||
mHaveAssistData = false;
|
||||
if ((flags&VoiceInteractionService.START_WITH_ASSIST) != 0) {
|
||||
if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ASSIST_STRUCTURE, mCallingUid,
|
||||
mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED) {
|
||||
mSessionComponentName.getPackageName()) == AppOpsManager.MODE_ALLOWED
|
||||
&& isStructureEnabled()) {
|
||||
try {
|
||||
mAm.requestAssistContextExtras(ActivityManager.ASSIST_CONTEXT_FULL,
|
||||
mAssistReceiver);
|
||||
@@ -457,6 +459,11 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStructureEnabled() {
|
||||
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, mUser) != 0;
|
||||
}
|
||||
|
||||
public void dump(String prefix, PrintWriter pw) {
|
||||
pw.print(prefix); pw.print("mToken="); pw.println(mToken);
|
||||
pw.print(prefix); pw.print("mShown="); pw.println(mShown);
|
||||
|
||||
Reference in New Issue
Block a user