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
17package com.android.settings.accessibility;
18
19import android.content.ContentResolver;
20import android.database.ContentObserver;
21import android.net.Uri;
22import android.os.Handler;
23import android.provider.Settings;
24
25abstract class SettingsContentObserver extends ContentObserver {
26    public SettingsContentObserver(Handler handler) {
27        super(handler);
28    }
29
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
37    public void unregister(ContentResolver contentResolver) {
38        contentResolver.unregisterContentObserver(this);
39    }
40
41    @Override
42    public abstract void onChange(boolean selfChange, Uri uri);
43}
44