1

I am curious about the "turned off" state and the boot process after that in details. I found some good articles on this topic like this one: http://www.lieberbiber.de/2015/07/05/mediatek-details-little-kernel/ but it's still not completely clear to me what's the exact process.

I know that the basic boot sequence is:

  • Boot ROM
  • Preloader
  • Little kernel (LK)
  • And then it may split into going to:
    • Download mode (in case of a Samsung device for example)
    • Fastboot mode or
    • Recovery or
    • Normal boot (starting Android boot itself)

But is the phone really off when we turn it off and the battery is inserted? I know that Android is really shut down but is the phone completely off regarding the software level? As the article linked above says, the little kernel is doing the charging animation, or selects the next boot image when pressing the keys (recovery, fastboot, normal boot, etc).

So my question is: when the phone is off and we press the power button is it the hardware which starts the boot really from zero (from the boot rom) or at this point the phone has already been finished with processing the boot rom, the preloader and loading the little kernel as well which is watching the key press events?

It's not clear to me because I checked the source code of the little kernel as well and there are some keyboard ckecking routines for example to enter to recovery mode.

Thanks in advance!

Cheers!

0

Clarification

You're asking different things in each part of the post. The title asks "Does Android consume power when switched off?" but the latter part of the post asks "which is watching the key press events?", with a few different questions in between, which adds further distractions and confusions to the possible answerers...

Anyhow, I guess it all boils down to: "Once an Android phone is turned off, what wakes it up to start a process in each appropriate situations?".

Backgrounds

To answer this, I'll have to take you to even lower level of an electronic device: hardware.
You may argue,

"What are you talking about?! A hardware is nothing when there's no software! Something HAS to be there watching the button input and I'm simply asking what that could be".

Be patient, please. Well get there soon.

"But...!"

Believe me. Besides, you might need to remind yourself of the definition of 'software' and 'hardware' now, since we're about to dive deep into such a low level.

I wonder whether you've ever played with an Arduino, those little boards that get clicky button inputs and put flashy LED outputs. A chip working as the brain in one of these devices* is called an 'MCU', or a 'microcontroller'. A computer - including Android devices - is equipped with a few of these. Every firmware/ROM chips, BIOS chips, or any programmable ICs is likely another microcontroller.

Simple Answer

These MCUs are quite simple compared to CPUs, but more robust and energy-efficient. For this reason, MCUs are often used to aid CPUs to set things up for them. How do they work? Essentially, they behave just according to how a firmware is programmed inside the ROM.

"Ha, so it's simply the Boot ROM, isn't it? You could have just said so!" Well, you'll have to know a bit more to understand better to get an answer for each of your oh-so-many questions.

Deeper Explanation

The keywords are interrupt and sleep mode (the terminology of the latter may vary).

(Wrong) Example

The firmware could be coded in a way that the chip would constantly be looking at the external inputs. However, this is not the ideal way. The chip will have to retrieve the state of a button, compare whether it's on or off, and then count up to 50ms or so to simply wait. Now back to retrieving the state, and so on. The poweroff state could last hours, days, or even years - all the while unbeknownst to the poor little chip is whether the moment for it to shine again would ever come...

Sorry, that was a little bit disturbing. The existential crisis is not the only problem though, if that helps. Even if the chip were to be actively working, each glancing costs valuable resource as well!

Interrupt

Interrupt works the other way round. It's more like giving a notification to the main computational part. An MCU with the capability, essentially every modern one, is prepared with a procedure where they could push away & forget whatever they were up to before, execute a specific function to respond to the interrupt signal, and then get back to the task they were doing before. This way, an MCU doesn't have to actively, repeatedly compute a retrieval & comparison set. In the case of a typical Android device, you could assign interrupt for [power applied/removed on the charger pin], [power applied/removed on the charger pin] and [power button pressed].

Sleep Mode

You may ask,

"Okay, sooo... now that MCU doesn't have to be burdened with that, it could happily sleep?"

HA! No.

...well yes. MCU could just sleep there.

Actually what I want to remark here is that, don't quote me on this but, what they sip when they sleep should be comparable to self discharge of a battery. At this point, there's so little software involved here that I would say those running at this point are all purely implemented in the hardware - but that's just my opinion and I don't consider myself expert enough to get you necessarily convinced.

Closure

So, basically, when in the poweroff state, Boot ROM is barely running that battery consumption is minuscule. When awakened, all it has to do is to call Preloader and/or to tell LK about what happened. I'm not sure of even deeper details; I have no idea but I'm willing to say it should be implementation dependent.

Clear Ups

I guess at this point, your main question should be answered.
Followings are answers to your other questions.

Does Android consume power when switched off?

No.
It is not any part of the Android OS ("Normal boot", you said) that consumes power.

Does Android consume power when switched off?

Yes but barely.
Note that there could be additional power consumption to run other parts, notably RTC (Real Time Clock) module.

But is the phone really off when we turn it off and the battery is inserted? I know that Android is really shut down but is the phone completely off regarding the software level?

No but almost.

when the phone is off and we press the power button is it the hardware which starts the boot really from zero (from the boot rom) or at this point the phone has already been finished with processing the boot rom, the preloader and loading the little kernel as well which is watching the key press events?

More like former.
Except Boot ROM is constantly running but barely.

Hope you got better idea about how everything works now!

*Note: Most Arduino boards have two MCUs, one in the center and the other to control the USB interface.

| improve this answer | |
  • Good answer. But might have been better if it were a bit less funky and a bit straight-forward in answering. – Gokul NC Jun 24 at 9:44
  • @GokulNC Thanks for your feedback :) I will try to next time. Maybe Quora ruined me a bit there? – EuphCat Jul 10 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.