summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuis Vidal <lvidal@cyngn.com>2016-01-13 16:12:10 -0800
committerLuis Vidal <lvidal@cyngn.com>2016-01-18 10:52:10 -0800
commite6bcdddcfcbe248cc145409e4749db867b8deef3 (patch)
tree96fa971ad2f0962cced31e0e0778315f4380b55f /src
parentd530b3c1edc0cabf879ea4824fb10d5abfdf422c (diff)
downloadpackages_apps_ThemeChooser-e6bcdddcfcbe248cc145409e4749db867b8deef3.tar.gz
packages_apps_ThemeChooser-e6bcdddcfcbe248cc145409e4749db867b8deef3.tar.bz2
packages_apps_ThemeChooser-e6bcdddcfcbe248cc145409e4749db867b8deef3.zip
Disable live lock screen
Fix to disable a previously enabled live lock screen if a static wallpaper or none is selected Change-Id: Ib0e130e31326b5717ba87a4464a8dae950eb5f64 TICKET: CYNGNOS-1580
Diffstat (limited to 'src')
-rw-r--r--src/com/cyngn/theme/chooser/ThemeFragment.java51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java
index 0b7de62..e6fcd9e 100644
--- a/src/com/cyngn/theme/chooser/ThemeFragment.java
+++ b/src/com/cyngn/theme/chooser/ThemeFragment.java
@@ -602,25 +602,29 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
mProgress.setProgress(progress);
}
- private void setLiveLockScreenAsKeyguard() {
- try {
- final String[] permissions = Utils.getDangerousPermissionsNotGranted(getActivity(),
- LLS_PACKAGE_NAME);
- if (permissions.length > 0) {
- Intent reqIntent = Utils.buildPermissionGrantRequestIntent(getActivity(),
- LLS_PACKAGE_NAME, permissions);
- if (reqIntent != null) {
- startActivity(reqIntent);
+ private void setLiveLockScreenAsKeyguard(boolean setLLS) {
+ ComponentName cn = null;
+ if (setLLS) {
+ try {
+ final String[] permissions = Utils.getDangerousPermissionsNotGranted(getActivity(),
+ LLS_PACKAGE_NAME);
+ if (permissions.length > 0) {
+ Intent reqIntent = Utils.buildPermissionGrantRequestIntent(getActivity(),
+ LLS_PACKAGE_NAME, permissions);
+ if (reqIntent != null) {
+ startActivity(reqIntent);
+ }
}
+ cn = new ComponentName(LLS_PACKAGE_NAME, LLS_PROVIDER_NAME);
+ } catch (InvalidParameterException e) {
+ Log.e(TAG, "Package Manager couldn't find package " + LLS_PACKAGE_NAME, e);
+ return;
}
- } catch (InvalidParameterException e) {
- Log.e(TAG, "Package Manager couldn't find package " + LLS_PACKAGE_NAME, e);
- return;
}
+
CmLockPatternUtils lockPatternUtils = new CmLockPatternUtils(getActivity());
try {
- lockPatternUtils.setThirdPartyKeyguard(
- new ComponentName(LLS_PACKAGE_NAME, LLS_PROVIDER_NAME));
+ lockPatternUtils.setThirdPartyKeyguard(cn);
} catch (PackageManager.NameNotFoundException e) {
// we should not be here!
}
@@ -639,8 +643,12 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
if (isSuccess) {
Map<String, String> appliedComponents = getComponentsToApply();
String modLLS = appliedComponents.get(MODIFIES_LIVE_LOCK_SCREEN);
- if (modLLS != null && !TextUtils.equals(modLLS, "")) {
- setLiveLockScreenAsKeyguard();
+ if (modLLS != null) {
+ if (TextUtils.equals(modLLS, "")) {
+ setLiveLockScreenAsKeyguard(false);
+ } else {
+ setLiveLockScreenAsKeyguard(true);
+ }
}
mProgress.setProgress(100);
animateProgressOut();
@@ -1540,13 +1548,17 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
&& (mBaseThemeSupportedComponents.contains(MODIFIES_LOCKSCREEN) ||
mBaseThemeSupportedComponents.contains(MODIFIES_LIVE_LOCK_SCREEN)))) {
if (isLiveLockScreen) {
- mSelectedComponentsMap.put(MODIFIES_LOCKSCREEN, "");
+ if (mSelectedComponentsMap.containsKey(MODIFIES_LOCKSCREEN)) {
+ mSelectedComponentsMap.put(MODIFIES_LOCKSCREEN, "");
+ }
mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, pkgName);
setCardTitle(mLockScreenCard, pkgName,
getString(R.string.live_lock_screen_label));
} else {
mSelectedComponentsMap.put(MODIFIES_LOCKSCREEN, pkgName);
- mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, "");
+ if (mSelectedComponentsMap.containsKey(MODIFIES_LIVE_LOCK_SCREEN)) {
+ mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN, "");
+ }
setCardTitle(mLockScreenCard, pkgName, getString(R.string.lockscreen_label));
}
}
@@ -2058,6 +2070,9 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb
if (pkgName != null && TextUtils.isEmpty(pkgName)) {
mLockScreenCard.setWallpaper(null);
mSelectedComponentsMap.put(ThemesColumns.MODIFIES_LOCKSCREEN, WALLPAPER_NONE);
+ if(mSelectedComponentsMap.containsKey(MODIFIES_LIVE_LOCK_SCREEN)) {
+ mSelectedComponentsMap.put(MODIFIES_LIVE_LOCK_SCREEN,WALLPAPER_NONE);
+ }
setCardTitle(mLockScreenCard, WALLPAPER_NONE,
getString(R.string.lockscreen_label));
} else if (ComponentSelector.EXTERNAL_WALLPAPER.equals(pkgName)) {