Settings: Add laser sensor preference

Add a switch for enabling/disabling the laser sensor within
developer options.

Test: Manual using setting app, RunSettingsRoboTests
Bug: 64423712
Change-Id: I89a32dfa062fc62c4be096d2e026a32ce9b784ca
This commit is contained in:
Emilian Peev
2017-09-06 16:47:08 +01:00
parent 3d1f6abd6f
commit 6530b21cc5
6 changed files with 299 additions and 0 deletions

View File

@@ -364,6 +364,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private BugReportInPowerPreferenceController mBugReportInPowerController;
private TelephonyMonitorPreferenceController mTelephonyMonitorController;
private CameraHalHdrplusPreferenceController mCameraHalHdrplusController;
private CameraLaserSensorPreferenceController mCameraLaserSensorController;
private BroadcastReceiver mEnableAdbReceiver;
@@ -405,6 +406,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mWebViewAppPrefController = new WebViewAppPreferenceController(getActivity());
mVerifyAppsOverUsbController = new VerifyAppsOverUsbPreferenceController(getActivity());
mCameraHalHdrplusController = new CameraHalHdrplusPreferenceController(getActivity());
mCameraLaserSensorController = new CameraLaserSensorPreferenceController(getActivity());
setIfOnlyAvailableForAdmins(true);
if (isUiRestricted() || !Utils.isDeviceProvisioned(getActivity())) {
@@ -440,6 +442,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mCameraHalHdrplusController.displayPreference(getPreferenceScreen());
mEnableAdbController.displayPreference(getPreferenceScreen());
mCameraLaserSensorController.displayPreference(getPreferenceScreen());
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
@@ -659,6 +663,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mTelephonyMonitorController.enablePreference(enabled);
mWebViewAppPrefController.enablePreference(enabled);
mCameraHalHdrplusController.enablePreference(enabled);
mCameraLaserSensorController.enablePreference(enabled);
updateAllOptions();
}
@@ -793,6 +798,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mHaveDebugSettings |= mBugReportInPowerController.updatePreference();
mHaveDebugSettings |= mTelephonyMonitorController.updatePreference();
mHaveDebugSettings |= mCameraHalHdrplusController.updatePreference();
mHaveDebugSettings |= mCameraLaserSensorController.updatePreference();
updateSwitchPreference(mKeepScreenOn, Settings.Global.getInt(cr,
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
updateSwitchPreference(mBtHciSnoopLog, SystemProperties.getBoolean(
@@ -2459,6 +2465,10 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
return true;
}
if (mCameraLaserSensorController.handlePreferenceTreeClick(preference)) {
return true;
}
if (preference == mClearAdbKeys) {
if (mAdbKeysDialog != null) dismissDialogs();
mAdbKeysDialog = new AlertDialog.Builder(getActivity())