Add stats log for sensor privacy.
Test: statsd_testdrive 381 BUG: 192269258 Change-Id: I69e766b789b4b4a6ca0ad26b3a312baca3dbccd2
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.display;
|
||||
|
||||
import static android.hardware.SensorPrivacyManager.Sensors.CAMERA;
|
||||
import static android.hardware.SensorPrivacyManager.Sources.DIALOG;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.SensorPrivacyManager;
|
||||
@@ -77,7 +78,7 @@ public class AdaptiveSleepCameraStatePreferenceController {
|
||||
mPreference.setSummary(R.string.adaptive_sleep_camera_lock_summary);
|
||||
mPreference.setPositiveButtonText(R.string.allow);
|
||||
mPreference.setPositiveButtonOnClickListener(
|
||||
p -> mPrivacyManager.setSensorPrivacy(CAMERA, false));
|
||||
p -> mPrivacyManager.setSensorPrivacy(DIALOG, CAMERA, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.display;
|
||||
|
||||
import static android.hardware.SensorPrivacyManager.Sensors.CAMERA;
|
||||
import static android.hardware.SensorPrivacyManager.Sources.DIALOG;
|
||||
|
||||
import static com.android.settings.display.SmartAutoRotateController.isRotationResolverServiceAvailable;
|
||||
|
||||
@@ -63,7 +64,7 @@ public class SmartAutoRotateCameraStateController extends BasePreferenceControll
|
||||
((BannerMessagePreference) mPreference)
|
||||
.setPositiveButtonText(R.string.allow)
|
||||
.setPositiveButtonOnClickListener(v -> {
|
||||
mPrivacyManager.setSensorPrivacy(CAMERA, false);
|
||||
mPrivacyManager.setSensorPrivacy(DIALOG, CAMERA, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.privacy;
|
||||
|
||||
import static android.hardware.SensorPrivacyManager.Sources.SETTINGS;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -51,7 +53,7 @@ public abstract class SensorToggleController extends TogglePreferenceController
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
mSensorPrivacyManagerHelper.setSensorBlocked(getSensor(), !isChecked);
|
||||
mSensorPrivacyManagerHelper.setSensorBlocked(SETTINGS, getSensor(), !isChecked);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -153,21 +153,23 @@ public class SensorPrivacyManagerHelper {
|
||||
|
||||
/**
|
||||
* Sets the sensor privacy for the current user.
|
||||
* @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 setSensorBlocked(int sensor, boolean blocked) {
|
||||
mSensorPrivacyManager.setSensorPrivacy(sensor, blocked);
|
||||
public void setSensorBlocked(int source, int sensor, boolean blocked) {
|
||||
mSensorPrivacyManager.setSensorPrivacy(source, sensor, blocked);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sensor privacy for the given user.
|
||||
* @param source The source with which sensor privacy is toggled.
|
||||
* @param sensor The sensor to set for
|
||||
* @param blocked The state to set to
|
||||
* @param userId The user to set for
|
||||
*/
|
||||
public void setSensorBlocked(int sensor, boolean blocked, int userId) {
|
||||
mSensorPrivacyManager.setSensorPrivacy(sensor, blocked, userId);
|
||||
public void setSensorBlocked(int source, int sensor, boolean blocked, int userId) {
|
||||
mSensorPrivacyManager.setSensorPrivacy(source, sensor, blocked, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user