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

Commit dbc69077 authored by Buga Dániel's avatar Buga Dániel
Browse files

Fix reboot window texts

PS2: move assignment of titleResourceId into the condition and
only query longPressBehavior when it's needed.

Change-Id: I00c3940c2b5472434177e94ab7c72d5fecc61b2e
parent 410fda5b
Loading
Loading
Loading
Loading
+25 −15
Original line number Diff line number Diff line
@@ -117,21 +117,31 @@ public final class ShutdownThread extends Thread {
            }
        }

        final int titleResourceId;
        final int resourceId;

        Log.d(TAG, "Notifying thread to start shutdown");

        if (mRebootSafeMode) {
            titleResourceId = com.android.internal.R.string.reboot_safemode_title;
            resourceId = com.android.internal.R.string.reboot_safemode_confirm;
        } else if (mReboot) {
            titleResourceId = com.android.internal.R.string.reboot_system;
            resourceId = com.android.internal.R.string.reboot_confirm;
        } else {

            final int longPressBehavior = context.getResources().getInteger(
                            com.android.internal.R.integer.config_longPressOnPowerBehavior);
        final int resourceId = mRebootSafeMode
                ? com.android.internal.R.string.reboot_safemode_confirm
                : (longPressBehavior == 2
                        ? com.android.internal.R.string.shutdown_confirm_question
                        : com.android.internal.R.string.shutdown_confirm);

        final int titleResourceId = mRebootSafeMode
                ? com.android.internal.R.string.reboot_safemode_title
                : (mReboot
                        ? com.android.internal.R.string.reboot_system
                        : com.android.internal.R.string.power_off);

        Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior);

            titleResourceId = com.android.internal.R.string.power_off;
            if (longPressBehavior == 2) {
                resourceId = com.android.internal.R.string.shutdown_confirm_question;
            } else {
                resourceId = com.android.internal.R.string.shutdown_confirm;
            }

            Log.d(TAG, "longPressBehavior=" + longPressBehavior);
        }

        if (confirm) {
            final CloseDialogReceiver closer = new CloseDialogReceiver(context);