Merge "Turn off ambient settings when DISALLOW_AMBIENT_DISPLAY is set."

This commit is contained in:
TreeHugger Robot
2018-01-24 19:36:18 +00:00
committed by Android (Google) Code Review
2 changed files with 28 additions and 0 deletions

View File

@@ -1647,6 +1647,15 @@ public class SettingsProvider extends ContentProvider {
restriction = UserManager.DISALLOW_AIRPLANE_MODE;
break;
case Settings.Secure.DOZE_ENABLED:
case Settings.Secure.DOZE_ALWAYS_ON:
case Settings.Secure.DOZE_PULSE_ON_PICK_UP:
case Settings.Secure.DOZE_PULSE_ON_LONG_PRESS:
case Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP:
if ("0".equals(value)) return false;
restriction = UserManager.DISALLOW_AMBIENT_DISPLAY;
break;
default:
if (setting != null && setting.startsWith(Settings.Global.DATA_ROAMING)) {
if ("0".equals(value)) return false;

View File

@@ -561,6 +561,25 @@ public class UserRestrictionsUtils {
}
}
break;
case UserManager.DISALLOW_AMBIENT_DISPLAY:
if (newValue) {
android.provider.Settings.Secure.putString(
context.getContentResolver(),
Settings.Secure.DOZE_ENABLED, "0");
android.provider.Settings.Secure.putString(
context.getContentResolver(),
Settings.Secure.DOZE_ALWAYS_ON, "0");
android.provider.Settings.Secure.putString(
context.getContentResolver(),
Settings.Secure.DOZE_PULSE_ON_PICK_UP, "0");
android.provider.Settings.Secure.putString(
context.getContentResolver(),
Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, "0");
android.provider.Settings.Secure.putString(
context.getContentResolver(),
Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, "0");
}
break;
}
} finally {
Binder.restoreCallingIdentity(id);