Update string for work mode toggle
Bug: 71743500 Test: Go to that page in settings, observe the string. Test: Flip the state, observe the summary is updated. Change-Id: I8b634314c752c6ab8f51e1472db3956194390cbd
This commit is contained in:
@@ -5580,10 +5580,12 @@
|
|||||||
<string name="add_account_label">Add account</string>
|
<string name="add_account_label">Add account</string>
|
||||||
<!-- Label for the state of the work profile [CHAR LIMIT=80] -->
|
<!-- Label for the state of the work profile [CHAR LIMIT=80] -->
|
||||||
<string name="managed_profile_not_available_label">Work profile isn\u2019t available yet</string>
|
<string name="managed_profile_not_available_label">Work profile isn\u2019t available yet</string>
|
||||||
<!-- Account Settings. The preference title for enabling work mode -->
|
<!-- This string is the title of a setting. If a user taps the setting, they can turn their work profile on or off. The work profile is a section of their phone that's managed by their employer. "Work" is an adjective. -->
|
||||||
<string name="work_mode_label">Work mode</string>
|
<string name="work_mode_label">Work profile</string>
|
||||||
<!-- Account Settings. The preference summary for enabling work mode -->
|
<!-- This string is located under a setting and describes what the setting does. It's letting a user know whether their work profile is on or off, and they can use the setting to turn it on or off. The work profile is a section of their phone that's managed by their employer. "Work" is an adjective.-->
|
||||||
<string name="work_mode_summary">Allow work profile to function, including apps, background sync, and related features</string>
|
<string name="work_mode_on_summary">Managed by your organization</string>
|
||||||
|
<!-- This string is located under a setting and describes what the setting does. It's letting a user know whether their work profile is on or off, and they can use the setting to turn it on or off. The work profile is a section of their phone that's managed by their employer. "Work" is an adjective.-->
|
||||||
|
<string name="work_mode_off_summary">Apps and notifications are off</string>
|
||||||
<!-- Button label to remove the work profile [CHAR LIMIT=35] -->
|
<!-- Button label to remove the work profile [CHAR LIMIT=35] -->
|
||||||
<string name="remove_managed_profile_label">Remove work profile</string>
|
<string name="remove_managed_profile_label">Remove work profile</string>
|
||||||
<!-- Data synchronization settings screen, title of setting that controls whether background data should be used [CHAR LIMIT=30] -->
|
<!-- Data synchronization settings screen, title of setting that controls whether background data should be used [CHAR LIMIT=30] -->
|
||||||
|
@@ -20,14 +20,13 @@
|
|||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="work_mode"
|
android:key="work_mode"
|
||||||
android:summary="@string/work_mode_summary"
|
android:title="@string/work_mode_label"
|
||||||
android:title="@string/work_mode_label"/>
|
android:summary="@string/summary_placeholder"/>
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="contacts_search"
|
android:key="contacts_search"
|
||||||
android:summary="@string/managed_profile_contact_search_summary"
|
android:summary="@string/managed_profile_contact_search_summary"
|
||||||
android:title="@string/managed_profile_contact_search_title"
|
android:title="@string/managed_profile_contact_search_title"
|
||||||
settings:useAdditionalSummary="true"
|
settings:useAdditionalSummary="true"/>
|
||||||
/>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -104,8 +104,7 @@ public class ManagedProfileSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private void loadDataAndPopulateUi() {
|
private void loadDataAndPopulateUi() {
|
||||||
if (mWorkModePreference != null) {
|
if (mWorkModePreference != null) {
|
||||||
mWorkModePreference.setChecked(
|
updateWorkModePreference();
|
||||||
!mUserManager.isQuietModeEnabled(mManagedUser));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mContactPrefrence != null) {
|
if (mContactPrefrence != null) {
|
||||||
@@ -124,6 +123,14 @@ public class ManagedProfileSettings extends SettingsPreferenceFragment
|
|||||||
return MetricsProto.MetricsEvent.ACCOUNTS_WORK_PROFILE_SETTINGS;
|
return MetricsProto.MetricsEvent.ACCOUNTS_WORK_PROFILE_SETTINGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateWorkModePreference() {
|
||||||
|
boolean isWorkModeOn = !mUserManager.isQuietModeEnabled(mManagedUser);
|
||||||
|
mWorkModePreference.setChecked(isWorkModeOn);
|
||||||
|
mWorkModePreference.setSummary(isWorkModeOn
|
||||||
|
? R.string.work_mode_on_summary
|
||||||
|
: R.string.work_mode_off_summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
@@ -159,8 +166,7 @@ public class ManagedProfileSettings extends SettingsPreferenceFragment
|
|||||||
|| action.equals(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE)) {
|
|| action.equals(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE)) {
|
||||||
if (intent.getIntExtra(Intent.EXTRA_USER_HANDLE,
|
if (intent.getIntExtra(Intent.EXTRA_USER_HANDLE,
|
||||||
UserHandle.USER_NULL) == mManagedUser.getIdentifier()) {
|
UserHandle.USER_NULL) == mManagedUser.getIdentifier()) {
|
||||||
mWorkModePreference.setChecked(
|
updateWorkModePreference();
|
||||||
!mUserManager.isQuietModeEnabled(mManagedUser));
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user