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

Commit f1780e12 authored by Brian Lee's avatar Brian Lee Committed by Android (Google) Code Review
Browse files

Merge "Add RemoteLockscreenValidation service and client"

parents 1a6f679f c9f720ec
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ package android {
    field public static final String BIND_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.BIND_NOTIFICATION_ASSISTANT_SERVICE";
    field public static final String BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE = "android.permission.BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE";
    field public static final String BIND_PRINT_RECOMMENDATION_SERVICE = "android.permission.BIND_PRINT_RECOMMENDATION_SERVICE";
    field public static final String BIND_REMOTE_LOCKSCREEN_VALIDATION_SERVICE = "android.permission.BIND_REMOTE_LOCKSCREEN_VALIDATION_SERVICE";
    field public static final String BIND_RESOLVER_RANKER_SERVICE = "android.permission.BIND_RESOLVER_RANKER_SERVICE";
    field public static final String BIND_RESUME_ON_REBOOT_SERVICE = "android.permission.BIND_RESUME_ON_REBOOT_SERVICE";
    field public static final String BIND_ROTATION_RESOLVER_SERVICE = "android.permission.BIND_ROTATION_RESOLVER_SERVICE";
@@ -12565,6 +12566,17 @@ package android.service.quicksettings {
}
package android.service.remotelockscreenvalidation {
  public abstract class RemoteLockscreenValidationService extends android.app.Service {
    ctor public RemoteLockscreenValidationService();
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method public abstract void onValidateLockscreenGuess(@NonNull byte[], @NonNull android.os.OutcomeReceiver<android.app.RemoteLockscreenValidationResult,java.lang.Exception>);
    field public static final String SERVICE_INTERFACE = "android.service.remotelockscreenvalidation.RemoteLockscreenValidationService";
  }
}
package android.service.resolver {
  public abstract class ResolverRankerService extends android.app.Service {
+12 −0
Original line number Diff line number Diff line
package android.service.remotelockscreenvalidation;

import android.app.RemoteLockscreenValidationResult;

/**
* Callback interface for remote device lockscreen validation
* @hide
*/
interface IRemoteLockscreenValidationCallback {
    oneway void onSuccess(in RemoteLockscreenValidationResult result);
    oneway void onFailure(in String message);
}
+12 −0
Original line number Diff line number Diff line
package android.service.remotelockscreenvalidation;

import android.app.RemoteLockscreenValidationResult;
import android.service.remotelockscreenvalidation.IRemoteLockscreenValidationCallback;

/**
* Interface used by the System to validate remote device lockscreen.
* {@hide}
*/
interface IRemoteLockscreenValidationService {
    void validateLockscreenGuess(in byte[] guess, in IRemoteLockscreenValidationCallback callback);
}
+2 −0
Original line number Diff line number Diff line
include /services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS
brnlee@google.com
 No newline at end of file
+79 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.service.remotelockscreenvalidation;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;

import java.util.concurrent.Executor;

/**
 * Client for {@link RemoteLockscreenValidationService}
 * @hide
 */
public interface RemoteLockscreenValidationClient {

    /**
     * Create a client for the {@link RemoteLockscreenValidationService} specified by the
     * {@link ComponentName}
     * @hide
     */
    @NonNull
    static RemoteLockscreenValidationClient create(@NonNull Context context,
            @NonNull ComponentName serviceComponent) {
        return new RemoteLockscreenValidationClientImpl(
                context,
                /* bgExecutor= */ null,
                serviceComponent);
    }

    /**
     * Create a client for the {@link RemoteLockscreenValidationService} specified by the
     * {@link ComponentName}
     * @param context Context.
     * @param bgExecutor A background {@link Executor} for service registration.
     * @hide
     */
    @NonNull
    static RemoteLockscreenValidationClient create(@NonNull Context context,
            @Nullable Executor bgExecutor, @NonNull ComponentName serviceComponent) {
        return new RemoteLockscreenValidationClientImpl(context, bgExecutor, serviceComponent);
    }

    /**
     * Returns whether the {@link RemoteLockscreenValidationService} defined by the
     * {@code ComponentName} provided in the constructor is available.
     *
     * <p>Calling API methods like {@link #validateLockscreenGuess} will fail if unavailable.
     */
    boolean isServiceAvailable();

    /**
     * Unbinds from the {@link RemoteLockscreenValidationService}
     */
    void disconnect();

    /**
     * Validates the lockscreen guess.
     *
     * @param guess lockscreen guess
     * @param callback object used to relay the response of the guess validation
     */
    void validateLockscreenGuess(byte[] guess, IRemoteLockscreenValidationCallback callback);
}
Loading