1 /* 2 * Copyright (C) 2018 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.server.wm; 18 19 import android.util.proto.ProtoOutputStream; 20 import android.view.RemoteAnimationAdapter; 21 22 /** 23 * Interface used by the owner/creator of a process that owns windows to listen to changes from the 24 * WM side. 25 * @see WindowProcessController 26 */ 27 public interface WindowProcessListener { 28 29 /** Clear the profiler record if we are currently profiling this process. */ clearProfilerIfNeeded()30 void clearProfilerIfNeeded(); 31 32 /** Update the service connection for this process based on activities it might have. */ updateServiceConnectionActivities()33 void updateServiceConnectionActivities(); 34 35 /** Set or clear flag that we would like to clean-up UI resources for this process. */ setPendingUiClean(boolean pendingUiClean)36 void setPendingUiClean(boolean pendingUiClean); 37 38 /** 39 * Set flag that we would like to clean-up UI resources for this process and force new process 40 * state. 41 */ setPendingUiCleanAndForceProcessStateUpTo(int newState)42 void setPendingUiCleanAndForceProcessStateUpTo(int newState); 43 44 /** Update the process information. */ updateProcessInfo(boolean updateServiceConnectionActivities, boolean activityChange, boolean updateOomAdj)45 void updateProcessInfo(boolean updateServiceConnectionActivities, boolean activityChange, 46 boolean updateOomAdj); 47 48 /** 49 * Returns true if the process is removed and we should completely clean up the related records 50 * belonging to this process. 51 */ isRemoved()52 boolean isRemoved(); 53 54 /** 55 * Returns true if the process is in a cached state. 56 */ isCached()57 boolean isCached(); 58 59 /** Returns the total time (in milliseconds) spent executing in both user and system code. */ getCpuTime()60 long getCpuTime(); 61 62 /** Called when we are in the process on starting an activity. */ onStartActivity(int topProcessState, boolean setProfileProc, String packageName, long versionCode)63 void onStartActivity(int topProcessState, boolean setProfileProc, String packageName, 64 long versionCode); 65 66 /** App died :(...oh well */ appDied(String reason)67 void appDied(String reason); dumpDebug(ProtoOutputStream proto, long fieldId)68 void dumpDebug(ProtoOutputStream proto, long fieldId); 69 70 /** 71 * Sets if the process is currently running a remote animation, which is taken a signal for 72 * determining oom adjustment and scheduling behavior. 73 * 74 * @param runningRemoteAnimation True if the process is running a remote animation, false 75 * otherwise. 76 * @see RemoteAnimationAdapter 77 */ setRunningRemoteAnimation(boolean runningRemoteAnimation)78 void setRunningRemoteAnimation(boolean runningRemoteAnimation); 79 } 80