Add animation for fingerprint error state

- Put lock icon logic in a separate class.
- Add animation when switching between fingerprint scanning and
fingerprint error.

Change-Id: I87c3f101d645a990d5397b82a797c9ee40a63da2
This commit is contained in:
Jorim Jaggi
2015-04-28 13:27:12 -07:00
parent 1fd75d83c3
commit 27267d6869
24 changed files with 1184 additions and 118 deletions

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="100"
android:propertyName="rotation"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="566"
android:propertyName="rotation"
android:valueFrom="0.0"
android:valueTo="-305.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_3" />
<objectAnimator
android:duration="1066"
android:propertyName="rotation"
android:valueFrom="-305.0"
android:valueTo="-305.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_0" />
<objectAnimator
android:duration="800"
android:propertyName="rotation"
android:valueFrom="-305.0"
android:valueTo="-720.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_0" />
</set>
</set>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="183"
android:propertyName="rotation"
android:valueFrom="285.0"
android:valueTo="285.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="516"
android:propertyName="rotation"
android:valueFrom="285.0"
android:valueTo="90.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_1" />
</set>
</set>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="283"
android:propertyName="scaleX"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="316"
android:propertyName="scaleX"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_1" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="283"
android:propertyName="scaleY"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="316"
android:propertyName="scaleY"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_1" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="283"
android:propertyName="rotation"
android:valueFrom="184.0"
android:valueTo="184.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="316"
android:propertyName="rotation"
android:valueFrom="184.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_1" />
</set>
</set>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="233"
android:propertyName="trimPathStart"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="466"
android:propertyName="trimPathStart"
android:valueFrom="1.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</set>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="133"
android:propertyName="trimPathEnd"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="100"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="100"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_2" />
</set>
</set>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="16"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="66"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
</set>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="116"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="116"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_3" />
</set>
<objectAnimator
android:duration="166"
android:propertyName="trimPathStart"
android:valueFrom="1.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_3" />
</set>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="16"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="133"
android:propertyName="trimPathEnd"
android:valueFrom="1.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
</set>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="166"
android:propertyName="trimPathEnd"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="150"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="166"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_2" />
</set>
</set>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="150"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="250"
android:propertyName="trimPathEnd"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_0" />
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="133"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="216"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_0" />
</set>
</set>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="16"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="216"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
</set>

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="16"
android:propertyName="trimPathEnd"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="216"
android:propertyName="trimPathEnd"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="133"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="266"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_2" />
</set>
</set>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="33"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="150"
android:propertyName="trimPathStart"
android:valueFrom="0.0"
android:valueTo="1.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
</set>
</set>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<set
android:ordering="sequentially" >
<objectAnimator
android:duration="100"
android:propertyName="rotation"
android:valueFrom="0.0"
android:valueTo="0.0"
android:valueType="floatType"
android:interpolator="@android:interpolator/linear" />
<objectAnimator
android:duration="566"
android:propertyName="rotation"
android:valueFrom="0.0"
android:valueTo="-305.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_3" />
<objectAnimator
android:duration="1066"
android:propertyName="rotation"
android:valueFrom="-305.0"
android:valueTo="-305.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_0" />
<objectAnimator
android:duration="800"
android:propertyName="rotation"
android:valueFrom="-305.0"
android:valueTo="-720.0"
android:valueType="floatType"
android:interpolator="@interpolator/lockscreen_fingerprint_error_state_animation_interpolator_0" />
</set>
</set>

