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