diff options
author | d34d <clark@cyngn.com> | 2015-03-13 18:35:34 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-04-01 01:58:53 +0000 |
commit | 88aba00aa3bf65f992115e5334f0f8713254deec (patch) | |
tree | e2e011efac9f3e1f81965538595bae6d514299ed /src/com/cyanogenmod | |
parent | 2104b3f5dbee3fe29707713492577dfb110bc6dc (diff) | |
download | packages_apps_SetupWizard-88aba00aa3bf65f992115e5334f0f8713254deec.zip packages_apps_SetupWizard-88aba00aa3bf65f992115e5334f0f8713254deec.tar.gz packages_apps_SetupWizard-88aba00aa3bf65f992115e5334f0f8713254deec.tar.bz2 |
Disable theme components for secondary users
This patch is to mitigate theming problems with multiple users.
Once themes properly support multiple users we can revert this.
Change-Id: Idc89a273bc1563fc668ca2a5a591cf133e8d5406
(cherry picked from commit 836f867086ce22c6c9c2c26bba4440177b1d9099)
Diffstat (limited to 'src/com/cyanogenmod')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/SetupWizardApp.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java index 549cb61..015e368 100644 --- a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java +++ b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java @@ -20,6 +20,7 @@ package com.cyanogenmod.setupwizard; import android.app.Application; import android.app.StatusBarManager; import android.content.Context; +import android.content.pm.PackageManager; import android.provider.Settings; import com.cyanogenmod.setupwizard.util.SetupWizardUtils; @@ -46,6 +47,12 @@ public class SetupWizardApp extends Application { private static final String KEY_DETECT_CAPTIVE_PORTAL = "captive_portal_detection_enabled"; + private static final String[] THEME_PACKAGES = { + "org.cyanogenmod.theme.chooser", + "com.cyngn.theme.chooser", + "com.cyngn.themestore" + }; + public static final int REQUEST_CODE_SETUP_WIFI = 0; public static final int REQUEST_CODE_SETUP_GMS= 1; public static final int REQUEST_CODE_RESTORE_GMS= 2; @@ -61,11 +68,15 @@ public class SetupWizardApp extends Application { try { // Since this is a new component, we need to disable here if the user // has already been through setup on a previous version. - if (!SetupWizardUtils.isOwner() + final boolean isOwner = SetupWizardUtils.isOwner(); + if (!isOwner || Settings.Secure.getInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE) == 1) { SetupWizardUtils.disableGMSSetupWizard(this); SetupWizardUtils.disableSetupWizard(this); + if (!isOwner) { + disableThemeComponentsForSecondaryUser(); + } } else { disableCaptivePortalDetection(); } @@ -73,7 +84,6 @@ public class SetupWizardApp extends Application { // Continue with setup disableCaptivePortalDetection(); } - } public void disableStatusBar() { @@ -93,4 +103,17 @@ public class SetupWizardApp extends Application { public void enableCaptivePortalDetection() { Settings.Global.putInt(getContentResolver(), KEY_DETECT_CAPTIVE_PORTAL, 1); } + + private void disableThemeComponentsForSecondaryUser() { + PackageManager pm = getPackageManager(); + for(String pkgName : THEME_PACKAGES) { + try { + pm.getApplicationInfo(pkgName, 0); + pm.setApplicationEnabledSetting(pkgName, + PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER, 0); + } catch (PackageManager.NameNotFoundException e) { + // don't care + } + } + } } |