Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | package com.android.server.appsearch; |
| 17 | |
| 18 | import android.app.appsearch.IAppSearchManager; |
| 19 | import android.content.Context; |
| 20 | |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 21 | import com.android.internal.infra.AndroidFuture; |
Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 22 | import com.android.server.SystemService; |
| 23 | |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 24 | import com.google.android.icing.proto.SchemaProto; |
| 25 | |
Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 26 | /** |
| 27 | * TODO(b/142567528): add comments when implement this class |
| 28 | */ |
| 29 | public class AppSearchManagerService extends SystemService { |
| 30 | |
| 31 | public AppSearchManagerService(Context context) { |
| 32 | super(context); |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | public void onStart() { |
| 37 | publishBinderService(Context.APP_SEARCH_SERVICE, new Stub()); |
| 38 | } |
| 39 | |
| 40 | private class Stub extends IAppSearchManager.Stub { |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 41 | @Override |
| 42 | public void setSchema(byte[] schemaBytes, AndroidFuture callback) { |
| 43 | try { |
| 44 | SchemaProto schema = SchemaProto.parseFrom(schemaBytes); |
| 45 | throw new UnsupportedOperationException("setSchema not yet implemented: " + schema); |
Alexander Dorokhine | 179c8b8 | 2020-01-11 00:17:48 -0800 | [diff] [blame] | 46 | |
| 47 | } catch (Throwable t) { |
| 48 | callback.completeExceptionally(t); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | @Override |
| 53 | public void put(byte[] documentBytes, AndroidFuture callback) { |
| 54 | try { |
| 55 | throw new UnsupportedOperationException("Put document not yet implemented"); |
Alexander Dorokhine | fd07eba | 2020-01-13 20:22:20 -0800 | [diff] [blame] | 56 | } catch (Throwable t) { |
| 57 | callback.completeExceptionally(t); |
| 58 | } |
| 59 | } |
Terry Wang | febbead | 2019-10-17 17:05:18 -0700 | [diff] [blame] | 60 | } |
| 61 | } |