View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="lockscreen_fingerprint_error_state"
android:width="32dp"
android:viewportWidth="32"
android:height="32dp"
android:viewportHeight="32" >
<group
android:name="white_fingerprint_ridges"
android:translateX="16.125"
android:translateY="19.75" >
<group
android:name="white_fingerprint_ridges_pivot"
android:translateX="33.2085"
android:translateY="30.91685" >
<group
android:name="ridge_5" >
<path
android:name="ridge_5_path"
android:pathData="M -25.3591003418,-24.4138946533 c -0.569000244141,0.106399536133 -1.12660217285,0.140594482422 -1.45460510254,0.140594482422 c -1.29689025879,0.0 -2.53239440918,-0.343307495117 -3.62019348145,-1.12400817871 c -1.67700195312,-1.20349121094 -2.76950073242,-3.17008972168 -2.76950073242,-5.39189147949"
android:strokeColor="#FFFFFFFF"
android:strokeAlpha="0.5"
android:strokeWidth="1.45"
android:strokeLineCap="round" />
</group>
<group
android:name="ridge_4" >
<path
android:name="ridge_7_path"
android:pathData="M -36.1409912109,-21.7843475342 c -1.00540161133,-1.19300842285 -1.57499694824,-1.9181060791 -2.36520385742,-3.50170898438 c -0.827560424805,-1.65869140625 -1.31352233887,-3.49159240723 -1.31352233887,-5.48489379883 c 0.0,-3.66279602051 2.96932983398,-6.63220214844 6.63221740723,-6.63220214844 c 3.6628112793,0.0 6.63220214844,2.96940612793 6.63220214844,6.63220214844"
android:strokeColor="#FFFFFFFF"
android:strokeAlpha="0.5"
android:strokeWidth="1.45"
android:strokeLineCap="round" />
</group>
<group
android:name="ridge_3" >
<path
android:name="ridge_6_path"
android:pathData="M -42.1907958984,-25.6756896973 c -0.758117675781,-2.14370727539 -0.896545410156,-3.86891174316 -0.896545410156,-5.12921142578 c 0.0,-1.46069335938 0.249176025391,-2.84799194336 0.814682006836,-4.09748840332 c 1.56153869629,-3.45030212402 5.03434753418,-5.85076904297 9.0679473877,-5.85076904297 c 5.49430847168,0.0 9.94830322266,4.4539642334 9.94830322266,9.94825744629 c 0.0,1.83151245117 -1.48460388184,3.31610107422 -3.31610107422,3.31610107422 c -1.83149719238,0.0 -3.31610107422,-1.48469543457 -3.31610107422,-3.31610107422 c 0.0,-1.83139038086 -1.48458862305,-3.31610107422 -3.31610107422,-3.31610107422 c -1.83149719238,0.0 -3.31610107422,1.48471069336 -3.31610107422,3.31610107422 c 0.0,2.57020568848 0.989517211914,4.88710021973 2.60510253906,6.5865020752 c 1.22210693359,1.28550720215 2.43139648438,2.09950256348 4.47590637207,2.69030761719"
android:strokeColor="#FFFFFFFF"
android:strokeAlpha="0.5"
android:strokeWidth="1.45"
android:strokeLineCap="round" />
</group>
<group
android:name="ridge_2" >
<path
android:name="ridge_2_path"
android:pathData="M -44.0646514893,-38.1672973633 c 1.19026184082,-1.77430725098 2.67503356934,-3.24531555176 4.55902099609,-4.27278137207 c 1.88395690918,-1.0274810791 4.04466247559,-1.61137390137 6.34175109863,-1.61137390137 c 2.28761291504,0.0 4.43991088867,0.579071044922 6.31831359863,1.59861755371 c 1.8784942627,1.01954650879 3.36059570312,2.4796295166 4.55279541016,4.24153137207"
android:strokeColor="#FFFFFFFF"
android:strokeAlpha="0.5"
android:strokeWidth="1.45"
android:strokeLineCap="round" />
</group>
<group
android:name="ridge_1"
android:translateX="-97.5"
android:translateY="-142.5" >
<path
android:name="ridge_1_path"
android:pathData="M 71.7812347412,97.0507202148 c -2.27149963379,-1.31344604492 -4.71360778809,-2.07006835938 -7.56221008301,-2.07006835938 c -2.84869384766,0.0 -5.23320007324,0.779556274414 -7.34411621094,2.07006835938"
android:strokeColor="#FFFFFFFF"
android:strokeAlpha="0.5"
android:strokeWidth="1.45"
android:strokeLineCap="round" />
</group>
</group>
</group>
<group
android:name="fingerprint_ridges"
android:translateX="16.125"
android:translateY="19.75" >
<group
android:name="fingerprint_ridges_pivot"
android:translateX="33.2085"
android:translateY="30.91685" >
<group
android:name="ridge_6" >
<path
android:name="ridge_5_path_0"
android:pathData="M -25.3591003418,-24.4138946533 c -0.569000244141,0.106399536133 -1.12660217285,0.140594482422 -1.45460510254,0.140594482422 c -1.29689025879,0.0 -2.53239440918,-0.343307495117 -3.62019348145,-1.12400817871 c -1.67700195312,-1.20349121094 -2.76950073242,-3.17008972168 -2.76950073242,-5.39189147949"
android:strokeColor="#FFF2501D"
android:strokeWidth="1.45"
android:strokeLineCap="round"
android:trimPathEnd="0" />
</group>
<group
android:name="ridge_7" >
<path
android:name="ridge_7_path_0"
android:pathData="M -36.1409912109,-21.7843475342 c -1.00540161133,-1.19300842285 -1.57499694824,-1.9181060791 -2.36520385742,-3.50170898438 c -0.827560424805,-1.65869140625 -1.31352233887,-3.49159240723 -1.31352233887,-5.48489379883 c 0.0,-3.66279602051 2.96932983398,-6.63220214844 6.63221740723,-6.63220214844 c 3.6628112793,0.0 6.63220214844,2.96940612793 6.63220214844,6.63220214844"
android:strokeColor="#FFF2501D"
android:strokeWidth="1.45"
android:strokeLineCap="round"
android:trimPathEnd="0" />
</group>
<group
android:name="ridge_8" >
<path
android:name="ridge_6_path_0"
android:pathData="M -42.1907958984,-25.6756896973 c -0.758117675781,-2.14370727539 -0.896545410156,-3.86891174316 -0.896545410156,-5.12921142578 c 0.0,-1.46069335938 0.249176025391,-2.84799194336 0.814682006836,-4.09748840332 c 1.56153869629,-3.45030212402 5.03434753418,-5.85076904297 9.0679473877,-5.85076904297 c 5.49430847168,0.0 9.94830322266,4.4539642334 9.94830322266,9.94825744629 c 0.0,1.83151245117 -1.48460388184,3.31610107422 -3.31610107422,3.31610107422 c -1.83149719238,0.0 -3.31610107422,-1.48469543457 -3.31610107422,-3.31610107422 c 0.0,-1.83139038086 -1.48458862305,-3.31610107422 -3.31610107422,-3.31610107422 c -1.83149719238,0.0 -3.31610107422,1.48471069336 -3.31610107422,3.31610107422 c 0.0,2.57020568848 0.989517211914,4.88710021973 2.60510253906,6.5865020752 c 1.22210693359,1.28550720215 2.43139648438,2.09950256348 4.47590637207,2.69030761719"
android:strokeColor="#FFF2501D"
android:strokeWidth="1.45"
android:strokeLineCap="round"
android:trimPathEnd="0" />
</group>
<group
android:name="ridge_9" >
<path
android:name="ridge_2_path_0"
android:pathData="M -44.0646514893,-38.1672973633 c 1.19026184082,-1.77430725098 2.67503356934,-3.24531555176 4.55902099609,-4.27278137207 c 1.88395690918,-1.0274810791 4.04466247559,-1.61137390137 6.34175109863,-1.61137390137 c 2.28761291504,0.0 4.43991088867,0.579071044922 6.31831359863,1.59861755371 c 1.8784942627,1.01954650879 3.36059570312,2.4796295166 4.55279541016,4.24153137207"
android:strokeColor="#FFF2501D"
android:strokeWidth="1.45"
android:strokeLineCap="round"
android:trimPathStart="1" />
</group>
<group
android:name="ridge_10"
android:translateX="-97.5"
android:translateY="-142.5" >
<path
android:name="ridge_1_path_0"
android:pathData="M 71.7812347412,97.0507202148 c -2.27149963379,-1.31344604492 -4.71360778809,-2.07006835938 -7.56221008301,-2.07006835938 c -2.84869384766,0.0 -5.23320007324,0.779556274414 -7.34411621094,2.07006835938"
android:strokeColor="#FFF2501D"
android:strokeWidth="1.45"
android:strokeLineCap="round"
android:trimPathEnd="0" />
</group>
</group>
</group>
<group
android:name="exclamation"
android:translateX="16"
android:translateY="16" >
<group
android:name="group_2"
android:scaleX="0"
android:scaleY="0"
android:rotation="184" >
<path
android:name="path_2_merged"
android:pathData="M 1.35900878906,6.76104736328 c 0.0,0.0 -2.69998168945,0.0 -2.69998168945,0.0 c 0.0,0.0 0.0,-2.69995117188 0.0,-2.69995117188 c 0.0,0.0 2.69998168945,0.0 2.69998168945,0.0 c 0.0,0.0 0.0,2.69995117188 0.0,2.69995117188 Z M 1.35363769531,1.36633300781 c 0.0,0.0 -2.69998168945,0.0 -2.69998168945,0.0 c 0.0,0.0 0.0,-8.09997558594 0.0,-8.09997558594 c 0.0,0.0 2.69998168945,0.0 2.69998168945,0.0 c 0.0,0.0 0.0,8.09997558594 0.0,8.09997558594 Z"
android:fillColor="#FFF2501D" />
</group>
</group>
<group
android:name="circle_outline"
android:translateX="16"
android:translateY="16" >
<group
android:name="group_1"
android:scaleX="1.12734"
android:scaleY="1.12734"
android:rotation="285" >
<path
android:name="path_3"
android:pathData="M 0.0101470947266,10.8087768555 c -5.96701049805,0.0 -10.8000183105,-4.8330078125 -10.8000183105,-10.8000488281 c 0.0,-5.96691894531 4.8330078125,-10.7999267578 10.8000183105,-10.7999267578 c 5.96697998047,0.0 10.799987793,4.8330078125 10.799987793,10.7999267578 c 0.0,5.96704101562 -4.8330078125,10.8000488281 -10.799987793,10.8000488281 Z"
android:strokeColor="#FFF2501D"
android:strokeWidth="2"
android:trimPathStart="1" />
</group>
</group>
</vector>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/lockscreen_fingerprint_error_state" >
<target
android:name="white_fingerprint_ridges"
android:animation="@anim/lockscreen_fingerprint_error_state_white_fingerprint_ridges_animation" />
<target
android:name="ridge_5_path"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_5_path_animation" />
<target
android:name="ridge_7_path"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_7_path_animation" />
<target
android:name="ridge_6_path"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_6_path_animation" />
<target
android:name="ridge_2_path"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_2_path_animation" />
<target
android:name="ridge_1_path"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_1_path_animation" />
<target
android:name="fingerprint_ridges"
android:animation="@anim/lockscreen_fingerprint_error_state_fingerprint_ridges_animation" />
<target
android:name="ridge_5_path_0"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_5_path_0_animation" />
<target
android:name="ridge_7_path_0"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_7_path_0_animation" />
<target
android:name="ridge_6_path_0"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_6_path_0_animation" />
<target
android:name="ridge_2_path_0"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_2_path_0_animation" />
<target
android:name="ridge_1_path_0"
android:animation="@anim/lockscreen_fingerprint_error_state_ridge_1_path_0_animation" />
<target
android:name="group_2"
android:animation="@anim/lockscreen_fingerprint_error_state_group_2_animation" />
<target
android:name="group_1"
android:animation="@anim/lockscreen_fingerprint_error_state_group_1_animation" />
<target
android:name="path_3"
android:animation="@anim/lockscreen_fingerprint_error_state_path_3_animation" />
</animated-vector>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
android:pathData="M 0.0,0.0 c 0.16666666667,0.0 0.83333333333,1.0 1.0,1.0" />

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
android:pathData="M 0.0,0.0 c 0.0,0.0 0.6,1.0 1.0,1.0" />

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
android:pathData="M 0.0,0.0 c 0.8,0.0 0.5,1.0 1.0,1.0" />

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 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
-->
<pathInterpolator
xmlns:android="http://schemas.android.com/apk/res/android"
android:pathData="M 0.0,0.0 c 0.4,0.0 0.6,1.0 1.0,1.0" />

