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     public byte[] spatial_audio;
48     public byte[] fastpair_customized;
49     public byte[] le_audio;
50     public byte[] gmcs_cccd;
51     public byte[] gtbs_cccd;
52     public byte[] exclusive_manager;
53 
toString()54     public String toString() {
55         StringBuilder builder = new StringBuilder();
56         builder.append("manufacturer_name=")
57                 .append(metadataToString(manufacturer_name))
58                 .append("|model_name=")
59                 .append(metadataToString(model_name))
60                 .append("|software_version=")
61                 .append(metadataToString(software_version))
62                 .append("|hardware_version=")
63                 .append(metadataToString(hardware_version))
64                 .append("|companion_app=")
65                 .append(metadataToString(companion_app))
66                 .append("|main_icon=")
67                 .append(metadataToString(main_icon))
68                 .append("|is_untethered_headset=")
69                 .append(metadataToString(is_untethered_headset))
70                 .append("|untethered_left_icon=")
71                 .append(metadataToString(untethered_left_icon))
72                 .append("|untethered_right_icon=")
73                 .append(metadataToString(untethered_right_icon))
74                 .append("|untethered_case_icon=")
75                 .append(metadataToString(untethered_case_icon))
76                 .append("|untethered_left_battery=")
77                 .append(metadataToString(untethered_left_battery))
78                 .append("|untethered_right_battery=")
79                 .append(metadataToString(untethered_right_battery))
80                 .append("|untethered_case_battery=")
81                 .append(metadataToString(untethered_case_battery))
82                 .append("|untethered_left_charging=")
83                 .append(metadataToString(untethered_left_charging))
84                 .append("|untethered_right_charging=")
85                 .append(metadataToString(untethered_right_charging))
86                 .append("|untethered_case_charging=")
87                 .append(metadataToString(untethered_case_charging))
88                 .append("|enhanced_settings_ui_uri=")
89                 .append(metadataToString(enhanced_settings_ui_uri))
90                 .append("|device_type=")
91                 .append(metadataToString(device_type))
92                 .append("|main_battery=")
93                 .append(metadataToString(main_battery))
94                 .append("|main_charging=")
95                 .append(metadataToString(main_charging))
96                 .append("|main_low_battery_threshold=")
97                 .append(metadataToString(main_low_battery_threshold))
98                 .append("|untethered_left_low_battery_threshold=")
99                 .append(metadataToString(untethered_left_low_battery_threshold))
100                 .append("|untethered_right_low_battery_threshold=")
101                 .append(metadataToString(untethered_right_low_battery_threshold))
102                 .append("|untethered_case_low_battery_threshold=")
103                 .append(metadataToString(untethered_case_low_battery_threshold))
104                 .append("|spatial_audio=")
105                 .append(metadataToString(spatial_audio))
106                 .append("|fastpair_customized=")
107                 .append(metadataToString(fastpair_customized))
108                 .append("|le_audio=")
109                 .append(metadataToString(le_audio))
110                 .append("|gmcs_cccd=")
111                 .append(metadataToString(gmcs_cccd))
112                 .append("|gtbs_cccd=")
113                 .append(metadataToString(gtbs_cccd))
114                 .append("|exclusive_manager=")
115                 .append(metadataToString(exclusive_manager));
116 
117         return builder.toString();
118     }
119 
metadataToString(byte[] metadata)120     private String metadataToString(byte[] metadata) {
121         if (metadata == null) {
122             return null;
123         }
124         return new String(metadata);
125     }
126 }
127