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

Commit fcaab29a authored by Beverly's avatar Beverly
Browse files

Get rid of upperbound on wireless charging anim

Previously, if the battery percentage was above 95%, then
wireless charging wouldn't turn the screen on nor play the
wireless charging animation. Now the charging
animation will trigger even if battery percentage is above 95%.

Test: manual
Change-Id: I531334548d41cba8a1a4c28dff484d3f2dfefe01
Fixes: 75029514
parent fa23f8e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1724,7 +1724,7 @@ public final class PowerManagerService extends SystemService

                // Update wireless dock detection state.
                final boolean dockedOnWirelessCharger = mWirelessChargerDetector.update(
                        mIsPowered, mPlugType, mBatteryLevel);
                        mIsPowered, mPlugType);

                // Treat plugging and unplugging the devices as a user activity.
                // Users find it disconcerting when they plug or unplug the device
+3 −12
Original line number Diff line number Diff line
@@ -84,10 +84,6 @@ final class WirelessChargerDetector {
    // The minimum number of samples that must be collected.
    private static final int MIN_SAMPLES = 3;

    // Upper bound on the battery charge percentage in order to consider turning
    // the screen on when the device starts charging wirelessly.
    private static final int WIRELESS_CHARGER_TURN_ON_BATTERY_LEVEL_LIMIT = 95;

    // To detect movement, we compute the angle between the gravity vector
    // at rest and the current gravity vector.  This field specifies the
    // cosine of the maximum angle variance that we tolerate while at rest.
@@ -214,11 +210,10 @@ final class WirelessChargerDetector {
     *
     * @param isPowered True if the device is powered.
     * @param plugType The current plug type.
     * @param batteryLevel The current battery level.
     * @return True if the device is determined to have just been docked on a wireless
     * charger, after suppressing spurious docking or undocking signals.
     */
    public boolean update(boolean isPowered, int plugType, int batteryLevel) {
    public boolean update(boolean isPowered, int plugType) {
        synchronized (mLock) {
            final boolean wasPoweredWirelessly = mPoweredWirelessly;

@@ -249,13 +244,9 @@ final class WirelessChargerDetector {
            }

            // Report that the device has been docked only if the device just started
            // receiving power wirelessly, has a high enough battery level that we
            // can be assured that charging was not delayed due to the battery previously
            // having been full, and the device is not known to already be at rest
            // receiving power wirelessly and the device is not known to already be at rest
            // on the wireless charger from earlier.
            return mPoweredWirelessly && !wasPoweredWirelessly
                    && batteryLevel < WIRELESS_CHARGER_TURN_ON_BATTERY_LEVEL_LIMIT
                    && !mAtRest;
            return mPoweredWirelessly && !wasPoweredWirelessly && !mAtRest;
        }
    }