• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.systemui.util.service;
18 
19 import com.android.systemui.util.annotations.WeaklyReferencedCallback;
20 
21 /**
22  * The {@link Observer} interface specifies an entity which listeners
23  * can be informed of changes to the source, which will require updating. Note that this deals
24  * with changes to the source itself, not content which will be updated through the interface.
25  */
26 public interface Observer {
27     /**
28      * Callback for receiving updates from the {@link Observer}.
29      */
30     @WeaklyReferencedCallback
31     interface Callback {
32         /**
33          * Invoked when the source has changed.
34          */
onSourceChanged()35         void onSourceChanged();
36     }
37 
38     /**
39      * Adds a callback to receive future updates from the {@link Observer}.
40      */
addCallback(Callback callback)41     void addCallback(Callback callback);
42 
43     /**
44      * Removes a callback from receiving further updates.
45      * @param callback
46      */
removeCallback(Callback callback)47     void removeCallback(Callback callback);
48 }
49