public class

SliceAction

extends java.lang.Object

implements SliceAction

 java.lang.Object

↳androidx.slice.builders.SliceAction

Gradle dependencies

compile group: 'androidx.slice', name: 'slice-builders', version: '1.1.0-alpha02'

  • groupId: androidx.slice
  • artifactId: slice-builders
  • version: 1.1.0-alpha02

Artifact androidx.slice:slice-builders:1.1.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.slice:slice-builders com.android.support:slices-builders

Overview

Class representing an action, supports tappable icons, custom toggle icons, and default toggles, as well as date and time pickers.

Summary

Constructors
publicSliceAction(PendingIntent action, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a default toggle.

publicSliceAction(PendingIntent action, java.lang.CharSequence actionTitle, long dateTimeMillis, boolean isDatePicker)

Construct a SliceAction representing a default date or time picker.

publicSliceAction(PendingIntent action, Icon actionIcon, java.lang.CharSequence actionTitle)

publicSliceAction(PendingIntent action, Icon actionIcon, java.lang.CharSequence actionTitle, boolean isChecked)

publicSliceAction(PendingIntent action, IconCompat actionIcon, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon.

publicSliceAction(PendingIntent action, IconCompat actionIcon, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a custom toggle icon.

publicSliceAction(PendingIntent action, IconCompat actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon.

publicSliceAction(PendingIntent action, Icon actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Methods
public SlicebuildSlice(Slice.Builder builder)

public static SliceActioncreate(PendingIntent action, IconCompat actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon.

public static SliceActioncreateDatePicker(PendingIntent action, java.lang.CharSequence actionTitle, long dateTimeMillis)

Construct a SliceAction representing a timestamp connected to a date picker.

public static SliceActioncreateDeeplink(PendingIntent action, IconCompat actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

public static SliceActioncreateTimePicker(PendingIntent action, java.lang.CharSequence actionTitle, long dateTimeMillis)

Construct a SliceAction representing a timestamp connected to a time picker.

public static SliceActioncreateToggle(PendingIntent action, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a default toggle.

public static SliceActioncreateToggle(PendingIntent action, IconCompat actionIcon, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a custom toggle icon.

public PendingIntentgetAction()

public java.lang.CharSequencegetContentDescription()

public IconCompatgetIcon()

public intgetImageMode()

public SliceActionImplgetImpl()

public intgetPriority()

public java.lang.CharSequencegetTitle()

public booleanisActivity()

public booleanisChecked()

public booleanisDefaultToggle()

public booleanisToggle()

public SliceActionsetChecked(boolean isChecked)

public SliceActionsetContentDescription(java.lang.CharSequence description)

public voidsetPrimaryAction(Slice.Builder builder)

public SliceActionsetPriority(int priority)

Sets the priority of this action, with the lowest priority having the highest ranking.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public SliceAction(PendingIntent action, Icon actionIcon, java.lang.CharSequence actionTitle)

public SliceAction(PendingIntent action, Icon actionIcon, int imageMode, java.lang.CharSequence actionTitle)

public SliceAction(PendingIntent action, Icon actionIcon, java.lang.CharSequence actionTitle, boolean isChecked)

public SliceAction(PendingIntent action, IconCompat actionIcon, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon.

Parameters:

action: the pending intent to invoke for this action.
actionIcon: the icon to display for this action.
actionTitle: the title for this action, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).

public SliceAction(PendingIntent action, IconCompat actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon. Use this method to specify the format of the image, ListBuilder.ICON_IMAGE will be presented as a tintable icon. Note that there is no difference between ListBuilder.SMALL_IMAGE and ListBuilder.LARGE_IMAGE for actions; these will just be represented as an non-tintable image.

Parameters:

action: the pending intent to invoke for this action.
actionIcon: the icon to display for this action.
imageMode: the mode this icon should be displayed in.
actionTitle: the title for this action, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public SliceAction(PendingIntent action, IconCompat actionIcon, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a custom toggle icon.

Parameters:

action: the pending intent to invoke for this toggle.
actionIcon: the icon to display for this toggle, should have a checked and unchecked state.
actionTitle: the title for this toggle, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).
isChecked: the state of the toggle.

public SliceAction(PendingIntent action, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a default toggle.

Parameters:

action: the pending intent to invoke for this toggle.
actionTitle: the title for this toggle, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).
isChecked: the state of the toggle.

public SliceAction(PendingIntent action, java.lang.CharSequence actionTitle, long dateTimeMillis, boolean isDatePicker)

Construct a SliceAction representing a default date or time picker.

Parameters:

action: the pending intent to invoke for this date picker.
actionTitle: the timestamp for this date or time picker.
dateTimeMillis: the default state of the date or time picker.
isDatePicker: if it is a date picker, as opposed to a time picker.

Methods

public static SliceAction create(PendingIntent action, IconCompat actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon.

Parameters:

action: the pending intent to invoke for this action.
actionIcon: the icon to display for this action.
imageMode: the mode this icon should be displayed in.
actionTitle: the title for this action, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public static SliceAction createDatePicker(PendingIntent action, java.lang.CharSequence actionTitle, long dateTimeMillis)

Construct a SliceAction representing a timestamp connected to a date picker. Currently only supported in GridRow.

Parameters:

action: the pending intent to invoke for this picker.
actionTitle: the timestamp title for this picker.
dateTimeMillis: the default state of the date picker.

public static SliceAction createTimePicker(PendingIntent action, java.lang.CharSequence actionTitle, long dateTimeMillis)

Construct a SliceAction representing a timestamp connected to a time picker. Currently only supported in GridRow.

Parameters:

action: the pending intent to invoke for this picker.
actionTitle: the timestamp title for this picker.
dateTimeMillis: the default state of the time picker.

public static SliceAction createDeeplink(PendingIntent action, IconCompat actionIcon, int imageMode, java.lang.CharSequence actionTitle)

Construct a SliceAction representing a tappable icon that launches an activity when clicked.

Parameters:

action: the pending intent to invoke for this action.
actionIcon: the icon to display for this action.
imageMode: the mode this icon should be displayed in.
actionTitle: the title for this action, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public static SliceAction createToggle(PendingIntent action, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a default toggle.

Parameters:

action: the pending intent to invoke for this toggle.
actionTitle: the title for this toggle, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).
isChecked: the state of the toggle.

public static SliceAction createToggle(PendingIntent action, IconCompat actionIcon, java.lang.CharSequence actionTitle, boolean isChecked)

Construct a SliceAction representing a custom toggle icon.

Parameters:

action: the pending intent to invoke for this toggle.
actionIcon: the icon to display for this toggle, should have a checked and unchecked state.
actionTitle: the title for this toggle, also used for content description if one hasn't been set via SliceAction.setContentDescription(CharSequence).
isChecked: the state of the toggle.

public SliceAction setContentDescription(java.lang.CharSequence description)

Parameters:

description: the content description for this action.

public SliceAction setChecked(boolean isChecked)

Parameters:

isChecked: whether the state of this action is checked or not; only used for toggle actions.

public SliceAction setPriority(int priority)

Sets the priority of this action, with the lowest priority having the highest ranking.

public PendingIntent getAction()

Returns:

the PendingIntent associated with this action.

public IconCompat getIcon()

Returns:

the to display for this action. This can be null when the action represented is a default toggle.

public java.lang.CharSequence getTitle()

Returns:

the title for this action.

public boolean isActivity()

public java.lang.CharSequence getContentDescription()

Returns:

the content description to use for this action.

public int getPriority()

Returns:

the priority associated with this action, -1 if unset.

public boolean isToggle()

Returns:

whether this action represents a toggle (i.e. has a checked and unchecked state).

public boolean isChecked()

Returns:

whether the state of this action is checked or not; only used for toggle actions.

public int getImageMode()

Returns:

the image mode to use for this action.

public boolean isDefaultToggle()

Returns:

whether this action is a toggle using the standard switch control.

public Slice buildSlice(Slice.Builder builder)

Parameters:

builder: this should be a new builder that has any additional hints the action might need.

Returns:

the slice representation of this action.

public SliceActionImpl getImpl()

public void setPrimaryAction(Slice.Builder builder)

Parameters:

builder: the parent slice builder that contains the primary action.

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.slice.builders;

import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static androidx.slice.builders.ListBuilder.ICON_IMAGE;

import android.app.PendingIntent;
import android.graphics.drawable.Icon;

import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.IconCompat;
import androidx.remotecallback.RemoteCallback;
import androidx.slice.Slice;
import androidx.slice.core.SliceActionImpl;

/**
 * Class representing an action, supports tappable icons, custom toggle icons, and default
 * toggles, as well as date and time pickers.
 */
@RequiresApi(19)
public class SliceAction implements androidx.slice.core.SliceAction {

    private final SliceActionImpl mSliceAction;

    /**
     * @hide
     */
    @RestrictTo(LIBRARY)
    @RequiresApi(23)
    public SliceAction(@NonNull PendingIntent action, @NonNull Icon actionIcon,
            @NonNull CharSequence actionTitle) {
        this(action, actionIcon, ICON_IMAGE, actionTitle);
    }

    /**
     * @hide
     */
    @RestrictTo(LIBRARY)
    @RequiresApi(23)
    public SliceAction(@NonNull PendingIntent action, @NonNull Icon actionIcon,
            @ListBuilder.ImageMode int imageMode, @NonNull CharSequence actionTitle) {
        this(action, IconCompat.createFromIcon(actionIcon), imageMode, actionTitle);
    }

    /**
     * @hide
     */
    @RestrictTo(LIBRARY)
    @RequiresApi(23)
    public SliceAction(@NonNull PendingIntent action, @NonNull Icon actionIcon,
            @NonNull CharSequence actionTitle, boolean isChecked) {
        this(action, IconCompat.createFromIcon(actionIcon), actionTitle, isChecked);
    }

    /**
     * Construct a SliceAction representing a tappable icon.
     *
     * @param action the pending intent to invoke for this action.
     * @param actionIcon the icon to display for this action.
     * @param actionTitle the title for this action, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @hide
     */
    @RestrictTo(LIBRARY)
    public SliceAction(@NonNull PendingIntent action, @NonNull IconCompat actionIcon,
            @NonNull CharSequence actionTitle) {
        this(action, actionIcon, ICON_IMAGE, actionTitle);
    }

    /**
     * Construct a SliceAction representing a tappable icon. Use this method to specify the
     * format of the image, {@link ListBuilder#ICON_IMAGE} will be presented as a tintable icon.
     * Note that there is no difference between {@link ListBuilder#SMALL_IMAGE} and
     * {@link ListBuilder#LARGE_IMAGE} for actions; these will just be represented as an
     * non-tintable image.
     *
     * @param action the pending intent to invoke for this action.
     * @param actionIcon the icon to display for this action.
     * @param imageMode the mode this icon should be displayed in.
     * @param actionTitle the title for this action, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     *
     * @see ListBuilder#ICON_IMAGE
     * @see ListBuilder#SMALL_IMAGE
     * @see ListBuilder#LARGE_IMAGE
     * @hide
     */
    @RestrictTo(LIBRARY_GROUP)
    public SliceAction(@NonNull PendingIntent action, @NonNull IconCompat actionIcon,
            @ListBuilder.ImageMode int imageMode, @NonNull CharSequence actionTitle) {
        mSliceAction = new SliceActionImpl(action, actionIcon, imageMode, actionTitle);
    }

    /**
     * Construct a SliceAction representing a custom toggle icon.
     *
     * @param action the pending intent to invoke for this toggle.
     * @param actionIcon the icon to display for this toggle, should have a checked and unchecked
     *                   state.
     * @param actionTitle the title for this toggle, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @param isChecked the state of the toggle.
     * @hide
     */
    @RestrictTo(LIBRARY_GROUP)
    public SliceAction(@NonNull PendingIntent action, @NonNull IconCompat actionIcon,
            @NonNull CharSequence actionTitle, boolean isChecked) {
        mSliceAction = new SliceActionImpl(action, actionIcon, actionTitle, isChecked);
    }

    /**
     * Construct a SliceAction representing a default toggle.
     *
     * @param action the pending intent to invoke for this toggle.
     * @param actionTitle the title for this toggle, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @param isChecked the state of the toggle.
     * @hide
     */
    @RestrictTo(LIBRARY_GROUP)
    public SliceAction(@NonNull PendingIntent action, @NonNull CharSequence actionTitle,
            boolean isChecked) {
        mSliceAction = new SliceActionImpl(action, actionTitle, isChecked);
    }

    /**
     * Construct a SliceAction representing a default date or time picker.
     *
     * @param action         the pending intent to invoke for this date picker.
     * @param actionTitle    the timestamp for this date or time picker.
     * @param dateTimeMillis the default state of the date or time picker.
     * @param isDatePicker   if it is a date picker, as opposed to a time picker.
     * @hide
     */
    @RestrictTo(LIBRARY_GROUP)
    public SliceAction(@NonNull PendingIntent action, @NonNull CharSequence actionTitle,
            long dateTimeMillis, boolean isDatePicker) {
        mSliceAction = new SliceActionImpl(action, actionTitle, dateTimeMillis, isDatePicker);
    }

    /**
     * Construct a SliceAction representing a tappable icon.
     *
     * @param action the pending intent to invoke for this action.
     * @param actionIcon the icon to display for this action.
     * @param imageMode the mode this icon should be displayed in.
     * @param actionTitle the title for this action, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     *
     * @see ListBuilder#ICON_IMAGE
     * @see ListBuilder#SMALL_IMAGE
     * @see ListBuilder#LARGE_IMAGE
     */
    public static SliceAction create(@NonNull PendingIntent action,
            @NonNull IconCompat actionIcon, @ListBuilder.ImageMode int imageMode,
            @NonNull CharSequence actionTitle) {
        return new SliceAction(action, actionIcon, imageMode, actionTitle);
    }

    /**
     * Construct a SliceAction representing a tappable icon.
     *
     * @param action the remote callback to invoke for this action.
     * @param actionIcon the icon to display for this action.
     * @param imageMode the mode this icon should be displayed in.
     * @param actionTitle the title for this action, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     *
     * @see ListBuilder#ICON_IMAGE
     * @see ListBuilder#SMALL_IMAGE
     * @see ListBuilder#LARGE_IMAGE
     */
    public static SliceAction create(@NonNull RemoteCallback action,
            @NonNull IconCompat actionIcon, @ListBuilder.ImageMode int imageMode,
            @NonNull CharSequence actionTitle) {
        return new SliceAction(action.toPendingIntent(), actionIcon, imageMode, actionTitle);
    }

    /**
     * Construct a SliceAction representing a timestamp connected to a date picker.
     * Currently only supported in GridRow.
     *
     * @param action         the pending intent to invoke for this picker.
     * @param actionTitle    the timestamp title for this picker.
     * @param dateTimeMillis the default state of the date picker.
     * @hide
     */
    @NonNull
    public static SliceAction createDatePicker(@NonNull PendingIntent action,
            @NonNull CharSequence actionTitle, long dateTimeMillis) {
        return new SliceAction(action, actionTitle, dateTimeMillis, true);
    }

    /**
     * Construct a SliceAction representing a timestamp connected to a time picker.
     * Currently only supported in GridRow.
     *
     * @param action         the pending intent to invoke for this picker.
     * @param actionTitle    the timestamp title for this picker.
     * @param dateTimeMillis the default state of the time picker.
     * @hide
     */
    @NonNull
    public static SliceAction createTimePicker(@NonNull PendingIntent action,
            @NonNull CharSequence actionTitle, long dateTimeMillis) {
        return new SliceAction(action, actionTitle, dateTimeMillis, false);
    }

    /**
     * Construct a SliceAction representing a tappable icon that launches an
     * activity when clicked.
     *
     * @param action the pending intent to invoke for this action.
     * @param actionIcon the icon to display for this action.
     * @param imageMode the mode this icon should be displayed in.
     * @param actionTitle the title for this action, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     *
     * @see ListBuilder#ICON_IMAGE
     * @see ListBuilder#SMALL_IMAGE
     * @see ListBuilder#LARGE_IMAGE
     */
    public static SliceAction createDeeplink(@NonNull PendingIntent action,
            @NonNull IconCompat actionIcon, @ListBuilder.ImageMode int imageMode,
            @NonNull CharSequence actionTitle) {
        SliceAction sliceAction = new SliceAction(action, actionIcon, imageMode, actionTitle);
        sliceAction.mSliceAction.setActivity(true);
        return sliceAction;
    }

    /**
     * Construct a SliceAction representing a tappable icon that launches an
     * activity when clicked.
     *
     * @param action the remote callback to invoke for this action.
     * @param actionIcon the icon to display for this action.
     * @param imageMode the mode this icon should be displayed in.
     * @param actionTitle the title for this action, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     *
     * @see ListBuilder#ICON_IMAGE
     * @see ListBuilder#SMALL_IMAGE
     * @see ListBuilder#LARGE_IMAGE
     */
    public static SliceAction createDeeplink(@NonNull RemoteCallback action,
            @NonNull IconCompat actionIcon, @ListBuilder.ImageMode int imageMode,
            @NonNull CharSequence actionTitle) {
        SliceAction sliceAction = new SliceAction(action.toPendingIntent(), actionIcon, imageMode,
                actionTitle);
        sliceAction.mSliceAction.setActivity(true);
        return sliceAction;
    }

    /**
     * Construct a SliceAction representing a default toggle.
     *
     * @param action the pending intent to invoke for this toggle.
     * @param actionTitle the title for this toggle, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @param isChecked the state of the toggle.
     */
    public static SliceAction createToggle(@NonNull PendingIntent action,
            @NonNull CharSequence actionTitle, boolean isChecked) {
        return new SliceAction(action, actionTitle, isChecked);
    }

    /**
     * Construct a SliceAction representing a default toggle.
     *
     * @param action the remote callback to invoke for this toggle.
     * @param actionTitle the title for this toggle, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @param isChecked the state of the toggle.
     */
    public static SliceAction createToggle(@NonNull RemoteCallback action,
            @NonNull CharSequence actionTitle, boolean isChecked) {
        return new SliceAction(action.toPendingIntent(), actionTitle, isChecked);
    }

    /**
     * Construct a SliceAction representing a custom toggle icon.
     *
     * @param action the pending intent to invoke for this toggle.
     * @param actionIcon the icon to display for this toggle, should have a checked and unchecked
     *                   state.
     * @param actionTitle the title for this toggle, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @param isChecked the state of the toggle.
     */
    public static SliceAction createToggle(@NonNull PendingIntent action,
            @NonNull IconCompat actionIcon, @NonNull CharSequence actionTitle, boolean isChecked) {
        return new SliceAction(action, actionIcon, actionTitle, isChecked);
    }

    /**
     * Construct a SliceAction representing a custom toggle icon.
     *
     * @param action the remote callback to invoke for this toggle.
     * @param actionIcon the icon to display for this toggle, should have a checked and unchecked
     *                   state.
     * @param actionTitle the title for this toggle, also used for content description if one hasn't
     *                    been set via {@link #setContentDescription(CharSequence)}.
     * @param isChecked the state of the toggle.
     */
    public static SliceAction createToggle(@NonNull RemoteCallback action,
            @NonNull IconCompat actionIcon, @NonNull CharSequence actionTitle, boolean isChecked) {
        return new SliceAction(action.toPendingIntent(), actionIcon, actionTitle, isChecked);
    }

    /**
     * @param description the content description for this action.
     */
    @NonNull
    @Override
    public SliceAction setContentDescription(@NonNull CharSequence description) {
        mSliceAction.setContentDescription(description);
        return this;
    }

    /**
     * @param isChecked whether the state of this action is checked or not; only used for toggle
     *                  actions.
     */
    @NonNull
    @Override
    public SliceAction setChecked(boolean isChecked) {
        mSliceAction.setChecked(isChecked);
        return this;
    }

    /**
     * Sets the priority of this action, with the lowest priority having the highest ranking.
     */
    @NonNull
    @Override
    public SliceAction setPriority(@IntRange(from = 0) int priority) {
        mSliceAction.setPriority(priority);
        return this;
    }

    /**
     * @return the {@link PendingIntent} associated with this action.
     */
    @NonNull
    @Override
    public PendingIntent getAction() {
        return mSliceAction.getAction();
    }

    /**
     * @return the {@link Icon} to display for this action. This can be null when the action
     * represented is a default toggle.
     */
    @Nullable
    @Override
    public IconCompat getIcon() {
        return mSliceAction.getIcon();
    }

    /**
     * @return the title for this action.
     */
    @NonNull
    @Override
    public CharSequence getTitle() {
        return mSliceAction.getTitle();
    }

    @Override
    public boolean isActivity() {
        return mSliceAction.isActivity();
    }

    /**
     * @return the content description to use for this action.
     */
    @Nullable
    @Override
    public CharSequence getContentDescription() {
        return mSliceAction.getContentDescription();
    }

    /**
     * @return the priority associated with this action, -1 if unset.
     */
    @Override
    public int getPriority() {
        return mSliceAction.getPriority();
    }

    /**
     * @return whether this action represents a toggle (i.e. has a checked and unchecked state).
     */
    @Override
    public boolean isToggle() {
        return mSliceAction.isToggle();
    }

    /**
     * @return whether the state of this action is checked or not; only used for toggle actions.
     */
    @Override
    public boolean isChecked() {
        return mSliceAction.isChecked();
    }

    /**
     * @return the image mode to use for this action.
     */
    @Override
    public @ListBuilder.ImageMode int getImageMode() {
        return mSliceAction.getImageMode();
    }

    /**
     * @return whether this action is a toggle using the standard switch control.
     */
    @Override
    public boolean isDefaultToggle() {
        return mSliceAction.isDefaultToggle();
    }

    /**
     * @param builder this should be a new builder that has any additional hints the action might
     *                need.
     * @return the slice representation of this action.
     * @hide
     */
    @RestrictTo(LIBRARY)
    @NonNull
    public Slice buildSlice(@NonNull Slice.Builder builder) {
        return mSliceAction.buildSlice(builder);
    }

    /**
     * @hide
     */
    @RestrictTo(LIBRARY)
    @NonNull
    public SliceActionImpl getImpl() {
        return mSliceAction;
    }

    /**
     * @param builder the parent slice builder that contains the primary action.
     * @hide
     */
    @RestrictTo(LIBRARY)
    public void setPrimaryAction(@NonNull Slice.Builder builder) {
        builder.addAction(mSliceAction.getAction(),
                mSliceAction.buildPrimaryActionSlice(builder), mSliceAction.getSubtype());
    }
}