1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.car.customization.tool.domain.panel 18 19 /** 20 * The business logic of a [Panel]. 21 * 22 * It can be seen as a small and specialized state machine that is responsible for creating a 23 * specific Panel and process the relevant actions for it. 24 */ 25 internal interface PanelActionReducer { 26 27 /** 28 * Extra information that can be be passed by the [OpenPanelAction] action. 29 */ 30 var bundle: Map<String, Any> 31 32 /** 33 * Creates a brand new instance of a [Panel]. 34 * 35 * The function is also used by [ReloadPanelAction] to create a new instance with the updated 36 * values from the system. 37 */ buildnull38 fun build(): Panel 39 40 /** 41 * Process a [PanelAction] and returns an updated [Panel]. 42 */ 43 fun reduce(panel: Panel, action: PanelAction): Panel 44 } 45