SetupWizard: Remove Themes related code
* CMTE is not coming back in 14.1 anyway * Instead of fixing stuff around it, just remove remainders of it Change-Id: Ib0e3261d970779aa6dd30db5c8869a0f5198d2d3
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
|
||||
<uses-permission android:name="android.permission.MANAGE_USERS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
||||
<uses-permission android:name="cyanogenmod.permission.ACCESS_THEME_MANAGER"/>
|
||||
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
||||
<uses-permission android:name="cyanogenmod.permission.HARDWARE_ABSTRACTION_ACCESS" />
|
||||
<uses-permission android:name="android.permission.BACKUP" />
|
||||
|
@@ -56,12 +56,4 @@
|
||||
android:background="@drawable/reveal"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/finishing_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</com.cyanogenmod.setupwizard.widget.ScrimInsetsFrameLayout>
|
@@ -87,42 +87,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Whether or not to enable default theme -->
|
||||
<LinearLayout
|
||||
android:id="@+id/theme"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/location_margin_left"
|
||||
android:paddingRight="@dimen/content_margin_right"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true">
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/enable_theme_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginTop="5dp"
|
||||
android:duplicateParentState="true"
|
||||
android:clickable="false"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enable_theme_summary"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="15sp"
|
||||
android:lineSpacingExtra="@dimen/setup_line_spacing"
|
||||
android:gravity="top"
|
||||
android:layout_marginLeft="@dimen/location_text_margin_left"
|
||||
android:layout_marginRight="@dimen/location_text_margin_right"
|
||||
android:paddingBottom="@dimen/content_margin_bottom"
|
||||
android:text="@string/services_metrics_label"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Checkbox for using on-screen nav keys -->
|
||||
<LinearLayout
|
||||
android:id="@+id/nav_keys"
|
||||
|
@@ -83,8 +83,6 @@
|
||||
<string name="services_privacy_policy">Privacy Policy</string>
|
||||
<string name="services_help_improve_cm">Help improve <xliff:g id="name" example="CyanogenMod">%s</xliff:g></string>
|
||||
<string name="services_metrics_label"><xliff:g id="name" example="Help improve CyanogenMod">%1$s</xliff:g> by automatically sending diagnostic and usage data to LineageOS. This information can’t be used to identify you and lends a hand to teams working on things like battery life, app performance, and new <xliff:g id="name" example="CyanogenMod">%2$s</xliff:g> features.</string>
|
||||
<string name="services_apply_theme">Apply the <xliff:g id="name" example="Material">%s</xliff:g> theme</string>
|
||||
<string name="services_apply_theme_label"><xliff:g id="name" example="Apply the Material theme">%s</xliff:g> enabling a unique visual style for your icons, wallpaper and more.</string>
|
||||
<string name="services_os_nav_keys_label"><b>Use on screen navigation keys</b> instead of hardware keys.</string>
|
||||
<string name="services_os_privacy_guard"><b>Enable Privacy guard</b> to make your personal data such as contacts, messages or call logs not available for newly installed apps</string>
|
||||
|
||||
|
@@ -31,13 +31,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.ThemeConfig;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.animation.Animation;
|
||||
@@ -48,19 +46,15 @@ import android.widget.ProgressBar;
|
||||
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||
|
||||
import com.cyanogenmod.setupwizard.util.EnableAccessibilityController;
|
||||
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
import cyanogenmod.hardware.CMHardwareManager;
|
||||
import cyanogenmod.providers.CMSettings;
|
||||
import cyanogenmod.themes.ThemeManager;
|
||||
|
||||
public class FinishActivity extends BaseSetupWizardActivity
|
||||
implements ThemeManager.ThemeChangeListener {
|
||||
public class FinishActivity extends BaseSetupWizardActivity {
|
||||
|
||||
public static final String TAG = FinishActivity.class.getSimpleName();
|
||||
|
||||
private ImageView mReveal;
|
||||
private ProgressBar mFinishingProgressBar;
|
||||
|
||||
private EnableAccessibilityController mEnableAccessibilityController;
|
||||
|
||||
@@ -79,7 +73,6 @@ public class FinishActivity extends BaseSetupWizardActivity
|
||||
}
|
||||
mSetupWizardApp = (SetupWizardApp) getApplication();
|
||||
mReveal = (ImageView) findViewById(R.id.reveal);
|
||||
mFinishingProgressBar = (ProgressBar)findViewById(R.id.finishing_bar);
|
||||
mEnableAccessibilityController =
|
||||
EnableAccessibilityController.getInstance(getApplicationContext());
|
||||
setNextText(R.string.start);
|
||||
@@ -118,45 +111,10 @@ public class FinishActivity extends BaseSetupWizardActivity
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
|
||||
hideBackButton();
|
||||
hideNextButton();
|
||||
Animation fadeIn = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
|
||||
mFinishingProgressBar.setVisibility(View.VISIBLE);
|
||||
mFinishingProgressBar.setIndeterminate(true);
|
||||
mFinishingProgressBar.startAnimation(fadeIn);
|
||||
final ThemeManager tm = ThemeManager.getInstance(this);
|
||||
try {
|
||||
tm.registerThemeChangeListener(this);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "ThemeChangeListener already registered");
|
||||
}
|
||||
handleDefaultThemeSetup(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(boolean isSuccess) {
|
||||
if (isResumed()) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startFinishSequence();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
if (progress > 0) {
|
||||
mFinishingProgressBar.setIndeterminate(false);
|
||||
mFinishingProgressBar.setProgress(progress);
|
||||
}
|
||||
finishSetup();
|
||||
}
|
||||
|
||||
private void setupRevealImage() {
|
||||
mFinishingProgressBar.setProgress(100);
|
||||
Animation fadeOut = AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
|
||||
mFinishingProgressBar.startAnimation(fadeOut);
|
||||
mFinishingProgressBar.setVisibility(View.INVISIBLE);
|
||||
|
||||
final Point p = new Point();
|
||||
getWindowManager().getDefaultDisplay().getRealSize(p);
|
||||
final WallpaperManager wallpaperManager =
|
||||
@@ -218,8 +176,6 @@ public class FinishActivity extends BaseSetupWizardActivity
|
||||
handlePrivacyGuard(mSetupWizardApp);
|
||||
handleEnableMetrics(mSetupWizardApp);
|
||||
handleNavKeys(mSetupWizardApp);
|
||||
final ThemeManager tm = ThemeManager.getInstance(mSetupWizardApp);
|
||||
tm.unregisterThemeChangeListener(this);
|
||||
final WallpaperManager wallpaperManager =
|
||||
WallpaperManager.getInstance(mSetupWizardApp);
|
||||
wallpaperManager.forgetLoadedWallpaper();
|
||||
@@ -239,19 +195,6 @@ public class FinishActivity extends BaseSetupWizardActivity
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleDefaultThemeSetup(FinishActivity finishActivity) {
|
||||
Bundle privacyData = finishActivity.mSetupWizardApp.getSettingsBundle();
|
||||
if (!SetupWizardUtils.getDefaultThemePackageName(finishActivity.mSetupWizardApp)
|
||||
.equals(ThemeConfig.SYSTEM_DEFAULT) && privacyData != null &&
|
||||
privacyData.getBoolean(KEY_APPLY_DEFAULT_THEME)) {
|
||||
Log.i(TAG, "Applying default theme");
|
||||
final ThemeManager tm = ThemeManager.getInstance(finishActivity.mSetupWizardApp);
|
||||
tm.applyDefaultTheme();
|
||||
} else {
|
||||
finishActivity.finishSetup();
|
||||
}
|
||||
}
|
||||
|
||||
private static void handlePrivacyGuard(SetupWizardApp setupWizardApp) {
|
||||
Bundle mPrivacyData = setupWizardApp.getSettingsBundle();
|
||||
if (mPrivacyData != null && mPrivacyData.containsKey(KEY_PRIVACY_GUARD)) {
|
||||
|
@@ -25,7 +25,6 @@ import static com.cyanogenmod.setupwizard.SetupWizardApp.KEY_SEND_METRICS;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ThemeConfig;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
@@ -46,7 +45,6 @@ import android.widget.TextView;
|
||||
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||
|
||||
import com.cyanogenmod.setupwizard.R;
|
||||
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
import cyanogenmod.hardware.CMHardwareManager;
|
||||
import cyanogenmod.providers.CMSettings;
|
||||
@@ -60,16 +58,13 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
private SetupWizardApp mSetupWizardApp;
|
||||
|
||||
private View mMetricsRow;
|
||||
private View mDefaultThemeRow;
|
||||
private View mNavKeysRow;
|
||||
private View mPrivacyGuardRow;
|
||||
private CheckBox mMetrics;
|
||||
private CheckBox mDefaultTheme;
|
||||
private CheckBox mNavKeys;
|
||||
private CheckBox mPrivacyGuard;
|
||||
|
||||
private boolean mHideNavKeysRow = false;
|
||||
private boolean mHideThemeRow = false;
|
||||
|
||||
private View.OnClickListener mMetricsClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -80,15 +75,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mDefaultThemeClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean checked = !mDefaultTheme.isChecked();
|
||||
mDefaultTheme.setChecked(checked);
|
||||
mSetupWizardApp.getSettingsBundle().putBoolean(KEY_APPLY_DEFAULT_THEME, checked);
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mNavKeysClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -149,26 +135,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
metrics.setText(metricsSpan);
|
||||
mMetrics = (CheckBox) findViewById(R.id.enable_metrics_checkbox);
|
||||
|
||||
mDefaultThemeRow = findViewById(R.id.theme);
|
||||
mHideThemeRow = hideThemeSwitch(this);
|
||||
if (mHideThemeRow) {
|
||||
mDefaultThemeRow.setVisibility(View.GONE);
|
||||
} else {
|
||||
mDefaultThemeRow.setOnClickListener(mDefaultThemeClickListener);
|
||||
String defaultTheme =
|
||||
getString(R.string.services_apply_theme,
|
||||
getString(R.string.default_theme_name));
|
||||
String defaultThemeSummary = getString(R.string.services_apply_theme_label,
|
||||
defaultTheme);
|
||||
final SpannableStringBuilder themeSpan =
|
||||
new SpannableStringBuilder(defaultThemeSummary);
|
||||
themeSpan.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD),
|
||||
0, defaultTheme.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
TextView theme = (TextView) findViewById(R.id.enable_theme_summary);
|
||||
theme.setText(themeSpan);
|
||||
mDefaultTheme = (CheckBox) findViewById(R.id.enable_theme_checkbox);
|
||||
}
|
||||
|
||||
mNavKeysRow = findViewById(R.id.nav_keys);
|
||||
mNavKeysRow.setOnClickListener(mNavKeysClickListener);
|
||||
mNavKeys = (CheckBox) findViewById(R.id.nav_keys_checkbox);
|
||||
@@ -198,7 +164,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
super.onResume();
|
||||
updateDisableNavkeysOption();
|
||||
updateMetricsOption();
|
||||
updateThemeOption();
|
||||
updatePrivacyGuardOption();
|
||||
}
|
||||
|
||||
@@ -242,21 +207,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
myPageBundle.putBoolean(KEY_SEND_METRICS, metricsChecked);
|
||||
}
|
||||
|
||||
private void updateThemeOption() {
|
||||
if (!mHideThemeRow) {
|
||||
final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
|
||||
boolean themesChecked;
|
||||
if (myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME)) {
|
||||
themesChecked = myPageBundle.getBoolean(KEY_APPLY_DEFAULT_THEME);
|
||||
} else {
|
||||
themesChecked = getResources().getBoolean(
|
||||
R.bool.check_custom_theme_by_default);
|
||||
}
|
||||
mDefaultTheme.setChecked(themesChecked);
|
||||
myPageBundle.putBoolean(KEY_APPLY_DEFAULT_THEME, themesChecked);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDisableNavkeysOption() {
|
||||
if (!mHideNavKeysRow) {
|
||||
final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
|
||||
@@ -290,9 +240,4 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
final CMHardwareManager hardware = CMHardwareManager.getInstance(context);
|
||||
return hardware.get(CMHardwareManager.FEATURE_KEY_DISABLE);
|
||||
}
|
||||
|
||||
private static boolean hideThemeSwitch(Context context) {
|
||||
return SetupWizardUtils.getDefaultThemePackageName(context)
|
||||
.equals(ThemeConfig.SYSTEM_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ package com.cyanogenmod.setupwizard;
|
||||
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
@@ -102,10 +101,6 @@ public class SetupWizardApp extends Application {
|
||||
}
|
||||
NetworkMonitor.initInstance(this);
|
||||
PhoneMonitor.initInstance(this);
|
||||
final boolean isOwner = SetupWizardUtils.isOwner();
|
||||
if (!isOwner) {
|
||||
disableThemeComponentsForSecondaryUser();
|
||||
}
|
||||
SetupWizardUtils.disableComponentsForMissingFeatures(this);
|
||||
mHandler.postDelayed(mRadioTimeoutRunnable, SetupWizardApp.RADIO_READY_TIMEOUT);
|
||||
}
|
||||
@@ -132,17 +127,4 @@ public class SetupWizardApp extends Application {
|
||||
public Bundle getSettingsBundle() {
|
||||
return mSettingsBundle;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@ import static android.content.pm.PackageManager.DONT_KILL_APP;
|
||||
import static android.content.pm.PackageManager.GET_ACTIVITIES;
|
||||
import static android.content.pm.PackageManager.GET_RECEIVERS;
|
||||
import static android.content.pm.PackageManager.GET_SERVICES;
|
||||
import static android.content.res.ThemeConfig.SYSTEM_DEFAULT;
|
||||
|
||||
import static com.cyanogenmod.setupwizard.SetupWizardApp.KEY_DETECT_CAPTIVE_PORTAL;
|
||||
import static com.cyanogenmod.setupwizard.SetupWizardApp.LOGV;
|
||||
@@ -223,24 +222,6 @@ public class SetupWizardUtils {
|
||||
return PhoneMonitor.getInstance().simMissing();
|
||||
}
|
||||
|
||||
public static String getDefaultThemePackageName(Context context) {
|
||||
final String defaultThemePkg = CMSettings.Secure.getString(context.getContentResolver(),
|
||||
CMSettings.Secure.DEFAULT_THEME_PACKAGE);
|
||||
if (!TextUtils.isEmpty(defaultThemePkg)) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
if (pm.getPackageInfo(defaultThemePkg, 0) != null) {
|
||||
return defaultThemePkg;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// doesn't exist so system will be default
|
||||
Log.w(TAG, "Default theme " + defaultThemePkg + " not found");
|
||||
}
|
||||
}
|
||||
|
||||
return SYSTEM_DEFAULT;
|
||||
}
|
||||
|
||||
public static void disableComponentsForMissingFeatures(Context context) {
|
||||
disableComponent(context, BluetoothSetupActivity.class);
|
||||
if (!hasFingerprint(context)) {
|
||||
|
Reference in New Issue
Block a user