1 /* 2 * Copyright (C) 2023 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 events state table. Defines the table. */ 22 public class EventStateContract { EventStateContract()23 private EventStateContract() { 24 } 25 26 /** 27 * Table containing event state. Each row in the table 28 * represents the state of events and queries for a given task. 29 */ 30 public static class EventStateEntry implements BaseColumns { 31 public static final String TABLE_NAME = "event_state"; 32 33 /** Unique identifier of the task for processing this event */ 34 public static final String TASK_IDENTIFIER = "taskIdentifier"; 35 36 /** Name of the service package for this event */ 37 public static final String SERVICE_NAME = "serviceName"; 38 39 /** Token representing the event state. */ 40 public static final String TOKEN = "token"; 41 42 43 public static final String CREATE_TABLE_STATEMENT = 44 "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" 45 + TASK_IDENTIFIER + " TEXT NOT NULL," 46 + SERVICE_NAME + " TEXT NOT NULL," 47 + TOKEN + " BLOB NOT NULL," 48 + "UNIQUE(" + TASK_IDENTIFIER + "," 49 + SERVICE_NAME + "))"; 50 EventStateEntry()51 private EventStateEntry() {} 52 } 53 } 54