• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 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 android.print;
18 
19 import android.content.ComponentName;
20 import android.graphics.drawable.Icon;
21 import android.os.Bundle;
22 import android.print.IPrinterDiscoveryObserver;
23 import android.print.IPrintDocumentAdapter;
24 import android.print.PrintJobId;
25 import android.print.IPrintJobStateChangeListener;
26 import android.print.IPrintServicesChangeListener;
27 import android.printservice.recommendation.IRecommendationsChangeListener;
28 import android.print.PrinterId;
29 import android.print.PrintJobInfo;
30 import android.print.PrintAttributes;
31 import android.printservice.recommendation.RecommendationInfo;
32 import android.printservice.PrintServiceInfo;
33 
34 /**
35  * Interface for communication with the core print manager service.
36  *
37  * @hide
38  */
39 interface IPrintManager {
getPrintJobInfos(int appId, int userId)40     List<PrintJobInfo> getPrintJobInfos(int appId, int userId);
getPrintJobInfo(in PrintJobId printJobId, int appId, int userId)41     PrintJobInfo getPrintJobInfo(in PrintJobId printJobId, int appId, int userId);
print(String printJobName, in IPrintDocumentAdapter printAdapter, in PrintAttributes attributes, String packageName, int appId, int userId)42     Bundle print(String printJobName, in IPrintDocumentAdapter printAdapter,
43             in PrintAttributes attributes, String packageName, int appId, int userId);
cancelPrintJob(in PrintJobId printJobId, int appId, int userId)44     void cancelPrintJob(in PrintJobId printJobId, int appId, int userId);
restartPrintJob(in PrintJobId printJobId, int appId, int userId)45     void restartPrintJob(in PrintJobId printJobId, int appId, int userId);
46 
addPrintJobStateChangeListener(in IPrintJobStateChangeListener listener, int appId, int userId)47     void addPrintJobStateChangeListener(in IPrintJobStateChangeListener listener,
48             int appId, int userId);
removePrintJobStateChangeListener(in IPrintJobStateChangeListener listener, int userId)49     void removePrintJobStateChangeListener(in IPrintJobStateChangeListener listener,
50             int userId);
51 
52     /**
53      * Listen for changes to the installed and enabled print services.
54      *
55      * @param listener the listener to add
56      * @param userId the id of the user listening
57      *
58      * @see android.print.PrintManager#getPrintServices(int, String)
59      */
addPrintServicesChangeListener(in IPrintServicesChangeListener listener, int userId)60     void addPrintServicesChangeListener(in IPrintServicesChangeListener listener,
61             int userId);
62 
63     /**
64      * Stop listening for changes to the installed and enabled print services.
65      *
66      * @param listener the listener to remove
67      * @param userId the id of the user requesting the removal
68      *
69      * @see android.print.PrintManager#getPrintServices(int, String)
70      */
removePrintServicesChangeListener(in IPrintServicesChangeListener listener, int userId)71     void removePrintServicesChangeListener(in IPrintServicesChangeListener listener,
72             int userId);
73 
74     /**
75      * Get the print services.
76      *
77      * @param selectionFlags flags selecting which services to get
78      * @param userId the id of the user requesting the services
79      *
80      * @return the list of selected print services.
81      */
getPrintServices(int selectionFlags, int userId)82     List<PrintServiceInfo> getPrintServices(int selectionFlags, int userId);
83 
84     /**
85      * Enable or disable a print service.
86      *
87      * @param service The service to enabled or disable
88      * @param isEnabled whether the service should be enabled or disabled
89      * @param userId the id of the user requesting the services
90      */
setPrintServiceEnabled(in ComponentName service, boolean isEnabled, int userId)91     void setPrintServiceEnabled(in ComponentName service, boolean isEnabled, int userId);
92 
93     /**
94      * Listen for changes to the print service recommendations.
95      *
96      * @param listener the listener to add
97      * @param userId the id of the user listening
98      *
99      * @see android.print.PrintManager#getPrintServiceRecommendations
100      */
addPrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener, int userId)101     void addPrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener,
102             int userId);
103 
104     /**
105      * Stop listening for changes to the print service recommendations.
106      *
107      * @param listener the listener to remove
108      * @param userId the id of the user requesting the removal
109      *
110      * @see android.print.PrintManager#getPrintServiceRecommendations
111      */
removePrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener, int userId)112     void removePrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener,
113             int userId);
114 
115     /**
116      * Get the print service recommendations.
117      *
118      * @param userId the id of the user requesting the recommendations
119      *
120      * @return the list of selected print services.
121      */
getPrintServiceRecommendations(int userId)122     List<RecommendationInfo> getPrintServiceRecommendations(int userId);
123 
createPrinterDiscoverySession(in IPrinterDiscoveryObserver observer, int userId)124     void createPrinterDiscoverySession(in IPrinterDiscoveryObserver observer, int userId);
startPrinterDiscovery(in IPrinterDiscoveryObserver observer, in List<PrinterId> priorityList, int userId)125     void startPrinterDiscovery(in IPrinterDiscoveryObserver observer,
126             in List<PrinterId> priorityList, int userId);
stopPrinterDiscovery(in IPrinterDiscoveryObserver observer, int userId)127     void stopPrinterDiscovery(in IPrinterDiscoveryObserver observer, int userId);
validatePrinters(in List<PrinterId> printerIds, int userId)128     void validatePrinters(in List<PrinterId> printerIds, int userId);
startPrinterStateTracking(in PrinterId printerId, int userId)129     void startPrinterStateTracking(in PrinterId printerId, int userId);
130 
131     /**
132      * Get the custom icon for a printer. If the icon is not cached, the icon is
133      * requested asynchronously. Once it is available the printer is updated.
134      *
135      * @param printerId the id of the printer the icon should be loaded for
136      * @param userId the id of the user requesting the printer
137      * @return the custom icon to be used for the printer or null if the icon is
138      *         not yet available
139      * @see android.print.PrinterInfo.Builder#setHasCustomPrinterIcon()
140      */
getCustomPrinterIcon(in PrinterId printerId, int userId)141     Icon getCustomPrinterIcon(in PrinterId printerId, int userId);
142 
stopPrinterStateTracking(in PrinterId printerId, int userId)143     void stopPrinterStateTracking(in PrinterId printerId, int userId);
destroyPrinterDiscoverySession(in IPrinterDiscoveryObserver observer, int userId)144     void destroyPrinterDiscoverySession(in IPrinterDiscoveryObserver observer,
145             int userId);
146 
147     /**
148      * Check if the system will bind to print services in intant app.
149      *
150      * @param userId the Id of the user the behavior should be checked for
151      *
152      * @return {@code true} iff the system will bind to print services in instant apps.
153      */
getBindInstantServiceAllowed(int userId)154     boolean getBindInstantServiceAllowed(int userId);
155 
156     /**
157      * Set if the system will bind to print services in intant app.
158      *
159      * @param userId the Id of the user the behavior should be changed for
160      * @param allows iff {@code true} the system will bind to print services in instant apps
161      */
setBindInstantServiceAllowed(int userId, boolean allowed)162     void setBindInstantServiceAllowed(int userId, boolean allowed);
163 }
164