• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
21 /**
22  * Interface used by the owner/creator of a process that owns windows to listen to changes from the
23  * WM side.
24  * @see WindowProcessController
25  */
26 public interface WindowProcessListener {
27 
28     /** Clear the profiler record if we are currently profiling this process. */
clearProfilerIfNeeded()29     void clearProfilerIfNeeded();
30 
31     /** Update the service connection for this process based on activities it might have. */
updateServiceConnectionActivities()32     void updateServiceConnectionActivities();
33 
34     /** Set or clear flag that we would like to clean-up UI resources for this process. */
setPendingUiClean(boolean pendingUiClean)35     void setPendingUiClean(boolean pendingUiClean);
36 
37     /**
38      * Set flag that we would like to clean-up UI resources for this process and force new process
39      * state.
40      */
setPendingUiCleanAndForceProcessStateUpTo(int newState)41     void setPendingUiCleanAndForceProcessStateUpTo(int newState);
42 
43     /** Update the process information. */
updateProcessInfo(boolean updateServiceConnectionActivities, boolean activityChange, boolean updateOomAdj)44     void updateProcessInfo(boolean updateServiceConnectionActivities, boolean activityChange,
45             boolean updateOomAdj);
46 
47     /**
48      * Returns true if the process is removed and we should completely clean up the related records
49      * belonging to this process.
50      */
isRemoved()51     boolean isRemoved();
52 
53     /** Returns the total time (in milliseconds) spent executing in both user and system code. */
getCpuTime()54     long getCpuTime();
55 
56     /** Called when we are in the process on starting an activity. */
onStartActivity(int topProcessState, boolean setProfileProc, String packageName, long versionCode)57     void onStartActivity(int topProcessState, boolean setProfileProc, String packageName,
58             long versionCode);
59 
60     /** App died :(...oh well */
appDied()61     void appDied();
writeToProto(ProtoOutputStream proto, long fieldId)62     void writeToProto(ProtoOutputStream proto, long fieldId);
63 }
64