Search in sources :

Example 6 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by SudaMod.

the class SecuritySettingsTest method testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification.

@Test
public void testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification() {
    final Preference preference = mock(Preference.class);
    final PreferenceGroup group = mock(PreferenceGroup.class);
    when(group.findPreference(SecuritySettings.KEY_LOCKSCREEN_PREFERENCES)).thenReturn(preference);
    final LockScreenNotificationPreferenceController controller = mock(LockScreenNotificationPreferenceController.class);
    final SecuritySettings securitySettings = new SecuritySettings();
    ReflectionHelpers.setField(securitySettings, "mLockScreenNotificationPreferenceController", controller);
    when(controller.getSummaryResource()).thenReturn(1234);
    securitySettings.setLockscreenPreferencesSummary(group);
    verify(preference).setSummary(1234);
}
Also used : Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) Test(org.junit.Test)

Example 7 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by SudaMod.

the class SecuritySettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Activity activity = getActivity();
    mSubscriptionManager = SubscriptionManager.from(activity);
    mLockPatternUtils = new LockPatternUtils(activity);
    mManagedPasswordProvider = ManagedLockPasswordProvider.get(activity, MY_USER_ID);
    mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    mUm = UserManager.get(activity);
    mChooseLockSettingsHelper = new ChooseLockSettingsHelper(activity);
    mDashboardFeatureProvider = FeatureFactory.getFactory(activity).getDashboardFeatureProvider(activity);
    mSecurityFeatureProvider = FeatureFactory.getFactory(activity).getSecurityFeatureProvider();
    mTrustAgentManager = mSecurityFeatureProvider.getTrustAgentManager();
    if (savedInstanceState != null && savedInstanceState.containsKey(TRUST_AGENT_CLICK_INTENT)) {
        mTrustAgentClickIntent = savedInstanceState.getParcelable(TRUST_AGENT_CLICK_INTENT);
    }
    mManageDeviceAdminPreferenceController = new ManageDeviceAdminPreferenceController(activity);
    mEnterprisePrivacyPreferenceController = new EnterprisePrivacyPreferenceController(activity, null);
    mLockScreenNotificationPreferenceController = new LockScreenNotificationPreferenceController(activity);
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) ManageDeviceAdminPreferenceController(com.android.settings.enterprise.ManageDeviceAdminPreferenceController) EnterprisePrivacyPreferenceController(com.android.settings.enterprise.EnterprisePrivacyPreferenceController) LineageLockPatternUtils(org.lineageos.internal.util.LineageLockPatternUtils) LockPatternUtils(com.android.internal.widget.LockPatternUtils) Activity(android.app.Activity) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController)

Example 8 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by SudaMod.

the class LockscreenDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final LockScreenNotificationPreferenceController notificationController = 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 = new AddUserWhenLockedPreferenceController(context);
    lifecycle.addObserver(addUserWhenLockedController);
    controllers.add(addUserWhenLockedController);
    mOwnerInfoPreferenceController = new OwnerInfoPreferenceController(context, this, lifecycle);
    controllers.add(mOwnerInfoPreferenceController);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) AddUserWhenLockedPreferenceController(com.android.settings.accounts.AddUserWhenLockedPreferenceController)

Example 9 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

the class SecuritySettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Activity activity = getActivity();
    mSubscriptionManager = SubscriptionManager.from(activity);
    mLockPatternUtils = new LockPatternUtils(activity);
    mManagedPasswordProvider = ManagedLockPasswordProvider.get(activity, MY_USER_ID);
    mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    mUm = UserManager.get(activity);
    mChooseLockSettingsHelper = new ChooseLockSettingsHelper(activity);
    mDashboardFeatureProvider = FeatureFactory.getFactory(activity).getDashboardFeatureProvider(activity);
    mSecurityFeatureProvider = FeatureFactory.getFactory(activity).getSecurityFeatureProvider();
    mTrustAgentManager = mSecurityFeatureProvider.getTrustAgentManager();
    if (savedInstanceState != null && savedInstanceState.containsKey(TRUST_AGENT_CLICK_INTENT)) {
        mTrustAgentClickIntent = savedInstanceState.getParcelable(TRUST_AGENT_CLICK_INTENT);
    }
    mManageDeviceAdminPreferenceController = new ManageDeviceAdminPreferenceController(activity);
    mEnterprisePrivacyPreferenceController = new EnterprisePrivacyPreferenceController(activity, null);
    mLockScreenNotificationPreferenceController = new LockScreenNotificationPreferenceController(activity);
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) ManageDeviceAdminPreferenceController(com.android.settings.enterprise.ManageDeviceAdminPreferenceController) EnterprisePrivacyPreferenceController(com.android.settings.enterprise.EnterprisePrivacyPreferenceController) LockPatternUtils(com.android.internal.widget.LockPatternUtils) Activity(android.app.Activity) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController)

Example 10 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

the class LockscreenDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final LockScreenNotificationPreferenceController notificationController = 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 = new AddUserWhenLockedPreferenceController(context);
    lifecycle.addObserver(addUserWhenLockedController);
    controllers.add(addUserWhenLockedController);
    mOwnerInfoPreferenceController = new OwnerInfoPreferenceController(context, this, lifecycle);
    controllers.add(mOwnerInfoPreferenceController);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) AddUserWhenLockedPreferenceController(com.android.settings.accounts.AddUserWhenLockedPreferenceController)

Aggregations

LockScreenNotificationPreferenceController (com.android.settings.notification.LockScreenNotificationPreferenceController)21 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)10 ArrayList (java.util.ArrayList)10 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)8 Preference (android.support.v7.preference.Preference)6 PreferenceGroup (android.support.v7.preference.PreferenceGroup)6 Test (org.junit.Test)6 Activity (android.app.Activity)5 LockPatternUtils (com.android.internal.widget.LockPatternUtils)5 AddUserWhenLockedPreferenceController (com.android.settings.accounts.AddUserWhenLockedPreferenceController)5 EnterprisePrivacyPreferenceController (com.android.settings.enterprise.EnterprisePrivacyPreferenceController)5 ManageDeviceAdminPreferenceController (com.android.settings.enterprise.ManageDeviceAdminPreferenceController)5 ChooseLockSettingsHelper (com.android.settings.password.ChooseLockSettingsHelper)5 LineageLockPatternUtils (org.lineageos.internal.util.LineageLockPatternUtils)2