1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.cts; 18 19 import android.service.fingerprint.FingerprintActionStatsProto; 20 import android.service.fingerprint.FingerprintServiceDumpProto; 21 import android.service.fingerprint.FingerprintUserStatsProto; 22 23 import com.android.tradefed.log.LogUtil.CLog; 24 25 26 /** 27 * Test to check that the fingerprint service properly outputs its dump state. 28 */ 29 public class FingerprintIncidentTest extends ProtoDumpTestCase { 30 /** 31 * Test that no fingerprints are registered. 32 * 33 * @throws Exception 34 */ testNoneRegistered()35 public void testNoneRegistered() throws Exception { 36 // If the device doesn't support fingerprints, then pass. 37 if (!getDevice().hasFeature("android.hardware.fingerprint")) { 38 CLog.d("Bypass as android.hardware.fingerprint is not supported."); 39 return; 40 } 41 42 final FingerprintServiceDumpProto dump = 43 getDump(FingerprintServiceDumpProto.parser(), "dumpsys fingerprint --proto"); 44 45 // One of them 46 assertEquals(1, dump.getUsersCount()); 47 48 final FingerprintUserStatsProto userStats = dump.getUsers(0); 49 assertEquals(0, userStats.getUserId()); 50 assertEquals(0, userStats.getNumFingerprints()); 51 52 final FingerprintActionStatsProto normal = userStats.getNormal(); 53 assertEquals(0, normal.getAccept()); 54 assertEquals(0, normal.getReject()); 55 assertEquals(0, normal.getAcquire()); 56 assertEquals(0, normal.getLockout()); 57 58 final FingerprintActionStatsProto crypto = userStats.getCrypto(); 59 assertEquals(0, crypto.getAccept()); 60 assertEquals(0, crypto.getReject()); 61 assertEquals(0, crypto.getAcquire()); 62 assertEquals(0, crypto.getLockout()); 63 } 64 } 65 66