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

Commit 69475c45 authored by Jing Ji's avatar Jing Ji
Browse files

Allow BG-FGS start on BOOT_COMPLETED if it's exempted for other reasons

Apps might be starting FGS on BOOT_COMPLTED and we limited it to only
the selected type of FGS if the BF-FGS allow reason is only due to
the BOOT_COMPLETED. However, if the app has other exemptions which
allow it to start FGS from the background, we should just honor it,
ignore the type requirement regarding the BOOT_COMPLETED exemption.

Bug: 335364900
Test: atest CtsAppTestCases:BootCompletedFgsStartTest
Change-Id: I35a99028d77b550ba6197cc18902b5a5a2cc3739
parent 721670be
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1168,9 +1168,7 @@ public final class ActiveServices {
    }

    private boolean shouldAllowBootCompletedStart(ServiceRecord r, int foregroundServiceType) {
        @PowerExemptionManager.ReasonCode final int fgsStartReasonCode =
                r.mInfoTempFgsAllowListReason != null ? r.mInfoTempFgsAllowListReason.mReasonCode
                                                      : REASON_DENIED;
        @PowerExemptionManager.ReasonCode final int fgsStartReasonCode = r.getFgsAllowStart();
        if (Flags.fgsBootCompleted()
                && CompatChanges.isChangeEnabled(FGS_BOOT_COMPLETED_RESTRICTIONS, r.appInfo.uid)
                && fgsStartReasonCode == PowerExemptionManager.REASON_BOOT_COMPLETED) {