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

Commit 7936113d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Play vibration when non-wireless charging starts"

parents 75d4db71 e21f4dd4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6207,7 +6207,7 @@ public final class Settings {
        public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
        /**
         * Whether to vibrate for wireless charging events.
         * Whether to vibrate for charging events.
         * @hide
         */
        public static final String CHARGING_VIBRATION_ENABLED = "charging_vibration_enabled";
+6 −6
Original line number Diff line number Diff line
@@ -755,9 +755,10 @@ public class Notifier {
    };

    /**
     * Plays the wireless charging sound for both wireless and non-wireless charging
     * If enabled, plays a sound and/or vibration when wireless or non-wireless charging has started
     */
    private void playChargingStartedSound(@UserIdInt int userId) {
    private void playChargingStartedFeedback(@UserIdInt int userId) {
        playChargingStartedVibration(userId);
        final String soundPath = Settings.Global.getString(mContext.getContentResolver(),
                Settings.Global.CHARGING_STARTED_SOUND);
        if (isChargingFeedbackEnabled(userId) && soundPath != null) {
@@ -773,8 +774,7 @@ public class Notifier {
    }

    private void showWirelessChargingStarted(int batteryLevel, @UserIdInt int userId) {
        playWirelessChargingVibration(userId);
        playChargingStartedSound(userId);
        playChargingStartedFeedback(userId);
        if (mStatusBarManagerInternal != null) {
            mStatusBarManagerInternal.showChargingAnimation(batteryLevel);
        }
@@ -782,7 +782,7 @@ public class Notifier {
    }

    private void showWiredChargingStarted(@UserIdInt int userId) {
        playChargingStartedSound(userId);
        playChargingStartedFeedback(userId);
        mSuspendBlocker.release();
    }

@@ -790,7 +790,7 @@ public class Notifier {
        mTrustManager.setDeviceLockedForUser(userId, true /*locked*/);
    }

    private void playWirelessChargingVibration(@UserIdInt int userId) {
    private void playChargingStartedVibration(@UserIdInt int userId) {
        final boolean vibrateEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(),
                Settings.Secure.CHARGING_VIBRATION_ENABLED, 1, userId) != 0;
        if (vibrateEnabled && isChargingFeedbackEnabled(userId)) {