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 /**
20  * The {@link Observer} interface specifies an entity which listeners
21  * can be informed of changes to the source, which will require updating. Note that this deals
22  * with changes to the source itself, not content which will be updated through the interface.
23  */
24 public interface Observer {
25     /**
26      * Callback for receiving updates from the {@link Observer}.
27      */
28     interface Callback {
29         /**
30          * Invoked when the source has changed.
31          */
onSourceChanged()32         void onSourceChanged();
33     }
34 
35     /**
36      * Adds a callback to receive future updates from the {@link Observer}.
37      */
addCallback(Callback callback)38     void addCallback(Callback callback);
39 
40     /**
41      * Removes a callback from receiving further updates.
42      * @param callback
43      */
removeCallback(Callback callback)44     void removeCallback(Callback callback);
45 }
46