Merge "[Panlingual] Add the doc link and remove TODO description" into udc-dev
This commit is contained in:
@@ -161,7 +161,7 @@ public class LocaleConfig implements Parcelable {
|
|||||||
* <p><b>Note:</b> The creation of this LocaleConfig does not automatically mean it will
|
* <p><b>Note:</b> The creation of this LocaleConfig does not automatically mean it will
|
||||||
* become the override config for an application. Any LocaleConfig desired to be the override
|
* become the override config for an application. Any LocaleConfig desired to be the override
|
||||||
* must be passed into the {@link LocaleManager#setOverrideLocaleConfig(LocaleConfig)},
|
* must be passed into the {@link LocaleManager#setOverrideLocaleConfig(LocaleConfig)},
|
||||||
* otherwise it will not persist or affect the system’s understanding of app-supported
|
* otherwise it will not persist or affect the system's understanding of app-supported
|
||||||
* resources.
|
* resources.
|
||||||
*
|
*
|
||||||
* @param locales the desired locales for a specified application
|
* @param locales the desired locales for a specified application
|
||||||
|
|||||||
@@ -194,18 +194,19 @@ public class LocaleManager {
|
|||||||
* <p><b>Note:</b> Only the app itself with the same user can override its own LocaleConfig.
|
* <p><b>Note:</b> Only the app itself with the same user can override its own LocaleConfig.
|
||||||
*
|
*
|
||||||
* <p><b>Note:</b> This function takes in a {@link LocaleConfig} which is intended to
|
* <p><b>Note:</b> This function takes in a {@link LocaleConfig} which is intended to
|
||||||
* override the original config in the application’s resources. This LocaleConfig will become
|
* override the original config in the application's resources. This LocaleConfig will
|
||||||
* the override config, and stored in a system file for future access.
|
* become the override config, and stored in a system file for future access.
|
||||||
*
|
*
|
||||||
* <p><b>Note:</b> Using this function, applications can update their list of supported
|
* <p><b>Note:</b> Using this function, applications can update their list of supported
|
||||||
* locales while running, without an update of the application’s software.
|
* locales while running, without an update of the application's software. For more
|
||||||
|
* information, see the <a
|
||||||
|
* href="https://developer.android.com/about/versions/14/features#app-languages">section on
|
||||||
|
* dynamic updates for an app's localeConfig</a>.
|
||||||
*
|
*
|
||||||
* <p>Applications can remove the override LocaleConfig with a {@code null} object.
|
* <p>Applications can remove the override LocaleConfig with a {@code null} object.
|
||||||
*
|
*
|
||||||
* @param localeConfig the desired {@link LocaleConfig} for the calling app.
|
* @param localeConfig the desired {@link LocaleConfig} for the calling app.
|
||||||
*/
|
*/
|
||||||
// Add following to last Note: when guide is written:
|
|
||||||
// For more information, see TODO(b/261528306): add link to guide.
|
|
||||||
@UserHandleAware
|
@UserHandleAware
|
||||||
public void setOverrideLocaleConfig(@Nullable LocaleConfig localeConfig) {
|
public void setOverrideLocaleConfig(@Nullable LocaleConfig localeConfig) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ public class LocaleManagerService extends SystemService {
|
|||||||
private final PackageMonitor mPackageMonitor;
|
private final PackageMonitor mPackageMonitor;
|
||||||
|
|
||||||
private final Object mWriteLock = new Object();
|
private final Object mWriteLock = new Object();
|
||||||
// TODO(b/262713398): Set to false when stable
|
|
||||||
public static final boolean DEBUG = true;
|
public static final boolean DEBUG = false;
|
||||||
|
|
||||||
public LocaleManagerService(Context context) {
|
public LocaleManagerService(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -565,7 +565,6 @@ public class LocaleManagerService extends SystemService {
|
|||||||
*/
|
*/
|
||||||
public void setOverrideLocaleConfig(@NonNull String appPackageName, @UserIdInt int userId,
|
public void setOverrideLocaleConfig(@NonNull String appPackageName, @UserIdInt int userId,
|
||||||
@Nullable LocaleConfig localeConfig) throws IllegalArgumentException {
|
@Nullable LocaleConfig localeConfig) throws IllegalArgumentException {
|
||||||
// TODO(b/262713398): Remove when stable
|
|
||||||
if (!SystemProperties.getBoolean(PROP_DYNAMIC_LOCALES_CHANGE, true)) {
|
if (!SystemProperties.getBoolean(PROP_DYNAMIC_LOCALES_CHANGE, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -747,7 +746,6 @@ public class LocaleManagerService extends SystemService {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public LocaleConfig getOverrideLocaleConfig(@NonNull String appPackageName,
|
public LocaleConfig getOverrideLocaleConfig(@NonNull String appPackageName,
|
||||||
@UserIdInt int userId) {
|
@UserIdInt int userId) {
|
||||||
// TODO(b/262713398): Remove when stable
|
|
||||||
if (!SystemProperties.getBoolean(PROP_DYNAMIC_LOCALES_CHANGE, true)) {
|
if (!SystemProperties.getBoolean(PROP_DYNAMIC_LOCALES_CHANGE, true)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -850,7 +848,6 @@ public class LocaleManagerService extends SystemService {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private File getXmlFileNameForUser(@NonNull String appPackageName, @UserIdInt int userId) {
|
private File getXmlFileNameForUser(@NonNull String appPackageName, @UserIdInt int userId) {
|
||||||
// TODO(b/262752965): use per-package data directory
|
|
||||||
final File dir = new File(Environment.getDataSystemCeDirectory(userId), LOCALE_CONFIGS);
|
final File dir = new File(Environment.getDataSystemCeDirectory(userId), LOCALE_CONFIGS);
|
||||||
return new File(dir, appPackageName + SUFFIX_FILE_NAME);
|
return new File(dir, appPackageName + SUFFIX_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user