Loading core/java/android/os/PowerManagerInternal.java +4 −18 Original line number Diff line number Diff line Loading @@ -53,24 +53,6 @@ public abstract class PowerManagerInternal { */ public static final int WAKEFULNESS_DOZING = 3; /** * Power hint: * Interaction: The user is interacting with the device. The corresponding data field must be * the expected duration of the interaction, or 0 if unknown. * * Sustained Performance Mode: The corresponding data field must be Enable/Disable * Sustained Performance Mode. * * Launch: This is specific for activity launching. The corresponding data field must be * the expected duration of the required boost, or 0 if unknown. * * These must be kept in sync with the values in hardware/libhardware/include/hardware/power.h */ public static final int POWER_HINT_INTERACTION = 2; public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6; public static final int POWER_HINT_LAUNCH = 8; public static String wakefulnessToString(int wakefulness) { switch (wakefulness) { case WAKEFULNESS_ASLEEP: Loading Loading @@ -169,5 +151,9 @@ public abstract class PowerManagerInternal { public abstract void uidGone(int uid); /** * The hintId sent through this method should be in-line with the * PowerHint defined in android/hardware/power/<version 1.0 & up>/IPower.h */ public abstract void powerHint(int hintId, int data); } services/core/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ LOCAL_SRC_FILES += \ LOCAL_AIDL_INCLUDES += \ system/netd/server/binder LOCAL_JAVA_LIBRARIES := services.net telephony-common LOCAL_JAVA_LIBRARIES := services.net telephony-common \ android.hardware.power@1.0-java LOCAL_STATIC_JAVA_LIBRARIES := tzdata_update LOCAL_PROTOC_OPTIMIZE_TYPE := nano Loading services/core/java/com/android/server/am/ActivityStarter.java +3 −2 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Rect; import android.hardware.power.V1_0.PowerHint; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; Loading Loading @@ -1003,7 +1004,7 @@ class ActivityStarter { curTop.task != null && mStartActivity != null && curTop.task != mStartActivity.task )) && mService.mLocalPowerManager != null) { mService.mLocalPowerManager.powerHint(PowerManagerInternal.POWER_HINT_LAUNCH, 1); mService.mLocalPowerManager.powerHint(PowerHint.LAUNCH, 1); mPowerHintSent = true; } } Loading @@ -1011,7 +1012,7 @@ class ActivityStarter { void sendPowerHintForLaunchEndIfNeeded() { // Trigger launch power hint if activity is launched if (mPowerHintSent && mService.mLocalPowerManager != null) { mService.mLocalPowerManager.powerHint(PowerManagerInternal.POWER_HINT_LAUNCH, 0); mService.mLocalPowerManager.powerHint(PowerHint.LAUNCH, 0); mPowerHintSent = false; } } Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ import android.hardware.hdmi.HdmiControlManager; import android.hardware.hdmi.HdmiPlaybackClient; import android.hardware.hdmi.HdmiPlaybackClient.OneTouchPlayCallback; import android.hardware.input.InputManagerInternal; import android.hardware.power.V1_0.PowerHint; import android.media.AudioAttributes; import android.media.AudioManager; import android.media.AudioSystem; Loading Loading @@ -907,7 +908,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void run() { // send interaction hint to improve redraw performance mPowerManagerInternal.powerHint(PowerManagerInternal.POWER_HINT_INTERACTION, 0); mPowerManagerInternal.powerHint(PowerHint.INTERACTION, 0); updateRotation(false); } }; Loading Loading @@ -1838,7 +1839,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void onFling(int duration) { if (mPowerManagerInternal != null) { mPowerManagerInternal.powerHint( PowerManagerInternal.POWER_HINT_INTERACTION, duration); PowerHint.INTERACTION, duration); } } @Override Loading services/core/java/com/android/server/power/PowerManagerService.java +4 −8 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.hardware.SensorManager; import android.hardware.SystemSensorManager; import android.hardware.display.DisplayManagerInternal; import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest; import android.hardware.power.V1_0.PowerHint; import android.net.Uri; import android.os.BatteryManager; import android.os.BatteryManagerInternal; Loading Loading @@ -84,7 +85,6 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import static android.os.PowerManagerInternal.POWER_HINT_INTERACTION; import static android.os.PowerManagerInternal.WAKEFULNESS_ASLEEP; import static android.os.PowerManagerInternal.WAKEFULNESS_AWAKE; import static android.os.PowerManagerInternal.WAKEFULNESS_DOZING; Loading Loading @@ -163,10 +163,6 @@ public final class PowerManagerService extends SystemService // How long a partial wake lock must be held until we consider it a long wake lock. static final long MIN_LONG_WAKE_CHECK_INTERVAL = 60*1000; // Power hints defined in hardware/libhardware/include/hardware/power.h. private static final int POWER_HINT_LOW_POWER = 5; private static final int POWER_HINT_VR_MODE = 7; // Power features defined in hardware/libhardware/include/hardware/power.h. private static final int POWER_FEATURE_DOUBLE_TAP_TO_WAKE = 1; Loading Loading @@ -826,7 +822,7 @@ public final class PowerManagerService extends SystemService if (mLowPowerModeEnabled != lowPowerModeEnabled) { mLowPowerModeEnabled = lowPowerModeEnabled; powerHintInternal(POWER_HINT_LOW_POWER, lowPowerModeEnabled ? 1 : 0); powerHintInternal(PowerHint.LOW_POWER, lowPowerModeEnabled ? 1 : 0); postAfterBootCompleted(new Runnable() { @Override public void run() { Loading Loading @@ -1152,7 +1148,7 @@ public final class PowerManagerService extends SystemService Trace.traceBegin(Trace.TRACE_TAG_POWER, "userActivity"); try { if (eventTime > mLastInteractivePowerHintTime) { powerHintInternal(POWER_HINT_INTERACTION, 0); powerHintInternal(PowerHint.INTERACTION, 0); mLastInteractivePowerHintTime = eventTime; } Loading Loading @@ -3083,7 +3079,7 @@ public final class PowerManagerService extends SystemService private final IVrStateCallbacks mVrStateCallbacks = new IVrStateCallbacks.Stub() { @Override public void onVrStateChanged(boolean enabled) { powerHintInternal(POWER_HINT_VR_MODE, enabled ? 1 : 0); powerHintInternal(PowerHint.VR_MODE, enabled ? 1 : 0); } }; Loading Loading
core/java/android/os/PowerManagerInternal.java +4 −18 Original line number Diff line number Diff line Loading @@ -53,24 +53,6 @@ public abstract class PowerManagerInternal { */ public static final int WAKEFULNESS_DOZING = 3; /** * Power hint: * Interaction: The user is interacting with the device. The corresponding data field must be * the expected duration of the interaction, or 0 if unknown. * * Sustained Performance Mode: The corresponding data field must be Enable/Disable * Sustained Performance Mode. * * Launch: This is specific for activity launching. The corresponding data field must be * the expected duration of the required boost, or 0 if unknown. * * These must be kept in sync with the values in hardware/libhardware/include/hardware/power.h */ public static final int POWER_HINT_INTERACTION = 2; public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6; public static final int POWER_HINT_LAUNCH = 8; public static String wakefulnessToString(int wakefulness) { switch (wakefulness) { case WAKEFULNESS_ASLEEP: Loading Loading @@ -169,5 +151,9 @@ public abstract class PowerManagerInternal { public abstract void uidGone(int uid); /** * The hintId sent through this method should be in-line with the * PowerHint defined in android/hardware/power/<version 1.0 & up>/IPower.h */ public abstract void powerHint(int hintId, int data); }
services/core/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ LOCAL_SRC_FILES += \ LOCAL_AIDL_INCLUDES += \ system/netd/server/binder LOCAL_JAVA_LIBRARIES := services.net telephony-common LOCAL_JAVA_LIBRARIES := services.net telephony-common \ android.hardware.power@1.0-java LOCAL_STATIC_JAVA_LIBRARIES := tzdata_update LOCAL_PROTOC_OPTIMIZE_TYPE := nano Loading
services/core/java/com/android/server/am/ActivityStarter.java +3 −2 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Rect; import android.hardware.power.V1_0.PowerHint; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; Loading Loading @@ -1003,7 +1004,7 @@ class ActivityStarter { curTop.task != null && mStartActivity != null && curTop.task != mStartActivity.task )) && mService.mLocalPowerManager != null) { mService.mLocalPowerManager.powerHint(PowerManagerInternal.POWER_HINT_LAUNCH, 1); mService.mLocalPowerManager.powerHint(PowerHint.LAUNCH, 1); mPowerHintSent = true; } } Loading @@ -1011,7 +1012,7 @@ class ActivityStarter { void sendPowerHintForLaunchEndIfNeeded() { // Trigger launch power hint if activity is launched if (mPowerHintSent && mService.mLocalPowerManager != null) { mService.mLocalPowerManager.powerHint(PowerManagerInternal.POWER_HINT_LAUNCH, 0); mService.mLocalPowerManager.powerHint(PowerHint.LAUNCH, 0); mPowerHintSent = false; } } Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ import android.hardware.hdmi.HdmiControlManager; import android.hardware.hdmi.HdmiPlaybackClient; import android.hardware.hdmi.HdmiPlaybackClient.OneTouchPlayCallback; import android.hardware.input.InputManagerInternal; import android.hardware.power.V1_0.PowerHint; import android.media.AudioAttributes; import android.media.AudioManager; import android.media.AudioSystem; Loading Loading @@ -907,7 +908,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void run() { // send interaction hint to improve redraw performance mPowerManagerInternal.powerHint(PowerManagerInternal.POWER_HINT_INTERACTION, 0); mPowerManagerInternal.powerHint(PowerHint.INTERACTION, 0); updateRotation(false); } }; Loading Loading @@ -1838,7 +1839,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void onFling(int duration) { if (mPowerManagerInternal != null) { mPowerManagerInternal.powerHint( PowerManagerInternal.POWER_HINT_INTERACTION, duration); PowerHint.INTERACTION, duration); } } @Override Loading
services/core/java/com/android/server/power/PowerManagerService.java +4 −8 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.hardware.SensorManager; import android.hardware.SystemSensorManager; import android.hardware.display.DisplayManagerInternal; import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest; import android.hardware.power.V1_0.PowerHint; import android.net.Uri; import android.os.BatteryManager; import android.os.BatteryManagerInternal; Loading Loading @@ -84,7 +85,6 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import static android.os.PowerManagerInternal.POWER_HINT_INTERACTION; import static android.os.PowerManagerInternal.WAKEFULNESS_ASLEEP; import static android.os.PowerManagerInternal.WAKEFULNESS_AWAKE; import static android.os.PowerManagerInternal.WAKEFULNESS_DOZING; Loading Loading @@ -163,10 +163,6 @@ public final class PowerManagerService extends SystemService // How long a partial wake lock must be held until we consider it a long wake lock. static final long MIN_LONG_WAKE_CHECK_INTERVAL = 60*1000; // Power hints defined in hardware/libhardware/include/hardware/power.h. private static final int POWER_HINT_LOW_POWER = 5; private static final int POWER_HINT_VR_MODE = 7; // Power features defined in hardware/libhardware/include/hardware/power.h. private static final int POWER_FEATURE_DOUBLE_TAP_TO_WAKE = 1; Loading Loading @@ -826,7 +822,7 @@ public final class PowerManagerService extends SystemService if (mLowPowerModeEnabled != lowPowerModeEnabled) { mLowPowerModeEnabled = lowPowerModeEnabled; powerHintInternal(POWER_HINT_LOW_POWER, lowPowerModeEnabled ? 1 : 0); powerHintInternal(PowerHint.LOW_POWER, lowPowerModeEnabled ? 1 : 0); postAfterBootCompleted(new Runnable() { @Override public void run() { Loading Loading @@ -1152,7 +1148,7 @@ public final class PowerManagerService extends SystemService Trace.traceBegin(Trace.TRACE_TAG_POWER, "userActivity"); try { if (eventTime > mLastInteractivePowerHintTime) { powerHintInternal(POWER_HINT_INTERACTION, 0); powerHintInternal(PowerHint.INTERACTION, 0); mLastInteractivePowerHintTime = eventTime; } Loading Loading @@ -3083,7 +3079,7 @@ public final class PowerManagerService extends SystemService private final IVrStateCallbacks mVrStateCallbacks = new IVrStateCallbacks.Stub() { @Override public void onVrStateChanged(boolean enabled) { powerHintInternal(POWER_HINT_VR_MODE, enabled ? 1 : 0); powerHintInternal(PowerHint.VR_MODE, enabled ? 1 : 0); } }; Loading