Merge "Use flag to control the restart period value." into sc-v2-dev am: d3e2ea81f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17344416

Change-Id: Iaca5fda743044360512e7742522b1f5e94c4b862
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-03-25 12:34:05 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 1 deletions

View File

@@ -537,6 +537,13 @@ public final class DeviceConfig {
@SystemApi @SystemApi
public static final String NAMESPACE_WINDOW_MANAGER_NATIVE_BOOT = "window_manager_native_boot"; public static final String NAMESPACE_WINDOW_MANAGER_NATIVE_BOOT = "window_manager_native_boot";
/**
* Definitions for voice interaction related functions.
*
* @hide
*/
public static final String NAMESPACE_VOICE_INTERACTION = "voice_interaction";
/** /**
* List of namespaces which can be read without READ_DEVICE_CONFIG permission * List of namespaces which can be read without READ_DEVICE_CONFIG permission
* *

View File

@@ -67,6 +67,7 @@ import android.os.Process;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SharedMemory; import android.os.SharedMemory;
import android.provider.DeviceConfig;
import android.service.voice.HotwordDetectedResult; import android.service.voice.HotwordDetectedResult;
import android.service.voice.HotwordDetectionService; import android.service.voice.HotwordDetectionService;
import android.service.voice.HotwordRejectedResult; import android.service.voice.HotwordRejectedResult;
@@ -109,6 +110,7 @@ final class HotwordDetectionConnection {
private static final String TAG = "HotwordDetectionConnection"; private static final String TAG = "HotwordDetectionConnection";
static final boolean DEBUG = false; static final boolean DEBUG = false;
private static final String KEY_RESTART_PERIOD_IN_SECONDS = "restart_period_in_seconds";
// TODO: These constants need to be refined. // TODO: These constants need to be refined.
private static final long VALIDATION_TIMEOUT_MILLIS = 4000; private static final long VALIDATION_TIMEOUT_MILLIS = 4000;
private static final long MAX_UPDATE_TIMEOUT_MILLIS = 6000; private static final long MAX_UPDATE_TIMEOUT_MILLIS = 6000;
@@ -119,7 +121,9 @@ final class HotwordDetectionConnection {
* Time after which each HotwordDetectionService process is stopped and replaced by a new one. * Time after which each HotwordDetectionService process is stopped and replaced by a new one.
* 0 indicates no restarts. * 0 indicates no restarts.
*/ */
private static final int RESTART_PERIOD_SECONDS = 3600; // 60 minutes private static final int RESTART_PERIOD_SECONDS =
DeviceConfig.getInt(DeviceConfig.NAMESPACE_VOICE_INTERACTION,
KEY_RESTART_PERIOD_IN_SECONDS, 3600); // 60 minutes by default
private static final int MAX_ISOLATED_PROCESS_NUMBER = 10; private static final int MAX_ISOLATED_PROCESS_NUMBER = 10;
// Hotword metrics // Hotword metrics