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

Commit da9c082c authored by Sravan Kumar V's avatar Sravan Kumar V Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth-opp: Optimize OPP Power consummation.

Sleep BT service thread when screen is turned off
to avoid unnecessary iterations which leads to
High power consumption.

Change-Id: I14261aa9f7b995ff72ab8f1827084b92ad7d0f75
CRs-Fixed: 971559
parent d919b2d0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -449,6 +449,7 @@ public class BluetoothOppService extends Service {
            mPendingUpdate = true;
            if ((mUpdateThread == null) && (mAdapter != null)
                && mAdapter.isEnabled()) {
                mPowerManager = (PowerManager)getSystemService(POWER_SERVICE);
                if (V) Log.v(TAG, "Starting a new thread");
                mUpdateThread = new UpdateThread();
                mUpdateThread.start();
@@ -484,6 +485,13 @@ public class BluetoothOppService extends Service {
                        if (V) Log.v(TAG, "***returning from updatethread***");
                        return;
                    }
                    try {
                        if (!mPowerManager.isInteractive())
                            Thread.sleep(1000);
                    } catch (InterruptedException e) {
                            Log.e(TAG, "Interrupted", e);
                    }

                    mPendingUpdate = false;
                }
                Cursor cursor;