Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40b5d302 authored by Pinyao Ting's avatar Pinyao Ting Committed by android-build-team Robot
Browse files

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 b0a39a0b)
parent 5087d108
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public class AppSearchShortcutInfo extends GenericDocument {

    /** 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";
+4 −3
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ class ShortcutPackage extends ShortcutPackageItem {
    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 @@ class ShortcutPackage extends ShortcutPackageItem {
        });
    }

    @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 @@ class ShortcutPackage extends ShortcutPackageItem {
    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(