I am adding additional battery properties that require a shutdown under 
certain conditions. I have a requirement that the user be notified of the 
shutdown reason

Basically I am adding additional checks like shutdownIfOverTemp() in 
BatteryService, so I can use that function as an example of where I would 
like to add a reason notification to the end user.

The standard behavior simply shuts down the phone (at least in 4.1.2 that I 
am based on):

    private final void shutdownIfOverTemp() {
        // shut down gracefully if temperature is too high (> 68.0C)
        // wait until the system has booted before attempting to display 
the shutdown dialog.
        if (mBatteryTemperature > 680 && 
ActivityManagerNative.isSystemReady()) {
            Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
            intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            mContext.startActivity(intent);
        }
    }

I'm not sure what my options are to notify the user. 
I can't display a toast from the service right?

It might be OK to set EXTRA_KEY_CONFIRM to true (iffy in the case of being 
over temp), but I don't think this provides me a way to show a message 
anyway (I'll try it next)

The only way I can think of is to send a new intent 
SHUTDOWN_REQUEST_BATTERY_OVERTEMP then define an activity that would catch 
it, display something ("system shutting down due to battery temperature") 
and that activity would then send ACTION_REQUEST_SHUTDOWN? and I would have 
to do this for every separate shutdown reason or can I add an additional 
extra to ACTION_REQUEST_SHUTDOWN that would indicate the shutdown reason?


-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-porting+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to