« Back to Cius Developer Questions

platform key for reboot

Combination View Flat View Tree View
Threads [ Previous | Next ]
platform key for reboot
cius reboot platform key permission
Answer
1/13/12 3:14 AM
An interesting requirement came from my client who wishes the cius to be rebooted at a particular time of the day.
Please correct me if I am wrong but I reckon the app requires system permissions which in turn requires a platform key?
Is there an alternative to this for the Cius or am I missing a piece in the jig-saw puzzle.
 
Please advice
 
Regards,
Raven

Your surmise is correct, per design android.permission.REBOOT is required to effect a system restart, and this permission can only be granted to apps signed with the system key.  Not aware of any workaround.
 
Is there a particular side effect of restarting the device that they are trying to achieve..?

Hi David,

A big "thank you" for the confirmation! emoticon

The application I am working on is a long-lived app which must be on all the time (24/7).

After running it for X number of days, the interaction with the application became laggy.
I suppose the side effect they wanted to achieve through rebooting is to counter the lag
since after a reboot, the device becomes all snappy again.

I'm still investigating if it is a memory leak issue.
Since the android OS handles the GC / memory on its own, I wonder if it is natural for an app to become sluggish after X days without rebooting?

Regards,
Raven

Seems like it might be possible to add an Service to the long-running app that kills itself and relaunches itself on a certain schedule. Or perhaps the killer would have to be a separate app, and would have to send a "please exit" to the laggy app, then when it is gone, send a "please open" to it again. (If the laggy app fails to accept the "please exit", then you're screwed, unless you can ask the app manager to kill someone else, which seems very unlikely to be allowed.)

The service could do this according to lagginess, also, instead of according to schedule. It could ask, "what's your version", and if the answer comes back too slow, do the restart.

Not very satisfactory, but I understand the need. I've been in situations before where it was more important to have guarantees of a certain response time than uptime.

-jeff

Having the app restart itself rather than the entire system seems to make sense, as of course would be identifying the cause of the slowdown and correcting it.  Of course there are services and apps that run for many days and weeks on my device without a system restart or any slowdown, so it's definitely not endemic to Android apps. 
 
Performance profiling tools (see http://developer.android.com/guide/developing/debugging/debugging-tracing.html) can help in identifying memory leaks or other performance bottlenecks.

Jeff:

I have thought of putting a service up to restart the application periodically but didn't think of rebooting with the amount of "lag" as a metric. That is truly enlightening. Since the application didn't FC at any point in time, I think that is a feasible method to work on.

David:
Thank you for the confirmation that there are apps/activities that run at the front of the android stack without a system restart or any slowdown. I'll look at the heap stack and trace while I'm still at it.

Thank you for the suggestions, I will mark this question as answered since we have concluded it is not plausible to soft reboot the Cius device.

Regards,
Raven