Implement work-profile infra in BasePreferenceController

- Add settings:forWork in xml
- Set mIsForWork based on xml attribute
- Delete WorkProfilePreferenceController and move its function to
BasePreferenceController

Fixes: 123376083
Test: Add work profile, go to Settings->System->Language&input,
UI should show work profile related items
Change-Id: Id2dcbb0e158c117cdfd363466a275f4e133c345e
This commit is contained in:
Raff Tsai
2019-12-02 10:55:29 +08:00
parent 9700435b4d
commit f71db73025
13 changed files with 132 additions and 149 deletions

View File

@@ -16,34 +16,28 @@
package com.android.settings.inputmethod;
import android.app.settings.SettingsEnums;
import android.content.Context;
import com.android.settings.R;
import com.android.settings.core.WorkProfilePreferenceController;
import com.android.settings.core.BasePreferenceController;
/**
* Preference controller for "Spell checker for work".
*
* @see SpellCheckerPreferenceController
*/
public final class SpellCheckerForWorkPreferenceController extends WorkProfilePreferenceController {
public final class SpellCheckerForWorkPreferenceController extends BasePreferenceController {
public SpellCheckerForWorkPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@Override
protected int getSourceMetricsCategory() {
return SettingsEnums.SETTINGS_LANGUAGE_CATEGORY;
}
@AvailabilityStatus
@Override
public int getAvailabilityStatus() {
if (!mContext.getResources().getBoolean(R.bool.config_show_spellcheckers_settings)) {
return UNSUPPORTED_ON_DEVICE;
}
return super.getAvailabilityStatus();
return AVAILABLE;
}
}