1 /* 2 * Copyright (C) 2022 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 package com.android.launcher3.taskbar; 17 18 import android.util.SparseArray; 19 20 import androidx.annotation.CallSuper; 21 22 import com.android.launcher3.model.data.AppInfo; 23 import com.android.launcher3.model.data.ItemInfo; 24 25 /** 26 * Base class for providing recent apps functionality 27 */ 28 public class TaskbarRecentAppsController { 29 30 public static final TaskbarRecentAppsController DEFAULT = new TaskbarRecentAppsController(); 31 32 // Initialized in init. 33 protected TaskbarControllers mControllers; 34 35 @CallSuper init(TaskbarControllers taskbarControllers)36 protected void init(TaskbarControllers taskbarControllers) { 37 mControllers = taskbarControllers; 38 } 39 40 @CallSuper onDestroy()41 protected void onDestroy() { 42 mControllers = null; 43 } 44 45 /** Stores the current {@link AppInfo} instances, no-op except in desktop environment. */ setApps(AppInfo[] apps)46 protected void setApps(AppInfo[] apps) { } 47 48 /** 49 * Indicates whether recent apps functionality is enabled, should return false except in 50 * desktop environment. 51 */ isEnabled()52 protected boolean isEnabled() { 53 return false; 54 } 55 56 /** Called to update hotseatItems, no-op except in desktop environment. */ updateHotseatItemInfos(ItemInfo[] hotseatItems)57 protected ItemInfo[] updateHotseatItemInfos(ItemInfo[] hotseatItems) { 58 return hotseatItems; 59 } 60 61 /** Called to update the list of currently running apps, no-op except in desktop environment. */ updateRunningApps(SparseArray<ItemInfo> hotseatItems)62 protected void updateRunningApps(SparseArray<ItemInfo> hotseatItems) { } 63 } 64