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 android.app.dream.cts.app; 18 19 import android.app.dream.cts.app.IControlledDream; 20 21 /** 22 * {@link IDreamLifecycleListener} is an interface for being informed when a controllable dream's 23 * lifecycle changes. 24 */ 25 interface IDreamLifecycleListener { 26 /** 27 * invoked when the dream is attached. 28 */ onAttachedToWindow(IControlledDream dream)29 void onAttachedToWindow(IControlledDream dream); 30 31 /** 32 * invoked when dreaming starts. 33 */ onDreamingStarted(IControlledDream dream)34 void onDreamingStarted(IControlledDream dream); 35 36 /** 37 * invoked when focus changes. 38 */ onFocusChanged(IControlledDream dream, boolean hasFocus)39 void onFocusChanged(IControlledDream dream, boolean hasFocus); 40 41 /** 42 * invoked when dreaming stops. 43 */ onDreamingStopped(IControlledDream dream)44 void onDreamingStopped(IControlledDream dream); 45 46 /** 47 * invoked when waking up. 48 */ onWakeUp(IControlledDream dream)49 void onWakeUp(IControlledDream dream); 50 51 /** 52 * invoked when the dream is destroyed. 53 */ onDreamDestroyed(IControlledDream dream)54 void onDreamDestroyed(IControlledDream dream); 55 56 /** 57 * invoked when the dream is detached. 58 */ onDetachedFromWindow(IControlledDream dream)59 void onDetachedFromWindow(IControlledDream dream); 60 }