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

Commit 401ad721 authored by Guang Zhu's avatar Guang Zhu
Browse files

Modify svc power command so it pokes the wake lock when called. This will...

Modify svc power command so it pokes the wake lock when called. This will ensure screen is not asleep if stayon is requested.
parent 455e3af1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@

package com.android.commands.svc;

import android.os.Binder;
import android.os.IBinder;
import android.os.IPowerManager;
import android.os.PowerManager;
import android.os.ServiceManager;
import android.os.RemoteException;
import android.os.BatteryManager;
@@ -60,7 +63,10 @@ public class PowerCommand extends Svc.Command {
                    IPowerManager pm
                            = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
                    try {
                        IBinder lock = new Binder();
                        pm.acquireWakeLock(PowerManager.FULL_WAKE_LOCK, lock, "svc power");
                        pm.setStayOnSetting(val);
                        pm.releaseWakeLock(lock);
                    }
                    catch (RemoteException e) {
                        System.err.println("Faild to set setting: " + e);