Hi All,
I have a system service which is currently built as static_java_library and built into frameworks.jar.
Recently, I came across a use case where I want to implement lifecycle methods of System Service from com.android.server. But, I am compile time error saying symbol not found import com.android.server.SystemService.
Following is my Android.bp file:
java_library_static {
name: "my-services",
srcs: [
"src/**/*.java",
"src/com/my/service/IMyManager.aidl",
],
libs: ["services"],
platform_apis: true,
required: ["services"],
}
This is how I included in frameworks/base/Android.bp:
filegroup {
name:"my-service",
srcs: [
"my_services/src/**/*.java",
"my_services/src/**/*.aidl",
],
path: "my_services/src",
}
filegroup {
name: "framework-non-updatable-sources",
srcs: [
// Java/AIDL sources under frameworks/base
":framework-blobstore-sources",
":framework-core-sources",
":framework-drm-sources",
":framework-graphics-sources",
":framework-jobscheduler-sources", // jobscheduler is not a module for R
":framework-keystore-sources",
":framework-identity-sources",
":framework-location-sources",
":framework-lowpan-sources",
":framework-mca-effect-sources",
":framework-mca-filterfw-sources",
":framework-mca-filterpacks-sources",
":my-service",
I want to implement something like this:
public static class Lifecycle extends SystemService {
private StorageManagerService mStorageManagerService;
public Lifecycle(Context context) {
super(context);
}
@Override
public void onStart() {
mStorageManagerService = new StorageManagerService(getContext());
publishBinderService("mount", mStorageManagerService);
mStorageManagerService.start();
}
@Override
public void onBootPhase(int phase) {
if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
mStorageManagerService.servicesReady();
} else if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
mStorageManagerService.systemReady();
} else if (phase == SystemService.PHASE_BOOT_COMPLETED) {
mStorageManagerService.bootCompleted();
}
}
Please help me how can I achieve this.
Thanks,
Shankar