Posts

Showing posts from April, 2012

Android Java System Service - Beyond system_server

   To start with, this post is for developers who work on android platform and not for application developers. The default version of android open source platform has system services coded in both Java (services hosted by system_server) and C,C++ (media services hosted by mediaserver).      Recently, i came across requests to have Java based customized services hosted in their own process (and definitely not by system_server). Personally, i preferred all customized services to be in their own process, that way any service specific exception is just going to bring down the respective process and wouldn't trigger a framework reboot and offer a better user experience, opportunity for graceful handling. Besides, i don't like bloatware services being added to system_server just because its open source. These bloatware services when buggy (memory references, exceptions) has a direct negative impact on the android framework and is a big negativ...

Java - Redirect library logs to application's destination

     Application developers would often like to view the logs of dependency library (jars) in sequence to that of application logs and having the library's log redirected to the same destination (files, console, logcat etc) as that of the appplication's log helps achieve sequenced logs and isolate root cause among library and applications. Java's java.util.logging.Logger helps in quick implementation of the need, Library:    The sample library has two components and lets applications control the logs of whichever component is needed. // Class Focus's code public static String FOCUS_COMPONENT_NAME = "com.android.camera.focus"; Logger componentLogger = Logger.getLogger(FOCUS_COMPONENT_NAME); componentLogger.setUseParentHandlers(false); Logger libraryLogger = componentLogger.getParent(); // Class Zoom's code public static String ZOOM_COMPONENT_NAME = "com.android.camera.zoom"; Logger componentLogger = Logger.getLogger(ZO...