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

Commit 4e32c079 authored by Cathy Chen's avatar Cathy Chen Committed by Android (Google) Code Review
Browse files

Revert "Refactor remote lockscreen verification API."

Revert submission 21914417-lskf-api-review1

Reason for revert: build break

Reverted changes: /q/submissionid:21914417-lskf-api-review1

Bug: 272574624
Change-Id: Ic94a45013c5886c411189716a8abcef645911516
parent 34679790
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -935,7 +935,7 @@ package android.app {
  public class KeyguardManager {
    method @RequiresPermission(android.Manifest.permission.MANAGE_WEAK_ESCROW_TOKEN) public long addWeakEscrowToken(@NonNull byte[], @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.app.KeyguardManager.WeakEscrowTokenActivatedListener);
    method @NonNull @RequiresPermission(android.Manifest.permission.CHECK_REMOTE_LOCKSCREEN) public android.content.Intent createConfirmDeviceCredentialForRemoteValidationIntent(@NonNull android.app.RemoteLockscreenValidationSession, @NonNull android.content.ComponentName, @Nullable CharSequence, @Nullable CharSequence, @Nullable CharSequence, @Nullable CharSequence);
    method @NonNull @RequiresPermission(android.Manifest.permission.CHECK_REMOTE_LOCKSCREEN) public android.content.Intent createConfirmDeviceCredentialForRemoteValidationIntent(@NonNull android.app.StartLockscreenValidationRequest, @NonNull android.content.ComponentName, @Nullable CharSequence, @Nullable CharSequence, @Nullable CharSequence, @Nullable CharSequence);
    method public android.content.Intent createConfirmFactoryResetCredentialIntent(CharSequence, CharSequence, CharSequence);
    method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public int getMinLockLength(boolean, int);
    method @RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS) public boolean getPrivateNotificationsAllowed();
@@ -947,7 +947,7 @@ package android.app {
    method @RequiresPermission(android.Manifest.permission.SHOW_KEYGUARD_MESSAGE) public void requestDismissKeyguard(@NonNull android.app.Activity, @Nullable CharSequence, @Nullable android.app.KeyguardManager.KeyguardDismissCallback);
    method @RequiresPermission("android.permission.SET_INITIAL_LOCK") public boolean setLock(int, @NonNull byte[], int);
    method @RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD_SECURE_NOTIFICATIONS) public void setPrivateNotificationsAllowed(boolean);
    method @NonNull @RequiresPermission(android.Manifest.permission.CHECK_REMOTE_LOCKSCREEN) public android.app.RemoteLockscreenValidationSession startRemoteLockscreenValidation();
    method @NonNull @RequiresPermission(android.Manifest.permission.CHECK_REMOTE_LOCKSCREEN) public android.app.StartLockscreenValidationRequest startRemoteLockscreenValidation();
    method @RequiresPermission(android.Manifest.permission.MANAGE_WEAK_ESCROW_TOKEN) public boolean unregisterWeakEscrowTokenRemovedListener(@NonNull android.app.KeyguardManager.WeakEscrowTokenRemovedListener);
    method @NonNull @RequiresPermission(android.Manifest.permission.CHECK_REMOTE_LOCKSCREEN) public android.app.RemoteLockscreenValidationResult validateRemoteLockscreen(@NonNull byte[]);
    field public static final int PASSWORD = 0; // 0x0
@@ -1036,7 +1036,6 @@ package android.app {
    field public static final int RESULT_GUESS_VALID = 1; // 0x1
    field public static final int RESULT_LOCKOUT = 3; // 0x3
    field public static final int RESULT_NO_REMAINING_ATTEMPTS = 4; // 0x4
    field public static final int RESULT_SESSION_EXPIRED = 5; // 0x5
  }
  public static final class RemoteLockscreenValidationResult.Builder {
@@ -1046,23 +1045,6 @@ package android.app {
    method @NonNull public android.app.RemoteLockscreenValidationResult.Builder setTimeoutMillis(long);
  }
  public final class RemoteLockscreenValidationSession implements android.os.Parcelable {
    method public int describeContents();
    method public int getLockType();
    method public int getRemainingAttempts();
    method @NonNull public byte[] getSourcePublicKey();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.RemoteLockscreenValidationSession> CREATOR;
  }
  public static final class RemoteLockscreenValidationSession.Builder {
    ctor public RemoteLockscreenValidationSession.Builder();
    method @NonNull public android.app.RemoteLockscreenValidationSession build();
    method @NonNull public android.app.RemoteLockscreenValidationSession.Builder setLockType(int);
    method @NonNull public android.app.RemoteLockscreenValidationSession.Builder setRemainingAttempts(int);
    method @NonNull public android.app.RemoteLockscreenValidationSession.Builder setSourcePublicKey(@NonNull byte[]);
  }
  public final class RuntimeAppOpAccessMessage implements android.os.Parcelable {
    ctor public RuntimeAppOpAccessMessage(@IntRange(from=0L) int, @IntRange(from=0L) int, @NonNull String, @Nullable String, @NonNull String, int);
    method public int describeContents();
@@ -1080,6 +1062,23 @@ package android.app {
    method public void launchAssist(@Nullable android.os.Bundle);
  }
  public final class StartLockscreenValidationRequest implements android.os.Parcelable {
    method public int describeContents();
    method public int getLockscreenUiType();
    method public int getRemainingAttempts();
    method @NonNull public byte[] getSourcePublicKey();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.StartLockscreenValidationRequest> CREATOR;
  }
  public static final class StartLockscreenValidationRequest.Builder {
    ctor public StartLockscreenValidationRequest.Builder();
    method @NonNull public android.app.StartLockscreenValidationRequest build();
    method @NonNull public android.app.StartLockscreenValidationRequest.Builder setLockscreenUiType(int);
    method @NonNull public android.app.StartLockscreenValidationRequest.Builder setRemainingAttempts(int);
    method @NonNull public android.app.StartLockscreenValidationRequest.Builder setSourcePublicKey(@NonNull byte[]);
  }
  public class StatusBarManager {
    method @NonNull @RequiresPermission(android.Manifest.permission.STATUS_BAR) public android.app.StatusBarManager.DisableInfo getDisableInfo();
    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public int getNavBarMode();
+12 −9
Original line number Diff line number Diff line
@@ -146,13 +146,13 @@ public class KeyguardManager {
    public static final String EXTRA_CHECKBOX_LABEL = "android.app.extra.CHECKBOX_LABEL";

    /**
     * A {@link RemoteLockscreenValidationSession} extra to be sent along with
     * A {@link StartLockscreenValidationRequest} extra to be sent along with
     * {@link #ACTION_CONFIRM_REMOTE_DEVICE_CREDENTIAL} containing the data needed to prompt for
     * a remote device's lock screen.
     * @hide
     */
    public static final String EXTRA_REMOTE_LOCKSCREEN_VALIDATION_SESSION =
            "android.app.extra.REMOTE_LOCKSCREEN_VALIDATION_SESSION";
    public static final String EXTRA_START_LOCKSCREEN_VALIDATION_REQUEST =
            "android.app.extra.START_LOCKSCREEN_VALIDATION_REQUEST";

    /**
     * Result code returned by the activity started by
@@ -359,7 +359,8 @@ public class KeyguardManager {
    /**
     * Get an Intent to launch an activity to prompt the user to confirm the
     * credentials (pin, pattern or password) of a remote device.
     * @param session contains information necessary to start remote device credential validation.
     * @param startLockscreenValidationRequest contains information necessary to start remote device
     *                                         credential validation.
     * @param remoteLockscreenValidationServiceComponent
     *          the {@link ComponentName} of the implementation of
     *          {@link android.service.remotelockscreenvalidation.RemoteLockscreenValidationService}
@@ -375,14 +376,15 @@ public class KeyguardManager {
    @RequiresPermission(Manifest.permission.CHECK_REMOTE_LOCKSCREEN)
    @NonNull
    public Intent createConfirmDeviceCredentialForRemoteValidationIntent(
            @NonNull RemoteLockscreenValidationSession session,
            @NonNull StartLockscreenValidationRequest startLockscreenValidationRequest,
            @NonNull ComponentName remoteLockscreenValidationServiceComponent,
            @Nullable CharSequence title,
            @Nullable CharSequence description,
            @Nullable CharSequence checkboxLabel,
            @Nullable CharSequence alternateButtonLabel) {
        Intent intent = new Intent(ACTION_CONFIRM_REMOTE_DEVICE_CREDENTIAL)
                .putExtra(EXTRA_REMOTE_LOCKSCREEN_VALIDATION_SESSION, session)
                .putExtra(
                        EXTRA_START_LOCKSCREEN_VALIDATION_REQUEST, startLockscreenValidationRequest)
                .putExtra(Intent.EXTRA_COMPONENT_NAME, remoteLockscreenValidationServiceComponent)
                .putExtra(EXTRA_TITLE, title)
                .putExtra(EXTRA_DESCRIPTION, description)
@@ -1155,7 +1157,7 @@ public class KeyguardManager {
    @SystemApi
    @RequiresPermission(Manifest.permission.CHECK_REMOTE_LOCKSCREEN)
    @NonNull
    public RemoteLockscreenValidationSession startRemoteLockscreenValidation() {
    public StartLockscreenValidationRequest startRemoteLockscreenValidation() {
        return mLockPatternUtils.startRemoteLockscreenValidation();
    }

@@ -1163,10 +1165,11 @@ public class KeyguardManager {
     * Verifies credentials guess from a remote device.
     *
     * <p>Secret must be encrypted using {@code SecureBox} library
     * with public key from {@code RemoteLockscreenValidationSession}
     * with public key from {@code StartLockscreenValidationRequest}
     * and header set to {@code "encrypted_remote_credentials"} in UTF-8 encoding.
     *
     * @throws IllegalStateException if there was a decryption error.
     * @throws IllegalStateException if there is no active lock screen validation session or
     * there was a decryption error.
     *
     * @hide
     */
+1 −7
Original line number Diff line number Diff line
@@ -55,16 +55,10 @@ public final class RemoteLockscreenValidationResult implements Parcelable {
     */
    public static final int RESULT_NO_REMAINING_ATTEMPTS = 4;

    /**
     * New lockscreen validation session is required to verify guess.
     */
    public static final int RESULT_SESSION_EXPIRED = 5;

    @IntDef({RESULT_GUESS_VALID,
            RESULT_GUESS_INVALID,
            RESULT_LOCKOUT,
            RESULT_NO_REMAINING_ATTEMPTS,
            RESULT_SESSION_EXPIRED})
            RESULT_NO_REMAINING_ATTEMPTS})
    @Retention(RetentionPolicy.SOURCE)
    @interface ResultCode {}

+1 −1
Original line number Diff line number Diff line
@@ -17,4 +17,4 @@
package android.app;

/** {@hide} */
parcelable RemoteLockscreenValidationSession;
parcelable StartLockscreenValidationRequest;
+21 −22
Original line number Diff line number Diff line
@@ -30,45 +30,44 @@ import java.util.Objects;
 * @hide
 */
@SystemApi
public final class RemoteLockscreenValidationSession implements Parcelable {
public final class StartLockscreenValidationRequest implements Parcelable {

    @LockTypes
    private int mLockType;
    private int mLockscreenUiType;

    private byte[] mSourcePublicKey;

    private int mRemainingAttempts;

    public static final @NonNull Parcelable.Creator<RemoteLockscreenValidationSession> CREATOR = new
            Parcelable.Creator<RemoteLockscreenValidationSession>() {
    public static final @NonNull Parcelable.Creator<StartLockscreenValidationRequest> CREATOR = new
            Parcelable.Creator<StartLockscreenValidationRequest>() {
        @Override
        public RemoteLockscreenValidationSession createFromParcel(Parcel source) {
            return new RemoteLockscreenValidationSession(source);
        public StartLockscreenValidationRequest createFromParcel(Parcel source) {
            return new StartLockscreenValidationRequest(source);
        }

        @Override
        public RemoteLockscreenValidationSession[] newArray(int size) {
            return new RemoteLockscreenValidationSession[size];
        public StartLockscreenValidationRequest[] newArray(int size) {
            return new StartLockscreenValidationRequest[size];
        }
    };


    /**
     * Builder for {@code RemoteLockscreenValidationSession}
     * Builder for {@code StartLockscreenValidationRequest}
     */
    public static final class Builder {
        private RemoteLockscreenValidationSession mInstance =
                new RemoteLockscreenValidationSession();
        private StartLockscreenValidationRequest mInstance = new StartLockscreenValidationRequest();

        /**
         * Sets UI type.
         * Default value is {@code LockTypes.PASSWORD}
         *
         * @param lockType The UI format
         * @param lockscreenUiType The UI format
         * @return This builder.
         */
        public @NonNull Builder setLockType(@LockTypes int lockType) {
            mInstance.mLockType = lockType;
        public @NonNull Builder setLockscreenUiType(@LockTypes int lockscreenUiType) {
            mInstance.mLockscreenUiType = lockscreenUiType;
            return this;
        }

@@ -93,11 +92,11 @@ public final class RemoteLockscreenValidationSession implements Parcelable {
        }

        /**
         * Creates {@code RemoteLockscreenValidationSession}
         * Creates {@code StartLockscreenValidationRequest}
         *
         * @throws NullPointerException if required fields are not set.
         */
        public @NonNull RemoteLockscreenValidationSession build() {
        public @NonNull StartLockscreenValidationRequest build() {
            Objects.requireNonNull(mInstance.mSourcePublicKey);
            return mInstance;
        }
@@ -106,8 +105,8 @@ public final class RemoteLockscreenValidationSession implements Parcelable {
    /**
     * Specifies lock screen credential type.
     */
    public @LockTypes int getLockType() {
        return mLockType;
    public @LockTypes int getLockscreenUiType() {
        return mLockscreenUiType;
    }

    /**
@@ -128,16 +127,16 @@ public final class RemoteLockscreenValidationSession implements Parcelable {

    @Override
    public void writeToParcel(@NonNull Parcel out, int flags) {
        out.writeInt(mLockType);
        out.writeInt(mLockscreenUiType);
        out.writeByteArray(mSourcePublicKey);
        out.writeInt(mRemainingAttempts);
    }

    private RemoteLockscreenValidationSession() {
    private StartLockscreenValidationRequest() {
    }

    private RemoteLockscreenValidationSession(Parcel in) {
        mLockType = in.readInt();
    private StartLockscreenValidationRequest(Parcel in) {
        mLockscreenUiType = in.readInt();
        mSourcePublicKey = in.createByteArray();
        mRemainingAttempts = in.readInt();
    }
Loading