Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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.phone; |
| 18 | |
| 19 | import android.content.BroadcastReceiver; |
| 20 | import android.content.Context; |
| 21 | import android.content.Intent; |
| 22 | import android.os.SystemProperties; |
| 23 | import android.util.Log; |
| 24 | |
| 25 | /** |
| 26 | * BroadcastReceiver responsible for (periodic) update of {@link CallerInfoCache}. |
| 27 | * |
| 28 | * This broadcast can be sent from Contacts edit screen, implying relevant settings have changed |
| 29 | * and the cache may become obsolete. |
| 30 | */ |
| 31 | public class CallerInfoCacheUpdateReceiver extends BroadcastReceiver { |
| 32 | private static final String LOG_TAG = CallerInfoCacheUpdateReceiver.class.getSimpleName(); |
| 33 | private static final boolean DBG = |
| 34 | (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1); |
| 35 | |
| 36 | public static final String ACTION_UPDATE_CALLER_INFO_CACHE = |
| 37 | "com.android.phone.UPDATE_CALLER_INFO_CACHE"; |
| 38 | |
| 39 | @Override |
| 40 | public void onReceive(Context context, Intent intent) { |
| 41 | if (DBG) log("CallerInfoCacheUpdateReceiver#onReceive(). Intent: " + intent); |
| 42 | PhoneGlobals.getInstance().callerInfoCache.startAsyncCache(); |
| 43 | } |
| 44 | |
| 45 | private static void log(String msg) { |
| 46 | Log.d(LOG_TAG, msg); |
| 47 | } |
| 48 | } |