Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 789a4748 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "Fix Intent.ACTION_REBOOT"

parents aaa9675b b8a8a578
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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"
+9 −2
Original line number Diff line number Diff line
@@ -27,20 +27,27 @@ 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() {
                if (mReboot) {
                    ShutdownThread.reboot(ShutdownActivity.this, null, mConfirm);
                } else {
                    ShutdownThread.shutdown(ShutdownActivity.this, mConfirm);
                }
            }
        });
    }
}