14b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov/*
24b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * Copyright (C) 2013 The Android Open Source Project
34b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov *
44b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * Licensed under the Apache License, Version 2.0 (the "License");
54b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * you may not use this file except in compliance with the License.
64b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * You may obtain a copy of the License at
74b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov *
84b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov *      http://www.apache.org/licenses/LICENSE-2.0
94b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov *
104b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * Unless required by applicable law or agreed to in writing, software
114b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * distributed under the License is distributed on an "AS IS" BASIS,
124b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * See the License for the specific language governing permissions and
144b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * limitations under the License.
154b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov */
164b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov
174b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganovpackage android.print;
184b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov
1966c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmannimport android.content.ComponentName;
20bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmannimport android.graphics.drawable.Icon;
217bfbbcb04bf4ba8f3069b2df136f708c9849bacfSvetoslavimport android.os.Bundle;
2244720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganovimport android.print.IPrinterDiscoveryObserver;
23a00271533f639c8ed36429c663889ac9f654bc72Svetoslav Ganovimport android.print.IPrintDocumentAdapter;
242fbd2a7f070f246ddafd9de94efa9a98861e9136Svetoslavimport android.print.PrintJobId;
25704697b6197262678e930daa831a1916ddee4dcfSvetoslav Ganovimport android.print.IPrintJobStateChangeListener;
2666c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmannimport android.print.IPrintServicesChangeListener;
279dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmannimport android.printservice.recommendation.IRecommendationsChangeListener;
2844720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganovimport android.print.PrinterId;
294b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganovimport android.print.PrintJobInfo;
304b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganovimport android.print.PrintAttributes;
319dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmannimport android.printservice.recommendation.RecommendationInfo;
32860f8a6b663ca96d30d17da09eca8caf065aae62Svetoslav Ganovimport android.printservice.PrintServiceInfo;
334b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov
344b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov/**
354b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * Interface for communication with the core print manager service.
364b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov *
374b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov * @hide
384b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov */
394b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganovinterface IPrintManager {
40a00271533f639c8ed36429c663889ac9f654bc72Svetoslav Ganov    List<PrintJobInfo> getPrintJobInfos(int appId, int userId);
412fbd2a7f070f246ddafd9de94efa9a98861e9136Svetoslav    PrintJobInfo getPrintJobInfo(in PrintJobId printJobId, int appId, int userId);
427bfbbcb04bf4ba8f3069b2df136f708c9849bacfSvetoslav    Bundle print(String printJobName, in IPrintDocumentAdapter printAdapter,
437bfbbcb04bf4ba8f3069b2df136f708c9849bacfSvetoslav            in PrintAttributes attributes, String packageName, int appId, int userId);
442fbd2a7f070f246ddafd9de94efa9a98861e9136Svetoslav    void cancelPrintJob(in PrintJobId printJobId, int appId, int userId);
452fbd2a7f070f246ddafd9de94efa9a98861e9136Svetoslav    void restartPrintJob(in PrintJobId printJobId, int appId, int userId);
4644720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov
47704697b6197262678e930daa831a1916ddee4dcfSvetoslav Ganov    void addPrintJobStateChangeListener(in IPrintJobStateChangeListener listener,
48704697b6197262678e930daa831a1916ddee4dcfSvetoslav Ganov            int appId, int userId);
49704697b6197262678e930daa831a1916ddee4dcfSvetoslav Ganov    void removePrintJobStateChangeListener(in IPrintJobStateChangeListener listener,
50704697b6197262678e930daa831a1916ddee4dcfSvetoslav Ganov            int userId);
51704697b6197262678e930daa831a1916ddee4dcfSvetoslav Ganov
5266c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    /**
5366c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * Listen for changes to the installed and enabled print services.
5466c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
5566c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param listener the listener to add
5666c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param userId the id of the user listening
5766c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
5866c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @see android.print.PrintManager#getPrintServices(int, String)
5966c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     */
6066c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    void addPrintServicesChangeListener(in IPrintServicesChangeListener listener,
6166c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann            int userId);
6266c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann
6366c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    /**
6466c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * Stop listening for changes to the installed and enabled print services.
6566c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
6666c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param listener the listener to remove
6766c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param userId the id of the user requesting the removal
6866c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
6966c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @see android.print.PrintManager#getPrintServices(int, String)
7066c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     */
7166c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    void removePrintServicesChangeListener(in IPrintServicesChangeListener listener,
7266c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann            int userId);
7366c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann
7466c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    /**
7566c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * Get the print services.
7666c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
7766c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param selectionFlags flags selecting which services to get
7866c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param userId the id of the user requesting the services
7966c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
8066c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @return the list of selected print services.
8166c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     */
8266c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    List<PrintServiceInfo> getPrintServices(int selectionFlags, int userId);
8366c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann
8466c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    /**
8566c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * Enable or disable a print service.
8666c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     *
8766c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param service The service to enabled or disable
8866c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param isEnabled whether the service should be enabled or disabled
8966c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     * @param userId the id of the user requesting the services
9066c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann     */
9166c96591e2ddb464c67e60dbf4193ef4ec8a620bPhilip P. Moltmann    void setPrintServiceEnabled(in ComponentName service, boolean isEnabled, int userId);
92860f8a6b663ca96d30d17da09eca8caf065aae62Svetoslav Ganov
939dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann    /**
949dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * Listen for changes to the print service recommendations.
959dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     *
969dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @param listener the listener to add
979dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @param userId the id of the user listening
989dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     *
999dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @see android.print.PrintManager#getPrintServiceRecommendations
1009dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     */
1019dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann    void addPrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener,
1029dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann            int userId);
1039dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann
1049dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann    /**
1059dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * Stop listening for changes to the print service recommendations.
1069dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     *
1079dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @param listener the listener to remove
1089dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @param userId the id of the user requesting the removal
1099dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     *
1109dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @see android.print.PrintManager#getPrintServiceRecommendations
1119dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     */
1129dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann    void removePrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener,
1139dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann            int userId);
1149dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann
1159dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann    /**
1169dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * Get the print service recommendations.
1179dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     *
1189dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @param userId the id of the user requesting the recommendations
1199dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     *
1209dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     * @return the list of selected print services.
1219dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann     */
1229dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann    List<RecommendationInfo> getPrintServiceRecommendations(int userId);
1239dcb86a48d73f399fb1b5c020005d76d350eeac2Philip P. Moltmann
12444720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov    void createPrinterDiscoverySession(in IPrinterDiscoveryObserver observer, int userId);
12544720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov    void startPrinterDiscovery(in IPrinterDiscoveryObserver observer,
12644720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov            in List<PrinterId> priorityList, int userId);
12744720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov    void stopPrinterDiscovery(in IPrinterDiscoveryObserver observer, int userId);
128d26d4898fcc9b78f4b66118895c375384098205eSvetoslav Ganov    void validatePrinters(in List<PrinterId> printerIds, int userId);
129d26d4898fcc9b78f4b66118895c375384098205eSvetoslav Ganov    void startPrinterStateTracking(in PrinterId printerId, int userId);
130bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann
131bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann    /**
132bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     * Get the custom icon for a printer. If the icon is not cached, the icon is
133bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     * requested asynchronously. Once it is available the printer is updated.
134bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     *
135bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     * @param printerId the id of the printer the icon should be loaded for
136bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     * @param userId the id of the user requesting the printer
137bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     * @return the custom icon to be used for the printer or null if the icon is
138bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     *         not yet available
139bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     * @see android.print.PrinterInfo.Builder#setHasCustomPrinterIcon()
140bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann     */
141bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann    Icon getCustomPrinterIcon(in PrinterId printerId, int userId);
142bb9f686b40743df2642b7d3b7778dbf7284ae665Philip P. Moltmann
143d26d4898fcc9b78f4b66118895c375384098205eSvetoslav Ganov    void stopPrinterStateTracking(in PrinterId printerId, int userId);
14444720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov    void destroyPrinterDiscoverySession(in IPrinterDiscoveryObserver observer,
14544720af55a8fdf991929983dad5d53c02851dd1eSvetoslav Ganov            int userId);
1464b9a4d16872bbb50712e007b419ac0b35ff1582dSvetoslav Ganov}
147