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

Commit cfe00f41 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9101843 from b2689e03 to tm-qpr1-release

Change-Id: Ifdeeaa82d370f1407f296d46826984cf96d17105
parents 3bb8d8b8 b2689e03
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -15,6 +15,14 @@ filegroup {
        "**/*.java",
        "**/*.aidl",
    ],
    exclude_srcs: [
        // Remove election toolbar code from build time
        "android/service/selectiontoolbar/*.aidl",
        "android/service/selectiontoolbar/*.java",
        "android/view/selectiontoolbar/*.aidl",
        "android/view/selectiontoolbar/*.java",
        "com/android/internal/widget/floatingtoolbar/RemoteFloatingToolbarPopup.java",
    ],
    visibility: ["//frameworks/base"],
}

+0 −24
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@ import android.app.ambientcontext.AmbientContextManager;
import android.app.ambientcontext.IAmbientContextManager;
import android.app.appsearch.AppSearchManagerFrameworkInitializer;
import android.app.blob.BlobStoreManagerFrameworkInitializer;
import android.app.cloudsearch.CloudSearchManager;
import android.app.cloudsearch.ICloudSearchManager;
import android.app.contentsuggestions.ContentSuggestionsManager;
import android.app.contentsuggestions.IContentSuggestionsManager;
import android.app.job.JobSchedulerFrameworkInitializer;
@@ -230,8 +228,6 @@ import android.view.contentcapture.ContentCaptureManager;
import android.view.contentcapture.IContentCaptureManager;
import android.view.displayhash.DisplayHashManager;
import android.view.inputmethod.InputMethodManager;
import android.view.selectiontoolbar.ISelectionToolbarManager;
import android.view.selectiontoolbar.SelectionToolbarManager;
import android.view.textclassifier.TextClassificationManager;
import android.view.textservice.TextServicesManager;
import android.view.translation.ITranslationManager;
@@ -365,15 +361,6 @@ public final class SystemServiceRegistry {
                return new TextClassificationManager(ctx);
            }});

        registerService(Context.SELECTION_TOOLBAR_SERVICE, SelectionToolbarManager.class,
                new CachedServiceFetcher<SelectionToolbarManager>() {
                    @Override
                    public SelectionToolbarManager createService(ContextImpl ctx) {
                        IBinder b = ServiceManager.getService(Context.SELECTION_TOOLBAR_SERVICE);
                        return new SelectionToolbarManager(ctx.getOuterContext(),
                                ISelectionToolbarManager.Stub.asInterface(b));
                    }});

        registerService(Context.FONT_SERVICE, FontManager.class,
                new CachedServiceFetcher<FontManager>() {
            @Override
@@ -1231,17 +1218,6 @@ public final class SystemServiceRegistry {
                }
            });

        registerService(Context.CLOUDSEARCH_SERVICE, CloudSearchManager.class,
            new CachedServiceFetcher<CloudSearchManager>() {
                @Override
                public CloudSearchManager createService(ContextImpl ctx)
                    throws ServiceNotFoundException {
                    IBinder b = ServiceManager.getService(Context.CLOUDSEARCH_SERVICE);
                    return b == null ? null :
                        new CloudSearchManager(ICloudSearchManager.Stub.asInterface(b));
                }
            });

        registerService(Context.APP_PREDICTION_SERVICE, AppPredictionManager.class,
                new CachedServiceFetcher<AppPredictionManager>() {
            @Override
+10 −56
Original line number Diff line number Diff line
@@ -15,17 +15,15 @@
 */
package android.app.cloudsearch;

import static java.util.Objects.requireNonNull;

import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
import android.os.RemoteException;

import java.util.concurrent.Executor;

/**
 * A {@link CloudSearchManager} is the  class having all the information passed to search providers.
 *
@@ -57,11 +55,9 @@ public class CloudSearchManager {
        void onSearchFailed(@NonNull SearchRequest request, @NonNull SearchResponse response);
    }

    private final ICloudSearchManager mService;

    /** @hide **/
    public CloudSearchManager(@NonNull ICloudSearchManager service) {
        mService = service;
    public CloudSearchManager() {

    }

    /**
@@ -72,7 +68,6 @@ public class CloudSearchManager {
     * @param request          request to be searched.
     * @param callbackExecutor where the callback is invoked.
     * @param callback         invoked when the result is available.
     *
     * @hide
     */
    @SystemApi
@@ -80,49 +75,8 @@ public class CloudSearchManager {
    public void search(@NonNull SearchRequest request,
            @NonNull @CallbackExecutor Executor callbackExecutor,
            @NonNull CallBack callback) {
        try {
            mService.search(
                    requireNonNull(request),
                    new CallBackWrapper(
                        requireNonNull(request),
                        requireNonNull(callback),
                        requireNonNull(callbackExecutor)));
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    private final class CallBackWrapper extends
            ICloudSearchManagerCallback.Stub {
        @NonNull
        private final SearchRequest mSearchRequest;

        @NonNull
        private final CallBack mCallback;

        @NonNull
        private final Executor mCallbackExecutor;

        CallBackWrapper(
                SearchRequest searchRequest,
                CallBack callback,
                Executor callbackExecutor) {
            mSearchRequest = searchRequest;
            mCallback = callback;
            mCallbackExecutor = callbackExecutor;
        }


        @Override
        public void onSearchSucceeded(SearchResponse searchResponse) {
            mCallbackExecutor.execute(
                    () -> mCallback.onSearchSucceeded(mSearchRequest, searchResponse));
        }

        @Override
        public void onSearchFailed(SearchResponse searchResponse) {
            mCallbackExecutor.execute(
                    () -> mCallback.onSearchFailed(mSearchRequest, searchResponse));
        }
        callbackExecutor.execute(
                () -> callback.onSearchFailed(request,
                        new SearchResponse.Builder(SearchResponse.SEARCH_STATUS_UNKNOWN).build()));
    }
}
+0 −33
Original line number Diff line number Diff line
/**
 * Copyright (c) 2022, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.cloudsearch;

import android.app.cloudsearch.SearchRequest;
import android.app.cloudsearch.SearchResponse;
import android.app.cloudsearch.ICloudSearchManagerCallback;

/**
 * Used by {@link CloudSearchManager} to tell system server to do search.
 *
 * @hide
 */
oneway interface ICloudSearchManager {
  void search(in SearchRequest request, in ICloudSearchManagerCallback callBack);

  void returnResults(in IBinder token, in String requestId,
                     in SearchResponse response);
}
+0 −31
Original line number Diff line number Diff line
/**
 * Copyright (c) 2022, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.cloudsearch;

import android.app.cloudsearch.SearchResponse;


/**
 * Callback used by system server to notify invoker of {@link CloudSearchManager} of the result
 *
 * @hide
 */
oneway interface ICloudSearchManagerCallback {
  void onSearchSucceeded(in SearchResponse response);

  void onSearchFailed(in SearchResponse response);
}
Loading