Add null check in FaceService#isHardwareDetected

Similar to I6c037f90691e4da2f88419c6f80994e8ae1565b0.
All clients (keyguard, settings) should already be checking isHardwareDetected()
before doing any face-related operation.

Test: load aosp_flame-eng, sysui does not crash
Fixes: 161232319

Change-Id: I2d394114073ef3df766e04430190e3430e7d1579
This commit is contained in:
felipeal
2020-07-14 15:03:59 -07:00
parent ba229b5a9e
commit d6fe1304bf
2 changed files with 6 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
private static final int MSG_SET_FEATURE_COMPLETED = 107;
private static final int MSG_CHALLENGE_GENERATED = 108;
private IFaceService mService;
private final IFaceService mService;
private final Context mContext;
private IBinder mToken = new Binder();
private AuthenticationCallback mAuthenticationCallback;

View File

@@ -30,6 +30,7 @@ import android.hardware.face.IFaceServiceReceiver;
import android.os.Binder;
import android.os.IBinder;
import android.os.NativeHandle;
import android.util.Slog;
import android.view.Surface;
import com.android.internal.util.DumpUtils;
@@ -177,6 +178,10 @@ public class FaceService extends SystemService {
@Override // Binder call
public boolean isHardwareDetected(String opPackageName) {
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
if (mFace10 == null) {
Slog.wtf(TAG, "No HAL, caller: " + opPackageName);
return false;
}
final long token = Binder.clearCallingIdentity();
try {
return mFace10.isHardwareDetected();