Understanding Android Services with Example

A Service is an application component that can perform long-running operations in the background, and it does not provide a user interface. There are Three different types of services – Foreground – A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to … Read more

How to Acquire and Release a wakelock forcefully from Android shell

Sometime when you are developing some code where you need to acquire a wakelock or when you are debugging some bug where you need to identify whether wakelock is the problem, you can choose to acquire or release the wakelock forcefully so your debugging on an issue becomes easier. Note: Following steps needs a root … Read more

Android Power OFF Sequence / How Android Shuts Down works ?

This post tries to brief about how android shutdown / poweroff sequence is with respect to the android open source code. We tried to take logs for reference to identify source code and below is the related logcat messages, [bash] ShutdownThread: Notifying thread to start shutdown longPressBehavior=1 ShutdownThread: Sending shutdown broadcast… SyncManager: Writing sync state … Read more

How early suspend works in Android ?

This post briefs about the source code flow of how early suspend mechanism in power managerment works in Android. This code references are with respect to Android open source code. $ vim frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java [bash] private void setHalAutoSuspendModeLocked(boolean enable) { if (enable != mHalAutoSuspendModeEnabled) { if (DEBUG) { Slog.d(TAG, "Setting HAL auto-suspend mode to " + … Read more

How to capture bluetooth packets on Android

When we want to capture bluetooth packets for some debugging in Android, we can follow below procedure. Enable Bluetooth and then make sure you have also enabled developer options. Go to developer options, and enable “Enable Bluetooth HCI Snoop Log” then do the operations of what you need to capture from bluetooth, Now, connected your … Read more