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

Commit 3efe391c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Checking for storage space before adding user"

parents 7ca3862c c5e057c7
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.server.LocalServices;
import com.android.server.SystemService;
import com.android.server.am.UserState;

import com.android.server.storage.DeviceStorageMonitorInternal;
import libcore.io.IoUtils;
import libcore.util.Objects;

@@ -2184,6 +2184,12 @@ public class UserManagerService extends IUserManager.Stub {
            Log.w(LOG_TAG, "Cannot add user. DISALLOW_ADD_USER is enabled.");
            return null;
        }
        DeviceStorageMonitorInternal dsm = LocalServices
                .getService(DeviceStorageMonitorInternal.class);
        if (dsm.isMemoryLow()) {
            Log.w(LOG_TAG, "Cannot add user. Not enough space on disk.");
            return null;
        }
        return createUserInternalUnchecked(name, flags, parentId);
    }