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

Commit bb4988ad authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Improve service docs around user unlocking.

Also delete some @removed methods that never shipped to reduce
confusion.

Test: builds, boots
Bug: 30434803
Change-Id: I18773182f62f0f62bd4e36c9c3098372483a374f
parent 830d4b42
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -169,10 +169,6 @@ package android.os {
    method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
    method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
    method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle);
    method public deprecated boolean isUserRunningAndLocked();
    method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndUnlocked();
    method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle);
  }

}
+0 −4
Original line number Diff line number Diff line
@@ -163,10 +163,6 @@ package android.os {
    method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
    method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
    method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle);
    method public deprecated boolean isUserRunningAndLocked();
    method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndUnlocked();
    method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle);
  }

}
+0 −4
Original line number Diff line number Diff line
@@ -169,10 +169,6 @@ package android.os {
    method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
    method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
    method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle);
    method public deprecated boolean isUserRunningAndLocked();
    method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndUnlocked();
    method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle);
  }

}
+0 −34
Original line number Diff line number Diff line
@@ -1097,40 +1097,6 @@ public class UserManager {
        }
    }

    /** @removed */
    @Deprecated
    public boolean isUserRunningAndLocked() {
        return isUserRunningAndLocked(Process.myUserHandle());
    }

    /** @removed */
    @Deprecated
    public boolean isUserRunningAndLocked(UserHandle user) {
        try {
            return ActivityManager.getService().isUserRunning(
                    user.getIdentifier(), ActivityManager.FLAG_AND_LOCKED);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /** @removed */
    @Deprecated
    public boolean isUserRunningAndUnlocked() {
        return isUserRunningAndUnlocked(Process.myUserHandle());
    }

    /** @removed */
    @Deprecated
    public boolean isUserRunningAndUnlocked(UserHandle user) {
        try {
            return ActivityManager.getService().isUserRunning(
                    user.getIdentifier(), ActivityManager.FLAG_AND_UNLOCKED);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Return whether the calling user is running in an "unlocked" state.
     * <p>
+11 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server;
import android.content.Context;
import android.os.IBinder;
import android.os.ServiceManager;
import android.os.UserManager;

/**
 * The base class for services running in the system process. Override and implement
@@ -133,9 +134,16 @@ public abstract class SystemService {
    public void onStartUser(int userHandle) {}

    /**
     * Called when an existing user is unlocked. This means the
     * credential-encrypted storage for that user is now available, and
     * encryption-aware component filtering is no longer in effect.
     * Called when an existing user is in the process of being unlocked. This
     * means the credential-encrypted storage for that user is now available,
     * and encryption-aware component filtering is no longer in effect.
     * <p>
     * While dispatching this event to services, the user is in the
     * {@code STATE_RUNNING_UNLOCKING} state, and once dispatching is finished
     * the user will transition into the {@code STATE_RUNNING_UNLOCKED} state.
     * Code written inside system services should use
     * {@link UserManager#isUserUnlockingOrUnlocked(int)} to handle both of
     * these states.
     *
     * @param userHandle The identifier of the user.
     */