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

Commit 13a58a91 authored by Evan Rosky's avatar Evan Rosky
Browse files

Make user-switch transitions customizable

Make UserSwitcherController subclassable

Add ability for keyguard to animate in without a screen freeze
by adding a keyguardAnimatingIn state that WindowAnimator and
WallpaperController can use to prevent graphical glitches

Bug: 29329555
Change-Id: Idfd40156538b4bfb1777ad1a9a566e7da54e8f32
parent 18396451
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -748,6 +748,15 @@ public class UserManager {
        return SystemProperties.getBoolean("ro.fw.system_user_split", false);
    }

    /**
     * @return Whether guest user is always ephemeral
     * @hide
     */
    public static boolean isGuestUserEphemeral() {
        return Resources.getSystem()
                .getBoolean(com.android.internal.R.bool.config_guestUserEphemeral);
    }

    /**
     * Returns whether switching users is currently allowed.
     * <p>For instance switching users is not allowed if the current user is in a phone call,
@@ -870,6 +879,16 @@ public class UserManager {
        }
    }

    /**
     * Checks if a user is a guest user.
     * @return whether user is a guest user.
     * @hide
     */
    public boolean isGuestUser(int id) {
        UserInfo user = getUserInfo(id);
        return user != null && user.isGuest();
    }

    /**
     * Checks if the calling app is running as a guest user.
     * @return whether the caller is a guest user.
+10 −0
Original line number Diff line number Diff line
@@ -210,6 +210,16 @@ interface IWindowManager
    void dismissKeyguard();
    void keyguardGoingAway(int flags);

    /**
     * Called to tell WindowManager whether the keyguard is animating in. While this property
     * is true, WindowManager won't assume that the keyguard is opaque (eg. WindowAnimator won't
     * force-hide windows just because keyguard is visible and WallpaperController won't occlude
     * app windows with the system wallpaper.
     *
     * <p>Requires CONTROL_KEYGUARD permission</p>
     */
    void setKeyguardAnimatingIn(boolean animating);

    // Requires INTERACT_ACROSS_USERS_FULL permission
    void setSwitchingUser(boolean switching);

+14 −3
Original line number Diff line number Diff line
@@ -191,6 +191,12 @@ public class KeyguardViewMediator extends SystemUI {
     */
    private static final String KEYGUARD_ANALYTICS_SETTING = "keyguard_analytics";

    /**
     * Boolean option for doKeyguardLocked/doKeyguardTimeout which, when set to true, forces the
     * keyguard to show even if it is disabled for the current user.
     */
    public static final String OPTION_FORCE_SHOW = "force_show";

    /** The stream type that the lock sounds are tied to. */
    private int mUiSoundsStreamType;

@@ -1240,8 +1246,9 @@ public class KeyguardViewMediator extends SystemUI {
                return;
            }

            boolean forceShow = options != null && options.getBoolean(OPTION_FORCE_SHOW, false);
            if (mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser())
                    && !lockedOrMissing) {
                    && !lockedOrMissing && !forceShow) {
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
                return;
            }
@@ -1361,7 +1368,11 @@ public class KeyguardViewMediator extends SystemUI {
    }

    public boolean isSecure() {
        return mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())
        return isSecure(KeyguardUpdateMonitor.getCurrentUser());
    }

    public boolean isSecure(int userId) {
        return mLockPatternUtils.isSecure(userId)
                || KeyguardUpdateMonitor.getInstance(mContext).isSimPinSecure();
    }

+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class KeyguardBouncer {

        final int activeUserId = ActivityManager.getCurrentUser();
        final boolean allowDismissKeyguard =
                !(UserManager.isSplitSystemUser() && activeUserId == UserHandle.USER_SYSTEM)
                !UserManager.isSplitSystemUser()
                && activeUserId == keyguardUserId;
        // If allowed, try to dismiss the Keyguard. If no security auth (password/pin/pattern) is
        // set, this will dismiss the whole Keyguard. Otherwise, show the bouncer.
+3 −1
Original line number Diff line number Diff line
@@ -129,7 +129,9 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen

    public void setCurrentUser(int user) {
        if (user != mCurrentUserId) {
            if (mSelectedUser == null || user != mSelectedUser.getIdentifier()) {
                mCached = false;
            }
            mCurrentUserId = user;
        }
    }
Loading