Show setting for work profile lock screen notification

- Add work profile notification setting to security_lockscreen_setting
- Modify the preference controller to stop hardcode preference keys.

cherry-pick of: ag/2315314

Bug: 62051309
Bug: 62045663
Test: make RunSettingsRoboTests
Change-Id: I779590e34c1eca2dab5b62dda473cfa4371fc064
This commit is contained in:
Fan Zhang
2017-05-24 17:24:06 -07:00
parent 21aab578c9
commit 33c493777b
6 changed files with 119 additions and 35 deletions

View File

@@ -18,6 +18,8 @@ package com.android.settings.security;
import android.content.Context;
import android.provider.SearchIndexableResource;
import android.support.annotation.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.accounts.AddUserWhenLockedPreferenceController;
@@ -26,6 +28,7 @@ import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.notification.LockScreenNotificationPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -38,6 +41,15 @@ public class LockscreenDashboardFragment extends DashboardFragment
private static final String TAG = "LockscreenDashboardFragment";
@VisibleForTesting
static final String KEY_LOCK_SCREEN_NOTIFICATON = "security_setting_lock_screen_notif";
@VisibleForTesting
static final String KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER =
"security_setting_lock_screen_notif_work_header";
@VisibleForTesting
static final String KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE =
"security_setting_lock_screen_notif_work";
private OwnerInfoPreferenceController mOwnerInfoPreferenceController;
@Override
@@ -60,7 +72,10 @@ public class LockscreenDashboardFragment extends DashboardFragment
final List<PreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
final LockScreenNotificationPreferenceController notificationController =
new LockScreenNotificationPreferenceController(context);
new LockScreenNotificationPreferenceController(context,
KEY_LOCK_SCREEN_NOTIFICATON,
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER,
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
lifecycle.addObserver(notificationController);
controllers.add(notificationController);
final AddUserWhenLockedPreferenceController addUserWhenLockedController =