TextToImageTask

internal class TextToImageTask(context: Context, workerParameters: WorkerParameters, pushNotificationManager: PushNotificationManager, activityIntentProvider: ActivityIntentProvider, observeHordeProcessStatusUseCase: ObserveHordeProcessStatusUseCase, observeLocalDiffusionProcessStatusUseCase: ObserveLocalDiffusionProcessStatusUseCase, interruptGenerationUseCase: InterruptGenerationUseCase, val preferenceManager: PreferenceManager, val backgroundWorkObserver: BackgroundWorkObserver, val textToImageUseCase: TextToImageUseCase, val fileProviderDescriptor: FileProviderDescriptor) : CoreGenerationWorker(source)

Coordinates TextToImageTask behavior in the SDAI background work feature layer.

Author

Dmitriy Moroz

Constructors

Link copied to clipboard
constructor(context: Context, workerParameters: WorkerParameters, pushNotificationManager: PushNotificationManager, activityIntentProvider: ActivityIntentProvider, observeHordeProcessStatusUseCase: ObserveHordeProcessStatusUseCase, observeLocalDiffusionProcessStatusUseCase: ObserveLocalDiffusionProcessStatusUseCase, interruptGenerationUseCase: InterruptGenerationUseCase, preferenceManager: PreferenceManager, backgroundWorkObserver: BackgroundWorkObserver, textToImageUseCase: TextToImageUseCase, fileProviderDescriptor: FileProviderDescriptor)

Properties

Link copied to clipboard

Exposes the activityIntentProvider value used by the SDAI background work feature layer.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Exposes the backgroundWorkObserver value used by the SDAI background work feature layer.

Link copied to clipboard
open val coroutineContext: CoroutineDispatcher
Link copied to clipboard
private val coroutineScope: CoroutineScope
Link copied to clipboard

Exposes the fileProviderDescriptor value used by the SDAI background work feature layer.

Link copied to clipboard
val foregroundInfoAsync: ListenableFuture<ForegroundInfo>
Link copied to clipboard
open override val genericNotificationId: Int

Exposes the genericNotificationId value used by the SDAI background work feature layer.

Link copied to clipboard
val id: @NonNull UUID
Link copied to clipboard
val inputData: @NonNull Data
Link copied to clipboard

Exposes the interruptGenerationUseCase value used by the SDAI background work feature layer.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private var mAppContext: @NonNull Context
Link copied to clipboard
Link copied to clipboard
private var mUsed: Boolean
Link copied to clipboard
private var mWorkerParams: @NonNull WorkerParameters
Link copied to clipboard
@get:RequiresApi(value = 28)
val network: @Nullable Network?
Link copied to clipboard
open override val notificationId: Int

Exposes the notificationId value used by the SDAI background work feature layer.

Link copied to clipboard

Exposes the observeHordeProcessStatusUseCase value used by the SDAI background work feature layer.

Exposes the observeLocalDiffusionProcessStatusUseCase value used by the SDAI background work feature layer.

Link copied to clipboard
Link copied to clipboard

Exposes the preferenceManager value used by the SDAI background work feature layer.

Link copied to clipboard

Exposes the pushNotificationManager value used by the SDAI background work feature layer.

Link copied to clipboard
@get:IntRange(from = 0)
val runAttemptCount: Int
Link copied to clipboard
protected val source: ServerSource
Link copied to clipboard
@get:RequiresApi(value = 31)
val stopReason: Int
Link copied to clipboard
val tags: @NonNull Set<String?>
Link copied to clipboard
open val taskExecutor: @NonNull TaskExecutor
Link copied to clipboard

Exposes the textToImageUseCase value used by the SDAI background work feature layer.

Link copied to clipboard
@get:RequiresApi(value = 24)
val triggeredContentAuthorities: @NonNull List<String?>
Link copied to clipboard
@get:RequiresApi(value = 24)
val triggeredContentUris: @NonNull List<Uri?>
Link copied to clipboard

Functions

Link copied to clipboard
protected fun clearSubscriptions()
Link copied to clipboard
open suspend override fun doWork(): ListenableWorker.Result
Link copied to clipboard
open suspend fun getForegroundInfo(): ForegroundInfo
Link copied to clipboard
override fun getForegroundInfoAsync(): ListenableFuture<ForegroundInfo>
Link copied to clipboard
protected suspend fun handleCancellation()
Link copied to clipboard
protected fun handleError(t: Throwable)
Link copied to clipboard
protected fun handleProcess()
Link copied to clipboard
protected fun handleStart()
Link copied to clipboard
protected fun handleSuccess(result: List<AiGenerationResult>)
Link copied to clipboard
protected fun listenHordeStatus()
Link copied to clipboard
Link copied to clipboard
override fun onStopped()
Link copied to clipboard
suspend fun setForeground(foregroundInfo: ForegroundInfo)
Link copied to clipboard
fun setForegroundAsync(foregroundInfo: @NonNull ForegroundInfo): @NonNull ListenableFuture<Void?>
Link copied to clipboard
fun setForegroundNotification(title: String, body: String, subText: String? = null, progress: Pair<Int, Int>? = null, silent: Boolean = false, canCancel: Boolean = false)

Executes the setForegroundNotification step in the SDAI background work feature layer.

Link copied to clipboard
suspend fun setProgress(data: Data)
Link copied to clipboard
open fun setProgressAsync(data: @NonNull Data): @NonNull ListenableFuture<Void?>
Link copied to clipboard
Link copied to clipboard

Executes the showGenericNotification step in the SDAI background work feature layer.

Link copied to clipboard
override fun startWork(): ListenableFuture<ListenableWorker.Result>
Link copied to clipboard