@MainThread
    public void setScanPeriods(long scanPeriod, long betweenScanPeriod, boolean backgroundFlag) {
        LogManager.d(TAG, "Set scan periods called with %s, %s Background mode must have changed.",
                scanPeriod, betweenScanPeriod);
        if (mBackgroundFlag != backgroundFlag) {
            mRestartNeeded = true;
        }
        mBackgroundFlag = backgroundFlag;
        mScanPeriod = scanPeriod;
        mBetweenScanPeriod = betweenScanPeriod;
        if (mBackgroundFlag) {
            LogManager.d(TAG, "We are in the background.  Setting wakeup alarm");
            setWakeUpAlarm();
        } else {
            LogManager.d(TAG, "We are not in the background.  Cancelling wakeup alarm");
            cancelWakeUpAlarm();
        }
        long now = SystemClock.elapsedRealtime();
        if (mNextScanCycleStartTime > now) {
            // We are waiting to start scanning.  We may need to adjust the next start time
            // only do an adjustment if we need to make it happen sooner.  Otherwise, it will
            // take effect on the next cycle.
            long proposedNextScanStartTime = (mLastScanCycleEndTime + betweenScanPeriod);
            if (proposedNextScanStartTime < mNextScanCycleStartTime) {
                mNextScanCycleStartTime = proposedNextScanStartTime;
                LogManager.i(TAG, "Adjusted nextScanStartTime to be %s",
                        new Date(mNextScanCycleStartTime - SystemClock.elapsedRealtime() + System.currentTimeMillis()));
            }
        }
        if (mScanCycleStopTime > now) {
            // we are waiting to stop scanning.  We may need to adjust the stop time
            // only do an adjustment if we need to make it happen sooner.  Otherwise, it will
            // take effect on the next cycle.
            long proposedScanStopTime = (mLastScanCycleStartTime + scanPeriod);
            if (proposedScanStopTime < mScanCycleStopTime) {
                mScanCycleStopTime = proposedScanStopTime;
                LogManager.i(TAG, "Adjusted scanStopTime to be %s", mScanCycleStopTime);
            }
        }
    }
@ MainThread public void setScanPeriods ( long scanPeriod , long betweenScanPeriod , boolean backgroundFlag ) { LogManager . d ( TAG , "Set scan periods called with %s, %s Background mode must have changed." , scanPeriod , betweenScanPeriod ) ; if ( mBackgroundFlag != backgroundFlag ) { mRestartNeeded = true ; } mBackgroundFlag = backgroundFlag ; mScanPeriod = scanPeriod ; mBetweenScanPeriod = betweenScanPeriod ; if ( mBackgroundFlag ) { LogManager . d ( TAG , "We are in the background.  Setting wakeup alarm" ) ; setWakeUpAlarm ( ) ; } else { LogManager . d ( TAG , "We are not in the background.  Cancelling wakeup alarm" ) ; cancelWakeUpAlarm ( ) ; } long now = SystemClock . elapsedRealtime ( ) ; if ( mNextScanCycleStartTime > now ) { long proposedNextScanStartTime = ( mLastScanCycleEndTime + betweenScanPeriod ) ; if ( proposedNextScanStartTime < mNextScanCycleStartTime ) { mNextScanCycleStartTime = proposedNextScanStartTime ; LogManager . i ( TAG , "Adjusted nextScanStartTime to be %s" , new Date ( mNextScanCycleStartTime - SystemClock . elapsedRealtime ( ) + System . currentTimeMillis ( ) ) ) ; } } if ( mScanCycleStopTime > now ) { long proposedScanStopTime = ( mLastScanCycleStartTime + scanPeriod ) ; if ( proposedScanStopTime < mScanCycleStopTime ) { mScanCycleStopTime = proposedScanStopTime ; LogManager . i ( TAG , "Adjusted scanStopTime to be %s" , mScanCycleStopTime ) ; } } }
Tells the cycler the scan rate and whether it is in operating in background mode.
Background mode flag  is used only with the Android 5.0 scanning implementations to switch
between LOW_POWER_MODE vs. LOW_LATENCY_MODE
@param backgroundFlag