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

Commit 3d27c9f9 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am f1eebfc2: Merge "Remove unused APIs and rename others based on API review" into klp-dev

* commit 'f1eebfc2':
  Remove unused APIs and rename others based on API review
parents add9898c f1eebfc2
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -6375,7 +6375,6 @@ package android.content {
    field public static final java.lang.String ACTION_PROVIDER_CHANGED = "android.intent.action.PROVIDER_CHANGED";
    field public static final java.lang.String ACTION_QUICK_CLOCK = "android.intent.action.QUICK_CLOCK";
    field public static final java.lang.String ACTION_REBOOT = "android.intent.action.REBOOT";
    field public static final java.lang.String ACTION_RESTRICTIONS_PIN_CHALLENGE = "android.intent.action.RESTRICTIONS_PIN_CHALLENGE";
    field public static final java.lang.String ACTION_RUN = "android.intent.action.RUN";
    field public static final java.lang.String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF";
    field public static final java.lang.String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON";
@@ -18552,14 +18551,13 @@ package android.os {
    method public java.lang.String getUserName();
    method public android.os.Bundle getUserRestrictions();
    method public android.os.Bundle getUserRestrictions(android.os.UserHandle);
    method public boolean hasRestrictionsPin();
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean setRestrictionsChallenge(java.lang.String);
    method public void setUserRestriction(java.lang.String, boolean);
    method public void setUserRestrictions(android.os.Bundle);
    method public void setUserRestrictions(android.os.Bundle, android.os.UserHandle);
    field public static final java.lang.String DISALLOW_APP_RESTRICTIONS = "no_app_restrictions";
    field public static final java.lang.String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth";
    field public static final java.lang.String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials";
    field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi";
+7 −4
Original line number Diff line number Diff line
@@ -2469,16 +2469,19 @@ public class Intent implements Parcelable, Cloneable {
            "android.intent.action.GET_RESTRICTION_ENTRIES";

    /**
     * @hide
     * Activity to challenge the user for a PIN that was configured when setting up
     * restrictions. Launch the activity using
     * restrictions. Restrictions include blocking of apps and preventing certain user operations,
     * controlled by {@link android.os.UserManager#setUserRestrictions(Bundle).
     * Launch the activity using
     * {@link android.app.Activity#startActivityForResult(Intent, int)} and check if the
     * result is {@link android.app.Activity#RESULT_OK} for a successful response to the
     * challenge.<p/>
     * Before launching this activity, make sure that there is a PIN in effect, by calling
     * {@link android.os.UserManager#hasRestrictionsPin()}.
     * {@link android.os.UserManager#hasRestrictionsChallenge()}.
     */
    public static final String ACTION_RESTRICTIONS_PIN_CHALLENGE =
            "android.intent.action.RESTRICTIONS_PIN_CHALLENGE";
    public static final String ACTION_RESTRICTIONS_CHALLENGE =
            "android.intent.action.RESTRICTIONS_CHALLENGE";

    /**
     * Sent the first time a user is starting, to allow system apps to
+3 −3
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ interface IUserManager {
            int userHandle);
    Bundle getApplicationRestrictions(in String packageName);
    Bundle getApplicationRestrictionsForUser(in String packageName, int userHandle);
    boolean changeRestrictionsPin(in String newPin);
    int checkRestrictionsPin(in String pin);
    boolean hasRestrictionsPin();
    boolean setRestrictionsChallenge(in String newPin);
    int checkRestrictionsChallenge(in String pin);
    boolean hasRestrictionsChallenge();
    void removeRestrictions();
}
+13 −23
Original line number Diff line number Diff line
@@ -140,16 +140,6 @@ public class UserManager {
     */
    public static final String DISALLOW_REMOVE_USER = "no_remove_user";

    /**
     * Key for user restrictions. Specifies if a user is disallowed from setting app restrictions
     * via a restrictions PIN. The default is <code>false</code>. If app restrictions have already
     * been set up, then this user restriction cannot be set to true.
     * <p/>
     * Type: Boolean
     * @see #hasRestrictionsPin()
     */
    public static final String DISALLOW_APP_RESTRICTIONS = "no_app_restrictions";

    /** @hide */
    public static final int PIN_VERIFICATION_FAILED_INCORRECT = -3;
    /** @hide */
@@ -650,15 +640,14 @@ public class UserManager {
    }

    /**
     * @hide
     * Sets a new restrictions PIN. This should only be called after verifying that there
     * currently isn't a PIN set, or after the user successfully enters the current PIN.
     * @param newPin
     * @return Returns true if the PIN was changed successfully.
     * Sets a new challenge PIN for restrictions. This is only for use by pre-installed
     * apps and requires the MANAGE_USERS permission.
     * @param newPin the PIN to use for challenge dialogs.
     * @return Returns true if the challenge PIN was set successfully.
     */
    public boolean changeRestrictionsPin(String newPin) {
    public boolean setRestrictionsChallenge(String newPin) {
        try {
            return mService.changeRestrictionsPin(newPin);
            return mService.setRestrictionsChallenge(newPin);
        } catch (RemoteException re) {
            Log.w(TAG, "Could not change restrictions pin");
        }
@@ -674,9 +663,9 @@ public class UserManager {
     * Returns {@link #PIN_VERIFICATION_SUCCESS} if the input matches the saved PIN. Returns
     * {@link #PIN_VERIFICATION_FAILED_NOT_SET} if there is no PIN set.
     */
    public int checkRestrictionsPin(String pin) {
    public int checkRestrictionsChallenge(String pin) {
        try {
            return mService.checkRestrictionsPin(pin);
            return mService.checkRestrictionsChallenge(pin);
        } catch (RemoteException re) {
            Log.w(TAG, "Could not check restrictions pin");
        }
@@ -684,16 +673,17 @@ public class UserManager {
    }

    /**
     * @hide
     * Checks whether the user has restrictions that are PIN-protected. An application that
     * participates in restrictions can check if the owner has requested a PIN challenge for
     * any restricted operations. If there is a PIN in effect, the application should launch
     * the PIN challenge activity {@link android.content.Intent#ACTION_RESTRICTIONS_PIN_CHALLENGE}.
     * @see android.content.Intent#ACTION_RESTRICTIONS_PIN_CHALLENGE
     * the PIN challenge activity {@link android.content.Intent#ACTION_RESTRICTIONS_CHALLENGE}.
     * @see android.content.Intent#ACTION_RESTRICTIONS_CHALLENGE
     * @return whether a restrictions PIN is in effect.
     */
    public boolean hasRestrictionsPin() {
    public boolean hasRestrictionsChallenge() {
        try {
            return mService.hasRestrictionsPin();
            return mService.hasRestrictionsChallenge();
        } catch (RemoteException re) {
            Log.w(TAG, "Could not change restrictions pin");
        }
+4 −4
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public class RestrictionsPinActivity extends AlertActivity
        super.onCreate(icicle);

        mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
        mHasRestrictionsPin = mUserManager.hasRestrictionsPin();
        mHasRestrictionsPin = mUserManager.hasRestrictionsChallenge();
        initUi();
        setupAlert();
    }
@@ -83,7 +83,7 @@ public class RestrictionsPinActivity extends AlertActivity
        super.onResume();

        setPositiveButtonState(false);
        boolean hasPin = mUserManager.hasRestrictionsPin();
        boolean hasPin = mUserManager.hasRestrictionsChallenge();
        if (hasPin) {
            mPinErrorMessage.setVisibility(View.INVISIBLE);
            mPinText.setOnEditorActionListener(this);
@@ -100,7 +100,7 @@ public class RestrictionsPinActivity extends AlertActivity

    private boolean updatePinTimer(int pinTimerMs) {
        if (pinTimerMs < 0) {
            pinTimerMs = mUserManager.checkRestrictionsPin(null);
            pinTimerMs = mUserManager.checkRestrictionsChallenge(null);
        }
        boolean enableInput;
        if (pinTimerMs >= 200) {
@@ -128,7 +128,7 @@ public class RestrictionsPinActivity extends AlertActivity
    }

    protected void performPositiveButtonAction() {
        int result = mUserManager.checkRestrictionsPin(mPinText.getText().toString());
        int result = mUserManager.checkRestrictionsChallenge(mPinText.getText().toString());
        if (result == UserManager.PIN_VERIFICATION_SUCCESS) {
            setResult(RESULT_OK);
            finish();
Loading