[Panlingual] Adds a filter of application for per apps locale change.
- Settings -> System -> app language -> app languages Use this filter to only show apps allowed to change the locale. - Settings -> Apps -> all apps -> any one of app -> language Use this filter to only show the language preference of app allowed to change the locale. Bug: 210935436 Test: atest pass. Test: local test. Change-Id: I2f8a0815dae68392e11882ad9e1e4945492efdba
This commit is contained in:
@@ -20,20 +20,23 @@ import android.content.Context;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.applications.AppLocaleUtil;
|
||||
|
||||
/**
|
||||
* A controller to update current locale information of application.
|
||||
*/
|
||||
public class AppLocalePreferenceController extends AppInfoPreferenceControllerBase {
|
||||
private static final String TAG = AppLocalePreferenceController.class.getSimpleName();
|
||||
|
||||
public AppLocalePreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return FeatureFlagUtils
|
||||
.isEnabled(mContext, FeatureFlagUtils.SETTINGS_APP_LANGUAGE_SELECTION)
|
||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
boolean isFeatureOn = FeatureFlagUtils
|
||||
.isEnabled(mContext, FeatureFlagUtils.SETTINGS_APP_LANGUAGE_SELECTION);
|
||||
return isFeatureOn && canDisplayLocaleUi() ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,4 +48,8 @@ public class AppLocalePreferenceController extends AppInfoPreferenceControllerBa
|
||||
public CharSequence getSummary() {
|
||||
return AppLocaleDetails.getSummary(mContext, mParent.getAppEntry().info.packageName);
|
||||
}
|
||||
|
||||
boolean canDisplayLocaleUi() {
|
||||
return AppLocaleUtil.canDisplayLocaleUi(mContext, mParent.getAppEntry());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user