Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c010951c authored by yuemingw's avatar yuemingw Committed by Yueming Wang
Browse files

Turn off ambient settings when DISALLOW_AMBIENT_DISPLAY is set.

Bug: 67675787
Test: manual
Change-Id: I2098b1d71ed7dd86e84137219ba4e8fd7020fad1
parent ebf2577f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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;
+19 −0
Original line number Diff line number Diff line
@@ -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);