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

Commit 783f9e66 authored by Guang Zhu's avatar Guang Zhu
Browse files

Use correct PowerManager call to wake up screen

The current implementation does not actually wakes up the screen.

Change-Id: Ief2dca013cfe40e03b64273fe7b09822e9ad42a7
parent add52a97
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -16,14 +16,12 @@

package com.android.commands.svc;

import android.os.Binder;
import android.os.IBinder;
import android.content.Context;
import android.os.BatteryManager;
import android.os.IPowerManager;
import android.os.PowerManager;
import android.os.ServiceManager;
import android.os.RemoteException;
import android.os.BatteryManager;
import android.content.Context;
import android.os.ServiceManager;
import android.os.SystemClock;

public class PowerCommand extends Svc.Command {
    public PowerCommand() {
@@ -65,10 +63,12 @@ public class PowerCommand extends Svc.Command {
                    IPowerManager pm
                            = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
                    try {
                        IBinder lock = new Binder();
                        pm.acquireWakeLock(lock, PowerManager.FULL_WAKE_LOCK, "svc power", null);
                        if (val != 0) {
                            // if the request is not to set it to false, wake up the screen so that
                            // it can stay on as requested
                            pm.wakeUp(SystemClock.uptimeMillis());
                        }
                        pm.setStayOnSetting(val);
                        pm.releaseWakeLock(lock, 0);
                    }
                    catch (RemoteException e) {
                        System.err.println("Faild to set setting: " + e);