Skip to content

Commit

Permalink
Settings: Implement FOD icon animation [2/2]
Browse files Browse the repository at this point in the history
  • Loading branch information
AshutoshSundresh authored and imjyotiraditya committed Jun 13, 2021
1 parent 0183791 commit 40adfcb
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
3 changes: 3 additions & 0 deletions res/values/wave_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,7 @@
<string name="dark_mode_auto_suntime">Automatically enable from sunset to sunrise</string>
<string name="dark_mode_auto_custom">Custom time range</string>

<!-- FOD icon animation -->
<string name="fod_icon_animation_summary">Animate the FOD icon when turning on the screen</string>
<string name="fod_icon_animation">Animated FOD icon</string>
</resources>
7 changes: 7 additions & 0 deletions res/xml/screen_lock_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />

<me.waveproject.framework.preference.SystemSettingSwitchPreference
android:key="fod_icon_animation"
android:title="@string/fod_icon_animation"
android:summary="@string/fod_icon_animation_summary"
android:defaultValue="false"
settings:controller="com.android.settings.security.FodPreferenceController" />

</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2017 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.settings.security.screenlock;

import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;

public class FodPreferenceController extends BasePreferenceController {

private static final String FOD = "vendor.lineage.biometrics.fingerprint.inscreen";
private static final String FOD_ANIMATION = "fod_icon_animation";
private Context mContext;

private FingerprintManager fpm;
private PackageManager packageManager;

private boolean mHasFod;

public FodPreferenceController(Context context) {
super(context, FOD_ANIMATION);
mContext = context;

fpm = Utils.getFingerprintManagerOrNull(context);
packageManager = context.getPackageManager();
mHasFod = packageManager.hasSystemFeature(FOD);
}

@Override
public int getAvailabilityStatus() {
if (fpm != null && fpm.isHardwareDetected() && fpm.hasEnrolledFingerprints()
&& packageManager.hasSystemFeature(FOD)) {
return AVAILABLE;
}
return UNSUPPORTED_ON_DEVICE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void onOwnerInfoUpdated() {
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
DashboardFragment parent, LockPatternUtils lockPatternUtils) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new FodPreferenceController(context));
controllers.add(new PatternVisiblePreferenceController(
context, MY_USER_ID, lockPatternUtils));
controllers.add(new PowerButtonInstantLockPreferenceController(
Expand Down

0 comments on commit 40adfcb

Please sign in to comment.