Cherish: Add lockscreen background blur [2/2]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -1268,4 +1268,7 @@
|
|||||||
<string name="theme_navbar_picker_nexus">Nexus</string>
|
<string name="theme_navbar_picker_nexus">Nexus</string>
|
||||||
<string name="theme_navbar_picker_old">Old</string>
|
<string name="theme_navbar_picker_old">Old</string>
|
||||||
<string name="theme_navbar_picker_sammy">Samsung</string>
|
<string name="theme_navbar_picker_sammy">Samsung</string>
|
||||||
|
|
||||||
|
<!-- Lockscreen blur -->
|
||||||
|
<string name="lockscreen_blur_title">Background blur</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -66,6 +66,15 @@
|
|||||||
android:icon="@drawable/ic_upset"
|
android:icon="@drawable/ic_upset"
|
||||||
android:title="@string/always_on_display_schedule_title"
|
android:title="@string/always_on_display_schedule_title"
|
||||||
android:fragment="com.cherish.settings.fragments.AODSchedule" />
|
android:fragment="com.cherish.settings.fragments.AODSchedule" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
||||||
|
android:key="lockscreen_blur"
|
||||||
|
android:title="@string/lockscreen_blur_title"
|
||||||
|
android:max="100"
|
||||||
|
settings:min="0"
|
||||||
|
settings:units="%"
|
||||||
|
settings:interval="5"
|
||||||
|
android:defaultValue="0" />
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||||
android:key="lockscreen_status_bar"
|
android:key="lockscreen_status_bar"
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.internal.util.cherish.FodUtils;
|
import com.android.internal.util.cherish.FodUtils;
|
||||||
import com.android.internal.util.cherish.CherishUtils;
|
import com.android.internal.util.cherish.CherishUtils;
|
||||||
|
import com.cherish.settings.preferences.SystemSettingSeekBarPreference;
|
||||||
|
import com.cherish.settings.utils.Utils;
|
||||||
import com.cherish.settings.preferences.SystemSettingListPreference;
|
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||||
import com.cherish.settings.preferences.SecureSettingListPreference;
|
import com.cherish.settings.preferences.SecureSettingListPreference;
|
||||||
@@ -64,6 +66,8 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
private static final String AOD_SCHEDULE_KEY = "always_on_display_schedule";
|
private static final String AOD_SCHEDULE_KEY = "always_on_display_schedule";
|
||||||
private static final String FOD_ANIMATION_CATEGORY = "fod_animations";
|
private static final String FOD_ANIMATION_CATEGORY = "fod_animations";
|
||||||
private static final String FOD_ICON_PICKER_CATEGORY = "fod_icon_picker";
|
private static final String FOD_ICON_PICKER_CATEGORY = "fod_icon_picker";
|
||||||
|
private static final String KEY_LOCKSCREEN_BLUR = "lockscreen_blur";
|
||||||
|
|
||||||
private ContentResolver mResolver;
|
private ContentResolver mResolver;
|
||||||
private Preference FODSettings;
|
private Preference FODSettings;
|
||||||
|
|
||||||
@@ -73,10 +77,11 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
static final int MODE_MIXED_SUNSET = 3;
|
static final int MODE_MIXED_SUNSET = 3;
|
||||||
static final int MODE_MIXED_SUNRISE = 4;
|
static final int MODE_MIXED_SUNRISE = 4;
|
||||||
|
|
||||||
|
private SystemSettingSeekBarPreference mLockscreenBlur;
|
||||||
private CustomSeekBarPreference mClockFontSize;
|
private CustomSeekBarPreference mClockFontSize;
|
||||||
private CustomSeekBarPreference mDateFontSize;
|
private CustomSeekBarPreference mDateFontSize;
|
||||||
private CustomSeekBarPreference mOwnerInfoFontSize;
|
private CustomSeekBarPreference mOwnerInfoFontSize;
|
||||||
private CustomSeekBarPreference mCustomTextClockFontSize;
|
private CustomSeekBarPreference mCustomTextClockFontSize;
|
||||||
private PreferenceCategory mFODIconPickerCategory;
|
private PreferenceCategory mFODIconPickerCategory;
|
||||||
private Preference mAODPref;
|
private Preference mAODPref;
|
||||||
|
|
||||||
@@ -88,6 +93,11 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
|
|||||||
ContentResolver resolver = getActivity().getContentResolver();
|
ContentResolver resolver = getActivity().getContentResolver();
|
||||||
PreferenceScreen prefScreen = getPreferenceScreen();
|
PreferenceScreen prefScreen = getPreferenceScreen();
|
||||||
Resources resources = getResources();
|
Resources resources = getResources();
|
||||||
|
|
||||||
|
mLockscreenBlur = (SystemSettingSeekBarPreference) findPreference(KEY_LOCKSCREEN_BLUR);
|
||||||
|
if (!Utils.isBlurSupported()) {
|
||||||
|
prefScreen.removePreference(mLockscreenBlur);
|
||||||
|
}
|
||||||
|
|
||||||
mFODIconPickerCategory = findPreference(FOD_ICON_PICKER_CATEGORY);
|
mFODIconPickerCategory = findPreference(FOD_ICON_PICKER_CATEGORY);
|
||||||
if (mFODIconPickerCategory != null && !FodUtils.hasFodSupport(getContext())) {
|
if (mFODIconPickerCategory != null && !FodUtils.hasFodSupport(getContext())) {
|
||||||
|
|||||||
@@ -19,13 +19,23 @@ package com.cherish.settings.utils;
|
|||||||
|
|
||||||
import static android.os.UserHandle.USER_SYSTEM;
|
import static android.os.UserHandle.USER_SYSTEM;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.om.IOverlayManager;
|
import android.content.om.IOverlayManager;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
import android.provider.Settings;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.KeyCharacterMap;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.Surface;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
@@ -36,5 +46,13 @@ public class Utils {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBlurSupported() {
|
||||||
|
boolean blurSupportedSysProp = SystemProperties
|
||||||
|
.getBoolean("ro.surface_flinger.supports_background_blur", false);
|
||||||
|
boolean blurDisabledSysProp = SystemProperties
|
||||||
|
.getBoolean("persist.sys.sf.disable_blurs", false);
|
||||||
|
return blurSupportedSysProp && !blurDisabledSysProp && ActivityManager.isHighEndGfx();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user