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

Commit 5e452905 authored by mik_os's avatar mik_os
Browse files

Fix bug in Power Off menu.

We need to catch hardware "Back key" too.

Change-Id: If69051addf4314d5e271c754405e1a24af157d78
parent b14fc638
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.os.storage.IMountShutdownObserver;

import com.android.internal.telephony.ITelephony;
import android.util.Log;
import android.view.KeyEvent;
import android.view.WindowManager;

public final class ShutdownThread extends Thread {
@@ -129,6 +130,15 @@ public final class ShutdownThread extends Thread {
                            }
                        })
                        .create();
                        dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
                            public boolean onKey (DialogInterface dialog, int keyCode, KeyEvent event) {
                                if (keyCode == KeyEvent.KEYCODE_BACK) {
                                    mReboot = false;
                                    dialog.cancel();
                                }
                                return true;
                            }
                        });
            } else {
                dialog = new AlertDialog.Builder(context)
                        .setIcon(android.R.drawable.ic_dialog_alert)