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

Commit 997336a4 authored by Eric Biggers's avatar Eric Biggers
Browse files

Move LockSettingsInternal into services

Now that LockPatternUtils no longer depends on LockSettingsInternal,
move LockSettingsInternal and the callback classes associated with it
(EscrowTokenStateChangeCallback, LockSettingsStateListener, and
RebootEscrowListener) into the services jar where they belong.

Bug: 408077877
Test: atest Frameworks{,Mocking}ServicesTests:com.android.server.{devicepolicy,locksettings,recoverysystem,trust}
Test: atest Frameworks{,Mocking}CoreTests:com.android.internal.widget
Flag: EXEMPT refactor
Change-Id: Iba28fb358e790cdf293911d7fc85f8b06ac16873
parent 321e0254
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -1552,18 +1552,6 @@ public class LockPatternUtils {
        }
    }

    /**
     * Callback interface to notify when an added escrow token has been activated.
     */
    public interface EscrowTokenStateChangeCallback {
        /**
         * The method to be called when the token is activated.
         * @param handle 64 bit handle corresponding to the escrow token
         * @param userId user for whom the escrow token has been added
         */
        void onEscrowTokenActivated(long handle, int userId);
    }

    /**
     * Remove a weak escrow token.
     *
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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 com.android.server.locksettings;

/**
 * Callback interface to notify when an added escrow token has been activated.
 */
public interface EscrowTokenStateChangeCallback {
    /**
     * The method to be called when the token is activated.
     * @param handle 64 bit handle corresponding to the escrow token
     * @param userId user for whom the escrow token has been added
     */
    void onEscrowTokenActivated(long handle, int userId);
}
+5 −4
Original line number Diff line number Diff line
@@ -14,19 +14,20 @@
 * limitations under the License.
 */

package com.android.internal.widget;
package com.android.server.locksettings;

import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.admin.PasswordMetrics;

import com.android.internal.widget.LockscreenCredential;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * LockSettingsService local system service interface.
 *
 * @hide Only for use within the system server.
 */
public abstract class LockSettingsInternal {
    /** ErrorCode for armRebootEscrow failures. **/
@@ -91,7 +92,7 @@ public abstract class LockSettingsInternal {
     * @return a unique 64-bit token handle which is needed to refer to this token later.
     */
    public abstract long addEscrowToken(byte[] token, int userId,
            LockPatternUtils.EscrowTokenStateChangeCallback callback);
            EscrowTokenStateChangeCallback callback);

    /**
     * Remove an escrow token.
+0 −4
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PASSWORD_OR_PIN;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_PIN;
import static com.android.internal.widget.LockPatternUtils.CURRENT_LSKF_BASED_PROTECTOR_ID_KEY;
import static com.android.internal.widget.LockPatternUtils.EscrowTokenStateChangeCallback;
import static com.android.internal.widget.LockPatternUtils.PIN_LENGTH_UNAVAILABLE;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE;
@@ -143,10 +142,7 @@ import com.android.internal.widget.ILockSettings;
import com.android.internal.widget.IWeakEscrowTokenActivatedListener;
import com.android.internal.widget.IWeakEscrowTokenRemovedListener;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockSettingsInternal;
import com.android.internal.widget.LockSettingsStateListener;
import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.RebootEscrowListener;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.server.LocalServices;
import com.android.server.ServiceThread;
+1 −2
Original line number Diff line number Diff line
@@ -14,12 +14,11 @@
 * limitations under the License.
 */

package com.android.internal.widget;
package com.android.server.locksettings;

/**
 * Callback interface between LockSettingService and other system services to be notified about the
 * state of primary authentication (i.e. PIN/pattern/password).
 * @hide
 */
public interface LockSettingsStateListener {
    /**
Loading