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

Commit 610dfe45 authored by Alex Buynytskyy's avatar Alex Buynytskyy Committed by Presubmit Automerger Backend
Browse files

[automerge] [RESTRICT AUTOMERGE] Add a debug workaround for the tests. 2p: 3f60b9a1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22976449

Bug: 261373611
Change-Id: I251e5f56d2c58b6c72503bd54386fbc013854fee
Merged-In: I8c05bcce1b8f4e5c7a7c0168323995516093fa38
parents 068671b7 3f60b9a1
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.os.Environment;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
@@ -261,12 +262,12 @@ public class InstallLocationUtils {

        // We're left with new installations with either preferring external or auto, so just pick
        // volume with most space
        String bestCandidate = !volumePaths.isEmpty() ? volumePaths.keyAt(0) : null;
        if (volumePaths.size() == 1) {
            if (checkFitOnVolume(storageManager, volumePaths.valueAt(0), params)) {
                return volumePaths.keyAt(0);
                return bestCandidate;
            }
        } else {
            String bestCandidate = null;
            long bestCandidateAvailBytes = Long.MIN_VALUE;
            for (String vol : volumePaths.keySet()) {
                final String volumePath = volumePaths.get(vol);
@@ -289,6 +290,14 @@ public class InstallLocationUtils {

        }

        // For new installations of a predefined size, check property to let it through
        // regardless of the actual free space.
        if (bestCandidate != null && Integer.MAX_VALUE == params.sizeBytes
                && SystemProperties.getBoolean("debug.pm.install_skip_size_check_for_maxint",
                false)) {
            return bestCandidate;
        }

        throw new IOException("No special requests, but no room on allowed volumes. "
                + " allow3rdPartyOnInternal? " + allow3rdPartyOnInternal);
    }