103 lines
4.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (c) 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.printspooler">
<!-- Allows an application to call APIs that give it access to all print jobs
on the device. Usually an app can access only the print jobs it created. -->
<permission
android:name="com.android.printspooler.permission.ACCESS_ALL_PRINT_JOBS"
android:protectionLevel="signature" />
<!-- May be required by the settings and add printer activities of a
print service if the developer wants only trusted system code to
be able to launch these activities. -->
<permission android:name="android.permission.START_PRINT_SERVICE_CONFIG_ACTIVITY"
android:protectionLevel="signature" />
<uses-permission android:name="com.android.printspooler.permission.ACCESS_ALL_PRINT_JOBS"/>
First cut of the print notifications. 1. Added notifications for a queued print job, for a started print job, for ongoing canceling a print job, and for a failed print job. The notifications for queued and started state have a cancel action. The notification for failed print job has a cancel and a restart action. 2. Propagating failure message from the print service to the notifications. 3. PrintJobConfigActivity was not setting the initial value for the print job copies and was not updating the UI immediately after creation. 4. Refactored PrintJobConfigActivity to avoid using the hack to avoid reaction for item selection change in a spinner for an event that happened before the callback was registered. 5. Removed the label attribute from PrinterInfo and now PrinterId is composed of the printer name and the service component name. This is nice since for restarting print jobs we do not need to store information about the printer except the printer id which is already part of the PrintJobInfo's data. Also the printer name is not expected to change anyway. 6. Allowing cancellation of a queued print job. Also no print job is cancelled without asking the managing print service to do that. Before we were immediately canceling print jobs in queued state but it was possible for a buggy print service to not set the print job state to started before starting to do expensive work that will not be canceled. 7. PrintServiceInfo was throwing an exception the the meta-data XML for the print service was not well-formed which would crash the system process. Now we just ignore not well-formed meta-data. 8. Removed unused permissions from the PrintSpooler's manifest. Change-Id: Iba2dd14b487f56e137b90d1da17c3033422ab5e6
2013-08-02 14:22:19 -07:00
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.START_PRINT_SERVICE_CONFIG_ACTIVITY"/>
<uses-permission android:name="android.permission.READ_PRINT_SERVICES" />
<uses-permission android:name="android.permission.READ_PRINT_SERVICE_RECOMMENDATIONS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<queries>
<intent>
<action android:name="android.printservice.PrintService" />
</intent>
</queries>
<application
android:allowClearUserData="true"
android:label="@string/app_label"
android:icon="@drawable/ic_app_icon"
android:supportsRtl="true">
<service
android:name=".model.PrintSpoolerService"
android:exported="true"
android:permission="android.permission.BIND_PRINT_SPOOLER_SERVICE">
</service>
<service
android:name=".renderer.PdfManipulationService"
android:isolatedProcess="true"
android:process=":renderer">
</service>
<activity
android:name=".ui.PrintActivity"
android:configChanges="mnc|mnc|touchscreen|navigation|screenLayout|screenSize|smallestScreenSize|orientation|locale|keyboard|keyboardHidden|fontScale|uiMode|layoutDirection|density"
Refactor how the print dialog activity is started. 1. Before the print job activity was started asyncronously with respect to the print call on to the print manager. This was creating a situation where the starting activity may finish before the print dialog appears which may lead to an orphaned print document adapter with no data to print (as the UI is is gone), or strange behaviors where the print dialog starts on as a separate task. To address this the pending intent for starting the print dialog is not started by the print spooler since we cannot call into it synchronously as we have to start its process and bind to the spooler service which leads to jankyness in the client app. Now the pending intent is created by the print manager service in the synchronous print call so from an app's perspective calling print starts the activity. The side effect of this design is that the print dialog activity may start before the system is bound to the spooler service. In such a case the print activity cannot start poking the print spooler state as the system registers callback to observe the spooler state. To address this the print spooler activity disables the UI and also binds to the spooler service which happenes immediately after it is started. As soon as the print dialog binds to the service it starts the UI. 2. Fixed an bug in the printer adapter of the print dialog that was leading to a crash if the only item in the adater is the all pritners option and it is selected. 3. Piping the package name that started the printing so we can pass it to the storage UI as a hint to open the last location the app used. bug:11127269 Change-Id: Ia93820bdae0b0e7600a0930b1f10d9708bd86b68
2013-10-10 13:36:23 -07:00
android:permission="android.permission.BIND_PRINT_SPOOLER_SERVICE"
Add "app printer activity" and always keep the print service state updated. Also fiddle with the UI to use more standard values. To be sure the print service state alwasy updated I changed PrintManager.getPrintServices to return a loader which just wraps a registerListener/getList/removeListener combo. I also added a new function to enabled/disable a print service to be keep all updating logic inside the PrintManagerService->UserState. Then I changed all code to use this new interface. Detailed comments: PrintServiceInfo: - I had to add the enabled state to the PrintServiceInfo as some users of PrintManager.getPrintServices want all services but then display different data depending on the enabled state. Of course I could have created two PrintManager.getPrintServices-loaders to load the two separate list of services. I think it is much easier to add this property though. It is updated every time new data is returned to the PrintManager.getPrintServices-loader. AddPrinterActivity: - This is shown as a dialog-style overlay to indicate that the user will return to the select-printers activity. It contains of three list that are updated via separate loaders. - The recommended services will be added later to keep this path set small. PrintActivity: - There are two small places where we have to update the data when we get a new list of print services. - In very, very rare conditions it can happen that the print service of the current printer gains or looses the "advancedOptions" activity - If we have no enabled print services we want to show "Add printer" instead of "All printers...". - Also the print registry is not the only loader anymore, hence we have to assign loader ids to it to not conflict with the other loaders in this activity. - Small bug in onPrintersChanged: If a printer is selected and the print service of this printer gets disabled the holder goes into "removed" state which disables the printer. When the print service is then enabled again, we forgot to re-enable the holder. PrinterRegistry: - The registry assumed that the FusedPrinterProvider was the only loader in the activity. This is not true anymore, hence it has to assign the appropriate loader ids. - The FusedPrinterProvider has an internal loader, hence we have to forward a loader Id into it. - The PrintRegistry is only called backed for a single loader, hence no need to check the loader-id. SelectPrinterActivity: - The AddPrinterDialog was removed as we now have the AddPrinterActivity. - Added a loader for the enabled services to update the empty state. - Added dedicated loader Id for the PrinterRegistry again. - If we have no enabled services, the SelectPrinterActivity chainloads the AddPrinterActivity as this is the only thing the user can do anyway. "Save a click". This should only happen when the activity is create the first time. - Moved the "add printer" from the menu item to the list of printers as suggested by UX and Zach. PrintManagerService, UserState and IPrintManagerParamtersTest: - As the only place where the print service state is updated is now the userstate, we have no more sychronization problems. Whohoo. - The users can now register for changes to the print services similar as they can register for changes to the print jobs. - UserState.getPrintServices is the only function can exposes any knowledge of the print services to the outside world. Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
2016-02-24 11:32:43 -08:00
android:theme="@style/Theme.PrintActivity">
Refactor how the print dialog activity is started. 1. Before the print job activity was started asyncronously with respect to the print call on to the print manager. This was creating a situation where the starting activity may finish before the print dialog appears which may lead to an orphaned print document adapter with no data to print (as the UI is is gone), or strange behaviors where the print dialog starts on as a separate task. To address this the pending intent for starting the print dialog is not started by the print spooler since we cannot call into it synchronously as we have to start its process and bind to the spooler service which leads to jankyness in the client app. Now the pending intent is created by the print manager service in the synchronous print call so from an app's perspective calling print starts the activity. The side effect of this design is that the print dialog activity may start before the system is bound to the spooler service. In such a case the print activity cannot start poking the print spooler state as the system registers callback to observe the spooler state. To address this the print spooler activity disables the UI and also binds to the spooler service which happenes immediately after it is started. As soon as the print dialog binds to the service it starts the UI. 2. Fixed an bug in the printer adapter of the print dialog that was leading to a crash if the only item in the adater is the all pritners option and it is selected. 3. Piping the package name that started the printing so we can pass it to the storage UI as a hint to open the last location the app used. bug:11127269 Change-Id: Ia93820bdae0b0e7600a0930b1f10d9708bd86b68
2013-10-10 13:36:23 -07:00
<intent-filter>
<action android:name="android.print.PRINT_DIALOG" />
Refactor how the print dialog activity is started. 1. Before the print job activity was started asyncronously with respect to the print call on to the print manager. This was creating a situation where the starting activity may finish before the print dialog appears which may lead to an orphaned print document adapter with no data to print (as the UI is is gone), or strange behaviors where the print dialog starts on as a separate task. To address this the pending intent for starting the print dialog is not started by the print spooler since we cannot call into it synchronously as we have to start its process and bind to the spooler service which leads to jankyness in the client app. Now the pending intent is created by the print manager service in the synchronous print call so from an app's perspective calling print starts the activity. The side effect of this design is that the print dialog activity may start before the system is bound to the spooler service. In such a case the print activity cannot start poking the print spooler state as the system registers callback to observe the spooler state. To address this the print spooler activity disables the UI and also binds to the spooler service which happenes immediately after it is started. As soon as the print dialog binds to the service it starts the UI. 2. Fixed an bug in the printer adapter of the print dialog that was leading to a crash if the only item in the adater is the all pritners option and it is selected. 3. Piping the package name that started the printing so we can pass it to the storage UI as a hint to open the last location the app used. bug:11127269 Change-Id: Ia93820bdae0b0e7600a0930b1f10d9708bd86b68
2013-10-10 13:36:23 -07:00
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="printjob" android:pathPattern="*" />
</intent-filter>
</activity>
<activity
android:name=".ui.SelectPrinterActivity"
android:label="@string/all_printers_label"
Add "app printer activity" and always keep the print service state updated. Also fiddle with the UI to use more standard values. To be sure the print service state alwasy updated I changed PrintManager.getPrintServices to return a loader which just wraps a registerListener/getList/removeListener combo. I also added a new function to enabled/disable a print service to be keep all updating logic inside the PrintManagerService->UserState. Then I changed all code to use this new interface. Detailed comments: PrintServiceInfo: - I had to add the enabled state to the PrintServiceInfo as some users of PrintManager.getPrintServices want all services but then display different data depending on the enabled state. Of course I could have created two PrintManager.getPrintServices-loaders to load the two separate list of services. I think it is much easier to add this property though. It is updated every time new data is returned to the PrintManager.getPrintServices-loader. AddPrinterActivity: - This is shown as a dialog-style overlay to indicate that the user will return to the select-printers activity. It contains of three list that are updated via separate loaders. - The recommended services will be added later to keep this path set small. PrintActivity: - There are two small places where we have to update the data when we get a new list of print services. - In very, very rare conditions it can happen that the print service of the current printer gains or looses the "advancedOptions" activity - If we have no enabled print services we want to show "Add printer" instead of "All printers...". - Also the print registry is not the only loader anymore, hence we have to assign loader ids to it to not conflict with the other loaders in this activity. - Small bug in onPrintersChanged: If a printer is selected and the print service of this printer gets disabled the holder goes into "removed" state which disables the printer. When the print service is then enabled again, we forgot to re-enable the holder. PrinterRegistry: - The registry assumed that the FusedPrinterProvider was the only loader in the activity. This is not true anymore, hence it has to assign the appropriate loader ids. - The FusedPrinterProvider has an internal loader, hence we have to forward a loader Id into it. - The PrintRegistry is only called backed for a single loader, hence no need to check the loader-id. SelectPrinterActivity: - The AddPrinterDialog was removed as we now have the AddPrinterActivity. - Added a loader for the enabled services to update the empty state. - Added dedicated loader Id for the PrinterRegistry again. - If we have no enabled services, the SelectPrinterActivity chainloads the AddPrinterActivity as this is the only thing the user can do anyway. "Save a click". This should only happen when the activity is create the first time. - Moved the "add printer" from the menu item to the list of printers as suggested by UX and Zach. PrintManagerService, UserState and IPrintManagerParamtersTest: - As the only place where the print service state is updated is now the userstate, we have no more sychronization problems. Whohoo. - The users can now register for changes to the print services similar as they can register for changes to the print jobs. - UserState.getPrintServices is the only function can exposes any knowledge of the print services to the outside world. Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
2016-02-24 11:32:43 -08:00
android:theme="@style/Theme.SelectPrinterActivity"
android:parentActivityName=".ui.PrintActivity"
Add "app printer activity" and always keep the print service state updated. Also fiddle with the UI to use more standard values. To be sure the print service state alwasy updated I changed PrintManager.getPrintServices to return a loader which just wraps a registerListener/getList/removeListener combo. I also added a new function to enabled/disable a print service to be keep all updating logic inside the PrintManagerService->UserState. Then I changed all code to use this new interface. Detailed comments: PrintServiceInfo: - I had to add the enabled state to the PrintServiceInfo as some users of PrintManager.getPrintServices want all services but then display different data depending on the enabled state. Of course I could have created two PrintManager.getPrintServices-loaders to load the two separate list of services. I think it is much easier to add this property though. It is updated every time new data is returned to the PrintManager.getPrintServices-loader. AddPrinterActivity: - This is shown as a dialog-style overlay to indicate that the user will return to the select-printers activity. It contains of three list that are updated via separate loaders. - The recommended services will be added later to keep this path set small. PrintActivity: - There are two small places where we have to update the data when we get a new list of print services. - In very, very rare conditions it can happen that the print service of the current printer gains or looses the "advancedOptions" activity - If we have no enabled print services we want to show "Add printer" instead of "All printers...". - Also the print registry is not the only loader anymore, hence we have to assign loader ids to it to not conflict with the other loaders in this activity. - Small bug in onPrintersChanged: If a printer is selected and the print service of this printer gets disabled the holder goes into "removed" state which disables the printer. When the print service is then enabled again, we forgot to re-enable the holder. PrinterRegistry: - The registry assumed that the FusedPrinterProvider was the only loader in the activity. This is not true anymore, hence it has to assign the appropriate loader ids. - The FusedPrinterProvider has an internal loader, hence we have to forward a loader Id into it. - The PrintRegistry is only called backed for a single loader, hence no need to check the loader-id. SelectPrinterActivity: - The AddPrinterDialog was removed as we now have the AddPrinterActivity. - Added a loader for the enabled services to update the empty state. - Added dedicated loader Id for the PrinterRegistry again. - If we have no enabled services, the SelectPrinterActivity chainloads the AddPrinterActivity as this is the only thing the user can do anyway. "Save a click". This should only happen when the activity is create the first time. - Moved the "add printer" from the menu item to the list of printers as suggested by UX and Zach. PrintManagerService, UserState and IPrintManagerParamtersTest: - As the only place where the print service state is updated is now the userstate, we have no more sychronization problems. Whohoo. - The users can now register for changes to the print services similar as they can register for changes to the print jobs. - UserState.getPrintServices is the only function can exposes any knowledge of the print services to the outside world. Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
2016-02-24 11:32:43 -08:00
android:exported="false">
</activity>
<activity
android:name=".ui.AddPrinterActivity"
android:label="@string/print_add_printer"
android:theme="@style/Theme.AddPrinterActivity"
android:parentActivityName=".ui.SelectPrinterActivity"
android:exported="false">
</activity>
First cut of the print notifications. 1. Added notifications for a queued print job, for a started print job, for ongoing canceling a print job, and for a failed print job. The notifications for queued and started state have a cancel action. The notification for failed print job has a cancel and a restart action. 2. Propagating failure message from the print service to the notifications. 3. PrintJobConfigActivity was not setting the initial value for the print job copies and was not updating the UI immediately after creation. 4. Refactored PrintJobConfigActivity to avoid using the hack to avoid reaction for item selection change in a spinner for an event that happened before the callback was registered. 5. Removed the label attribute from PrinterInfo and now PrinterId is composed of the printer name and the service component name. This is nice since for restarting print jobs we do not need to store information about the printer except the printer id which is already part of the PrintJobInfo's data. Also the printer name is not expected to change anyway. 6. Allowing cancellation of a queued print job. Also no print job is cancelled without asking the managing print service to do that. Before we were immediately canceling print jobs in queued state but it was possible for a buggy print service to not set the print job state to started before starting to do expensive work that will not be canceled. 7. PrintServiceInfo was throwing an exception the the meta-data XML for the print service was not well-formed which would crash the system process. Now we just ignore not well-formed meta-data. 8. Removed unused permissions from the PrintSpooler's manifest. Change-Id: Iba2dd14b487f56e137b90d1da17c3033422ab5e6
2013-08-02 14:22:19 -07:00
<receiver
android:name=".model.NotificationController$NotificationBroadcastReceiver"
First cut of the print notifications. 1. Added notifications for a queued print job, for a started print job, for ongoing canceling a print job, and for a failed print job. The notifications for queued and started state have a cancel action. The notification for failed print job has a cancel and a restart action. 2. Propagating failure message from the print service to the notifications. 3. PrintJobConfigActivity was not setting the initial value for the print job copies and was not updating the UI immediately after creation. 4. Refactored PrintJobConfigActivity to avoid using the hack to avoid reaction for item selection change in a spinner for an event that happened before the callback was registered. 5. Removed the label attribute from PrinterInfo and now PrinterId is composed of the printer name and the service component name. This is nice since for restarting print jobs we do not need to store information about the printer except the printer id which is already part of the PrintJobInfo's data. Also the printer name is not expected to change anyway. 6. Allowing cancellation of a queued print job. Also no print job is cancelled without asking the managing print service to do that. Before we were immediately canceling print jobs in queued state but it was possible for a buggy print service to not set the print job state to started before starting to do expensive work that will not be canceled. 7. PrintServiceInfo was throwing an exception the the meta-data XML for the print service was not well-formed which would crash the system process. Now we just ignore not well-formed meta-data. 8. Removed unused permissions from the PrintSpooler's manifest. Change-Id: Iba2dd14b487f56e137b90d1da17c3033422ab5e6
2013-08-02 14:22:19 -07:00
android:exported="false" >
</receiver>
</application>
</manifest>