Merge "Create "on lock screen notifications" in Privacy"
This commit is contained in:
committed by
Android (Google) Code Review
commit
006d1c6027
@@ -21,6 +21,7 @@
|
|||||||
android:key="privacy_dashboard_page"
|
android:key="privacy_dashboard_page"
|
||||||
android:title="@string/privacy_dashboard_title">
|
android:title="@string/privacy_dashboard_title">
|
||||||
|
|
||||||
|
<!-- App permissions -->
|
||||||
<Preference
|
<Preference
|
||||||
android:key="privacy_manage_perms"
|
android:key="privacy_manage_perms"
|
||||||
android:title="@string/app_permissions"
|
android:title="@string/app_permissions"
|
||||||
@@ -29,6 +30,14 @@
|
|||||||
<intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
|
<intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
|
<!-- On lock screen notifications -->
|
||||||
|
<com.android.settings.RestrictedListPreference
|
||||||
|
android:key="privacy_lock_screen_notifications"
|
||||||
|
android:title="@string/lock_screen_notifications_title"
|
||||||
|
android:summary="@string/summary_placeholder"
|
||||||
|
settings:searchable="false"/>
|
||||||
|
|
||||||
|
<!-- Show passwords -->
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="show_password"
|
android:key="show_password"
|
||||||
android:title="@string/show_password"
|
android:title="@string/show_password"
|
||||||
@@ -42,4 +51,20 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="dashboard_tile_placeholder"/>
|
android:key="dashboard_tile_placeholder"/>
|
||||||
|
|
||||||
|
<!-- Work profile settings are at the bottom with high order value to avoid users thinking that
|
||||||
|
any of the above settings (including dynamic) are specific to the work profile. -->
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="privacy_work_profile_notifications_category"
|
||||||
|
android:title="@string/profile_section_header"
|
||||||
|
android:order="998"
|
||||||
|
settings:searchable="false">
|
||||||
|
|
||||||
|
<com.android.settings.RestrictedListPreference
|
||||||
|
android:key="privacy_lock_screen_work_profile_notifications"
|
||||||
|
android:title="@string/locked_work_profile_notification_title"
|
||||||
|
android:summary="@string/summary_placeholder"
|
||||||
|
android:order="999"
|
||||||
|
settings:searchable="false"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -22,7 +22,10 @@ import android.provider.SearchIndexableResource;
|
|||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
|
import com.android.settings.notification.LockScreenNotificationPreferenceController;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -31,6 +34,11 @@ import java.util.List;
|
|||||||
@SearchIndexable
|
@SearchIndexable
|
||||||
public class PrivacyDashboardFragment extends DashboardFragment {
|
public class PrivacyDashboardFragment extends DashboardFragment {
|
||||||
private static final String TAG = "PrivacyDashboardFragment";
|
private static final String TAG = "PrivacyDashboardFragment";
|
||||||
|
private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "privacy_lock_screen_notifications";
|
||||||
|
private static final String KEY_WORK_PROFILE_CATEGORY =
|
||||||
|
"privacy_work_profile_notifications_category";
|
||||||
|
private static final String KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS =
|
||||||
|
"privacy_lock_screen_work_profile_notifications";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
@@ -52,6 +60,28 @@ public class PrivacyDashboardFragment extends DashboardFragment {
|
|||||||
return R.string.help_url_privacy_dashboard;
|
return R.string.help_url_privacy_dashboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||||
|
return buildPreferenceControllers(context, getSettingsLifecycle());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<AbstractPreferenceController> buildPreferenceControllers(
|
||||||
|
Context context, Lifecycle lifecycle) {
|
||||||
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
|
final LockScreenNotificationPreferenceController notificationController =
|
||||||
|
new LockScreenNotificationPreferenceController(context,
|
||||||
|
KEY_LOCK_SCREEN_NOTIFICATIONS,
|
||||||
|
KEY_WORK_PROFILE_CATEGORY,
|
||||||
|
KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS);
|
||||||
|
if (lifecycle != null) {
|
||||||
|
lifecycle.addObserver(notificationController);
|
||||||
|
}
|
||||||
|
controllers.add(notificationController);
|
||||||
|
|
||||||
|
return controllers;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -64,5 +94,11 @@ public class PrivacyDashboardFragment extends DashboardFragment {
|
|||||||
result.add(sir);
|
result.add(sir);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||||
|
Context context) {
|
||||||
|
return buildPreferenceControllers(context, null);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user