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

Commit 446067c7 authored by Cassie Wang's avatar Cassie Wang
Browse files

Fix package access bug.

Bug where we weren't passing the PackageIdentifiers from the
SetSchemaRequest properly.

Bug: 179416188
Test: atest -m -c --rebuild-module-info CtsAppSearchTestCases
Change-Id: Ie51a27a728ae7a2f25960ab47ee4054a56ed6abe
parent 076669f9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class AppSearchManagerService extends SystemService {
                        schemasPackageAccessibleBundles.entrySet()) {
                    List<PackageIdentifier> packageIdentifiers =
                            new ArrayList<>(entry.getValue().size());
                    for (int i = 0; i < packageIdentifiers.size(); i++) {
                    for (int i = 0; i < entry.getValue().size(); i++) {
                        packageIdentifiers.add(new PackageIdentifier(entry.getValue().get(i)));
                    }
                    schemasPackageAccessible.put(entry.getKey(), packageIdentifiers);
+1 −1
Original line number Diff line number Diff line
@@ -317,7 +317,7 @@ public final class AppSearchImpl {
            }

            Map<String, List<PackageIdentifier>> prefixedSchemasPackageAccessible =
                    new ArrayMap<>(schemasNotPlatformSurfaceable.size());
                    new ArrayMap<>(schemasPackageAccessible.size());
            for (Map.Entry<String, List<PackageIdentifier>> entry :
                    schemasPackageAccessible.entrySet()) {
                prefixedSchemasPackageAccessible.put(prefix + entry.getKey(), entry.getValue());
+10 −4
Original line number Diff line number Diff line
@@ -37,8 +37,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * This test class adapts the AppSearch Framework API to ListenableFuture, so it can be tested via
 * a consistent interface.
 * This test class adapts the AppSearch Framework API to ListenableFuture, so it can be tested via a
 * consistent interface.
 *
 * @hide
 */
public class GlobalSearchSessionShimImpl implements GlobalSearchSessionShim {
@@ -47,7 +48,13 @@ public class GlobalSearchSessionShimImpl implements GlobalSearchSessionShim {

    @NonNull
    public static ListenableFuture<GlobalSearchSessionShim> createGlobalSearchSession() {
        Context context = ApplicationProvider.getApplicationContext();
        return createGlobalSearchSession(ApplicationProvider.getApplicationContext());
    }

    /** Only for use when called from a non-instrumented context. */
    @NonNull
    public static ListenableFuture<GlobalSearchSessionShim> createGlobalSearchSession(
            @NonNull Context context) {
        AppSearchManager appSearchManager = context.getSystemService(AppSearchManager.class);
        SettableFuture<AppSearchResult<GlobalSearchSession>> future = SettableFuture.create();
        ExecutorService executor = Executors.newCachedThreadPool();
@@ -62,7 +69,6 @@ public class GlobalSearchSessionShimImpl implements GlobalSearchSessionShim {
            @NonNull GlobalSearchSession session, @NonNull ExecutorService executor) {
        mGlobalSearchSession = Preconditions.checkNotNull(session);
        mExecutor = Preconditions.checkNotNull(executor);

    }

    @NonNull