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

Commit ed6a6ca0 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Make the system locale available to the decryption UI.

Bug: 17659622
Change-Id: I8f7d1c4d1d04ec483b6a3c9bea742f79374b647a
parent 9de68440
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -35,8 +35,12 @@ import android.widget.Button;

import com.android.internal.widget.LockPatternUtils;

import java.util.Locale;

public class CryptKeeperConfirm extends Fragment {

    private static final String TAG = "CryptKeeperConfirm";

    public static class Blank extends Activity {
        private Handler mHandler = new Handler();

@@ -107,17 +111,26 @@ public class CryptKeeperConfirm extends Fragment {
               is then persisted, and the settings will be there on future
               reboots.
             */

            // 1. The owner info.
            LockPatternUtils utils = new LockPatternUtils(getActivity());
            utils.setVisiblePatternEnabled(utils.isVisiblePatternEnabled());
            if (utils.isOwnerInfoEnabled()) {
                utils.setOwnerInfo(utils.getOwnerInfo(UserHandle.USER_OWNER),
                                   UserHandle.USER_OWNER);
            }

            Intent intent = new Intent(getActivity(), Blank.class);
            intent.putExtras(getArguments());

            startActivity(intent);

            // 2. The system locale.
            try {
                IBinder service = ServiceManager.getService("mount");
                IMountService mountService = IMountService.Stub.asInterface(service);
                mountService.setField("SystemLocale", Locale.getDefault().toLanguageTag());
            } catch (Exception e) {
                Log.e(TAG, "Error storing locale for decryption UI", e);
            }
        }
    };