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)
This commit is contained in:
parent
2104b3f5db
commit
88aba00aa3
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user