Skip to content

Commit e0a8722

Browse files
AshutoshSundreshimjyotiraditya
authored andcommitted
Settings: Implement FOD icon animation [2/2]
1 parent 18f9ea7 commit e0a8722

4 files changed

Lines changed: 66 additions & 0 deletions

File tree

res/values/wave_strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,7 @@
266266
<string name="dark_mode_auto_suntime">Automatically enable from sunset to sunrise</string>
267267
<string name="dark_mode_auto_custom">Custom time range</string>
268268

269+
<!-- FOD icon animation -->
270+
<string name="fod_icon_animation_summary">Animate the FOD icon when turning on the screen</string>
271+
<string name="fod_icon_animation">Animated FOD icon</string>
269272
</resources>

res/xml/screen_lock_settings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@
4040
android:key="power_button_instantly_locks"
4141
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
4242

43+
<me.waveproject.framework.preference.SystemSettingSwitchPreference
44+
android:key="fod_icon_animation"
45+
android:title="@string/fod_icon_animation"
46+
android:summary="@string/fod_icon_animation_summary"
47+
android:defaultValue="false"
48+
settings:controller="com.android.settings.security.FodPreferenceController" />
49+
4350
</PreferenceScreen>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (C) 2017 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.settings.security.screenlock;
18+
19+
import android.content.Context;
20+
import android.content.pm.PackageManager;
21+
import android.hardware.fingerprint.FingerprintManager;
22+
23+
import com.android.settings.R;
24+
import com.android.settings.Utils;
25+
import com.android.settings.core.BasePreferenceController;
26+
27+
public class FodPreferenceController extends BasePreferenceController {
28+
29+
private static final String FOD = "vendor.lineage.biometrics.fingerprint.inscreen";
30+
private static final String FOD_ANIMATION = "fod_icon_animation";
31+
private Context mContext;
32+
33+
private FingerprintManager fpm;
34+
private PackageManager packageManager;
35+
36+
private boolean mHasFod;
37+
38+
public FodPreferenceController(Context context) {
39+
super(context, FOD_ANIMATION);
40+
mContext = context;
41+
42+
fpm = Utils.getFingerprintManagerOrNull(context);
43+
packageManager = context.getPackageManager();
44+
mHasFod = packageManager.hasSystemFeature(FOD);
45+
}
46+
47+
@Override
48+
public int getAvailabilityStatus() {
49+
if (fpm != null && fpm.isHardwareDetected() && fpm.hasEnrolledFingerprints()
50+
&& packageManager.hasSystemFeature(FOD)) {
51+
return AVAILABLE;
52+
}
53+
return UNSUPPORTED_ON_DEVICE;
54+
}
55+
}

src/com/android/settings/security/screenlock/ScreenLockSettings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public void onOwnerInfoUpdated() {
6969
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
7070
DashboardFragment parent, LockPatternUtils lockPatternUtils) {
7171
final List<AbstractPreferenceController> controllers = new ArrayList<>();
72+
controllers.add(new FodPreferenceController(context));
7273
controllers.add(new PatternVisiblePreferenceController(
7374
context, MY_USER_ID, lockPatternUtils));
7475
controllers.add(new PowerButtonInstantLockPreferenceController(

0 commit comments

Comments
 (0)