Fix Intent.ACTION_REBOOT
Turns out this would be useful for automated testing. Change-Id: Idd5e35a8d4a354447b17a77fe0b606f78df844d0 Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
@@ -1311,6 +1311,10 @@
|
||||
<action android:name="android.intent.action.ACTION_REQUEST_SHUTDOWN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.REBOOT" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.android.internal.app.NetInitiatedActivity"
|
||||
android:theme="@style/Theme.Dialog.Alert"
|
||||
|
||||
@@ -27,19 +27,26 @@ import com.android.internal.app.ShutdownThread;
|
||||
public class ShutdownActivity extends Activity {
|
||||
|
||||
private static final String TAG = "ShutdownActivity";
|
||||
private boolean mReboot;
|
||||
private boolean mConfirm;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mConfirm = getIntent().getBooleanExtra(Intent.EXTRA_KEY_CONFIRM, false);
|
||||
Intent intent = getIntent();
|
||||
mReboot = Intent.ACTION_REBOOT.equals(intent.getAction());
|
||||
mConfirm = intent.getBooleanExtra(Intent.EXTRA_KEY_CONFIRM, false);
|
||||
Slog.i(TAG, "onCreate(): confirm=" + mConfirm);
|
||||
|
||||
Handler h = new Handler();
|
||||
h.post(new Runnable() {
|
||||
public void run() {
|
||||
ShutdownThread.shutdown(ShutdownActivity.this, mConfirm);
|
||||
if (mReboot) {
|
||||
ShutdownThread.reboot(ShutdownActivity.this, null, mConfirm);
|
||||
} else {
|
||||
ShutdownThread.shutdown(ShutdownActivity.this, mConfirm);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user