1 /*
2  * Copyright (C) 2013 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.settings.accessibility;
18 
19 import android.content.ContentResolver;
20 import android.database.ContentObserver;
21 import android.net.Uri;
22 import android.os.Handler;
23 import android.provider.Settings;
24 
25 abstract class SettingsContentObserver extends ContentObserver {
SettingsContentObserver(Handler handler)26     public SettingsContentObserver(Handler handler) {
27         super(handler);
28     }
29 
register(ContentResolver contentResolver)30     public void register(ContentResolver contentResolver) {
31         contentResolver.registerContentObserver(Settings.Secure.getUriFor(
32                 Settings.Secure.ACCESSIBILITY_ENABLED), false, this);
33         contentResolver.registerContentObserver(Settings.Secure.getUriFor(
34                 Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES), false, this);
35     }
36 
unregister(ContentResolver contentResolver)37     public void unregister(ContentResolver contentResolver) {
38         contentResolver.unregisterContentObserver(this);
39     }
40 
41     @Override
onChange(boolean selfChange, Uri uri)42     public abstract void onChange(boolean selfChange, Uri uri);
43 }
44