• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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.dialer.calllog.database;
18 
19 import android.content.Context;
20 import android.database.sqlite.SQLiteDatabase;
21 import android.support.annotation.WorkerThread;
22 import com.android.dialer.common.Assert;
23 
24 /** Static methods and constants for interacting with the annotated call log table. */
25 public final class AnnotatedCallLog {
26 
27   private static final String DATABASE_NAME = "annotated_call_log.db";
28 
29   public static final String TABLE_NAME = "AnnotatedCallLog";
30 
31   /** Column names for the annotated call log table. */
32   public static final class Columns {
33     public static final String ID = "_id";
34     public static final String TIMESTAMP = "timestamp";
35     public static final String CONTACT_NAME = "contact_name";
36   }
37 
AnnotatedCallLog()38   private AnnotatedCallLog() {}
39 
40   @WorkerThread
getWritableDatabase(Context appContext)41   public static SQLiteDatabase getWritableDatabase(Context appContext) {
42     Assert.isWorkerThread();
43 
44     return new AnnotatedCallLogDatabaseHelper(appContext, DATABASE_NAME).getWritableDatabase();
45   }
46 
47   @WorkerThread
getReadableDatabase(Context appContext)48   public static SQLiteDatabase getReadableDatabase(Context appContext) {
49     Assert.isWorkerThread();
50 
51     return new AnnotatedCallLogDatabaseHelper(appContext, DATABASE_NAME).getReadableDatabase();
52   }
53 }
54