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

Commit 4babd9c4 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Remove the flag to treat all "suspend" calls as "quarantine".

Bug: 305256093
Test: manual
Change-Id: Ibd4565081af144447ebca6e00c3ecf5b7ca6877d
parent 085eef0f
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -194,13 +194,6 @@ public class FeatureFlagUtils {
    public static final String SETTINGS_REMOTE_DEVICE_CREDENTIAL_VALIDATION =
            "settings_remote_device_credential_validation";

    /**
     * Flag to enable/disable to start treating any calls to "suspend" an app as "quarantine".
     * @hide
     */
    public static final String SETTINGS_TREAT_PAUSE_AS_QUARANTINE =
            "settings_treat_pause_as_quarantine";

    private static final Map<String, String> DEFAULT_FLAGS;

    static {
@@ -246,7 +239,6 @@ public class FeatureFlagUtils {
        DEFAULT_FLAGS.put(SETTINGS_BIOMETRICS2_FINGERPRINT_SETTINGS, "false");
        // TODO: b/298454866 Replace with Trunk Stable Feature Flag
        DEFAULT_FLAGS.put(SETTINGS_REMOTEAUTH_ENROLLMENT_SETTINGS, "false");
        DEFAULT_FLAGS.put(SETTINGS_TREAT_PAUSE_AS_QUARANTINE, "false");
    }

    private static final Set<String> PERSISTENT_FLAGS;
@@ -264,7 +256,6 @@ public class FeatureFlagUtils {
        PERSISTENT_FLAGS.add(SETTINGS_ENABLE_SPA);
        PERSISTENT_FLAGS.add(SETTINGS_ENABLE_SPA_PHASE2);
        PERSISTENT_FLAGS.add(SETTINGS_PREFER_ACCESSIBILITY_MENU_IN_SYSTEM);
        PERSISTENT_FLAGS.add(SETTINGS_TREAT_PAUSE_AS_QUARANTINE);
    }

    /**
+4 −21
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import static android.os.storage.StorageManager.FLAG_STORAGE_CE;
import static android.os.storage.StorageManager.FLAG_STORAGE_DE;
import static android.os.storage.StorageManager.FLAG_STORAGE_EXTERNAL;
import static android.provider.DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE;
import static android.util.FeatureFlagUtils.SETTINGS_TREAT_PAUSE_AS_QUARANTINE;

import static com.android.internal.annotations.VisibleForTesting.Visibility;
import static com.android.internal.util.FrameworkStatsLog.BOOT_TIME_EVENT_DURATION__EVENT__OTA_PACKAGE_MANAGER_INIT_TIME;
@@ -168,7 +167,6 @@ import android.util.ArraySet;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.ExceptionUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.Pair;
import android.util.Slog;
@@ -3208,15 +3206,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
        }

        if (quarantined) {
            final boolean hasQuarantineAppsPerm = mContext.checkCallingOrSelfPermission(
                    android.Manifest.permission.QUARANTINE_APPS) == PERMISSION_GRANTED;
            // TODO: b/305256093 - In order to facilitate testing, temporarily allowing apps
            // with SUSPEND_APPS permission to quarantine apps. Remove this once the testing
            // is done and this is no longer needed.
            if (!hasQuarantineAppsPerm) {
                mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SUSPEND_APPS,
            mContext.enforceCallingOrSelfPermission(android.Manifest.permission.QUARANTINE_APPS,
                    callingMethod);
            }
        } else {
            mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SUSPEND_APPS,
                    callingMethod);
@@ -6287,16 +6278,8 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                SuspendDialogInfo dialogInfo, int flags, String suspendingPackage,
                int suspendingUserId, int targetUserId) {
            final int callingUid = Binder.getCallingUid();
            boolean quarantined = false;
            if (Flags.quarantinedEnabled()) {
                if ((flags & PackageManager.FLAG_SUSPEND_QUARANTINED) != 0) {
                    quarantined = true;
                } else if (FeatureFlagUtils.isEnabled(mContext,
                        SETTINGS_TREAT_PAUSE_AS_QUARANTINE)) {
                    final String wellbeingPkg = mContext.getString(R.string.config_systemWellbeing);
                    quarantined = suspendingPackage.equals(wellbeingPkg);
                }
            }
            final boolean quarantined = ((flags & PackageManager.FLAG_SUSPEND_QUARANTINED) != 0)
                    && Flags.quarantinedEnabled();
            final Computer snapshot = snapshotComputer();
            final UserPackage suspender = UserPackage.of(targetUserId, suspendingPackage);
            enforceCanSetPackagesSuspendedAsUser(snapshot, quarantined, suspender, callingUid,