Not only is it not in the API docs, but because as you say you need to be
signed with the platform cert, you can only use this if you are running on a
device whose system software you have built yourself.

On Fri, Aug 7, 2009 at 1:55 PM, markwhitney <markwhit...@gmail.com> wrote:

>
> Got it to work.  For reference to anyone else, in addition to signing
> with the platform key, the ACTION_REBOOT intent has to have a few
> extras defined.  Without any extras, it looks like the Watchdog thread
> will basically ignore it.
>
> This code would do an immediate reboot:
>
>  Intent i = new Intent(Intent.ACTION_REBOOT);
>  i.putExtra("nowait", 1);
>  i.putExtra("interval", 1);
>  i.putExtra("window", 0);
>  sendBroadcast(i);
>
> Details in frameworks/base/services/java/com/android/server/
> Watchdog.java in the Android source.
>
> Note that this is not in the API docs so probably subject to change :)
>
> mark
>
> On Aug 6, 2:24 pm, markwhitney <markwhit...@gmail.com> wrote:
> > Great, thanks for the link, I will look into this further there.
> >
> > On Aug 6, 1:54 pm, Roman <roman.baumgaert...@t-mobile.com> wrote:
> >
> > > There is already a post about this on the forum. Look at
> >
> > >http://groups.google.com/group/android-platform/browse_thread/thread/.
> ..
> >
> > > In general you don't want to allow third party apps to do arebooton
> > > your phone this easily. It is very dangerous that's why theREBOOTis
> > > only allowed for system apps.
> >
> > > --
> > > Roman Baumgaertner
> > > Sr. SW Engineer-OSDC
> > > ·T· · ·Mobile· stick together
> > > The views, opinions and statements in this email are those of the
> > > author solely in their individual capacity, and do not necessarily
> > > represent those of T-Mobile USA, Inc.
> >
> > > On Aug 6, 8:54 am, markwhitney <markwhit...@gmail.com> wrote:
> >
> > > > I am trying torebootAndroid by broadcasting Intent.ACTION_REBOOT
> > > > from my activity.
> >
> > > > I believe that I have given it all the proper permissions to send
> such
> > > > a signal but when I launch the activity, nothing happens.  I saw a
> > > > similar post about this back in May, but no responses.
> >
> > > > Logcat:
> >
> > > > ActivityManager  I  Starting activity: Intent
> > > > { action=android.intent.action.MAIN categories=
> > > > {android.intent.category.LAUNCHER} flags=0x102000
> > > >                                   00 comp=
> > > > {com.android.settings.shutitdown/
> > > > com.android.settings.shutitdown.ShutdownActivity} }
> > > > ActivityManager  I  Start proc com.android.settings.shutitdown for
> > > > activity com.android.settings.shutitdown/.ShutdownActivity: pid=1397
> > > > uid=10
> > > >                                   00 gids={}
> > > > ShutdownActivity  D  creating activity: forreboot
> > > > ShutdownActivity  I  rebooted
> > > > InputConnectionWrapper  W  showStatusIcon on inactive InputConnection
> > > > ActivityManager  I  Displayed activity
> > > > com.android.settings.shutitdown/.ShutdownActivity: 564 ms
> >
> > > > Note that there is no denial to send the Intent, just silence.  Here
> > > > is the activity code:
> >
> > > > public class ShutdownActivity extends Activity {
> > > >     private static final String LOG_TAG = "ShutdownActivity";
> >
> > > >     public void onCreate(Bundle b) {
> > > >         super.onCreate(b);
> > > >         setContentView(R.layout.shutdown_main);
> > > >         Log.d(LOG_TAG, "creating activity: forreboot");
> > > >         Intent i = new Intent(Intent.ACTION_REBOOT);
> > > >         i.setAction(Intent.ACTION_REBOOT);
> > > >         sendBroadcast(i);
> > > >         Log.i(LOG_TAG, "rebooted");
> > > >     }
> > > >     public void onPause() {
> > > >     }
> >
> > > > }
> >
> > > > ...and the manifest:
> >
> > > > <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> > > >         package="com.android.settings.shutitdown"
> > > >         android:sharedUserId="android.uid.system">
> >
> > > >     <uses-permission android:name="android.permission.REBOOT" />
> >
> > > >     <application android:label="shutitdown"
> > > > android:icon="@drawable/ic_launcher_settings">
> > > >         <activity android:name=".ShutdownActivity"
> > > >                   android:label="Shutdown">
> > > >           <intent-filter>
> > > >             <action android:name="android.intent.action.MAIN" />
> > > >             <category android:name="android.intent.category.LAUNCHER"
> /
> >
> > > >           </intent-filter>
> > > >         </activity>
> > > >     </application>
> >
> > > > </manifest>
> >
> >
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to