@@ -233,13 +233,20 @@ public void onColorSelected(int colorValue, String id) {
233
233
234
234
private void initializeOrganizationInfoPreferences () {
235
235
mSetOrganizationColorPreference = findPreference (SET_ORGANIZATION_COLOR_KEY );
236
- mSetOrganizationColorPreference .setOnPreferenceClickListener (this );
237
236
mSetOrganizationNamePreference = findPreference (SET_ORGANIZATION_NAME_KEY );
238
- mSetOrganizationNamePreference .setOnPreferenceChangeListener (this );
239
237
240
- final int colorValue = mDevicePolicyManager .getOrganizationColor (mAdminComponentName );
241
- mSetOrganizationColorPreference .setSummary (
242
- String .format (ColorPicker .COLOR_STRING_FORMATTER , colorValue ));
238
+ if (mSetOrganizationColorPreference .isEnabled ()) {
239
+ mSetOrganizationColorPreference .setOnPreferenceClickListener (this );
240
+ final int colorValue = mDevicePolicyManager .getOrganizationColor (mAdminComponentName );
241
+ mSetOrganizationColorPreference .setSummary (
242
+ String .format (ColorPicker .COLOR_STRING_FORMATTER , colorValue ));
243
+ }
244
+
245
+ if (mSetOrganizationNamePreference .isEnabled ()) {
246
+ mSetOrganizationNamePreference .setOnPreferenceChangeListener (this );
247
+ final String name = mDevicePolicyManager .getOrganizationName (mAdminComponentName );
248
+ mSetOrganizationNamePreference .setSummary (name );
249
+ }
243
250
}
244
251
245
252
private void showAddCrossProfileIntentFilterFragment () {
@@ -275,13 +282,21 @@ private void reloadBluetoothContactSharing() {
275
282
}
276
283
277
284
private void reloadCrossProfileCallerIdDisableUi () {
285
+ if (!mDisableCrossProfileCallerIdSwitchPreference .isEnabled ()) {
286
+ return ;
287
+ }
288
+
278
289
boolean isCrossProfileCallerIdDisabled = mDevicePolicyManager
279
290
.getCrossProfileCallerIdDisabled (mAdminComponentName );
280
291
mDisableCrossProfileCallerIdSwitchPreference .setChecked (isCrossProfileCallerIdDisabled );
281
292
}
282
293
283
294
284
295
private void reloadCrossProfileContactsSearchDisableUi () {
296
+ if (!mDisableCrossProfileContactsSearchSwitchPreference .isEnabled ()) {
297
+ return ;
298
+ }
299
+
285
300
boolean isCrossProfileContactsSearchDisabled = mDevicePolicyManager
286
301
.getCrossProfileContactsSearchDisabled (mAdminComponentName );
287
302
mDisableCrossProfileContactsSearchSwitchPreference .setChecked (
0 commit comments