View File

@@ -61,7 +61,7 @@
android:scaleType="center"
android:contentDescription="@string/accessibility_phone_button" />
<com.android.systemui.statusbar.KeyguardAffordanceView
<com.android.systemui.statusbar.phone.LockIcon
android:id="@+id/lock_icon"
android:layout_width="@dimen/keyguard_affordance_width"
android:layout_height="@dimen/keyguard_affordance_height"

View File

@@ -86,7 +86,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private KeyguardAffordanceView mCameraImageView;
private KeyguardAffordanceView mPhoneImageView;
private KeyguardAffordanceView mLockIcon;
private LockIcon mLockIcon;
private TextView mIndicationText;
private ViewGroup mPreviewContainer;
@@ -102,11 +102,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private AccessibilityController mAccessibilityController;
private PhoneStatusBar mPhoneStatusBar;
private final TrustDrawable mTrustDrawable;
private final Interpolator mLinearOutSlowInInterpolator;
private int mLastUnlockIconRes = 0;
private boolean mPrewarmSent;
private boolean mTransientFpError;
public KeyguardBottomAreaView(Context context) {
this(context, null);
@@ -123,7 +120,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mTrustDrawable = new TrustDrawable(mContext);
mLinearOutSlowInInterpolator =
AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in);
}
@@ -169,20 +165,19 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mPreviewContainer = (ViewGroup) findViewById(R.id.preview_container);
mCameraImageView = (KeyguardAffordanceView) findViewById(R.id.camera_button);
mPhoneImageView = (KeyguardAffordanceView) findViewById(R.id.phone_button);
mLockIcon = (KeyguardAffordanceView) findViewById(R.id.lock_icon);
mLockIcon = (LockIcon) findViewById(R.id.lock_icon);
mIndicationText = (TextView) findViewById(R.id.keyguard_indication_text);
watchForCameraPolicyChanges();
updateCameraVisibility();
updatePhoneVisibility();
mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
mUnlockMethodCache.addListener(this);
updateLockIcon();
mLockIcon.update();
setClipChildren(false);
setClipToPadding(false);
mPreviewInflater = new PreviewInflater(mContext, new LockPatternUtils(mContext));
inflatePreviews();
mLockIcon.setOnClickListener(this);
mLockIcon.setBackground(mTrustDrawable);
mLockIcon.setOnLongClickListener(this);
mCameraImageView.setOnClickListener(this);
mPhoneImageView.setOnClickListener(this);
@@ -222,6 +217,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
public void setAccessibilityController(AccessibilityController accessibilityController) {
mAccessibilityController = accessibilityController;
mLockIcon.setAccessibilityController(accessibilityController);
accessibilityController.addStateChangedCallback(this);
}
@@ -294,21 +290,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mPhoneImageView.setClickable(touchExplorationEnabled);
mCameraImageView.setFocusable(accessibilityEnabled);
mPhoneImageView.setFocusable(accessibilityEnabled);
updateLockIconClickability();
}
private void updateLockIconClickability() {
if (mAccessibilityController == null) {
return;
}
boolean clickToUnlock = mAccessibilityController.isTouchExplorationEnabled();
boolean clickToForceLock = mUnlockMethodCache.isTrustManaged()
&& !mAccessibilityController.isAccessibilityEnabled();
boolean longClickToForceLock = mUnlockMethodCache.isTrustManaged()
&& !clickToForceLock;
mLockIcon.setClickable(clickToForceLock || clickToUnlock);
mLockIcon.setLongClickable(longClickToForceLock);
mLockIcon.setFocusable(mAccessibilityController.isAccessibilityEnabled());
mLockIcon.update();
}
@Override
@@ -409,69 +391,12 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (isShown()) {
mTrustDrawable.start();
} else {
mTrustDrawable.stop();
}
if (changedView == this && visibility == VISIBLE) {
updateLockIcon();
mLockIcon.update();
updateCameraVisibility();
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mTrustDrawable.stop();
}
private void updateLockIcon() {
boolean visible = isShown() && KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
if (visible) {
mTrustDrawable.start();
} else {
mTrustDrawable.stop();
}
if (!visible) {
return;
}
// TODO: Real icon for facelock.
boolean isFingerprintIcon =
KeyguardUpdateMonitor.getInstance(mContext).isFingerprintDetectionRunning();
boolean anyFingerprintIcon = isFingerprintIcon || mTransientFpError;
int iconRes = mTransientFpError ? R.drawable.ic_fingerprint_error
: isFingerprintIcon ? R.drawable.ic_fingerprint
: mUnlockMethodCache.isFaceUnlockRunning()
? com.android.internal.R.drawable.ic_account_circle
: mUnlockMethodCache.isCurrentlyInsecure() ? R.drawable.ic_lock_open_24dp
: R.drawable.ic_lock_24dp;
if (mLastUnlockIconRes != iconRes) {
Drawable icon = mContext.getDrawable(iconRes);
int iconHeight = getResources().getDimensionPixelSize(
R.dimen.keyguard_affordance_icon_height);
int iconWidth = getResources().getDimensionPixelSize(
R.dimen.keyguard_affordance_icon_width);
if (!anyFingerprintIcon && (icon.getIntrinsicHeight() != iconHeight
|| icon.getIntrinsicWidth() != iconWidth)) {
icon = new IntrinsicSizeDrawable(icon, iconWidth, iconHeight);
}
mLockIcon.setImageDrawable(icon);
mLockIcon.setPaddingRelative(0, 0, 0, anyFingerprintIcon
? getResources().getDimensionPixelSize(
R.dimen.fingerprint_icon_additional_padding)
: 0);
mLockIcon.setRestingAlpha(
anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT);
}
// Hide trust circle when fingerprint is running.
boolean trustManaged = mUnlockMethodCache.isTrustManaged() && !anyFingerprintIcon;
mTrustDrawable.setTrustManaged(trustManaged);
updateLockIconClickability();
}
public KeyguardAffordanceView getPhoneView() {
return mPhoneImageView;
}
@@ -503,7 +428,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public void onUnlockMethodStateChanged() {
updateLockIcon();
mLockIcon.update();
updateCameraVisibility();
}
@@ -563,9 +488,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private final Runnable mTransientFpErrorClearRunnable = new Runnable() {
@Override
public void run() {
mTransientFpError = false;
mLockIcon.setTransientFpError(false);
mIndicationController.hideTransientIndication();
updateLockIcon();
}
};
@@ -578,17 +502,17 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public void onScreenTurnedOn() {
updateLockIcon();
mLockIcon.update();
}
@Override
public void onScreenTurnedOff(int why) {
updateLockIcon();
mLockIcon.update();
}
@Override
public void onKeyguardVisibilityChanged(boolean showing) {
updateLockIcon();
mLockIcon.update();
}
@Override
@@ -597,24 +521,21 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
@Override
public void onFingerprintRunningStateChanged(boolean running) {
updateLockIcon();
mLockIcon.update();
}
@Override
public void onFingerprintHelp(int msgId, String helpString) {
mTransientFpError = true;
mLockIcon.setTransientFpError(true);
mIndicationController.showTransientIndication(helpString,
getResources().getColor(R.color.system_warning_color, null));
removeCallbacks(mTransientFpErrorClearRunnable);
postDelayed(mTransientFpErrorClearRunnable, TRANSIENT_FP_ERROR_TIMEOUT);
updateLockIcon();
}
@Override
public void onFingerprintError(int msgId, String errString) {
// TODO: Go to bouncer if this is "too many attempts" (lockout) error.
Log.i(TAG, "FP Error: " + errString);
updateLockIcon();
}
};
@@ -622,29 +543,4 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
KeyguardIndicationController keyguardIndicationController) {
mIndicationController = keyguardIndicationController;
}
/**
* A wrapper around another Drawable that overrides the intrinsic size.
*/
private static class IntrinsicSizeDrawable extends InsetDrawable {
private final int mIntrinsicWidth;
private final int mIntrinsicHeight;
public IntrinsicSizeDrawable(Drawable drawable, int intrinsicWidth, int intrinsicHeight) {
super(drawable, 0);
mIntrinsicWidth = intrinsicWidth;
mIntrinsicHeight = intrinsicHeight;
}
@Override
public int getIntrinsicWidth() {
return mIntrinsicWidth;
}
@Override
public int getIntrinsicHeight() {
return mIntrinsicHeight;
}
}
}

