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

Commit 619af934 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't overwrite the system global gender settings" into main

parents fd0dd5df 67466de3
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -69,12 +69,19 @@ public class GrammaticalGenderPreferenceController extends DeveloperOptionsPrefe


    @Override
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        final var oldValue = SystemProperties.getInt(GRAMMATICAL_GENDER_PROPERTY,
                Configuration.GRAMMATICAL_GENDER_NOT_SPECIFIED);
        SystemProperties.set(GRAMMATICAL_GENDER_PROPERTY, newValue.toString());
        SystemProperties.set(GRAMMATICAL_GENDER_PROPERTY, newValue.toString());
        updateState(mPreference);
        updateState(mPreference);
        try {
        try {
            Configuration config = mActivityManager.getConfiguration();
            Configuration config = mActivityManager.getConfiguration();
            // Only apply the developer settings value if it is the one currently used,
            // otherwise it means there's some kind of override that we don't want to
            // touch here.
            if (config.getGrammaticalGender() == oldValue) {
                config.setGrammaticalGender(Integer.parseInt(newValue.toString()));
                config.setGrammaticalGender(Integer.parseInt(newValue.toString()));
                mActivityManager.updatePersistentConfiguration(config);
                mActivityManager.updatePersistentConfiguration(config);
            }
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
            // intentional no-op
            // intentional no-op
        }
        }