• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.app.appsearch.aidl;
18 
19 import android.annotation.NonNull;
20 import android.app.appsearch.AppSearchResult;
21 import android.os.RemoteException;
22 
23 /**
24  * The base implementation class for {@link IAppSearchResultCallback}, which could extract {@link
25  * AppSearchResult} from either {@link AppSearchResultParcel} or {@link AppSearchResultParcelV2}.
26  *
27  * @param <ValueType> The type of result object for successful calls.
28  * @hide
29  */
30 public abstract class AppSearchResultCallback<ValueType> extends IAppSearchResultCallback.Stub {
31 
32     /**
33      * Invokes a callback function with an {@link AppSearchResult} that has been extracted from
34      * either an {@link AppSearchResultParcel} or an {@link AppSearchResultParcelV2}.
35      */
onResult(@onNull AppSearchResult<ValueType> result)36     public abstract void onResult(@NonNull AppSearchResult<ValueType> result);
37 
38     @Override
onResult(AppSearchResultParcel appSearchResultParcel)39     public void onResult(AppSearchResultParcel appSearchResultParcel) throws RemoteException {
40         onResult(appSearchResultParcel.getResult());
41     }
42 
43     @Override
onResultV2(AppSearchResultParcelV2 appSearchResultParcelV2)44     public void onResultV2(AppSearchResultParcelV2 appSearchResultParcelV2) throws RemoteException {
45         onResult(appSearchResultParcelV2.getResult());
46     }
47 }
48