Implementing System Service LifeCycle methods

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Implementing System Service LifeCycle methods

శంకర్ కుమార్ యల్లపు
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

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/40a8945c-64a1-4057-bb38-1005cc8271bbn%40googlegroups.com.