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

Commit 3c8466a9 authored by Kihong Seong's avatar Kihong Seong Committed by Gerrit Code Review
Browse files

Merge "Add log for updateScanModeScreenOff" into main

parents f617a5a2 5d9edbd0
Loading
Loading
Loading
Loading
+27 −16
Original line number Diff line number Diff line
@@ -677,25 +677,36 @@ public class ScanManager {
            if (mScanNative.isOpportunisticScanClient(client)) {
                return false;
            }
            int updatedScanMode = client.scanModeApp;
            if (!isAppForeground(client) || mScanNative.isForceDowngradedScanClient(client)) {
                return client.updateScanMode(ScanSettings.SCAN_MODE_SCREEN_OFF);
            }

                updatedScanMode = ScanSettings.SCAN_MODE_SCREEN_OFF;
            } else {
                // The following codes are effectively only for services
                // Apps are either already or will be soon handled by handleImportanceChange().
                switch (client.scanModeApp) {
                    case ScanSettings.SCAN_MODE_LOW_POWER:
                    return client.updateScanMode(ScanSettings.SCAN_MODE_SCREEN_OFF);
                        updatedScanMode = ScanSettings.SCAN_MODE_SCREEN_OFF;
                        break;
                    case ScanSettings.SCAN_MODE_BALANCED:
                    case ScanSettings.SCAN_MODE_AMBIENT_DISCOVERY:
                    return client.updateScanMode(ScanSettings.SCAN_MODE_SCREEN_OFF_BALANCED);
                        updatedScanMode = ScanSettings.SCAN_MODE_SCREEN_OFF_BALANCED;
                        break;
                    case ScanSettings.SCAN_MODE_LOW_LATENCY:
                    return client.updateScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY);
                        updatedScanMode = ScanSettings.SCAN_MODE_LOW_LATENCY;
                        break;
                    case ScanSettings.SCAN_MODE_OPPORTUNISTIC:
                    default:
                        return false;
                }
            }
            Log.d(
                    TAG,
                    "Scan mode update during screen off from "
                            + client.scanModeApp
                            + " to "
                            + updatedScanMode);
            return client.updateScanMode(updatedScanMode);
        }

        /**
         * Services and Apps are assumed to be in the foreground by default unless it changes to the