Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dc1a734 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't show the Fingerprint suggestion if it is disabled." into nyc-mr1-dev

parents 0fd709bf c9ec8c80
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.IWallpaperManagerCallback;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.app.WallpaperManager;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
@@ -59,10 +60,11 @@ public class SuggestionsChecks {
        } else if (className.equals(WifiCallingSuggestionActivity.class.getName())) {
            return isWifiCallingUnavailableOrEnabled();
        } else if (className.equals(FingerprintSuggestionActivity.class.getName())) {
            return isNotSingleFingerprintEnrolled();
        } else if (className.equals(ScreenLockSuggestionActivity.class.getName())
                || className.equals(FingerprintEnrollSuggestionActivity.class.getName())) {
            return isNotSingleFingerprintEnrolled() || !isFingerprintEnabled();
        } else if (className.equals(ScreenLockSuggestionActivity.class.getName())) {
            return isDeviceSecured();
        } else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) {
            return isDeviceSecured() || !isFingerprintEnabled();
        }
        return false;
    }
@@ -108,6 +110,14 @@ public class SuggestionsChecks {
        return false;
    }

    private boolean isFingerprintEnabled() {
        DevicePolicyManager dpManager =
                (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
        final int dpmFlags = dpManager.getKeyguardDisabledFeatures(null, /* admin */
                mContext.getUserId());
        return (dpmFlags & DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) == 0;
    }

    private final IWallpaperManagerCallback mCallback = new IWallpaperManagerCallback.Stub() {
        @Override
        public void onWallpaperChanged() throws RemoteException {