Loading api/system-current.txt +8 −2 Original line number Diff line number Diff line Loading @@ -5743,6 +5743,12 @@ package android.provider { field public static final String NAMESPACE = "activity_manager"; } public static interface DeviceConfig.AttentionManagerService { field public static final String NAMESPACE = "attention_manager_service"; field public static final String PROPERTY_COMPONENT_NAME = "component_name"; field public static final String PROPERTY_SERVICE_ENABLED = "service_enabled"; } public static interface DeviceConfig.FsiBoot { field public static final String NAMESPACE = "fsi_boot"; field public static final String OOB_ENABLED = "oob_enabled"; Loading @@ -5751,8 +5757,8 @@ package android.provider { public static interface DeviceConfig.IntelligenceAttention { field public static final String NAMESPACE = "intelligence_attention"; field public static final String PROPERTY_ATTENTION_CHECK_ENABLED = "attention_check_enabled"; field public static final String PROPERTY_ATTENTION_CHECK_SETTINGS = "attention_check_settings"; field public static final String PROPERTY_ATTENTION_ENABLED = "attention_enabled"; field public static final String PROPERTY_ATTENTION_SETTINGS = "attention_settings"; } public static interface DeviceConfig.OnPropertyChangedListener { Loading core/java/android/provider/DeviceConfig.java +22 −8 Original line number Diff line number Diff line Loading @@ -112,14 +112,12 @@ public final class DeviceConfig { @SystemApi public interface IntelligenceAttention { String NAMESPACE = "intelligence_attention"; /** * If {@code true}, enables the attention check. */ String PROPERTY_ATTENTION_CHECK_ENABLED = "attention_check_enabled"; /** * Settings for performing the attention check. */ String PROPERTY_ATTENTION_CHECK_SETTINGS = "attention_check_settings"; /** If {@code true}, enables the attention features. */ String PROPERTY_ATTENTION_ENABLED = "attention_enabled"; /** Settings for the attention features. */ String PROPERTY_ATTENTION_SETTINGS = "attention_settings"; } /** Loading Loading @@ -181,6 +179,22 @@ public final class DeviceConfig { String KEY_MAX_CACHED_PROCESSES = "max_cached_processes"; } /** * Namespace for {@link AttentionManagerService} related features. * * @hide */ @SystemApi public interface AttentionManagerService { String NAMESPACE = "attention_manager_service"; /** If {@code true}, enables {@link AttentionManagerService} features. */ String PROPERTY_SERVICE_ENABLED = "service_enabled"; /** Allows a CTS to inject a fake implementation. */ String PROPERTY_COMPONENT_NAME = "component_name"; } /** * Namespace for storage-related features. * Loading services/core/java/com/android/server/attention/AttentionManagerService.java +18 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package com.android.server.attention; import static android.provider.DeviceConfig.AttentionManagerService.NAMESPACE; import static android.provider.DeviceConfig.AttentionManagerService.PROPERTY_COMPONENT_NAME; import static android.provider.DeviceConfig.AttentionManagerService.PROPERTY_SERVICE_ENABLED; import android.Manifest; import android.annotation.Nullable; import android.annotation.UserIdInt; Loading @@ -40,6 +44,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.provider.DeviceConfig; import android.service.attention.AttentionService; import android.service.attention.AttentionService.AttentionFailureCodes; import android.service.attention.IAttentionCallback; Loading @@ -66,6 +71,9 @@ import java.io.PrintWriter; public class AttentionManagerService extends SystemService { private static final String LOG_TAG = "AttentionManagerService"; /** Default value in absence of {@link DeviceConfig} override. */ private static final boolean DEFAULT_SERVICE_ENABLED = true; /** Service will unbind if connection is not used for that amount of time. */ private static final long CONNECTION_TTL_MILLIS = 60_000; Loading Loading @@ -105,7 +113,7 @@ public class AttentionManagerService extends SystemService { super.onBootPhase(phase); if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { mComponentName = resolveAttentionService(mContext); if (mComponentName != null) { if (isAttentionServiceSupported()) { // If the service is supported we want to keep receiving the screen off events. mContext.registerReceiver(new ScreenStateReceiver(), new IntentFilter(Intent.ACTION_SCREEN_OFF)); Loading @@ -117,7 +125,12 @@ public class AttentionManagerService extends SystemService { * Returns {@code true} if attention service is supported on this device. */ public boolean isAttentionServiceSupported() { return mComponentName != null; return mComponentName != null && isServiceEnabled(); } private boolean isServiceEnabled() { final String enabled = DeviceConfig.getProperty(NAMESPACE, PROPERTY_SERVICE_ENABLED); return enabled == null ? DEFAULT_SERVICE_ENABLED : "true".equals(enabled); } /** Loading Loading @@ -266,8 +279,9 @@ public class AttentionManagerService extends SystemService { * system. */ private static ComponentName resolveAttentionService(Context context) { // TODO(b/111939367): add a flag to turn on/off. final String componentNameString = context.getString( final String flag = DeviceConfig.getProperty(NAMESPACE, PROPERTY_COMPONENT_NAME); final String componentNameString = flag != null ? flag : context.getString( R.string.config_defaultAttentionService); if (TextUtils.isEmpty(componentNameString)) { Loading Loading
api/system-current.txt +8 −2 Original line number Diff line number Diff line Loading @@ -5743,6 +5743,12 @@ package android.provider { field public static final String NAMESPACE = "activity_manager"; } public static interface DeviceConfig.AttentionManagerService { field public static final String NAMESPACE = "attention_manager_service"; field public static final String PROPERTY_COMPONENT_NAME = "component_name"; field public static final String PROPERTY_SERVICE_ENABLED = "service_enabled"; } public static interface DeviceConfig.FsiBoot { field public static final String NAMESPACE = "fsi_boot"; field public static final String OOB_ENABLED = "oob_enabled"; Loading @@ -5751,8 +5757,8 @@ package android.provider { public static interface DeviceConfig.IntelligenceAttention { field public static final String NAMESPACE = "intelligence_attention"; field public static final String PROPERTY_ATTENTION_CHECK_ENABLED = "attention_check_enabled"; field public static final String PROPERTY_ATTENTION_CHECK_SETTINGS = "attention_check_settings"; field public static final String PROPERTY_ATTENTION_ENABLED = "attention_enabled"; field public static final String PROPERTY_ATTENTION_SETTINGS = "attention_settings"; } public static interface DeviceConfig.OnPropertyChangedListener { Loading
core/java/android/provider/DeviceConfig.java +22 −8 Original line number Diff line number Diff line Loading @@ -112,14 +112,12 @@ public final class DeviceConfig { @SystemApi public interface IntelligenceAttention { String NAMESPACE = "intelligence_attention"; /** * If {@code true}, enables the attention check. */ String PROPERTY_ATTENTION_CHECK_ENABLED = "attention_check_enabled"; /** * Settings for performing the attention check. */ String PROPERTY_ATTENTION_CHECK_SETTINGS = "attention_check_settings"; /** If {@code true}, enables the attention features. */ String PROPERTY_ATTENTION_ENABLED = "attention_enabled"; /** Settings for the attention features. */ String PROPERTY_ATTENTION_SETTINGS = "attention_settings"; } /** Loading Loading @@ -181,6 +179,22 @@ public final class DeviceConfig { String KEY_MAX_CACHED_PROCESSES = "max_cached_processes"; } /** * Namespace for {@link AttentionManagerService} related features. * * @hide */ @SystemApi public interface AttentionManagerService { String NAMESPACE = "attention_manager_service"; /** If {@code true}, enables {@link AttentionManagerService} features. */ String PROPERTY_SERVICE_ENABLED = "service_enabled"; /** Allows a CTS to inject a fake implementation. */ String PROPERTY_COMPONENT_NAME = "component_name"; } /** * Namespace for storage-related features. * Loading
services/core/java/com/android/server/attention/AttentionManagerService.java +18 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package com.android.server.attention; import static android.provider.DeviceConfig.AttentionManagerService.NAMESPACE; import static android.provider.DeviceConfig.AttentionManagerService.PROPERTY_COMPONENT_NAME; import static android.provider.DeviceConfig.AttentionManagerService.PROPERTY_SERVICE_ENABLED; import android.Manifest; import android.annotation.Nullable; import android.annotation.UserIdInt; Loading @@ -40,6 +44,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.provider.DeviceConfig; import android.service.attention.AttentionService; import android.service.attention.AttentionService.AttentionFailureCodes; import android.service.attention.IAttentionCallback; Loading @@ -66,6 +71,9 @@ import java.io.PrintWriter; public class AttentionManagerService extends SystemService { private static final String LOG_TAG = "AttentionManagerService"; /** Default value in absence of {@link DeviceConfig} override. */ private static final boolean DEFAULT_SERVICE_ENABLED = true; /** Service will unbind if connection is not used for that amount of time. */ private static final long CONNECTION_TTL_MILLIS = 60_000; Loading Loading @@ -105,7 +113,7 @@ public class AttentionManagerService extends SystemService { super.onBootPhase(phase); if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { mComponentName = resolveAttentionService(mContext); if (mComponentName != null) { if (isAttentionServiceSupported()) { // If the service is supported we want to keep receiving the screen off events. mContext.registerReceiver(new ScreenStateReceiver(), new IntentFilter(Intent.ACTION_SCREEN_OFF)); Loading @@ -117,7 +125,12 @@ public class AttentionManagerService extends SystemService { * Returns {@code true} if attention service is supported on this device. */ public boolean isAttentionServiceSupported() { return mComponentName != null; return mComponentName != null && isServiceEnabled(); } private boolean isServiceEnabled() { final String enabled = DeviceConfig.getProperty(NAMESPACE, PROPERTY_SERVICE_ENABLED); return enabled == null ? DEFAULT_SERVICE_ENABLED : "true".equals(enabled); } /** Loading Loading @@ -266,8 +279,9 @@ public class AttentionManagerService extends SystemService { * system. */ private static ComponentName resolveAttentionService(Context context) { // TODO(b/111939367): add a flag to turn on/off. final String componentNameString = context.getString( final String flag = DeviceConfig.getProperty(NAMESPACE, PROPERTY_COMPONENT_NAME); final String componentNameString = flag != null ? flag : context.getString( R.string.config_defaultAttentionService); if (TextUtils.isEmpty(componentNameString)) { Loading