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

Commit 12b77a16 authored by Zoey Chen's avatar Zoey Chen
Browse files

[ToA] ShellCommand: Implement grammatical gender in GrammaticalInflectionService

Bug: 314887263
Test: manual
Change-Id: I9d600d66a986b9c90fe8911ea85e344b47598383
parent 07e48d4a
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.content.res.Configuration.GRAMMATICAL_GENDER_NOT_SPECIFIED
import android.app.ActivityManager;
import android.app.GrammaticalInflectionManager;
import android.app.IGrammaticalInflectionManager;
import android.content.AttributionSource;
import android.content.res.Configuration;
import android.os.RemoteException;
import android.os.ShellCommand;
@@ -44,9 +45,12 @@ class GrammaticalInflectionShellCommand extends ShellCommand {
    }

    private final IGrammaticalInflectionManager mBinderService;
    private AttributionSource mAttributionSource;

    GrammaticalInflectionShellCommand(IGrammaticalInflectionManager grammaticalInflectionManager) {
    GrammaticalInflectionShellCommand(IGrammaticalInflectionManager grammaticalInflectionManager,
            AttributionSource attributionSource) {
        mBinderService = grammaticalInflectionManager;
        mAttributionSource = attributionSource;
    }

    @Override
@@ -115,7 +119,7 @@ class GrammaticalInflectionShellCommand extends ShellCommand {
        } while (true);

        try {
            mBinderService.setSystemWideGrammaticalGender(userId, grammaticalGender);
            mBinderService.setSystemWideGrammaticalGender(grammaticalGender, userId);
        } catch (RemoteException e) {
            getOutPrintWriter().println("Remote Exception: " + e);
        }
@@ -141,7 +145,8 @@ class GrammaticalInflectionShellCommand extends ShellCommand {
        } while (true);

        try {
            int grammaticalGender = mBinderService.getSystemGrammaticalGender(userId);
            int grammaticalGender = mBinderService.getSystemGrammaticalGender(mAttributionSource,
                    userId);
            getOutPrintWriter().println(GRAMMATICAL_GENDER_MAP.get(grammaticalGender));
        } catch (RemoteException e) {
            getOutPrintWriter().println("Remote Exception: " + e);