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:
@@ -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