1 /* 2 * Copyright (C) 2024 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.wm.shell.freeform 18 19 import android.app.ActivityManager.RunningTaskInfo 20 21 /** 22 * Interface used by [FreeformTaskTransitionObserver] to manage freeform tasks. 23 * 24 * The implementations are responsible for handle all the task management. 25 */ 26 interface TaskChangeListener { 27 /** Notifies a task opening in freeform mode. */ onTaskOpeningnull28 fun onTaskOpening(taskInfo: RunningTaskInfo) 29 30 /** Notifies a task info update on the given task from Shell Transitions framework. */ 31 fun onTaskChanging(taskInfo: RunningTaskInfo) 32 33 /** 34 * Notifies a task info update on the given task from [FreeformTaskListener]. 35 * 36 * This is used to propagate task info changes since not all task changes are propagated from 37 * [TransitionObserver] in [onTaskChanging]. It is recommended to use [onTaskChanging] instead 38 * of this method where possible. 39 */ 40 fun onNonTransitionTaskChanging(taskInfo: RunningTaskInfo) 41 42 /** Notifies a task moving to the front. */ 43 fun onTaskMovingToFront(taskInfo: RunningTaskInfo) 44 45 /** Notifies a task moving to the back. */ 46 fun onTaskMovingToBack(taskInfo: RunningTaskInfo) 47 48 /** Notifies a task is closing. */ 49 fun onTaskClosing(taskInfo: RunningTaskInfo) 50 } 51