Loading AconfigFlags.bp +1 −1 Original line number Diff line number Diff line Loading @@ -334,7 +334,7 @@ java_aconfig_library { aconfig_declarations { name: "android.app.flags-aconfig", package: "android.app", srcs: ["core/java/android/app/activity_manager.aconfig"], srcs: ["core/java/android/app/*.aconfig"], } java_aconfig_library { Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5952,6 +5952,7 @@ package android.app { public class GrammaticalInflectionManager { method public int getApplicationGrammaticalGender(); method @FlaggedApi("android.app.system_terms_of_address_enabled") public int getSystemGrammaticalGender(); method public void setRequestedApplicationGrammaticalGender(int); } core/java/android/app/GrammaticalInflectionManager.java +50 −3 Original line number Diff line number Diff line Loading @@ -16,12 +16,15 @@ package android.app; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemService; import android.content.Context; import android.content.res.Configuration; import android.os.RemoteException; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; Loading @@ -31,11 +34,15 @@ import java.util.Set; */ @SystemService(Context.GRAMMATICAL_INFLECTION_SERVICE) public class GrammaticalInflectionManager { private static final Set<Integer> VALID_GENDER_VALUES = new HashSet<>(Arrays.asList( /** @hide */ @NonNull public static final Set<Integer> VALID_GRAMMATICAL_GENDER_VALUES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( Configuration.GRAMMATICAL_GENDER_NOT_SPECIFIED, Configuration.GRAMMATICAL_GENDER_NEUTRAL, Configuration.GRAMMATICAL_GENDER_FEMININE, Configuration.GRAMMATICAL_GENDER_MASCULINE)); Configuration.GRAMMATICAL_GENDER_MASCULINE))); private final Context mContext; private final IGrammaticalInflectionManager mService; Loading Loading @@ -79,7 +86,7 @@ public class GrammaticalInflectionManager { */ public void setRequestedApplicationGrammaticalGender( @Configuration.GrammaticalGender int grammaticalGender) { if (!VALID_GENDER_VALUES.contains(grammaticalGender)) { if (!VALID_GRAMMATICAL_GENDER_VALUES.contains(grammaticalGender)) { throw new IllegalArgumentException("Unknown grammatical gender"); } Loading @@ -90,4 +97,44 @@ public class GrammaticalInflectionManager { throw e.rethrowFromSystemServer(); } } /** * Sets the current grammatical gender for all privileged applications. The value will be * stored in an encrypted file at {@link android.os.Environment#getDataSystemCeDirectory(int) * * @param grammaticalGender the terms of address the user preferred in system. * * @see Configuration#getGrammaticalGender * @hide */ public void setSystemWideGrammaticalGender( @Configuration.GrammaticalGender int grammaticalGender) { if (!VALID_GRAMMATICAL_GENDER_VALUES.contains(grammaticalGender)) { throw new IllegalArgumentException("Unknown grammatical gender"); } try { mService.setSystemWideGrammaticalGender(mContext.getUserId(), grammaticalGender); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Get the current grammatical gender of privileged application from the encrypted file, * which is stored under {@link android.os.Environment#getDataSystemCeDirectory(int)}. * * @return the value of grammatical gender * * @see Configuration#getGrammaticalGender */ @FlaggedApi(Flags.FLAG_SYSTEM_TERMS_OF_ADDRESS_ENABLED) @Configuration.GrammaticalGender public int getSystemGrammaticalGender() { try { return mService.getSystemGrammaticalGender(mContext.getUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } core/java/android/app/IGrammaticalInflectionManager.aidl +11 −1 Original line number Diff line number Diff line Loading @@ -16,4 +16,14 @@ package android.app; * Sets a specified app’s app-specific grammatical gender. */ void setRequestedApplicationGrammaticalGender(String appPackageName, int userId, int gender); /** * Sets the grammatical gender to system. */ void setSystemWideGrammaticalGender(int userId, int gender); /** * Gets the grammatical gender from system. */ int getSystemGrammaticalGender(int userId); } core/java/android/app/OWNERS +3 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ per-file IBackupAgent.aidl = file:/services/backup/OWNERS per-file Broadcast* = file:/BROADCASTS_OWNERS per-file ReceiverInfo* = file:/BROADCASTS_OWNERS # GrammaticalInflectionManager per-file *GrammaticalInflection* = file:/services/core/java/com/android/server/grammaticalinflection/OWNERS # KeyguardManager per-file KeyguardManager.java = file:/services/core/java/com/android/server/locksettings/OWNERS Loading Loading
AconfigFlags.bp +1 −1 Original line number Diff line number Diff line Loading @@ -334,7 +334,7 @@ java_aconfig_library { aconfig_declarations { name: "android.app.flags-aconfig", package: "android.app", srcs: ["core/java/android/app/activity_manager.aconfig"], srcs: ["core/java/android/app/*.aconfig"], } java_aconfig_library { Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5952,6 +5952,7 @@ package android.app { public class GrammaticalInflectionManager { method public int getApplicationGrammaticalGender(); method @FlaggedApi("android.app.system_terms_of_address_enabled") public int getSystemGrammaticalGender(); method public void setRequestedApplicationGrammaticalGender(int); }
core/java/android/app/GrammaticalInflectionManager.java +50 −3 Original line number Diff line number Diff line Loading @@ -16,12 +16,15 @@ package android.app; import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.SystemService; import android.content.Context; import android.content.res.Configuration; import android.os.RemoteException; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; Loading @@ -31,11 +34,15 @@ import java.util.Set; */ @SystemService(Context.GRAMMATICAL_INFLECTION_SERVICE) public class GrammaticalInflectionManager { private static final Set<Integer> VALID_GENDER_VALUES = new HashSet<>(Arrays.asList( /** @hide */ @NonNull public static final Set<Integer> VALID_GRAMMATICAL_GENDER_VALUES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( Configuration.GRAMMATICAL_GENDER_NOT_SPECIFIED, Configuration.GRAMMATICAL_GENDER_NEUTRAL, Configuration.GRAMMATICAL_GENDER_FEMININE, Configuration.GRAMMATICAL_GENDER_MASCULINE)); Configuration.GRAMMATICAL_GENDER_MASCULINE))); private final Context mContext; private final IGrammaticalInflectionManager mService; Loading Loading @@ -79,7 +86,7 @@ public class GrammaticalInflectionManager { */ public void setRequestedApplicationGrammaticalGender( @Configuration.GrammaticalGender int grammaticalGender) { if (!VALID_GENDER_VALUES.contains(grammaticalGender)) { if (!VALID_GRAMMATICAL_GENDER_VALUES.contains(grammaticalGender)) { throw new IllegalArgumentException("Unknown grammatical gender"); } Loading @@ -90,4 +97,44 @@ public class GrammaticalInflectionManager { throw e.rethrowFromSystemServer(); } } /** * Sets the current grammatical gender for all privileged applications. The value will be * stored in an encrypted file at {@link android.os.Environment#getDataSystemCeDirectory(int) * * @param grammaticalGender the terms of address the user preferred in system. * * @see Configuration#getGrammaticalGender * @hide */ public void setSystemWideGrammaticalGender( @Configuration.GrammaticalGender int grammaticalGender) { if (!VALID_GRAMMATICAL_GENDER_VALUES.contains(grammaticalGender)) { throw new IllegalArgumentException("Unknown grammatical gender"); } try { mService.setSystemWideGrammaticalGender(mContext.getUserId(), grammaticalGender); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Get the current grammatical gender of privileged application from the encrypted file, * which is stored under {@link android.os.Environment#getDataSystemCeDirectory(int)}. * * @return the value of grammatical gender * * @see Configuration#getGrammaticalGender */ @FlaggedApi(Flags.FLAG_SYSTEM_TERMS_OF_ADDRESS_ENABLED) @Configuration.GrammaticalGender public int getSystemGrammaticalGender() { try { return mService.getSystemGrammaticalGender(mContext.getUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
core/java/android/app/IGrammaticalInflectionManager.aidl +11 −1 Original line number Diff line number Diff line Loading @@ -16,4 +16,14 @@ package android.app; * Sets a specified app’s app-specific grammatical gender. */ void setRequestedApplicationGrammaticalGender(String appPackageName, int userId, int gender); /** * Sets the grammatical gender to system. */ void setSystemWideGrammaticalGender(int userId, int gender); /** * Gets the grammatical gender from system. */ int getSystemGrammaticalGender(int userId); }
core/java/android/app/OWNERS +3 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ per-file IBackupAgent.aidl = file:/services/backup/OWNERS per-file Broadcast* = file:/BROADCASTS_OWNERS per-file ReceiverInfo* = file:/BROADCASTS_OWNERS # GrammaticalInflectionManager per-file *GrammaticalInflection* = file:/services/core/java/com/android/server/grammaticalinflection/OWNERS # KeyguardManager per-file KeyguardManager.java = file:/services/core/java/com/android/server/locksettings/OWNERS Loading