View File

@@ -0,0 +1,212 @@
/*
* Copyright (C) 2015 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.systemui.statusbar.phone;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.util.AttributeSet;
import android.view.View;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.R;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.policy.AccessibilityController;
/**
* Manages the different states and animations of the unlock icon.
*/
public class LockIcon extends KeyguardAffordanceView {
private static final int STATE_LOCKED = 0;
private static final int STATE_LOCK_OPEN = 1;
private static final int STATE_FACE_UNLOCK = 2;
private static final int STATE_FINGERPRINT = 3;
private static final int STATE_FINGERPRINT_ERROR = 4;
private int mLastState = 0;
private boolean mTransientFpError;
private final TrustDrawable mTrustDrawable;
private final UnlockMethodCache mUnlockMethodCache;
private AccessibilityController mAccessibilityController;
public LockIcon(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mTrustDrawable = new TrustDrawable(context);
setBackground(mTrustDrawable);
mUnlockMethodCache = UnlockMethodCache.getInstance(context);
}
@Override
protected void onVisibilityChanged(@NonNull View changedView, @Visibility int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (isShown()) {
mTrustDrawable.start();
} else {
mTrustDrawable.stop();
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mTrustDrawable.stop();
}
public void setTransientFpError(boolean transientFpError) {
mTransientFpError = transientFpError;
update();
}
public void update() {
boolean visible = isShown() && KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
if (visible) {
mTrustDrawable.start();
} else {
mTrustDrawable.stop();
}
if (!visible) {
return;
}
// TODO: Real icon for facelock.
int state = getState();
boolean anyFingerprintIcon = state == STATE_FINGERPRINT || state == STATE_FINGERPRINT_ERROR;
if (state != mLastState) {
int iconRes = getAnimationResForTransition(mLastState, state);
if (iconRes == -1) {
iconRes = getIconForState(state);
}
Drawable icon = mContext.getDrawable(iconRes);
AnimatedVectorDrawable animation = null;
if (icon instanceof AnimatedVectorDrawable) {
animation = (AnimatedVectorDrawable) icon;
}
int iconHeight = getResources().getDimensionPixelSize(
R.dimen.keyguard_affordance_icon_height);
int iconWidth = getResources().getDimensionPixelSize(
R.dimen.keyguard_affordance_icon_width);
if (!anyFingerprintIcon && (icon.getIntrinsicHeight() != iconHeight
|| icon.getIntrinsicWidth() != iconWidth)) {
icon = new IntrinsicSizeDrawable(icon, iconWidth, iconHeight);
}
setPaddingRelative(0, 0, 0, anyFingerprintIcon
? getResources().getDimensionPixelSize(
R.dimen.fingerprint_icon_additional_padding)
: 0);
setRestingAlpha(
anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT);
setImageDrawable(icon);
if (animation != null) {
animation.start();
}
}
// Hide trust circle when fingerprint is running.
boolean trustManaged = mUnlockMethodCache.isTrustManaged() && !anyFingerprintIcon;
mTrustDrawable.setTrustManaged(trustManaged);
mLastState = state;
updateClickability();
}
private void updateClickability() {
if (mAccessibilityController == null) {
return;
}
boolean clickToUnlock = mAccessibilityController.isTouchExplorationEnabled();
boolean clickToForceLock = mUnlockMethodCache.isTrustManaged()
&& !mAccessibilityController.isAccessibilityEnabled();
boolean longClickToForceLock = mUnlockMethodCache.isTrustManaged()
&& !clickToForceLock;
setClickable(clickToForceLock || clickToUnlock);
setLongClickable(longClickToForceLock);
setFocusable(mAccessibilityController.isAccessibilityEnabled());
}
public void setAccessibilityController(AccessibilityController accessibilityController) {
mAccessibilityController = accessibilityController;
}
private int getIconForState(int state) {
switch (state) {
case STATE_LOCKED:
return R.drawable.ic_lock_24dp;
case STATE_LOCK_OPEN:
return R.drawable.ic_lock_open_24dp;
case STATE_FACE_UNLOCK:
return com.android.internal.R.drawable.ic_account_circle;
case STATE_FINGERPRINT:
return R.drawable.ic_fingerprint;
case STATE_FINGERPRINT_ERROR:
return R.drawable.ic_fingerprint_error;
default:
throw new IllegalArgumentException();
}
}
private int getAnimationResForTransition(int oldState, int newState) {
if (oldState == STATE_FINGERPRINT && newState == STATE_FINGERPRINT_ERROR) {
return R.drawable.lockscreen_fingerprint_error_state_animation;
} else {
return -1;
}
}
private int getState() {
boolean fingerprintRunning =
KeyguardUpdateMonitor.getInstance(mContext).isFingerprintDetectionRunning();
if (mTransientFpError) {
return STATE_FINGERPRINT_ERROR;
} else if (fingerprintRunning) {
return STATE_FINGERPRINT;
} else if (mUnlockMethodCache.isFaceUnlockRunning()) {
return STATE_FACE_UNLOCK;
} else if (mUnlockMethodCache.isCurrentlyInsecure()) {
return STATE_LOCK_OPEN;
} else {
return STATE_LOCKED;
}
}
/**
* A wrapper around another Drawable that overrides the intrinsic size.
*/
private static class IntrinsicSizeDrawable extends InsetDrawable {
private final int mIntrinsicWidth;
private final int mIntrinsicHeight;
public IntrinsicSizeDrawable(Drawable drawable, int intrinsicWidth, int intrinsicHeight) {
super(drawable, 0);
mIntrinsicWidth = intrinsicWidth;
mIntrinsicHeight = intrinsicHeight;
}
@Override
public int getIntrinsicWidth() {
return mIntrinsicWidth;
}
@Override
public int getIntrinsicHeight() {
return mIntrinsicHeight;
}
}
}