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

Commit 58bb1949 authored by Lucas Silva's avatar Lucas Silva
Browse files

API to notify controls provider which surface they are shown on

Add new intent extra to ControlsProviderService which will be passed to
the panel activity to notify them which surface their activity is being
displayed on.

Bug: 311743064
Flag: ACONFIG FLAG_HOME_PANEL_DREAM DEVELOPMENT
Test: NA - just adding API
Change-Id: I3bef6699801d5cecff2868c60d7a0b3d0151c1df
parent 04795509
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -40059,6 +40059,9 @@ package android.service.controls {
    method public final boolean onUnbind(@NonNull android.content.Intent);
    method public abstract void performControlAction(@NonNull String, @NonNull android.service.controls.actions.ControlAction, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method public static void requestAddControl(@NonNull android.content.Context, @NonNull android.content.ComponentName, @NonNull android.service.controls.Control);
    field @FlaggedApi("android.service.controls.flags.home_panel_dream") public static final int CONTROLS_SURFACE_ACTIVITY_PANEL = 0; // 0x0
    field @FlaggedApi("android.service.controls.flags.home_panel_dream") public static final int CONTROLS_SURFACE_DREAM = 1; // 0x1
    field @FlaggedApi("android.service.controls.flags.home_panel_dream") public static final String EXTRA_CONTROLS_SURFACE = "android.service.controls.extra.CONTROLS_SURFACE";
    field public static final String EXTRA_LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS = "android.service.controls.extra.LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS";
    field public static final String META_DATA_PANEL_ACTIVITY = "android.service.controls.META_DATA_PANEL_ACTIVITY";
    field public static final String SERVICE_CONTROLS = "android.service.controls.ControlsProviderService";
+39 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
package android.service.controls;

import android.Manifest;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
@@ -33,12 +35,15 @@ import android.os.Message;
import android.os.RemoteException;
import android.service.controls.actions.ControlAction;
import android.service.controls.actions.ControlActionWrapper;
import android.service.controls.flags.Flags;
import android.service.controls.templates.ControlTemplate;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.util.Preconditions;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.concurrent.Flow.Publisher;
import java.util.concurrent.Flow.Subscriber;
@@ -82,6 +87,40 @@ public abstract class ControlsProviderService extends Service {
    public static final String EXTRA_LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS =
            "android.service.controls.extra.LOCKSCREEN_ALLOW_TRIVIAL_CONTROLS";

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({CONTROLS_SURFACE_ACTIVITY_PANEL, CONTROLS_SURFACE_DREAM})
    public @interface ControlsSurface {
    }

    /**
     * Controls are being shown on the device controls activity panel.
     */
    @FlaggedApi(Flags.FLAG_HOME_PANEL_DREAM)
    public static final int CONTROLS_SURFACE_ACTIVITY_PANEL = 0;

    /**
     * Controls are being shown as a dream, while the device is idle.
     */
    @FlaggedApi(Flags.FLAG_HOME_PANEL_DREAM)
    public static final int CONTROLS_SURFACE_DREAM = 1;

    /**
     * Integer extra whose value specifies the surface which controls are being displayed on.
     * <p>
     * The possible values are:
     * <ul>
     * <li>{@link #CONTROLS_SURFACE_ACTIVITY_PANEL}
     * <li>{@link #CONTROLS_SURFACE_DREAM}
     * </ul>
     *
     * This is passed with the intent when the panel specified by {@link #META_DATA_PANEL_ACTIVITY}
     * is launched.
     */
    @FlaggedApi(Flags.FLAG_HOME_PANEL_DREAM)
    public static final String EXTRA_CONTROLS_SURFACE =
            "android.service.controls.extra.CONTROLS_SURFACE";

    /**
     * @hide
     */