- Unit test of System Property failed due to timing issue. Remove it to avoid to impact formal unit test tracker. - This system property is feature flag. Bug: b/265410669 Test: atest passed. Change-Id: I65b4a34e1a362428ccb18611c90702650a5cdf8f
49 lines
1.9 KiB
Java
49 lines
1.9 KiB
Java
/*
|
|
* Copyright (C) 2022 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.settings.regionalpreferences;
|
|
|
|
import android.content.Context;
|
|
import android.os.SystemProperties;
|
|
|
|
import com.android.settings.core.BasePreferenceController;
|
|
|
|
/** A controller for the entry of Regional preferences */
|
|
public class RegionalPreferencesController extends BasePreferenceController {
|
|
// This is a feature flag and will be removed after feature completed.
|
|
static final String FEATURE_PROPERTY = "i18n-feature-locale-preference";
|
|
public RegionalPreferencesController(Context context, String preferenceKey) {
|
|
super(context, preferenceKey);
|
|
}
|
|
|
|
/**
|
|
* @return {@link AvailabilityStatus} for the Setting. This status is used to determine if the
|
|
* Setting should be shown or disabled in Settings. Further, it can be used to produce
|
|
* appropriate error / warning Slice in the case of unavailability.
|
|
* </p>
|
|
* The status is used for the convenience methods: {@link #isAvailable()}, {@link
|
|
* #isSupported()}
|
|
* </p>
|
|
* The inherited class doesn't need to check work profile if android:forWork="true" is set in
|
|
* preference xml.
|
|
*/
|
|
@Override
|
|
public int getAvailabilityStatus() {
|
|
return SystemProperties.getBoolean(FEATURE_PROPERTY, true)
|
|
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
|
}
|
|
}
|