• 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.annotation.NonNull;
20 
21 /**
22  * Multi-cast delegate implementation for {@link ActivityMetricsLaunchObserver}.
23  *
24  * <br/><br/>
25  * This enables multiple launch observers to subscribe to {@link ActivityMetricsLogger}
26  * independently of each other.
27  *
28  * <br/><br/>
29  * Some callbacks in {@link ActivityMetricsLaunchObserver} have a {@code byte[]}
30  * parameter; this array is reused by all the registered observers, so it must not be written to
31  * (i.e. all observers must treat any array parameters as immutable).
32  *
33  * <br /><br />
34  * Multi-cast invocations occurs sequentially in-order of registered observers.
35  */
36 public interface ActivityMetricsLaunchObserverRegistry {
37     /**
38      * Register an extra launch observer to receive the multi-cast.
39      *
40      * <br /><br />
41      * Multi-cast invocation happens in the same order the observers were registered. For example,
42      * <pre>
43      *     registerLaunchObserver(A)
44      *     registerLaunchObserver(B)
45      *
46      *     obs.onIntentFailed() ->
47      *       A.onIntentFailed()
48      *       B.onIntentFailed()
49      * </pre>
50      */
registerLaunchObserver(@onNull ActivityMetricsLaunchObserver launchObserver)51     void registerLaunchObserver(@NonNull ActivityMetricsLaunchObserver launchObserver);
52 
53     /**
54      * Unregister an existing launch observer. It will not receive the multi-cast in the future.
55      *
56      * <br /><br />
57      * This does nothing if this observer was not already registered.
58      */
unregisterLaunchObserver(@onNull ActivityMetricsLaunchObserver launchObserver)59     void unregisterLaunchObserver(@NonNull ActivityMetricsLaunchObserver launchObserver);
60 }
61