Fix an issue where the return value is null when retrieving shortcut

Some testing devices were flashed to a build which contains a previous
version of AppSearchShortcutInfo, the schema wasn't in use and should be
updated to the latest version directly.

Bug: 185186093
Test: manual
Change-Id: Ie9b8a0d59611498909b5c78eca65fe563a65004b
(cherry picked from commit b0a39a0b5cc5d991d71f74b55ee37ac2c9d52d76)
diff --git a/core/java/android/content/pm/AppSearchShortcutInfo.java b/core/java/android/content/pm/AppSearchShortcutInfo.java
index 6d5829c..eb50924 100644
--- a/core/java/android/content/pm/AppSearchShortcutInfo.java
+++ b/core/java/android/content/pm/AppSearchShortcutInfo.java
@@ -52,7 +52,7 @@
 
     /** The name of the schema type for {@link ShortcutInfo} documents.*/
     public static final String SCHEMA_TYPE = "Shortcut";
-    public static final int SCHEMA_VERSION = 1;
+    public static final int SCHEMA_VERSION = 2;
 
     public static final String KEY_ACTIVITY = "activity";
     public static final String KEY_SHORT_LABEL = "shortLabel";
diff --git a/services/core/java/com/android/server/pm/ShortcutPackage.java b/services/core/java/com/android/server/pm/ShortcutPackage.java
index e222df0..c462a6c 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackage.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackage.java
@@ -264,7 +264,7 @@
     public ShortcutInfo findShortcutById(@Nullable final String id) {
         if (id == null) return null;
         final List<ShortcutInfo> ret = getShortcutById(Collections.singleton(id));
-        return ret.isEmpty() ? null : ret.get(0);
+        return (ret == null || ret.isEmpty()) ? null : ret.get(0);
     }
 
     public boolean isShortcutExistsAndInvisibleToPublisher(String id) {
@@ -2361,7 +2361,7 @@
         });
     }
 
-    @NonNull
+    @Nullable
     private List<ShortcutInfo> getShortcutById(@NonNull final Collection<String> ids) {
         final List<String> shortcutIds = new ArrayList<>(1);
         for (String id : ids) {
@@ -2525,7 +2525,8 @@
     private AndroidFuture<AppSearchSession> setupSchema(
             @NonNull final AppSearchSession session) {
         SetSchemaRequest.Builder schemaBuilder = new SetSchemaRequest.Builder()
-                .addSchemas(AppSearchPerson.SCHEMA, AppSearchShortcutInfo.SCHEMA);
+                .addSchemas(AppSearchPerson.SCHEMA, AppSearchShortcutInfo.SCHEMA)
+                .setForceOverride(true);
         for (PackageIdentifier pi : mPackageIdentifiers.values()) {
             schemaBuilder = schemaBuilder
                     .setSchemaTypeVisibilityForPackage(