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

Commit 35621c7d authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'eclair' into eclair-release

parents 784cd29e ba8eb1ef
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -426,6 +426,21 @@ void IPCThreadState::joinThreadPool(bool isMain)
            result = executeCommand(cmd);
        }
        
        // After executing the command, ensure that the thread is returned to the
        // default cgroup and priority before rejoining the pool.  This is a failsafe
        // in case the command implementation failed to properly restore the thread's
        // scheduling parameters upon completion.
        int my_id;
#ifdef HAVE_GETTID
        my_id = gettid();
#else
        my_id = getpid();
#endif
        if (!set_sched_policy(my_id, SP_FOREGROUND)) {
            // success; reset the priority as well
            setpriority(PRIO_PROCESS, my_id, ANDROID_PRIORITY_NORMAL);
        }

        // Let this thread exit the thread pool if it is no longer
        // needed and it is not the main process thread.
        if(result == TIMED_OUT && !isMain) {
+14 −3
Original line number Diff line number Diff line
@@ -1440,6 +1440,8 @@ class PowerManagerService extends IPowerManager.Stub
                        sendNotificationLocked(true, -1);
                    }
                } else {
                    // cancel light sensor task
                    mHandler.removeCallbacks(mAutoBrightnessTask);
                    mScreenOffTime = SystemClock.elapsedRealtime();
                    long identity = Binder.clearCallingIdentity();
                    try {
@@ -1803,6 +1805,10 @@ class PowerManagerService extends IPowerManager.Stub
        }
    }

    private boolean isScreenTurningOffLocked() {
        return (mScreenBrightness.animating && mScreenBrightness.targetValue == 0);
    }

    private void forceUserActivityLocked() {
        // cancel animation so userActivity will succeed
        mScreenBrightness.animating = false;
@@ -1863,7 +1869,7 @@ class PowerManagerService extends IPowerManager.Stub
                        + " force=" + force);
            }
            // ignore user activity if we are in the process of turning off the screen
            if (mScreenBrightness.animating && mScreenBrightness.targetValue == 0) {
            if (isScreenTurningOffLocked()) {
                Log.d(TAG, "ignoring user activity while turning off screen");
                return;
            }
@@ -2410,7 +2416,7 @@ class PowerManagerService extends IPowerManager.Stub

    SensorEventListener mProximityListener = new SensorEventListener() {
        public void onSensorChanged(SensorEvent event) {
            long milliseconds = event.timestamp / 1000000;
            long milliseconds = SystemClock.elapsedRealtime();
            synchronized (mLocks) {
                float distance = event.values[0];
                long timeSinceLastEvent = milliseconds - mLastProximityEventTime;
@@ -2441,8 +2447,13 @@ class PowerManagerService extends IPowerManager.Stub
    SensorEventListener mLightListener = new SensorEventListener() {
        public void onSensorChanged(SensorEvent event) {
            synchronized (mLocks) {
                // ignore light sensor while screen is turning off
                if (isScreenTurningOffLocked()) {
                    return;
                }

                int value = (int)event.values[0];
                long milliseconds = event.timestamp / 1000000;
                long milliseconds = SystemClock.elapsedRealtime();
                if (mDebugLightSensor) {
                    Log.d(TAG, "onSensorChanged: light value: " + value);
                }