Merge "Set toggle state for profile group" into sc-dev

This commit is contained in:
Evan Severson
2021-07-29 19:45:59 +00:00
committed by Android (Google) Code Review
3 changed files with 129 additions and 25 deletions

View File

@@ -59,7 +59,8 @@ public abstract class SensorToggleController extends TogglePreferenceController
@Override
public boolean setChecked(boolean isChecked) {
mSensorPrivacyManagerHelper.setSensorBlocked(SETTINGS, getSensor(), !isChecked);
mSensorPrivacyManagerHelper.setSensorBlockedForProfileGroup(SETTINGS, getSensor(),
!isChecked);
return true;
}

View File

@@ -172,6 +172,27 @@ public class SensorPrivacyManagerHelper {
mSensorPrivacyManager.setSensorPrivacy(source, sensor, blocked, userId);
}
/**
* Sets the sensor privacy for the current profile group.
* @param source The source with which sensor privacy is toggled.
* @param sensor The sensor to set for
* @param blocked The state to set to
*/
public void setSensorBlockedForProfileGroup(int source, int sensor, boolean blocked) {
mSensorPrivacyManager.setSensorPrivacyForProfileGroup(source, sensor, blocked);
}
/**
* Sets the sensor privacy for the given user's profile group.
* @param source The source with which sensor privacy is toggled.
* @param sensor The sensor to set for
* @param blocked The state to set to
*/
public void setSensorBlockedForProfileGroup(int source, int sensor, boolean blocked,
int userId) {
mSensorPrivacyManager.setSensorPrivacyForProfileGroup(source, sensor, blocked, userId);
}
/**
* Adds a listener for the state of the current user. If the current user changes and the state
* of the new user is different, a callback will be received.