From fcaab29a663cc2b18c626464e1ceae6b44e51be6 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 19 Mar 2018 10:42:06 -0400 Subject: 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 --- .../com/android/server/power/PowerManagerService.java | 2 +- .../com/android/server/power/WirelessChargerDetector.java | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index 055e6ea3f4a4..0055aecb2cc7 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -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 diff --git a/services/core/java/com/android/server/power/WirelessChargerDetector.java b/services/core/java/com/android/server/power/WirelessChargerDetector.java index 54487e39d82f..18e5ce465df6 100644 --- a/services/core/java/com/android/server/power/WirelessChargerDetector.java +++ b/services/core/java/com/android/server/power/WirelessChargerDetector.java @@ -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; } } -- cgit v1.2.3-59-g8ed1b