Remove interface for AttentionManagerService.

Per API council feedback, we are making changes to include only the
namespace in the system API defined in DeviceConfig.java. Strings which
define property names should be defined in code local to the feature
instead.

Bug: 126411407
Test: atest FrameworksCoreTests:DeviceConfigTest
Change-Id: Ic24db2f74d6b3b476265dd3e0719965d8c36156c
This commit is contained in:
Matt Pape
2019-03-07 13:51:38 -08:00
parent 2b16489cd0
commit aea28318e4
3 changed files with 20 additions and 27 deletions

View File

@@ -5858,6 +5858,7 @@ package android.provider {
method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(String, String, String, boolean);
field public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager";
field public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT = "activity_manager_native_boot";
field public static final String NAMESPACE_ATTENTION_MANAGER_SERVICE = "attention_manager_service";
field public static final String NAMESPACE_AUTOFILL = "autofill";
field public static final String NAMESPACE_CONNECTIVITY = "connectivity";
field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture";
@@ -5872,12 +5873,6 @@ package android.provider {
field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier";
}
public static interface DeviceConfig.AttentionManagerService {
field public static final String COMPONENT_NAME = "component_name";
field public static final String NAMESPACE = "attention_manager_service";
field public static final String SERVICE_ENABLED = "service_enabled";
}
public static interface DeviceConfig.OnPropertiesChangedListener {
method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties);
}

View File

@@ -77,6 +77,14 @@ public final class DeviceConfig {
public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT =
"activity_manager_native_boot";
/**
* Namespace for AttentionManagerService related features.
*
* @hide
*/
@SystemApi
public static final String NAMESPACE_ATTENTION_MANAGER_SERVICE = "attention_manager_service";
/**
* Namespace for autofill feature that provides suggestions across all apps when
* the user interacts with input fields.
@@ -290,22 +298,6 @@ public final class DeviceConfig {
String RAMPING_RINGER_VIBRATION_DURATION = "ramping_ringer_vibration_duration";
}
/**
* Namespace for {@link AttentionManagerService} related features.
*
* @hide
*/
@SystemApi
public interface AttentionManagerService {
String NAMESPACE = "attention_manager_service";
/** If {@code true}, enables {@link AttentionManagerService} features. */
String SERVICE_ENABLED = "service_enabled";
/** Allows a CTS to inject a fake implementation. */
String COMPONENT_NAME = "component_name";
}
/**
* Namespace for Rollback.
*

View File

@@ -16,9 +16,7 @@
package com.android.server.attention;
import static android.provider.DeviceConfig.AttentionManagerService.COMPONENT_NAME;
import static android.provider.DeviceConfig.AttentionManagerService.NAMESPACE;
import static android.provider.DeviceConfig.AttentionManagerService.SERVICE_ENABLED;
import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE;
import android.Manifest;
import android.annotation.Nullable;
@@ -80,6 +78,12 @@ public class AttentionManagerService extends SystemService {
/** If the check attention called within that period - cached value will be returned. */
private static final long STALE_AFTER_MILLIS = 5_000;
/** DeviceConfig flag name, if {@code true}, enables AttentionManagerService features. */
private static final String SERVICE_ENABLED = "service_enabled";
/** DeviceConfig flag name, allows a CTS to inject a fake implementation. */
private static final String COMPONENT_NAME = "component_name";
private final Context mContext;
private final PowerManager mPowerManager;
private final Object mLock;
@@ -127,7 +131,8 @@ public class AttentionManagerService extends SystemService {
}
private boolean isServiceEnabled() {
return DeviceConfig.getBoolean(NAMESPACE, SERVICE_ENABLED, DEFAULT_SERVICE_ENABLED);
return DeviceConfig.getBoolean(NAMESPACE_ATTENTION_MANAGER_SERVICE, SERVICE_ENABLED,
DEFAULT_SERVICE_ENABLED);
}
/**
@@ -283,7 +288,8 @@ public class AttentionManagerService extends SystemService {
* system.
*/
private static ComponentName resolveAttentionService(Context context) {
final String flag = DeviceConfig.getProperty(NAMESPACE, COMPONENT_NAME);
final String flag = DeviceConfig.getProperty(NAMESPACE_ATTENTION_MANAGER_SERVICE,
COMPONENT_NAME);
final String componentNameString = flag != null ? flag : context.getString(
R.string.config_defaultAttentionService);