001// SPDX-License-Identifier: GPL-3.0-or-later
002// Copyright © 2026 Aurélien Pierre
003
004package com.aurelienpierre.sioul;
005
006import android.content.Intent;
007import android.widget.RemoteViewsService;
008
009/**
010 * The home-screen cards' lists (HomeCard): Android's widget service binds here
011 * for the rows of a card's list, each card its own factory (HomeCardRows),
012 * the card's kind in its address. Bound by the system alone (its permission,
013 * BIND_REMOTEVIEWS, in the manifest); not exported. In Sioul's own process,
014 * Java alone: no Rust, no Qt.
015 */
016public final class HomeCardService extends RemoteViewsService
017{
018    /** The card's kind (HomeCard.ALL, MAIL, AGENDA). */
019    static final String KIND = "com.aurelienpierre.sioul.extra.CARD_KIND";
020
021    @Override
022    public RemoteViewsFactory onGetViewFactory(Intent intent)
023    {
024        String kind = intent == null ? null : intent.getStringExtra(KIND);
025        return new HomeCardRows(getApplicationContext(), kind == null ? HomeCard.ALL : kind);
026    }
027}