1 /* 2 * Copyright (C) 2024 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.testing.sampleserviceapi; 18 19 /** Sample Service API constants. */ 20 public class SampleServiceApi { 21 // Keys in AppParams for SampleService in test. 22 public static final String KEY_OPCODE = "opcode"; 23 public static final String KEY_RENDERING_CONFIG_IDS = "rendering_config_ids"; 24 public static final String KEY_LOG_DATA = "log_data"; 25 public static final String KEY_ERROR_CODE = "error_code"; 26 public static final String KEY_EXCEPTION_CLASS = "exception_class"; 27 public static final String KEY_TABLE_KEY = "table_key"; 28 public static final String KEY_BASE64_VALUE = "base_value"; 29 public static final String KEY_TABLE_VALUE_REPEAT_COUNT = "table_value_repeat_count"; 30 public static final String KEY_VALUE_LENGTH = "value_length"; 31 public static final String KEY_INFERENCE_RESULT = "inference_result"; 32 public static final String KEY_EXPECTED_LOG_DATA_KEY = "expected_log_key"; 33 public static final String KEY_EXPECTED_LOG_DATA_VALUE = "expected_log_value"; 34 public static final String KEY_POPULATION_NAME = "value_population_name"; 35 36 // Values of opcodes. 37 public static final String OPCODE_RENDER_AND_LOG = "render_and_log"; 38 public static final String OPCODE_FAIL_WITH_ERROR_CODE = "fail_with_error_code"; 39 public static final String OPCODE_THROW_EXCEPTION = "throw_exception"; 40 public static final String OPCODE_WRITE_LOCAL_DATA = "write_local_data"; 41 public static final String OPCODE_READ_LOCAL_DATA = "read_local_data"; 42 public static final String OPCODE_CHECK_VALUE_LENGTH = "check_value_length"; 43 public static final String OPCODE_RUN_MODEL_INFERENCE = "run_model_inference"; 44 public static final String OPCODE_RETURN_OUTPUT_DATA = "return_output_data"; 45 public static final String OPCODE_READ_REMOTE_DATA = "read_remote_data"; 46 public static final String OPCODE_READ_USER_DATA = "read_user_data"; 47 public static final String OPCODE_READ_LOG = "read_log"; 48 public static final String OPCODE_SCHEDULE_FEDERATED_JOB = "schedule_federated_job"; 49 public static final String OPCODE_CANCEL_FEDERATED_JOB = "cancel_federated_job"; 50 51 // Event types in logs. 52 public static final String KEY_EVENT_TYPE = "type"; 53 public static final int EVENT_TYPE_VIEW = 1; 54 public static final int EVENT_TYPE_CLICK = 2; 55 public static final String LINK_TEXT = "Click"; 56 public static final String DESTINATION_URL = "https://www.android.com"; 57 SampleServiceApi()58 private SampleServiceApi() {} 59 } 60