• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.ondevicepersonalization.services.data.events;
18 
19 import android.provider.BaseColumns;
20 
21 /** Contract for the queries table. Defines the table. */
22 public class QueriesContract {
QueriesContract()23     private QueriesContract() {
24     }
25 
26     /**
27      * Table containing queries. Each row in the table represents a single query.
28      */
29     public static class QueriesEntry implements BaseColumns {
30         public static final String TABLE_NAME = "queries";
31 
32         /** The id of the query. */
33         public static final String QUERY_ID = "queryId";
34 
35         /** Time of the query in milliseconds. */
36         public static final String TIME_MILLIS = "timeMillis";
37 
38         /** Name of the package that handled the request */
39         public static final String SERVICE_PACKAGE_NAME = "servicePackageName";
40 
41         /** Blob representing the common query fields. */
42         public static final String QUERY_DATA = "queryData";
43 
44         public static final String CREATE_TABLE_STATEMENT =
45                 "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " ("
46                     + QUERY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
47                     + TIME_MILLIS + " INTEGER NOT NULL,"
48                     + SERVICE_PACKAGE_NAME + " TEXT NOT NULL,"
49                     + QUERY_DATA + " BLOB NOT NULL)";
50 
QueriesEntry()51         private QueriesEntry() {}
52     }
53 }
54