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


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