| 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 { |
| 40 |
List<PrintJobInfo> getPrintJobInfos(int appId, int userId); |
| 41 |
PrintJobInfo getPrintJobInfo(in PrintJobId printJobId, int appId, int userId); |
| 42 |
Bundle print(String printJobName, in IPrintDocumentAdapter printAdapter, |
| 43 |
in PrintAttributes attributes, String packageName, int appId, int userId); |
| 44 |
void cancelPrintJob(in PrintJobId printJobId, int appId, int userId); |
| 45 |
void restartPrintJob(in PrintJobId printJobId, int appId, int userId); |
| 46 |
|
| 47 |
void addPrintJobStateChangeListener(in IPrintJobStateChangeListener listener, |
| 48 |
int appId, 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 |
*/ |
| 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 |
*/ |
| 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 |
*/ |
| 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 |
*/ |
| 91 |
void setPrintServiceEnabled(in ComponentName service, boolean isEnabled, int userId); |
| 92 |
|
| 93 |
/** |
| 94 |
* Checks whether the given print service is enabled. |
| 95 |
* |
| 96 |
* @param service the service to check |
| 97 |
* @param userId the id of the user requesting the check |
| 98 |
* @return whether the given print service is enabled |
| 99 |
*/ |
| 100 |
boolean isPrintServiceEnabled(in ComponentName service, int userId); |
| 101 |
|
| 102 |
/** |
| 103 |
* Listen for changes to the print service recommendations. |
| 104 |
* |
| 105 |
* @param listener the listener to add |
| 106 |
* @param userId the id of the user listening |
| 107 |
* |
| 108 |
* @see android.print.PrintManager#getPrintServiceRecommendations |
| 109 |
*/ |
| 110 |
void addPrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener, |
| 111 |
int userId); |
| 112 |
|
| 113 |
/** |
| 114 |
* Stop listening for changes to the print service recommendations. |
| 115 |
* |
| 116 |
* @param listener the listener to remove |
| 117 |
* @param userId the id of the user requesting the removal |
| 118 |
* |
| 119 |
* @see android.print.PrintManager#getPrintServiceRecommendations |
| 120 |
*/ |
| 121 |
void removePrintServiceRecommendationsChangeListener(in IRecommendationsChangeListener listener, |
| 122 |
int userId); |
| 123 |
|
| 124 |
/** |
| 125 |
* Get the print service recommendations. |
| 126 |
* |
| 127 |
* @param userId the id of the user requesting the recommendations |
| 128 |
* |
| 129 |
* @return the list of selected print services. |
| 130 |
*/ |
| 131 |
List<RecommendationInfo> getPrintServiceRecommendations(int userId); |
| 132 |
|
| 133 |
void createPrinterDiscoverySession(in IPrinterDiscoveryObserver observer, int userId); |
| 134 |
void startPrinterDiscovery(in IPrinterDiscoveryObserver observer, |
| 135 |
in List<PrinterId> priorityList, int userId); |
| 136 |
void stopPrinterDiscovery(in IPrinterDiscoveryObserver observer, int userId); |
| 137 |
void validatePrinters(in List<PrinterId> printerIds, int userId); |
| 138 |
void startPrinterStateTracking(in PrinterId printerId, int userId); |
| 139 |
|
| 140 |
/** |
| 141 |
* Get the custom icon for a printer. If the icon is not cached, the icon is |
| 142 |
* requested asynchronously. Once it is available the printer is updated. |
| 143 |
* |
| 144 |
* @param printerId the id of the printer the icon should be loaded for |
| 145 |
* @param userId the id of the user requesting the printer |
| 146 |
* @return the custom icon to be used for the printer or null if the icon is |
| 147 |
* not yet available |
| 148 |
* @see android.print.PrinterInfo.Builder#setHasCustomPrinterIcon() |
| 149 |
*/ |
| 150 |
Icon getCustomPrinterIcon(in PrinterId printerId, int userId); |
| 151 |
|
| 152 |
void stopPrinterStateTracking(in PrinterId printerId, int userId); |
| 153 |
void destroyPrinterDiscoverySession(in IPrinterDiscoveryObserver observer, |
| 154 |
int userId); |
| 155 |
|
| 156 |
/** |
| 157 |
* Check if the system will bind to print services in intant app. |
| 158 |
* |
| 159 |
* @param userId the Id of the user the behavior should be checked for |
| 160 |
* |
| 161 |
* @return {@code true} iff the system will bind to print services in instant apps. |
| 162 |
*/ |
| 163 |
boolean getBindInstantServiceAllowed(int userId); |
| 164 |
|
| 165 |
/** |
| 166 |
* Set if the system will bind to print services in intant app. |
| 167 |
* |
| 168 |
* @param userId the Id of the user the behavior should be changed for |
| 169 |
* @param allows iff {@code true} the system will bind to print services in instant apps |
| 170 |
*/ |
| 171 |
void setBindInstantServiceAllowed(int userId, boolean allowed); |
| 172 |
} |