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

Commit 981d8f54 authored by Grace Cheng's avatar Grace Cheng Committed by Android (Google) Code Review
Browse files

Merge "Synchronize SecureLockDeviceStatusListener broadcast" into main

parents 81e3b722 f021abe2
Loading
Loading
Loading
Loading
+36 −32
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ public class SecureLockDeviceService extends SecureLockDeviceServiceInternal {
    @Nullable private final FaceManager mFaceManager;
    @Nullable private final FingerprintManager mFingerprintManager;
    private final PowerManager mPowerManager;
    @NonNull private final Object mSecureLockDeviceStatusListenerLock = new Object();
    @NonNull private final SecureLockDeviceStore mStore;
    private final RemoteCallbackList<ISecureLockDeviceStatusListener>
            mSecureLockDeviceStatusListeners = new RemoteCallbackList<>();
@@ -553,6 +554,7 @@ public class SecureLockDeviceService extends SecureLockDeviceServiceInternal {
     *               update. Only listeners registered to this userId will be notified.s
     */
    private void notifySecureLockDeviceAvailabilityForUser(int userId) {
        synchronized (mSecureLockDeviceStatusListenerLock) {
            final int count = mSecureLockDeviceStatusListeners.beginBroadcast();
            try {
                for (int i = 0; i < count; i++) {
@@ -577,13 +579,14 @@ public class SecureLockDeviceService extends SecureLockDeviceServiceInternal {
                                + secureLockDeviceAvailability);
                    }
                    try {
                    listener.onSecureLockDeviceAvailableStatusChanged(secureLockDeviceAvailability);
                        listener.onSecureLockDeviceAvailableStatusChanged(
                                secureLockDeviceAvailability);
                    } catch (RemoteException e) {
                    Slog.e(TAG, "Failed to notify listener " + listener.asBinder() + " for "
                            + "user " + userId + ", RemoteException thrown: ", e);
                        Slog.e(TAG, "Failed to notify listener " + listener.asBinder()
                                + " for user " + userId + ", RemoteException thrown: ", e);
                    } catch (Exception e) {
                    Slog.e(TAG, "Exception thrown by listener " + listener.asBinder() + " for "
                            + "user " + userId + " during callback: ", e);
                        Slog.e(TAG, "Exception thrown by listener " + listener.asBinder()
                                + " for user " + userId + " during callback: ", e);
                        mSecureLockDeviceStatusListeners.unregister(listener);
                    }
                }
@@ -591,6 +594,7 @@ public class SecureLockDeviceService extends SecureLockDeviceServiceInternal {
                mSecureLockDeviceStatusListeners.finishBroadcast();
            }
        }
    }

    /**
     * @see AuthenticationPolicyManager#setSecureLockDeviceTestStatus(boolean)