slices/core/src/main/java/androidx/slice/core/SliceActionImpl.java
@NonNull
    public Slice buildSlice(@NonNull Slice.Builder builder) {
        Slice.Builder sb = new Slice.Builder(builder);
        if (mIcon != null) {
            @Slice.SliceHint String[] hints = mImageMode == ICON_IMAGE
                    ? new String[] {}
                    : new String[] {HINT_NO_TINT};
            sb.addIcon(mIcon, null, hints);
        }
        if (mTitle != null) {
            sb.addText(mTitle, null, HINT_TITLE);
        }
        if (mContentDescription != null) {
            sb.addText(mContentDescription, SUBTYPE_CONTENT_DESCRIPTION);
        }
        if (mIsToggle && mIsChecked) {
            sb.addHints(HINT_SELECTED);
        }
        if (mPriority != -1) {
            sb.addInt(mPriority, SUBTYPE_PRIORITY);
        }
        String subtype = mIsToggle ? SUBTYPE_TOGGLE : null;
        builder.addHints(HINT_SHORTCUT);
        builder.addAction(mAction, sb.build(), subtype);
        return builder.build();
    }
/**
     * @param builder this should be a new builder that has any additional hints the action might
     *                need.
     * @return the slice representation of this action.
     */
@param builder this should be a new builder that has any additional hints the action might
need.
@return the slice representation of this action.
@param builder this should be a new builder that has any additional hints the action might need . @return the slice representation of this action .
@NonNull
    public Slice buildSlice(@NonNull Slice.Builder builder) {
        Slice.Builder sb = new Slice.Builder(builder);
        if (mIcon != null) {
            @Slice.SliceHint String[] hints = mImageMode == ICON_IMAGE
                    ? new String[] {}
                    : new String[] {HINT_NO_TINT};
            sb.addIcon(mIcon, null, hints);
        }
        if (mTitle != null) {
            sb.addText(mTitle, null, HINT_TITLE);
        }
        if (mContentDescription != null) {
            sb.addText(mContentDescription, SUBTYPE_CONTENT_DESCRIPTION);
        }
        if (mIsToggle && mIsChecked) {
            sb.addHints(HINT_SELECTED);
        }
        if (mPriority != -1) {
            sb.addInt(mPriority, SUBTYPE_PRIORITY);
        }
        String subtype = mIsToggle ? SUBTYPE_TOGGLE : null;
        builder.addHints(HINT_SHORTCUT);
        builder.addAction(mAction, sb.build(), subtype);
        return builder.build();
    }
@ NonNull public Slice buildSlice ( @ NonNull Slice . Builder builder ) { Slice . Builder sb = new Slice . Builder ( builder ) ; if ( mIcon != null ) { @ Slice . SliceHint String [ ] hints = mImageMode == ICON_IMAGE ? new String [ ] { } : new String [ ] { HINT_NO_TINT } ; sb . addIcon ( mIcon , null , hints ) ; } if ( mTitle != null ) { sb . addText ( mTitle , null , HINT_TITLE ) ; } if ( mContentDescription != null ) { sb . addText ( mContentDescription , SUBTYPE_CONTENT_DESCRIPTION ) ; } if ( mIsToggle && mIsChecked ) { sb . addHints ( HINT_SELECTED ) ; } if ( mPriority != - 1 ) { sb . addInt ( mPriority , SUBTYPE_PRIORITY ) ; } String subtype = mIsToggle ? SUBTYPE_TOGGLE : null ; builder . addHints ( HINT_SHORTCUT ) ; builder . addAction ( mAction , sb . build ( ) , subtype ) ; return builder . build ( ) ; }
@param builder this should be a new builder that has any additional hints the action might
                need.
@param builder this should be a new builder that has any additional hints the action might need .