Add indexable setting items
When work profile is supported on the device, we should support work profile releated setting items. Fix: 238055360 Test: Manual Change-Id: I5b952f958d0c5fc0f7b22838e1f7cfc36239a22e
This commit is contained in:
@@ -86,8 +86,7 @@
|
||||
<com.android.settings.RestrictedListPreference
|
||||
android:key="privacy_lock_screen_notifications"
|
||||
android:title="@string/lock_screen_notifs_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:searchable="false"/>
|
||||
android:summary="@string/summary_placeholder"/>
|
||||
|
||||
<!-- Show media on lock screen -->
|
||||
<SwitchPreference
|
||||
@@ -117,8 +116,7 @@
|
||||
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"/>
|
||||
android:order="999"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<!-- Content Capture -->
|
||||
|
@@ -25,9 +25,12 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.notification.LockScreenNotificationPreferenceController;
|
||||
import com.android.settings.safetycenter.SafetyCenterManagerWrapper;
|
||||
@@ -131,5 +134,21 @@ public class PrivacyDashboardFragment extends DashboardFragment {
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
final int profileUserId =
|
||||
Utils.getManagedProfileId(
|
||||
UserManager.get(context), UserHandle.myUserId());
|
||||
// If work profile is supported, we should keep the search result.
|
||||
if (profileUserId != UserHandle.USER_NULL) {
|
||||
return keys;
|
||||
}
|
||||
|
||||
// Otherwise, we should hide the search result.
|
||||
keys.add(KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user