Loading api/current.txt +4 −20 Original line number Diff line number Diff line Loading @@ -43552,9 +43552,9 @@ package android.service.controls.actions { public abstract class ControlAction { method public abstract int getActionType(); method @Nullable public String getChallengeValue(); method @NonNull public static android.service.controls.actions.ControlAction getErrorAction(); method @NonNull public String getTemplateId(); method public static final boolean isValidResponse(int); field @NonNull public static final android.service.controls.actions.ControlAction ERROR_ACTION; field public static final int RESPONSE_CHALLENGE_ACK = 3; // 0x3 field public static final int RESPONSE_CHALLENGE_PASSPHRASE = 5; // 0x5 field public static final int RESPONSE_CHALLENGE_PIN = 4; // 0x4 Loading @@ -43566,7 +43566,6 @@ package android.service.controls.actions { field public static final int TYPE_ERROR = -1; // 0xffffffff field public static final int TYPE_FLOAT = 2; // 0x2 field public static final int TYPE_MODE = 4; // 0x4 field public static final int TYPE_MULTI_FLOAT = 3; // 0x3 } public final class FloatAction extends android.service.controls.actions.ControlAction { Loading @@ -43583,13 +43582,6 @@ package android.service.controls.actions { method public int getNewMode(); } public final class MultiFloatAction extends android.service.controls.actions.ControlAction { ctor public MultiFloatAction(@NonNull String, @NonNull float[], @Nullable String); ctor public MultiFloatAction(@NonNull String, @NonNull float[]); method public int getActionType(); method @NonNull public float[] getNewValues(); } } package android.service.controls.templates { Loading @@ -43604,16 +43596,15 @@ package android.service.controls.templates { } public abstract class ControlTemplate { method @NonNull public static android.service.controls.templates.ControlTemplate getErrorTemplate(); method @NonNull public static android.service.controls.templates.ControlTemplate getNoTemplateObject(); method @NonNull public String getTemplateId(); method public abstract int getTemplateType(); field @NonNull public static final android.service.controls.templates.ControlTemplate ERROR_TEMPLATE; field @NonNull public static final android.service.controls.templates.ControlTemplate NO_TEMPLATE; field public static final int TYPE_ERROR = -1; // 0xffffffff field public static final int TYPE_NONE = 0; // 0x0 field public static final int TYPE_NO_TEMPLATE = 0; // 0x0 field public static final int TYPE_RANGE = 2; // 0x2 field public static final int TYPE_STATELESS = 8; // 0x8 field public static final int TYPE_TEMPERATURE = 7; // 0x7 field public static final int TYPE_THUMBNAIL = 3; // 0x3 field public static final int TYPE_TOGGLE = 1; // 0x1 field public static final int TYPE_TOGGLE_RANGE = 6; // 0x6 } Loading Loading @@ -43653,13 +43644,6 @@ package android.service.controls.templates { field public static final int MODE_UNKNOWN = 0; // 0x0 } public final class ThumbnailTemplate extends android.service.controls.templates.ControlTemplate { ctor public ThumbnailTemplate(@NonNull String, @NonNull android.graphics.drawable.Icon, @NonNull CharSequence); method @NonNull public CharSequence getContentDescription(); method public int getTemplateType(); method @NonNull public android.graphics.drawable.Icon getThumbnail(); } public final class ToggleRangeTemplate extends android.service.controls.templates.ControlTemplate { ctor public ToggleRangeTemplate(@NonNull String, @NonNull android.service.controls.templates.ControlButton, @NonNull android.service.controls.templates.RangeTemplate); ctor public ToggleRangeTemplate(@NonNull String, boolean, @NonNull CharSequence, @NonNull android.service.controls.templates.RangeTemplate); core/java/android/service/controls/Control.java +2 −2 Original line number Diff line number Diff line Loading @@ -395,7 +395,7 @@ public final class Control implements Parcelable { * {@link ControlsProviderService#createPublisherForAllAvailable}: * <ul> * <li> Status: {@link Status#STATUS_UNKNOWN} * <li> Control template: {@link ControlTemplate#NO_TEMPLATE} * <li> Control template: {@link ControlTemplate#getNoTemplateObject} * <li> Status text: {@code ""} * </ul> */ Loading Loading @@ -593,7 +593,7 @@ public final class Control implements Parcelable { * <li> Title: {@code ""} * <li> Subtitle: {@code ""} * <li> Status: {@link Status#STATUS_UNKNOWN} * <li> Control template: {@link ControlTemplate#NO_TEMPLATE} * <li> Control template: {@link ControlTemplate#getNoTemplateObject} * <li> Status text: {@code ""} * </ul> */ Loading core/java/android/service/controls/ControlsProviderService.java +2 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,8 @@ public abstract class ControlsProviderService extends Service { private static boolean isStatelessControl(Control control) { return (control.getStatus() == Control.STATUS_UNKNOWN && control.getControlTemplate().getTemplateType() == ControlTemplate.TYPE_NONE && control.getControlTemplate().getTemplateType() == ControlTemplate.TYPE_NO_TEMPLATE && TextUtils.isEmpty(control.getStatusText())); } Loading core/java/android/service/controls/DeviceTypes.java +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,18 @@ import java.lang.annotation.RetentionPolicy; /** * Device types for {@link Control}. * * Each {@link Control} declares a type for the device they represent. This type will be used to * determine icons and colors. * <p> * The type of the device may change on status updates of the {@link Control}. For example, a * device of {@link #TYPE_OUTLET} could be determined by the {@link ControlsProviderService} to be * a {@link #TYPE_COFFEE_MAKER} and change the type for that {@link Control}, therefore possibly * changing icon and color. * <p> * In case the device type is not know by the application but the basic function is, or there is no * provided type, one of the generic types (those starting with {@code TYPE_GENERIC}) can be used. * These will provide an identifiable icon based on the basic function of the device. */ public class DeviceTypes { Loading core/java/android/service/controls/actions/ControlAction.java +34 −22 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; import android.service.controls.Control; import android.service.controls.IControlsActionCallback; import android.service.controls.ControlsProviderService; import android.service.controls.templates.ControlTemplate; import android.util.Log; Loading @@ -34,8 +34,15 @@ import java.lang.annotation.RetentionPolicy; /** * An abstract action indicating a user interaction with a {@link Control}. * * The action may have a value to authenticate the input, when the provider has requested it to * complete the action. * In some cases, an action needs to be validated by the user, using a password, PIN or simple * acknowledgment. For those cases, an optional (nullable) parameter can be passed to send the user * input. This <b>challenge value</b> will be requested from the user and sent as part * of a {@link ControlAction} only if the service has responded to an action with one of: * <ul> * <li> {@link #RESPONSE_CHALLENGE_ACK} * <li> {@link #RESPONSE_CHALLENGE_PIN} * <li> {@link #RESPONSE_CHALLENGE_PASSPHRASE} * </ul> */ public abstract class ControlAction { Loading @@ -53,7 +60,6 @@ public abstract class ControlAction { TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MULTI_FLOAT, TYPE_MODE, TYPE_COMMAND }) Loading @@ -61,6 +67,7 @@ public abstract class ControlAction { /** * Object returned when there is an unparcelling error. * @hide */ public static final @NonNull ControlAction ERROR_ACTION = new ControlAction() { @Override Loading @@ -70,7 +77,7 @@ public abstract class ControlAction { }; /** * The identifier of {@link #ERROR_ACTION} * The identifier of the action returned by {@link #getErrorAction}. */ public static final @ActionType int TYPE_ERROR = -1; Loading @@ -84,11 +91,6 @@ public abstract class ControlAction { */ public static final @ActionType int TYPE_FLOAT = 2; /** * The identifier of {@link MultiFloatAction}. */ public static final @ActionType int TYPE_MULTI_FLOAT = 3; /** * The identifier of {@link ModeAction}. */ Loading Loading @@ -121,28 +123,32 @@ public abstract class ControlAction { public static final @ResponseResult int RESPONSE_UNKNOWN = 0; /** * Response code for {@link IControlsActionCallback#accept} indicating that * the action has been performed. The action may still fail later and the state may not change. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that the action has been * performed. The action may still fail later and the state may not change. */ public static final @ResponseResult int RESPONSE_OK = 1; /** * Response code for {@link IControlsActionCallback#accept} indicating that * the action has failed. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that the action has failed. */ public static final @ResponseResult int RESPONSE_FAIL = 2; /** * Response code for {@link IControlsActionCallback#accept} indicating that * in order for the action to be performed, acknowledgment from the user is required. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that in order for the action * to be performed, acknowledgment from the user is required. */ public static final @ResponseResult int RESPONSE_CHALLENGE_ACK = 3; /** * Response code for {@link IControlsActionCallback#accept} indicating that * in order for the action to be performed, a PIN is required. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that in order for the action * to be performed, a PIN is required. */ public static final @ResponseResult int RESPONSE_CHALLENGE_PIN = 4; /** * Response code for {@link IControlsActionCallback#accept} indicating that * in order for the action to be performed, an alphanumeric passphrase is required. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that in order for the action * to be performed, an alphanumeric passphrase is required. */ public static final @ResponseResult int RESPONSE_CHALLENGE_PASSPHRASE = 5; Loading Loading @@ -228,8 +234,6 @@ public abstract class ControlAction { return new BooleanAction(bundle); case TYPE_FLOAT: return new FloatAction(bundle); case TYPE_MULTI_FLOAT: return new MultiFloatAction(bundle); case TYPE_MODE: return new ModeAction(bundle); case TYPE_COMMAND: Loading @@ -243,4 +247,12 @@ public abstract class ControlAction { return ERROR_ACTION; } } /** * Returns a singleton {@link ControlAction} used for indicating an error in unparceling. */ @NonNull public static ControlAction getErrorAction() { return ERROR_ACTION; } } Loading
api/current.txt +4 −20 Original line number Diff line number Diff line Loading @@ -43552,9 +43552,9 @@ package android.service.controls.actions { public abstract class ControlAction { method public abstract int getActionType(); method @Nullable public String getChallengeValue(); method @NonNull public static android.service.controls.actions.ControlAction getErrorAction(); method @NonNull public String getTemplateId(); method public static final boolean isValidResponse(int); field @NonNull public static final android.service.controls.actions.ControlAction ERROR_ACTION; field public static final int RESPONSE_CHALLENGE_ACK = 3; // 0x3 field public static final int RESPONSE_CHALLENGE_PASSPHRASE = 5; // 0x5 field public static final int RESPONSE_CHALLENGE_PIN = 4; // 0x4 Loading @@ -43566,7 +43566,6 @@ package android.service.controls.actions { field public static final int TYPE_ERROR = -1; // 0xffffffff field public static final int TYPE_FLOAT = 2; // 0x2 field public static final int TYPE_MODE = 4; // 0x4 field public static final int TYPE_MULTI_FLOAT = 3; // 0x3 } public final class FloatAction extends android.service.controls.actions.ControlAction { Loading @@ -43583,13 +43582,6 @@ package android.service.controls.actions { method public int getNewMode(); } public final class MultiFloatAction extends android.service.controls.actions.ControlAction { ctor public MultiFloatAction(@NonNull String, @NonNull float[], @Nullable String); ctor public MultiFloatAction(@NonNull String, @NonNull float[]); method public int getActionType(); method @NonNull public float[] getNewValues(); } } package android.service.controls.templates { Loading @@ -43604,16 +43596,15 @@ package android.service.controls.templates { } public abstract class ControlTemplate { method @NonNull public static android.service.controls.templates.ControlTemplate getErrorTemplate(); method @NonNull public static android.service.controls.templates.ControlTemplate getNoTemplateObject(); method @NonNull public String getTemplateId(); method public abstract int getTemplateType(); field @NonNull public static final android.service.controls.templates.ControlTemplate ERROR_TEMPLATE; field @NonNull public static final android.service.controls.templates.ControlTemplate NO_TEMPLATE; field public static final int TYPE_ERROR = -1; // 0xffffffff field public static final int TYPE_NONE = 0; // 0x0 field public static final int TYPE_NO_TEMPLATE = 0; // 0x0 field public static final int TYPE_RANGE = 2; // 0x2 field public static final int TYPE_STATELESS = 8; // 0x8 field public static final int TYPE_TEMPERATURE = 7; // 0x7 field public static final int TYPE_THUMBNAIL = 3; // 0x3 field public static final int TYPE_TOGGLE = 1; // 0x1 field public static final int TYPE_TOGGLE_RANGE = 6; // 0x6 } Loading Loading @@ -43653,13 +43644,6 @@ package android.service.controls.templates { field public static final int MODE_UNKNOWN = 0; // 0x0 } public final class ThumbnailTemplate extends android.service.controls.templates.ControlTemplate { ctor public ThumbnailTemplate(@NonNull String, @NonNull android.graphics.drawable.Icon, @NonNull CharSequence); method @NonNull public CharSequence getContentDescription(); method public int getTemplateType(); method @NonNull public android.graphics.drawable.Icon getThumbnail(); } public final class ToggleRangeTemplate extends android.service.controls.templates.ControlTemplate { ctor public ToggleRangeTemplate(@NonNull String, @NonNull android.service.controls.templates.ControlButton, @NonNull android.service.controls.templates.RangeTemplate); ctor public ToggleRangeTemplate(@NonNull String, boolean, @NonNull CharSequence, @NonNull android.service.controls.templates.RangeTemplate);
core/java/android/service/controls/Control.java +2 −2 Original line number Diff line number Diff line Loading @@ -395,7 +395,7 @@ public final class Control implements Parcelable { * {@link ControlsProviderService#createPublisherForAllAvailable}: * <ul> * <li> Status: {@link Status#STATUS_UNKNOWN} * <li> Control template: {@link ControlTemplate#NO_TEMPLATE} * <li> Control template: {@link ControlTemplate#getNoTemplateObject} * <li> Status text: {@code ""} * </ul> */ Loading Loading @@ -593,7 +593,7 @@ public final class Control implements Parcelable { * <li> Title: {@code ""} * <li> Subtitle: {@code ""} * <li> Status: {@link Status#STATUS_UNKNOWN} * <li> Control template: {@link ControlTemplate#NO_TEMPLATE} * <li> Control template: {@link ControlTemplate#getNoTemplateObject} * <li> Status text: {@code ""} * </ul> */ Loading
core/java/android/service/controls/ControlsProviderService.java +2 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,8 @@ public abstract class ControlsProviderService extends Service { private static boolean isStatelessControl(Control control) { return (control.getStatus() == Control.STATUS_UNKNOWN && control.getControlTemplate().getTemplateType() == ControlTemplate.TYPE_NONE && control.getControlTemplate().getTemplateType() == ControlTemplate.TYPE_NO_TEMPLATE && TextUtils.isEmpty(control.getStatusText())); } Loading
core/java/android/service/controls/DeviceTypes.java +12 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,18 @@ import java.lang.annotation.RetentionPolicy; /** * Device types for {@link Control}. * * Each {@link Control} declares a type for the device they represent. This type will be used to * determine icons and colors. * <p> * The type of the device may change on status updates of the {@link Control}. For example, a * device of {@link #TYPE_OUTLET} could be determined by the {@link ControlsProviderService} to be * a {@link #TYPE_COFFEE_MAKER} and change the type for that {@link Control}, therefore possibly * changing icon and color. * <p> * In case the device type is not know by the application but the basic function is, or there is no * provided type, one of the generic types (those starting with {@code TYPE_GENERIC}) can be used. * These will provide an identifiable icon based on the basic function of the device. */ public class DeviceTypes { Loading
core/java/android/service/controls/actions/ControlAction.java +34 −22 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; import android.service.controls.Control; import android.service.controls.IControlsActionCallback; import android.service.controls.ControlsProviderService; import android.service.controls.templates.ControlTemplate; import android.util.Log; Loading @@ -34,8 +34,15 @@ import java.lang.annotation.RetentionPolicy; /** * An abstract action indicating a user interaction with a {@link Control}. * * The action may have a value to authenticate the input, when the provider has requested it to * complete the action. * In some cases, an action needs to be validated by the user, using a password, PIN or simple * acknowledgment. For those cases, an optional (nullable) parameter can be passed to send the user * input. This <b>challenge value</b> will be requested from the user and sent as part * of a {@link ControlAction} only if the service has responded to an action with one of: * <ul> * <li> {@link #RESPONSE_CHALLENGE_ACK} * <li> {@link #RESPONSE_CHALLENGE_PIN} * <li> {@link #RESPONSE_CHALLENGE_PASSPHRASE} * </ul> */ public abstract class ControlAction { Loading @@ -53,7 +60,6 @@ public abstract class ControlAction { TYPE_ERROR, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_MULTI_FLOAT, TYPE_MODE, TYPE_COMMAND }) Loading @@ -61,6 +67,7 @@ public abstract class ControlAction { /** * Object returned when there is an unparcelling error. * @hide */ public static final @NonNull ControlAction ERROR_ACTION = new ControlAction() { @Override Loading @@ -70,7 +77,7 @@ public abstract class ControlAction { }; /** * The identifier of {@link #ERROR_ACTION} * The identifier of the action returned by {@link #getErrorAction}. */ public static final @ActionType int TYPE_ERROR = -1; Loading @@ -84,11 +91,6 @@ public abstract class ControlAction { */ public static final @ActionType int TYPE_FLOAT = 2; /** * The identifier of {@link MultiFloatAction}. */ public static final @ActionType int TYPE_MULTI_FLOAT = 3; /** * The identifier of {@link ModeAction}. */ Loading Loading @@ -121,28 +123,32 @@ public abstract class ControlAction { public static final @ResponseResult int RESPONSE_UNKNOWN = 0; /** * Response code for {@link IControlsActionCallback#accept} indicating that * the action has been performed. The action may still fail later and the state may not change. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that the action has been * performed. The action may still fail later and the state may not change. */ public static final @ResponseResult int RESPONSE_OK = 1; /** * Response code for {@link IControlsActionCallback#accept} indicating that * the action has failed. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that the action has failed. */ public static final @ResponseResult int RESPONSE_FAIL = 2; /** * Response code for {@link IControlsActionCallback#accept} indicating that * in order for the action to be performed, acknowledgment from the user is required. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that in order for the action * to be performed, acknowledgment from the user is required. */ public static final @ResponseResult int RESPONSE_CHALLENGE_ACK = 3; /** * Response code for {@link IControlsActionCallback#accept} indicating that * in order for the action to be performed, a PIN is required. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that in order for the action * to be performed, a PIN is required. */ public static final @ResponseResult int RESPONSE_CHALLENGE_PIN = 4; /** * Response code for {@link IControlsActionCallback#accept} indicating that * in order for the action to be performed, an alphanumeric passphrase is required. * Response code for the {@code consumer} in * {@link ControlsProviderService#performControlAction} indicating that in order for the action * to be performed, an alphanumeric passphrase is required. */ public static final @ResponseResult int RESPONSE_CHALLENGE_PASSPHRASE = 5; Loading Loading @@ -228,8 +234,6 @@ public abstract class ControlAction { return new BooleanAction(bundle); case TYPE_FLOAT: return new FloatAction(bundle); case TYPE_MULTI_FLOAT: return new MultiFloatAction(bundle); case TYPE_MODE: return new ModeAction(bundle); case TYPE_COMMAND: Loading @@ -243,4 +247,12 @@ public abstract class ControlAction { return ERROR_ACTION; } } /** * Returns a singleton {@link ControlAction} used for indicating an error in unparceling. */ @NonNull public static ControlAction getErrorAction() { return ERROR_ACTION; } }