Merge "Fix an issue where the return value is null when retrieving shortcut" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f049770c99
@@ -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";
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user