ShortcutManager: finishing touches

- Change back the throttling quota to 10 calls / day
- Foreground apps are no longer throttled, and when an app comes to
foreground the call counter will be reset.
- When the system locale changes, reset throttling for all packages
for all users.
  See LocalService.onSystemLocaleChangedNoLock() for how it's performed.
  Because the reset must happen before any other apps have a chance to
  publish shortcuts, the logic is not straightforward.

- Added an internal API to reset the throttling upon inline-reply
from a notification.

- Stop supporting icons from "content:" URIs
- Improved javadoc on several APIs.

Also internal refactor needed to this:
- ShortcutUser.getAllPackages()/getAllLaunchers() are no longer
accessible to outer code to prevent accidentally adding/removing the
content.  Outer code should use forAllPackages() / forAllLaunchers().

Bug 27923857

Change-Id: I002511193d1d33718163bb1dabe77610bde58198
diff --git a/services/core/java/com/android/server/pm/ShortcutLauncher.java b/services/core/java/com/android/server/pm/ShortcutLauncher.java
index c6d66fe..76d47a8 100644
--- a/services/core/java/com/android/server/pm/ShortcutLauncher.java
+++ b/services/core/java/com/android/server/pm/ShortcutLauncher.java
@@ -57,15 +57,18 @@
      */
     final private ArrayMap<PackageWithUser, ArraySet<String>> mPinnedShortcuts = new ArrayMap<>();
 
-    private ShortcutLauncher(@UserIdInt int ownerUserId, @NonNull String packageName,
+    private ShortcutLauncher(@NonNull ShortcutUser shortcutUser,
+            @UserIdInt int ownerUserId, @NonNull String packageName,
             @UserIdInt int launcherUserId, ShortcutPackageInfo spi) {
-        super(launcherUserId, packageName, spi != null ? spi : ShortcutPackageInfo.newEmpty());
+        super(shortcutUser, launcherUserId, packageName,
+                spi != null ? spi : ShortcutPackageInfo.newEmpty());
         mOwnerUserId = ownerUserId;
     }
 
-    public ShortcutLauncher(@UserIdInt int ownerUserId, @NonNull String packageName,
+    public ShortcutLauncher(@NonNull ShortcutUser shortcutUser,
+            @UserIdInt int ownerUserId, @NonNull String packageName,
             @UserIdInt int launcherUserId) {
-        this(ownerUserId, packageName, launcherUserId, null);
+        this(shortcutUser, ownerUserId, packageName, launcherUserId, null);
     }
 
     @Override
@@ -179,8 +182,8 @@
     /**
      * Load.
      */
-    public static ShortcutLauncher loadFromXml(XmlPullParser parser, int ownerUserId,
-            boolean fromBackup) throws IOException, XmlPullParserException {
+    public static ShortcutLauncher loadFromXml(XmlPullParser parser, ShortcutUser shortcutUser,
+            int ownerUserId, boolean fromBackup) throws IOException, XmlPullParserException {
         final String launcherPackageName = ShortcutService.parseStringAttribute(parser,
                 ATTR_PACKAGE_NAME);
 
@@ -189,8 +192,8 @@
                 fromBackup ? ownerUserId
                 : ShortcutService.parseIntAttribute(parser, ATTR_LAUNCHER_USER_ID, ownerUserId);
 
-        final ShortcutLauncher ret = new ShortcutLauncher(launcherUserId, launcherPackageName,
-                launcherUserId);
+        final ShortcutLauncher ret = new ShortcutLauncher(shortcutUser, launcherUserId,
+                launcherPackageName, launcherUserId);
 
         ArraySet<String> ids = null;
         final int outerDepth = parser.getDepth();