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

Commit a947e298 authored by Hui Yu's avatar Hui Yu
Browse files

Remove DeviceConfig mFlagFgsStartTempAllowListEnabled.

BG-FGS-Lauch always check temp allowlist now.

Bug: 171305836
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
Change-Id: I06d4218497402b16b5d3c67b2aeaaf438636272e
parent 799b044d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -5285,8 +5285,7 @@ public final class ActiveServices {
        }

        if (ret == FGS_FEATURE_DENIED) {
            if (mAm.mConstants.mFlagFgsStartTempAllowListEnabled
                    && mAm.isWhitelistedForFgsStartLocked(r.appInfo.uid)) {
            if (mAm.isWhitelistedForFgsStartLocked(r.appInfo.uid)) {
                // uid is on DeviceIdleController's user/system allowlist
                // or AMS's FgsStartTempAllowList.
                ret = FGS_FEATURE_ALLOWED_BY_DEVICE_IDLE_ALLOW_LIST;
+0 −21
Original line number Diff line number Diff line
@@ -166,13 +166,6 @@ final class ActivityManagerConstants extends ContentObserver {
    private static final String KEY_DEFAULT_FGS_STARTS_RESTRICTION_ENABLED =
            "default_fgs_starts_restriction_enabled";

    /**
     * Default value for mFlagFgsStartTempAllowListEnabled if not explicitly set in
     * Settings.Global.
     */
    private static final String KEY_DEFAULT_FGS_STARTS_TEMP_ALLOWLIST_ENABLED =
            "default_fgs_starts_temp_allowlist_enabled";

    /**
     * Whether FGS notification display is deferred following the transition into
     * the foreground state.  Default behavior is {@code true} unless overridden.
@@ -372,10 +365,6 @@ final class ActivityManagerConstants extends ContentObserver {
    // at all.
    volatile boolean mFlagFgsStartRestrictionEnabled = false;

    // When the foreground service background start restriction is enabled, if the app in
    // DeviceIdleController's Temp AllowList is allowed to bypass the restriction.
    volatile boolean mFlagFgsStartTempAllowListEnabled = false;

    // Whether we defer FGS notifications a few seconds following their transition to
    // the foreground state.  Applies only to S+ apps; enabled by default.
    volatile boolean mFlagFgsNotificationDeferralEnabled = true;
@@ -540,9 +529,6 @@ final class ActivityManagerConstants extends ContentObserver {
                            case KEY_DEFAULT_FGS_STARTS_RESTRICTION_ENABLED:
                                updateFgsStartsRestriction();
                                break;
                            case KEY_DEFAULT_FGS_STARTS_TEMP_ALLOWLIST_ENABLED:
                                updateFgsStartsTempAllowList();
                                break;
                            case KEY_DEFERRED_FGS_NOTIFICATIONS_ENABLED:
                                updateFgsNotificationDeferralEnable();
                                break;
@@ -809,13 +795,6 @@ final class ActivityManagerConstants extends ContentObserver {
                /*defaultValue*/ false);
    }

    private void updateFgsStartsTempAllowList() {
        mFlagFgsStartTempAllowListEnabled = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                KEY_DEFAULT_FGS_STARTS_TEMP_ALLOWLIST_ENABLED,
                /*defaultValue*/ false);
    }

    private void updateFgsNotificationDeferralEnable() {
        mFlagFgsNotificationDeferralEnabled = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,