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

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

Merge "Get rid of upperbound on wireless charging anim" into pi-dev

parents d5eab8b6 fcaab29a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1723,7 +1723,7 @@ public final class PowerManagerService extends SystemService


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


                // Treat plugging and unplugging the devices as a user activity.
                // Treat plugging and unplugging the devices as a user activity.
                // Users find it disconcerting when they plug or unplug the device
                // Users find it disconcerting when they plug or unplug the device
+3 −12
Original line number Original line Diff line number Diff line
@@ -84,10 +84,6 @@ final class WirelessChargerDetector {
    // The minimum number of samples that must be collected.
    // The minimum number of samples that must be collected.
    private static final int MIN_SAMPLES = 3;
    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
    // To detect movement, we compute the angle between the gravity vector
    // at rest and the current gravity vector.  This field specifies the
    // at rest and the current gravity vector.  This field specifies the
    // cosine of the maximum angle variance that we tolerate while at rest.
    // 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 isPowered True if the device is powered.
     * @param plugType The current plug type.
     * @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
     * @return True if the device is determined to have just been docked on a wireless
     * charger, after suppressing spurious docking or undocking signals.
     * 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) {
        synchronized (mLock) {
            final boolean wasPoweredWirelessly = mPoweredWirelessly;
            final boolean wasPoweredWirelessly = mPoweredWirelessly;


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


            // Report that the device has been docked only if the device just started
            // Report that the device has been docked only if the device just started
            // receiving power wirelessly, has a high enough battery level that we
            // receiving power wirelessly and the device is not known to already be at rest
            // 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
            // on the wireless charger from earlier.
            // on the wireless charger from earlier.
            return mPoweredWirelessly && !wasPoweredWirelessly
            return mPoweredWirelessly && !wasPoweredWirelessly && !mAtRest;
                    && batteryLevel < WIRELESS_CHARGER_TURN_ON_BATTERY_LEVEL_LIMIT
                    && !mAtRest;
        }
        }
    }
    }