Search in sources :

Example 36 with WallpaperManager

use of android.app.WallpaperManager in project packages_apps_AicpExtras by AICP.

the class Lockscreen method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Context mContext = getContext();
    PreferenceScreen prefSet = getPreferenceScreen();
    ContentResolver resolver = getActivity().getContentResolver();
    WallpaperManager manager = WallpaperManager.getInstance(mContext);
    try {
        mFingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
    } catch (Exception e) {
    // ignore
    }
    // Fingerprint vibration
    mFingerprintVib = (SwitchPreference) prefSet.findPreference(FP_SUCCESS_VIBRATION);
    if (mFingerprintManager == null || !mFingerprintManager.isHardwareDetected()) {
        mFingerprintVib.getParent().removePreference(mFingerprintVib);
    }
    Util.requireConfig(getActivity(), findPreference(KEY_AOD_SCHEDULE), com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable, true, false);
    // Lockscreen blur
    Preference lockscreenBlur = (Preference) findPreference(KEY_LOCKSCREEN_BLUR);
    ParcelFileDescriptor pfd = manager.getWallpaperFile(WallpaperManager.FLAG_LOCK);
    if (!AicpUtils.supportsBlur() || pfd != null) {
        lockscreenBlur.setEnabled(false);
        lockscreenBlur.setSummary(getResources().getString(R.string.lockscreen_blur_disabled));
    }
    // FOD category
    PreferenceCategory fodIconPickerCategory = (PreferenceCategory) findPreference(FOD_ICON_PICKER_CATEGORY);
    PackageManager packageManager = getContext().getPackageManager();
    boolean supportsFod = packageManager.hasSystemFeature(AicpContextConstants.Features.FOD);
    if (fodIconPickerCategory != null && !supportsFod) {
        fodIconPickerCategory.getParent().removePreference(fodIconPickerCategory);
    }
}
Also used : Context(android.content.Context) PreferenceScreen(androidx.preference.PreferenceScreen) PackageManager(android.content.pm.PackageManager) SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference) PreferenceCategory(androidx.preference.PreferenceCategory) ParcelFileDescriptor(android.os.ParcelFileDescriptor) WallpaperManager(android.app.WallpaperManager) ContentResolver(android.content.ContentResolver)

Aggregations

WallpaperManager (android.app.WallpaperManager)36 IOException (java.io.IOException)15 Bitmap (android.graphics.Bitmap)11 Intent (android.content.Intent)6 Context (android.content.Context)5 Rect (android.graphics.Rect)5 Bundle (android.os.Bundle)5 WindowManager (android.view.WindowManager)5 SuppressLint (android.annotation.SuppressLint)4 Application (android.app.Application)4 Handler (android.os.Handler)4 DisplayMetrics (android.util.DisplayMetrics)4 Display (android.view.Display)4 Before (org.junit.Before)4 Test (org.junit.Test)4 ShadowApplication (org.robolectric.shadows.ShadowApplication)4 Activity (android.app.Activity)3 ActivityNotFoundException (android.content.ActivityNotFoundException)3 Matrix (android.graphics.Matrix)3 TargetApi (android.annotation.TargetApi)2