Home | History | Annotate | Download | only in util
      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.contacts.util;
     18 
     19 import android.content.Context;
     20 import android.content.Intent;
     21 
     22 /**
     23  * Utilities for managing CallerInfoCache.
     24  *
     25  * The cache lives in Phone package and is used as fallback storage when database lookup is slower
     26  * than expected. It remembers some information necessary for responding to incoming calls
     27  * (e.g. custom ringtone settings, send-to-voicemail).
     28  *
     29  * Even though the cache will be updated periodically, Contacts app can request the cache update
     30  * via broadcast Intent. This class provides that mechanism, and possibly other misc utilities
     31  * for the update mechanism.
     32  */
     33 public final class CallerInfoCacheUtils {
     34     private static final String UPDATE_CALLER_INFO_CACHE =
     35             "com.android.phone.UPDATE_CALLER_INFO_CACHE";
     36 
     37     private CallerInfoCacheUtils() {
     38     }
     39 
     40     /**
     41      * Sends an Intent, notifying CallerInfo cache should be updated.
     42      *
     43      * Note: CallerInfo is *not* part of public API, and no guarantee is available around its
     44      * specific behavior. In practice this will only be used by Phone package, but may change
     45      * in the future.
     46      *
     47      * See also CallerInfoCache in Phone package for more information.
     48      */
     49     public static void sendUpdateCallerInfoCacheIntent(Context context) {
     50         context.sendBroadcast(new Intent(UPDATE_CALLER_INFO_CACHE));
     51     }
     52 }