I managed to do this creating a system app. Next are the steps.
- Add the
android.permission.STATUS_BAR
permission to the manifest.
On a BroadcastReceiver listening for android.intent.action.BOOT_COMPLETED
, do the following:
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
StatusBarManager statusBarManager = (StatusBarManager) context.getSystemService("statusbar");
statusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
}
}
For a couple of seconds the status bar will be usable but after the BOOT_COMPLETED broadcast is launch, it will be disables. If you don't want this to happen your app should be a launcher type of application and use this code as soon as the launcher is displayed.
Extra: you can also use the following to disable the soft keys:
StatusBarManager statusBarManager = (StatusBarManager) context.getSystemService("statusbar");
int state = StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_RECENT | StatusBarManager.DISABLE_HOME | StatusBarManager.DISABLE_BACK;
statusBarManager.disable(state);