Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3d14432 authored by Matt Pape's avatar Matt Pape Committed by Android (Google) Code Review
Browse files

Merge "Remove interface for AttentionManagerService."

parents 64e8dd21 aea28318
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -5858,6 +5858,7 @@ package android.provider {
    method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable 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";
@@ -5874,12 +5875,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);
  }
+8 −16
Original line number Diff line number Diff line
@@ -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.
@@ -249,22 +257,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.
     *
+11 −5
Original line number Diff line number Diff line
@@ -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);