Expand apps' control over the settings restore process

Applications can now specify two more aspects of the restore process:  whether
they need to run with their own custom Application subclass rather than being
launched in the usual restricted mode during restore, and whether it's okay for
the backup manager to kill the app process once restore has completed.  The new
manifest attributes for these are, respectively, android:restoreNeedsApplication
and android:killAfterRestore.

If unspecified in the manifest, restoreNeedsApplication is false, and
killAfterRestore is true.

In order to support kill-after-restore cleanly, this change also adds a new
system-process-only interface to the Activity Manager, which will schedule a
"commit suicide" event on the target app's main thread looper.

The framework backup agents have been given the appropriate new backup
attributes as well.
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 0a42a6f..8839f95 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -184,7 +184,29 @@
      * {@hide}
      */
     public static final int FLAG_ALLOW_BACKUP = 1<<14;
-    
+
+    /**
+     * Value for {@link #flags}: this is false if the application has set
+     * its android:killAfterRestore to false, true otherwise.
+     *
+     * <p>If android:allowBackup is set to false or no android:backupAgent
+     * is specified, this flag will be ignored.
+     *
+     * {@hide}
+     */
+    public static final int FLAG_KILL_AFTER_RESTORE = 1<<15;
+
+    /**
+     * Value for {@link #flags}: this is true if the application has set
+     * its android:restoreNeedsApplication to true, false otherwise.
+     *
+     * <p>If android:allowBackup is set to false or no android:backupAgent
+     * is specified, this flag will be ignored.
+     *
+     * {@hide}
+     */
+    public static final int FLAG_RESTORE_NEEDS_APPLICATION = 1<<16;
+
     /**
      * Flags associated with the application.  Any combination of
      * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
@@ -193,7 +215,8 @@
      * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
      * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
      * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
-     * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_RESIZEABLE_FOR_SCREENS}.
+     * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_RESIZEABLE_FOR_SCREENS},
+     * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}.
      */
     public int flags = 0;