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

Commit 83c79317 authored by Robin Lee's avatar Robin Lee
Browse files

lowRamDevice TVs can have multi-user

Svelte phones in single-user mode don't pose any problems. TVs in many
regions need multi-user in order to support a restricted profile mode.

Adds a special case for devices with UI_MODE_TYPE_TELEVISION to be able
to enable multi-user (ie. max_users will not be ignored in low_ram cases
as it is on other form factors).

Bug: 71626497
Bug: 67965409
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
Change-Id: I6d18b9dca472b9d971d9e51a9d0f4be7403bc26a
parent 9c43e89b
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -2530,8 +2531,13 @@ public class UserManager {
    public static int getMaxSupportedUsers() {
        // Don't allow multiple users on certain builds
        if (android.os.Build.ID.startsWith("JVP")) return 1;
        // Svelte devices don't get multi-user.
        if (ActivityManager.isLowRamDeviceStatic()) return 1;
        if (ActivityManager.isLowRamDeviceStatic()) {
            // Low-ram devices are Svelte. Most of the time they don't get multi-user.
            if ((Resources.getSystem().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK)
                    != Configuration.UI_MODE_TYPE_TELEVISION) {
                return 1;
            }
        }
        return SystemProperties.getInt("fw.max_users",
                Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers));
    }
+0 −3
Original line number Diff line number Diff line
@@ -2584,9 +2584,6 @@ public class UserManagerService extends IUserManager.Stub {
            Log.w(LOG_TAG, "Cannot add user. Not enough space on disk.");
            return null;
        }
        if (ActivityManager.isLowRamDeviceStatic()) {
            return null;
        }
        final boolean isGuest = (flags & UserInfo.FLAG_GUEST) != 0;
        final boolean isManagedProfile = (flags & UserInfo.FLAG_MANAGED_PROFILE) != 0;
        final boolean isRestricted = (flags & UserInfo.FLAG_RESTRICTED) != 0;