\subsection{Service Manager and Various Services}

\begin{frame}
  \frametitle{Whole Android Stack}
  \begin{center}
    \includegraphics[height=0.85\textheight]{slides/android-framework-native-services/android-stack-services.pdf}
  \end{center}
\end{frame}

\begin{frame}
  \frametitle{System Server boot}
  \begin{center}
    \includegraphics[height=0.8\textheight]{slides/android-framework-native-services/system-server-boot.pdf}
  \end{center}
\end{frame}

\begin{frame}
  \frametitle{The first step: \code{system_server.c}}
  \begin{itemize}
  \item Located in \code{frameworks/base/cmds/system_server}
  \item Started by \code{Zygote} through the SystemServer
  \item Starts all the various native services:
    \begin{itemize}
    \item \code{SurfaceFlinger}
    \item \code{SensorService}
    \end{itemize}
  \item It then calls back the SystemServer object's \code{init2} function to
    go on with the initialization
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Java Services Initialization}
  \begin{itemize}
  \item Located in
    \code{frameworks/base/services/java/com/android/server/SystemServer.java}
  \item Starts all the different Java services in a different thread
    by registering them into the Service Manager
  \item \code{PowerManager}, \code{ActivityManager} (also handles the
    ContentProviders), \code{PackageManager}, \code{BatteryService},
    \code{LightsService}, \code{VibratorService}, \code{AlarmManager},
    \code{WindowManager}, \code{BluetoothService},
    \code{DevicePolicyManager}, \code{StatusBarManager},
    \code{InputMethodManager}, \code{ConnectivityService},
    \code{MountService}, \code{NotificationManager},
    \code{LocationManager}, \code{AudioService}, \code{...}
  \item If you wish to add a new system service, you will need to add
    it to one of these two parts to register it at boot time
  \end{itemize}
\end{frame}
