If there was it wouldn't work...the phone would be frozen, so you couldn't run another app...
If you are trying to flush out the RAM/memory, I would just reboot the device normally (hold down the power button for a few seconds and the popup menu will offer Shutdown/Reboot options. choose accordingly).
Removing battery is not a good option as it can leave specific apps in unknown states (corrupt local cached data for them is possible).
You shouldn't have to remove the battery on this device...if you do frequently, I'd try to identify the root cause of the problems (hardware issue or software issue..if hardware, file a warranty claim and get it fixed/replaced ASAP).
I have NEVER had to remove the battery on my Galaxy Nexus, Samsung Galaxy S2, or HTC MyTouch 4G android phones, and I would consider myself a power-user in most cases.
Rebooting (shutting down / powering up) is another story, I do on occassion, but the only time I remove batteries is to replace them with other charged batteries.
Holding down the power button is a software-initiated action which is very different than a battery pull. A 'completely' hung device will not respond to this..(but again, with the SGS2 this should be extremely rare).
If you're interested in the various 'reboot' reactions, there's some decent documentation in the android.os.powermanager class (the reboot function documentation covers a bit on what is presumed before a normal reboot but also explains other error conditions etc.).
Perhaps you can advise as to why i get very different output when looking at previous values in /sys/class/power_supply in debug builds when comparing the impact of a battery-remove vs. a hold button for reboot ? Not to mention the occassional inconsistant baseband query errors which clear up in approx 200ms (only seen this occur on battery pulls).
If this is not the intent should this be a bug report?
Np i think i wrongly assumed this thread was in the os/dev forum. But short version is if you have a true hardware-level hang (such as a hung but not crash/fail video gpu call) the device won't respond to a button-press or hold. Android interfaces are dead and removing power is the only way to kill it.
But if either type of reset is required it would be reacting to a bigger problem that would be prudent to address.
As for my previous post i guess now it is more of a note to self but i will follow up and see if it is indeed a bug or not and provide findings in rhe dev forum section.
I must admit, as a non-developer, I always considered the long press on the power button as the equivalent of a power down, battery removal, reboot sequence.
Then OS updates introduced multiple options under the long press, one of which is Reboot. I'd assumed this was the equivalent sequence. What I think I'm hearing however is that it may not be.
Keep us advised of your findings so that we can pass on the right advice in future.
Yeah it's a bit confusing, but it's actually been debated in various circles.(the main example I'll give is think of an automobile's computer. there have been some android devices that interface with GPS, alert the driver of safety issues (low tire preasure, or other car error codes). if a driver turns the entire vehicle 'off', that entire system will need to be suspended / shutdown to some extent. If the user installs an App on their new car infotainment system, and it seems flakey, should they be able to reboot it? What about while driving vs. stationary? If the system is powered off, can we ensure that no 'wrong' or 'incomplete' data was stored? How can we ensure it came back. There has been quite a bit of work just dealing with these aspects (shutdown/startup/reboot).
In the case of the Android OS, just like iOS, the operating systems were designed with the perception that the user should not need to 'reboot'. You will notice the iPhone and Google Nexus devices do not have such an option...(only shutdown) It is a bit arrogant of an industry claim (in my opinion) to state that 'superphones' do not need to be rebooted,
Google provided a few methods to allow folks to introduce rebooting to the device (such as the power manager reboot function) which some phone manufacturers have used (but phone manufacturers can modify kernel source so they can always create other ways).
The short version is you will notice a slight delay for most devices when choosing the specific reboot/restart behavior. Typically (not always) these options will reboot in a manner that 'shuts down with an auto-startup'.
So if you do need to 'reboot' a device (which Apple, Google, etc. think you never should have to....ideal world and all), it's best to use either the provided restart/reboot option (if available), or choose shutdown, and then power-up the device again. Obviously if the device is trully hung, all software options will not suffice
The work done in the shutdown sequence is done to protect the integrity of the system and the end-user's data. There are also various self-protecting mechanisms in the boot process which seem to be very robust, but why let them errors when you can avoid those errors entirely.
So back to the hold-button (sgs2) vs. pull the battery question, @Philyew yeah, based on previous testing, there are some values that are properly set via software when holding the button, which is different than pulling the battery, and kernel logs show up a bit differently. For a particular industry (where safety is linked closely to the device's use) the inconsistant nature of those values on a 'battery pull', might not be acceptable, so will be interesting to see if this is a bug or just an 'inconsistant activity'.
I hope to have some follow-up on Monday