Add a new system service for app search project

Bug: 142567528
Test: manual
Change-Id: Iefb426383f94ec89c896065c798b22cfb2977bf3
This commit is contained in:
Terry Wang 2019-10-17 17:05:18 -07:00
parent 401607765b
commit ecc0d1b2c1
12 changed files with 213 additions and 1 deletions

View File

@ -212,6 +212,7 @@ filegroup {
name: "framework-non-updatable-sources",
srcs: [
// Java/AIDL sources under frameworks/base
":framework-appsearch-sources",
":framework-blobstore-sources",
":framework-core-sources",
":framework-drm-sources",

View File

@ -0,0 +1,39 @@
// Copyright (C) 2019 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.
filegroup {
name: "framework-appsearch-sources",
srcs: [
"java/**/*.java",
"java/**/*.aidl",
],
path: "java",
}
java_library {
name: "framework-appsearch",
installable: false,
sdk_version: "core_platform",
srcs: [
":framework-appsearch-sources",
],
aidl: {
export_include_dirs: [
"java",
],
},
libs: [
"framework-minus-apex",
],
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2019 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.appsearch;
import android.annotation.SystemService;
import android.content.Context;
/**
* TODO(b/142567528): add comments when implement this class
* @hide
*/
@SystemService(Context.APP_SEARCH_SERVICE)
public class AppSearchManager {
private final IAppSearchManager mService;
/**
* TODO(b/142567528): add comments when implement this class
* @hide
*/
public AppSearchManager(IAppSearchManager service) {
mService = service;
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 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.appsearch;
import android.app.SystemServiceRegistry;
import android.content.Context;
/**
* This is where the AppSearchManagerService wrapper is registered.
*
* TODO(b/142567528): add comments when implement this class
* @hide
*/
public class AppSearchManagerFrameworkInitializer {
/**
* TODO(b/142567528): add comments when implement this class
*/
public static void initialize() {
SystemServiceRegistry.registerStaticService(
Context.APP_SEARCH_SERVICE, AppSearchManager.class,
(service) -> new AppSearchManager(IAppSearchManager.Stub.asInterface(service)));
}
}

View File

@ -0,0 +1,19 @@
/**
* Copyright 2019, 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.appsearch;
/** {@hide} */
interface IAppSearchManager {
}

View File

@ -0,0 +1,24 @@
// Copyright (C) 2019 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.
java_library {
name: "appsearch-service",
installable: true,
srcs: [
"java/**/*.java",
],
libs: [
"framework",
"services.core",
],
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2019 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 com.android.server.appsearch;
import android.app.appsearch.IAppSearchManager;
import android.content.Context;
import com.android.server.SystemService;
/**
* TODO(b/142567528): add comments when implement this class
*/
public class AppSearchManagerService extends SystemService {
public AppSearchManagerService(Context context) {
super(context);
}
@Override
public void onStart() {
publishBinderService(Context.APP_SEARCH_SERVICE, new Stub());
}
private class Stub extends IAppSearchManager.Stub {
}
}

View File

@ -9927,6 +9927,7 @@ package android.content {
field public static final String ALARM_SERVICE = "alarm";
field public static final String APPWIDGET_SERVICE = "appwidget";
field public static final String APP_OPS_SERVICE = "appops";
field public static final String APP_SEARCH_SERVICE = "app_search";
field public static final String AUDIO_SERVICE = "audio";
field public static final String BATTERY_SERVICE = "batterymanager";
field public static final int BIND_ABOVE_CLIENT = 8; // 0x8

View File

@ -514,6 +514,7 @@ android.app.admin.SystemUpdateInfo$1
android.app.admin.SystemUpdateInfo
android.app.admin.SystemUpdatePolicy$1
android.app.admin.SystemUpdatePolicy
android.app.appsearch.AppSearchManagerFrameworkInitializer
android.app.assist.AssistContent$1
android.app.assist.AssistContent
android.app.assist.AssistStructure$1

View File

@ -22,6 +22,7 @@ import android.annotation.NonNull;
import android.app.ContextImpl.ServiceInitializationState;
import android.app.admin.DevicePolicyManager;
import android.app.admin.IDevicePolicyManager;
import android.app.appsearch.AppSearchManagerFrameworkInitializer;
import android.app.blob.BlobStoreManagerFrameworkInitializer;
import android.app.contentsuggestions.ContentSuggestionsManager;
import android.app.contentsuggestions.IContentSuggestionsManager;
@ -1263,6 +1264,7 @@ public final class SystemServiceRegistry {
JobSchedulerFrameworkInitializer.registerServiceWrappers();
BlobStoreManagerFrameworkInitializer.initialize();
TelephonyFrameworkInitializer.registerServiceWrappers();
AppSearchManagerFrameworkInitializer.initialize();
} finally {
// If any of the above code throws, we're in a pretty bad shape and the process
// will likely crash, but we'll reset it just in case there's an exception handler...

View File

@ -4897,6 +4897,15 @@ public abstract class Context {
@SystemApi
public static final String BATTERY_STATS_SERVICE = "batterystats";
/**
* Use with {@link #getSystemService(String)} to retrieve an
* AppSearchManager for indexing and querying app data managed
* by the system.
*
* @see #getSystemService(String)
*/
public static final String APP_SEARCH_SERVICE = "app_search";
/**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.

View File

@ -281,7 +281,8 @@ public final class SystemServer {
"com.android.server.DeviceIdleController";
private static final String BLOB_STORE_MANAGER_SERVICE_CLASS =
"com.android.server.blob.BlobStoreManagerService";
private static final String APP_SEARCH_MANAGER_SERVICE_CLASS =
"com.android.server.appsearch.AppSearchManagerService";
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
private static final String UNCRYPT_PACKAGE_FILE = "/cache/recovery/uncrypt_file";
@ -2023,6 +2024,10 @@ public final class SystemServer {
mSystemServiceManager.startBootPhase(t, SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY);
t.traceEnd();
t.traceBegin("AppSearchManagerService");
mSystemServiceManager.startService(APP_SEARCH_MANAGER_SERVICE_CLASS);
t.traceEnd();
// These are needed to propagate to the runnable below.
final NetworkManagementService networkManagementF = networkManagement;
final NetworkStatsService networkStatsF = networkStats;