Spooler should not crash if print service config activities are not exported.

1. If a print service does not export its activities for settings and
   adding printers the print spooler ignores them instead of crashing.
   Also if the service is not enabled its activities are now ignored.

2. Added a dedicated permission for a print service to optionally
   protect its settings and add printer activities such that only the
   system can bind to them.

3. Fixed a crash in the print dialog if its content is detached
   from the window and animators are running.

bug:10680224

Change-Id: I20b57d6622a15f9b2352ba78d04c44e67b316a15
diff --git a/packages/PrintSpooler/AndroidManifest.xml b/packages/PrintSpooler/AndroidManifest.xml
index 83ec1ad..9319025 100644
--- a/packages/PrintSpooler/AndroidManifest.xml
+++ b/packages/PrintSpooler/AndroidManifest.xml
@@ -22,17 +22,24 @@
         android:versionCode="1">
 
     <!-- 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.
-    -->
+         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:label="@string/permlab_accessAllPrintJobs"
         android:description="@string/permdesc_accessAllPrintJobs"
         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:label="@string/permlab_startPrintServiceConfigActivity"
+        android:description="@string/permdesc_startPrintServiceConfigActivity"
+        android:protectionLevel="signature" />
+
     <uses-permission android:name="com.android.printspooler.permission.ACCESS_ALL_PRINT_JOBS"/>
-    <uses-permission android:name="android.permission.ACCESS_ALL_PRINT_JOBS"/>
     <uses-permission android:name="android.permission.WAKE_LOCK"/>
+    <uses-permission android:name="android.permission.START_PRINT_SERVICE_CONFIG_ACTIVITY"/>
 
     <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="18"/>