diff options
| author | Steve Kondik <steve@cyngn.com> | 2013-11-04 02:59:16 +0000 |
|---|---|---|
| committer | Steve Kondik <steve@cyngn.com> | 2015-11-01 05:06:16 -0800 |
| commit | 41be9385e036bcfb7a1c8c5a86bb60addfaec657 (patch) | |
| tree | 5510209512d60dc02fb360d40feadb8213c005c2 /core/java/android/widget | |
| parent | 2e724e9fe80ccf4ba8f2a98963279e4182485a60 (diff) | |
| download | frameworks_base-41be9385e036bcfb7a1c8c5a86bb60addfaec657.zip frameworks_base-41be9385e036bcfb7a1c8c5a86bb60addfaec657.tar.gz frameworks_base-41be9385e036bcfb7a1c8c5a86bb60addfaec657.tar.bz2 | |
power: Add CM performance manager
Squashed commit of:
power: Add CPU boosting interface
* Boosts CPU using Power HAL for the given duration.
* Duration is given in microseconds.
* Power HAL must implement POWER_HINT_CPU_BOOST.
Add CPU boosting hooks
* Send boost hint during scrolling
* Still relevant on even high-end hardware
perf: Send a boost hint when a key on the navbar is pressed
* A lot of stuff happens, especially when invoking recents.
* Get ahead of the storm by sending a boost hint before
kicking off the animations.
perf: Send boost hint during initial launch
perf: Per-app performance profiles
* Performance Profiles is going to grow into a much more powerful
feature which can apply advanced optimizations or power saving
techniques depending on both the state of the hardware as well
as the current applications in use.
* Refactor the original code and move it into PowerManager so
that it's managed from the same place.
* Implement "automatic performance profiles". This feature will
automatically select a profile when specific activities are
running. Currently this list is static and engages performance
mode for several benchmarks (trollface).
* Added support for a new power hint, POWER_HINT_SET_PROFILE.
Currently, these profiles are fired using a property trigger
in init. This is easy, but the PowerHAL can do more.
* Moved the setting to Settings.Secure and also wrapped calls
to the service in the DEVICE_POWER permission. Nobody should
mess with this stuff except the system.
* Powersave profile will automatically activate Android's built-in
low power mode.
* Original patch by Jorge Ruesga
TODO:
* Implement API for per-app configuration by user
* Quicksettings tile
perf: Boost during animations
* Reduce animation jank by preemptively boostin the CPUs.
* Original idea taken from CodeAurora, modified for CM perf control.
systemui: Boost when expanding the notification shade
power: Add a new power hint for application launches
* Some devices may prefer a different behavior when launching apps,
particularly to avoid priority inversion issues. Add support
for a new LAUNCH_BOOST hint which can be handled in the PowerHAL.
power: Boost improvements
* Boost when opening the panelview
* Adjust launch boost to handle relaunch correctly
PowerManager: change performance profile when disabling battery saver
We need to be sure to update the performance profile when the system
disables battery saver mode.
This fixes the perf tile becoming out of sync - changing it to low power
mode triggers power saver, but turning power saver off does not trigger
the tile.
Ref: CYNGNOS-1156
Signed-off-by: Roman Birg <roman@cyngn.com>
base: cache power profiles support
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
perf: Add support for additional power profiles
* Add support for bias power (efficiency) and bias performance (quick)
modes if supported by a device.
Change-Id: Id3a53eaacdaf6ae93ee899835cfcb21279d35ad4
Diffstat (limited to 'core/java/android/widget')
| -rw-r--r-- | core/java/android/widget/OverScroller.java | 5 | ||||
| -rw-r--r-- | core/java/android/widget/Scroller.java | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/widget/OverScroller.java b/core/java/android/widget/OverScroller.java index 50569d7..9130d9a 100644 --- a/core/java/android/widget/OverScroller.java +++ b/core/java/android/widget/OverScroller.java @@ -18,6 +18,7 @@ package android.widget; import android.content.Context; import android.hardware.SensorManager; +import android.os.PowerManager; import android.util.Log; import android.view.ViewConfiguration; import android.view.animation.AnimationUtils; @@ -599,6 +600,8 @@ public class OverScroller { private static final int CUBIC = 1; private static final int BALLISTIC = 2; + private final PowerManager mPm; + static { float x_min = 0.0f; float y_min = 0.0f; @@ -643,6 +646,7 @@ public class OverScroller { * 39.37f // inch/meter * ppi * 0.84f; // look and feel tuning + mPm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); } void updateScroll(float q) { @@ -760,6 +764,7 @@ public class OverScroller { if (velocity != 0) { mDuration = mSplineDuration = getSplineFlingDuration(velocity); totalDistance = getSplineFlingDistance(velocity); + mPm.cpuBoost(mDuration * 1000); } mSplineDistance = (int) (totalDistance * Math.signum(velocity)); diff --git a/core/java/android/widget/Scroller.java b/core/java/android/widget/Scroller.java index 357c9c3..a968eae 100644 --- a/core/java/android/widget/Scroller.java +++ b/core/java/android/widget/Scroller.java @@ -19,6 +19,7 @@ package android.widget; import android.content.Context; import android.hardware.SensorManager; import android.os.Build; +import android.os.PowerManager; import android.view.ViewConfiguration; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; @@ -108,6 +109,8 @@ public class Scroller { private float mDeceleration; private final float mPpi; + private final PowerManager mPm; + // A context-specific coefficient adjusted to physical values. private float mPhysicalCoeff; @@ -178,6 +181,8 @@ public class Scroller { mFlywheel = flywheel; mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning + + mPm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); } /** @@ -395,6 +400,8 @@ public class Scroller { mDeltaX = dx; mDeltaY = dy; mDurationReciprocal = 1.0f / (float) mDuration; + + mPm.cpuBoost(duration * 1000); } /** |
