1/* 2 * Copyright (C) 2017 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 17syntax = "proto2"; 18package android.service.print; 19 20option java_multiple_files = true; 21option java_outer_classname = "PrintServiceProto"; 22 23import "frameworks/base/core/proto/android/content/component_name.proto"; 24import "frameworks/base/core/proto/android/privacy.proto"; 25 26message PrintServiceDumpProto { 27 option (android.msg_privacy).dest = DEST_AUTOMATIC; 28 29 // Each user has a separate printer state 30 repeated PrintUserStateProto user_states = 1; 31} 32 33message PrintUserStateProto { 34 option (android.msg_privacy).dest = DEST_AUTOMATIC; 35 36 // Should be 0, 10, 11, 12, etc. where 0 is the owner. 37 optional int32 user_id = 1; 38 39 // The installed print services 40 repeated InstalledPrintServiceProto installed_services = 2; 41 42 // The disabled print services 43 repeated android.content.ComponentNameProto disabled_services = 3; 44 45 // The active print services 46 repeated ActivePrintServiceProto active_services = 4; 47 48 // The cached print jobs 49 repeated CachedPrintJobProto cached_print_jobs = 5; 50 51 // The printer discovery sessions 52 repeated PrinterDiscoverySessionProto discovery_sessions = 6; 53 54 // The print spooler state 55 optional PrintSpoolerStateProto print_spooler_state = 7; 56} 57 58message PrintSpoolerStateProto { 59 option (android.msg_privacy).dest = DEST_AUTOMATIC; 60 61 // Is the print spooler destroyed? 62 optional bool is_destroyed = 1; 63 64 // Is the print spooler bound? 65 optional bool is_bound = 2; 66 67 // State internal to the print spooler 68 optional PrintSpoolerInternalStateProto internal_state = 3; 69} 70 71message PrintSpoolerInternalStateProto { 72 option (android.msg_privacy).dest = DEST_AUTOMATIC; 73 74 // Print jobs 75 repeated PrintJobInfoProto print_jobs = 1; 76 77 // Files used by these print jobs. These are auto-generated UUIDs that are 78 // only valid while the print job is processed. 79 repeated string print_job_files = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; 80 81 // Approved print services 82 repeated android.content.ComponentNameProto approved_services = 3; 83} 84 85message PrinterCapabilitiesProto { 86 option (android.msg_privacy).dest = DEST_AUTOMATIC; 87 88 // Minimum margins of the printer 89 optional MarginsProto min_margins = 1; 90 91 // List of supported media sizes 92 repeated MediaSizeProto media_sizes = 2; 93 94 // List of supported resolutions 95 repeated ResolutionProto resolutions = 3; 96 97 // List of supported color modes 98 repeated PrintAttributesProto.ColorMode color_modes = 4; 99 100 // List of supported duplex modes 101 repeated PrintAttributesProto.DuplexMode duplex_modes = 5; 102} 103 104message PrinterInfoProto { 105 option (android.msg_privacy).dest = DEST_EXPLICIT; 106 107 // The id of the printer 108 optional PrinterIdProto id = 1; 109 110 // The name of the printer 111 optional string name = 2; 112 113 enum Status { 114 // unused 115 __STATUS_UNUSED = 0; 116 117 // Printer is idle 118 STATUS_IDLE = 1; 119 120 // Printer is busy 121 STATUS_BUSY = 2; 122 123 // Printer is unavailable 124 STATUS_UNAVAILABLE = 3; 125 } 126 // The status of the printer 127 optional Status status = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; 128 129 // The description of the printer, set by the user. 130 optional string description = 4; 131 132 // The capabilities of the printer 133 optional PrinterCapabilitiesProto capabilities = 5; 134} 135 136message PrinterDiscoverySessionProto { 137 option (android.msg_privacy).dest = DEST_AUTOMATIC; 138 139 // Is this session destroyed? 140 optional bool is_destroyed = 1; 141 142 // Is printer discovery in progress? 143 optional bool is_printer_discovery_in_progress = 2; 144 145 // List of printer discovery observers 146 repeated string printer_discovery_observers = 3; 147 148 // List of discovery request 149 repeated string discovery_requests = 4; 150 151 // List of ids of printers that are have tracking requests 152 repeated PrinterIdProto tracked_printer_requests = 5; 153 154 // List of printers found 155 repeated PrinterInfoProto printer = 6; 156} 157 158message InstalledPrintServiceProto { 159 option (android.msg_privacy).dest = DEST_AUTOMATIC; 160 161 // Component name of the service 162 optional android.content.ComponentNameProto component_name = 1; 163 164 // Settings activity for this service 165 optional string settings_activity = 2; 166 167 // Add printers activity for this service 168 optional string add_printers_activity = 3; 169 170 // Advances options activity for this service 171 optional string advanced_options_activity = 4; 172} 173 174message PrinterIdProto { 175 option (android.msg_privacy).dest = DEST_EXPLICIT; 176 177 // Component name of the service that reported the printer 178 optional android.content.ComponentNameProto service_name = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; 179 180 // Local id of the printer 181 optional string local_id = 2; 182} 183 184message ActivePrintServiceProto { 185 option (android.msg_privacy).dest = DEST_AUTOMATIC; 186 187 // Component name of the service 188 optional android.content.ComponentNameProto component_name = 1; 189 190 // Is the active service destroyed 191 optional bool is_destroyed = 2; 192 193 // Is the active service bound 194 optional bool is_bound = 3; 195 196 // Has the active service a discovery session 197 optional bool has_discovery_session = 4; 198 199 // Has the active service a active print jobs 200 optional bool has_active_print_jobs = 5; 201 202 // Is the active service discovering printers 203 optional bool is_discovering_printers = 6; 204 205 // The tracked printers of this active service 206 repeated PrinterIdProto tracked_printers = 7; 207} 208 209message MediaSizeProto { 210 option (android.msg_privacy).dest = DEST_AUTOMATIC; 211 212 // Id of this media size 213 optional string id = 1; 214 215 // Label of this media size 216 optional string label = 2; 217 218 // Height of the media 219 optional int32 height_mils = 3; 220 221 // Width of the media 222 optional int32 width_mils = 4; 223} 224 225message ResolutionProto { 226 option (android.msg_privacy).dest = DEST_AUTOMATIC; 227 228 // Id of this resolution 229 optional string id = 1; 230 231 // Label for this resoltion 232 optional string label = 2; 233 234 // Resolution in horizontal orientation 235 optional int32 horizontal_dpi = 3; 236 237 // Resolution in vertical orientation 238 optional int32 vertical_dpi = 4; 239} 240 241message MarginsProto { 242 option (android.msg_privacy).dest = DEST_AUTOMATIC; 243 244 // Space at the top 245 optional int32 top_mils = 1; 246 247 // Space at the left 248 optional int32 left_mils = 2; 249 250 // Space at the right 251 optional int32 right_mils = 3; 252 253 // Space at the bottom 254 optional int32 bottom_mils = 4; 255} 256 257message PrintAttributesProto { 258 option (android.msg_privacy).dest = DEST_AUTOMATIC; 259 260 // Media to use 261 optional ResolutionProto media_size = 1; 262 263 // Is the media in portrait mode? 264 optional bool is_portrait = 2; 265 266 // Resolution to use 267 optional ResolutionProto resolution = 3; 268 269 // Margins around the document 270 optional MarginsProto min_margins = 4; 271 272 enum ColorMode { 273 // unused 274 __COLOR_MODE_UNUSED = 0; 275 276 // Use black, white, gray 277 COLOR_MODE_MONOCHROME = 1; 278 279 // Use full color is available 280 COLOR_MODE_COLOR = 2; 281 } 282 // Color mode to use 283 optional ColorMode color_mode = 5; 284 285 enum DuplexMode { 286 // unused 287 __DUPLEX_MODE_UNUSED = 0; 288 289 // No duplex 290 DUPLEX_MODE_NONE = 1; 291 292 // Duplex where the long edge attached 293 DUPLEX_MODE_LONG_EDGE = 2; 294 295 // Duplex where the short edge attach 296 DUPLEX_MODE_SHORT_EDGE = 4; 297 } 298 // Duplex mode to use 299 optional DuplexMode duplex_mode = 6; 300} 301 302message PrintDocumentInfoProto { 303 option (android.msg_privacy).dest = DEST_AUTOMATIC; 304 305 // Name of the document to print 306 optional string name = 1 [ (android.privacy).dest = DEST_EXPLICIT ]; 307 308 // Number of pages in the doc 309 optional int32 page_count = 2; 310 311 // Type of content (see PrintDocumentInfo.ContentType) 312 optional int32 content_type = 3; 313 314 // The size of the document 315 optional int64 data_size = 4; 316} 317 318message PageRangeProto { 319 option (android.msg_privacy).dest = DEST_AUTOMATIC; 320 321 // Start of the range 322 optional int32 start = 1; 323 324 // End of the range (included) 325 optional int32 end = 2; 326} 327 328message PrintJobInfoProto { 329 option (android.msg_privacy).dest = DEST_AUTOMATIC; 330 331 // Label of the job 332 optional string label = 1 [ (android.privacy).dest = DEST_EXPLICIT ]; 333 334 // Id of the job 335 optional string print_job_id = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; 336 337 enum State { 338 // Unknown state 339 STATE_UNKNOWN = 0; 340 341 // The print job is being created but not yet ready to be printed 342 STATE_CREATED = 1; 343 344 // The print jobs is created, it is ready to be printed and should be processed 345 STATE_QUEUED = 2; 346 347 // The print job is being printed 348 STATE_STARTED = 3; 349 350 // The print job is blocked 351 STATE_BLOCKED = 4; 352 353 // The print job is successfully printed 354 STATE_COMPLETED = 5; 355 356 // The print job was printing but printing failed 357 STATE_FAILED = 6; 358 359 // The print job is canceled 360 STATE_CANCELED = 7; 361 } 362 363 // State of the job 364 optional State state = 3; 365 366 // Printer handling the job 367 optional PrinterIdProto printer = 4; 368 369 // Tag assigned to the job 370 optional string tag = 5 [ (android.privacy).dest = DEST_EXPLICIT ]; 371 372 // Time the job was created 373 optional int64 creation_time = 6; 374 375 // Attributes of the job 376 optional PrintAttributesProto attributes = 7; 377 378 // Document info of the job 379 optional PrintDocumentInfoProto document_info = 8; 380 381 // If the job current getting canceled 382 optional bool is_canceling = 9; 383 384 // The selected ranges of the job 385 repeated PageRangeProto pages = 10; 386 387 // Does the job have any advanced options 388 optional bool has_advanced_options = 11; 389 390 // Progress of the job 391 optional float progress = 12; 392 393 // The current service set state 394 optional string status = 13; 395} 396 397message CachedPrintJobProto { 398 option (android.msg_privacy).dest = DEST_AUTOMATIC; 399 400 // The id of the app the job belongs to 401 optional int32 app_id = 1; 402 403 // The print job 404 optional PrintJobInfoProto print_job = 2; 405} 406