1341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette/* 2341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * Copyright (C) 2013 The Android Open Source Project 3341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * 4341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * Licensed under the Apache License, Version 2.0 (the "License"); 5341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * you may not use this file except in compliance with the License. 6341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * You may obtain a copy of the License at 7341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * 8341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * http://www.apache.org/licenses/LICENSE-2.0 9341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * 10341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * Unless required by applicable law or agreed to in writing, software 11341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * distributed under the License is distributed on an "AS IS" BASIS, 12341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * See the License for the specific language governing permissions and 14341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette * limitations under the License. 15341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette */ 16341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette 17341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverettepackage com.android.settings.accessibility; 18341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette 19341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viveretteimport android.content.ContentResolver; 20341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viveretteimport android.database.ContentObserver; 21341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viveretteimport android.net.Uri; 22341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viveretteimport android.os.Handler; 23341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viveretteimport android.provider.Settings; 24341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette 25341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viveretteabstract class SettingsContentObserver extends ContentObserver { 26341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette public SettingsContentObserver(Handler handler) { 27341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette super(handler); 28341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette } 29341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette 30341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette public void register(ContentResolver contentResolver) { 31341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette contentResolver.registerContentObserver(Settings.Secure.getUriFor( 32341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette Settings.Secure.ACCESSIBILITY_ENABLED), false, this); 33341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette contentResolver.registerContentObserver(Settings.Secure.getUriFor( 34341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES), false, this); 35341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette } 36341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette 37341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette public void unregister(ContentResolver contentResolver) { 38341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette contentResolver.unregisterContentObserver(this); 39341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette } 40341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette 41341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette @Override 42341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette public abstract void onChange(boolean selfChange, Uri uri); 43341ff66e0374a46f89c51bca2ef55da368b7e40fAlan Viverette} 44