PackageInstaller: add permission granting support

Add support to PackageInstaller for allowing the user to grant
permissions to other apps. The user is involved in the decision,
and can approve or reject permissions.

Applications can make a request to PackageInstaller using something
like the following code:

  private void onPromptPermissionsClicked(String... permissions) {
    Intent i = getActivity().getApplication()
               .getPackageManager().requestPermission(permissions);
    startActivityForResult(i, 0);
  }

This code reuses the sideloading upgrade flow when adding permissions,
making the UI very familiar to someone who's sideloaded applications.
Conceptually, we are treating a permission grant as a reinstall of the
application with new permissions.

Change-Id: Ia37f761e5574a490d1d37b9eb40cf5e77c928a40
3 files changed