I have added a custom system-service to AOSP. I wanted to make use of my service in Activity.java class and wanted to do some changes in startActivityForResult() method. The same way I want to create an instance to PackageManagerService. But for some reason I cannot get this running, I get the following errors from logcat:
***********************************************
F/SystemServer( 500): BOOT FAILURE starting Input Manager Service
F/SystemServer( 500): java.lang.RuntimeException: Unable to get provider com.android.providers.settings.SettingsProvider: java.lang.ClassNotFoundException: com.android.providers.settings.SettingsProvider
F/SystemServer( 500): at android.app.ActivityThread.installProvider(ActivityThread.java:4201)
F/SystemServer( 500): at android.app.ActivityThread.getProvider(ActivityThread.java:4010)
F/SystemServer( 500): at android.app.ActivityThread.acquireProvider(ActivityThread.java:4026)
F/SystemServer( 500): at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:1612)
F/SystemServer( 500): at android.content.ContentResolver.acquireProvider(ContentResolver.java:948)
F/SystemServer( 500): at android.provider.Settings$NameValueCache.getString(Settings.java:701)
F/SystemServer( 500): at android.provider.Settings$Secure.getString(Settings.java:2207)
F/SystemServer( 500): at com.android.server.InputMethodManagerService.buildInputMethodListLocked(InputMethodManagerService.java:1966)
F/SystemServer( 500): at com.android.server.InputMethodManagerService.(InputMethodManagerService.java:556)
F/SystemServer( 500): at com.android.server.ServerThread.run(SystemServer.java:273)
F/SystemServer( 500): Caused by: java.lang.ClassNotFoundException: com.android.providers.settings.SettingsProvider
F/SystemServer( 500): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
F/SystemServer( 500): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
F/SystemServer( 500): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
F/SystemServer( 500): at android.app.ActivityThread.installProvider(ActivityThread.java:4186)
F/SystemServer( 500): ... 9 more
I/SystemServer( 500): Accessibility Manager
W/SystemServer( 500): ***********************************************
F/SystemServer( 500): BOOT FAILURE making display ready
How I can make an instance of services in Activity.java. Also is there a systemReady() kind of method in Activity.java, I know there is such kind of method in PackageManagerService, but that is a service where as Activity is not. So wondering what would be the best way to check it. Any thoughts appreciated
This was because of the dex opt signature mismatch for SettingsProvider.apk For testing purposes I was able to get around this issue by disabling this check achieved by setting the below env variables:
export WITH_DEXPREOPT=false export DISABLE_DEXPREOPT=true
Courtesy: https://groups.google.com/forum/#!msg/android-building/vJCkg8Yq9Ic/mgev8ODDia4J