diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index a69dd30bc0dc1..ebad4224199af 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -58,6 +58,8 @@ import android.os.SystemProperties; import android.os.SystemService; import android.os.UserHandle; import android.os.WorkSource; +import android.os.Parcel; +import android.os.ServiceManager; import android.provider.Settings; import android.service.dreams.DreamManagerInternal; import android.util.EventLog; @@ -659,6 +661,7 @@ public final class PowerManagerService extends com.android.server.SystemService if (mLowPowerModeEnabled != lowPowerModeEnabled) { mLowPowerModeEnabled = lowPowerModeEnabled; powerHintInternal(POWER_HINT_LOW_POWER_MODE, lowPowerModeEnabled ? 1 : 0); + setSurfaceFlingerLowPowerMode(lowPowerModeEnabled ? 1 : 0); mLowPowerModeEnabled = lowPowerModeEnabled; BackgroundThread.getHandler().post(new Runnable() { @Override @@ -2094,6 +2097,21 @@ public final class PowerManagerService extends com.android.server.SystemService nativeSendPowerHint(hintId, data); } + private static void setSurfaceFlingerLowPowerMode(int enabled) { + try { + final IBinder flinger = ServiceManager.getService("SurfaceFlinger"); + if (flinger != null) { + final Parcel data = Parcel.obtain(); + data.writeInterfaceToken("android.ui.ISurfaceComposer"); + data.writeInt(enabled); + flinger.transact(1016, data, null, 0); + data.recycle(); + } + } catch (RemoteException ex) { + Slog.e(TAG, "Failed to reduce refresh rate", ex); + } + } + /** * Low-level function turn the device off immediately, without trying * to be clean. Most people should use {@link ShutdownThread} for a clean shutdown.