Support search for work profile settings page.

Test: manual, robotest
Bug: 254192800
Change-Id: Id8ec76557fc170fcf727da1971cd90f494c7ecd4
This commit is contained in:
Lili Zou
2023-01-18 17:36:54 +08:00
parent 9aabfafb4c
commit 2a445bb89e
4 changed files with 30 additions and 7 deletions

View File

@@ -31,6 +31,7 @@ import androidx.preference.PreferenceScreen;
import androidx.preference.TwoStatePreference;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.slices.SliceData;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -56,9 +57,13 @@ public class WorkModePreferenceController extends BasePreferenceController imple
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE);
mIntentFilter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE);
// Set default managed profile for the current user, otherwise isAvailable will be false and
// the setting won't be searchable.
mManagedUser = Utils.getManagedProfile(mUserManager);
}
public void setManagedUser(UserHandle managedUser) {
@VisibleForTesting
void setManagedUser(UserHandle managedUser) {
mManagedUser = managedUser;
}