1 /* 2 * Copyright 2019 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.bluetooth.btservice.storage; 18 19 import androidx.room.Entity; 20 21 @Entity 22 class CustomizedMetadataEntity { 23 public byte[] manufacturer_name; 24 public byte[] model_name; 25 public byte[] software_version; 26 public byte[] hardware_version; 27 public byte[] companion_app; 28 public byte[] main_icon; 29 public byte[] is_untethered_headset; 30 public byte[] untethered_left_icon; 31 public byte[] untethered_right_icon; 32 public byte[] untethered_case_icon; 33 public byte[] untethered_left_battery; 34 public byte[] untethered_right_battery; 35 public byte[] untethered_case_battery; 36 public byte[] untethered_left_charging; 37 public byte[] untethered_right_charging; 38 public byte[] untethered_case_charging; 39 public byte[] enhanced_settings_ui_uri; 40 public byte[] device_type; 41 public byte[] main_battery; 42 public byte[] main_charging; 43 public byte[] main_low_battery_threshold; 44 public byte[] untethered_left_low_battery_threshold; 45 public byte[] untethered_right_low_battery_threshold; 46 public byte[] untethered_case_low_battery_threshold; 47 toString()48 public String toString() { 49 StringBuilder builder = new StringBuilder(); 50 builder.append("manufacturer_name=") 51 .append(metadataToString(manufacturer_name)) 52 .append("|model_name=") 53 .append(metadataToString(model_name)) 54 .append("|software_version=") 55 .append(metadataToString(software_version)) 56 .append("|hardware_version=") 57 .append(metadataToString(hardware_version)) 58 .append("|companion_app=") 59 .append(metadataToString(companion_app)) 60 .append("|main_icon=") 61 .append(metadataToString(main_icon)) 62 .append("|is_untethered_headset=") 63 .append(metadataToString(is_untethered_headset)) 64 .append("|untethered_left_icon=") 65 .append(metadataToString(untethered_left_icon)) 66 .append("|untethered_right_icon=") 67 .append(metadataToString(untethered_right_icon)) 68 .append("|untethered_case_icon=") 69 .append(metadataToString(untethered_case_icon)) 70 .append("|untethered_left_battery=") 71 .append(metadataToString(untethered_left_battery)) 72 .append("|untethered_right_battery=") 73 .append(metadataToString(untethered_right_battery)) 74 .append("|untethered_case_battery=") 75 .append(metadataToString(untethered_case_battery)) 76 .append("|untethered_left_charging=") 77 .append(metadataToString(untethered_left_charging)) 78 .append("|untethered_right_charging=") 79 .append(metadataToString(untethered_right_charging)) 80 .append("|untethered_case_charging=") 81 .append(metadataToString(untethered_case_charging)) 82 .append("|enhanced_settings_ui_uri=") 83 .append(metadataToString(enhanced_settings_ui_uri)) 84 .append("|device_type=") 85 .append(metadataToString(device_type)) 86 .append("|main_battery=") 87 .append(metadataToString(main_battery)) 88 .append("|main_charging=") 89 .append(metadataToString(main_charging)) 90 .append("|main_low_battery_threshold=") 91 .append(metadataToString(main_low_battery_threshold)) 92 .append("|untethered_left_low_battery_threshold=") 93 .append(metadataToString(untethered_left_low_battery_threshold)) 94 .append("|untethered_right_low_battery_threshold=") 95 .append(metadataToString(untethered_right_low_battery_threshold)) 96 .append("|untethered_case_low_battery_threshold=") 97 .append(metadataToString(untethered_case_low_battery_threshold)); 98 99 return builder.toString(); 100 } 101 metadataToString(byte[] metadata)102 private String metadataToString(byte[] metadata) { 103 if (metadata == null) { 104 return null; 105 } 106 return new String(metadata); 107 } 108 } 109