SetupWizard: RIP Whisperpush
Change-Id: I20363cc80dbb1481bd66abb4bd4202212ff37028
This commit is contained in:
@@ -65,15 +65,12 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
public static final String TAG = "CyanogenSettingsPage";
|
||||
|
||||
public static final String KEY_SEND_METRICS = "send_metrics";
|
||||
public static final String KEY_REGISTER_WHISPERPUSH = "register";
|
||||
public static final String KEY_ENABLE_NAV_KEYS = "enable_nav_keys";
|
||||
public static final String KEY_APPLY_DEFAULT_THEME = "apply_default_theme";
|
||||
|
||||
public static final String SETTING_METRICS = "settings.cyanogen.allow_metrics";
|
||||
public static final String PRIVACY_POLICY_URI = "https://cyngn.com/oobe-legal?hideHeader=1";
|
||||
|
||||
private static final String WHISPERPUSH_PACKAGE = "org.whispersystems.whisperpush";
|
||||
|
||||
public CyanogenSettingsPage(Context context, SetupDataCallbacks callbacks) {
|
||||
super(context, callbacks);
|
||||
}
|
||||
@@ -147,25 +144,10 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
}
|
||||
}
|
||||
});
|
||||
handleWhisperPushRegistration();
|
||||
handleEnableMetrics();
|
||||
handleDefaultThemeSetup();
|
||||
}
|
||||
|
||||
private void handleWhisperPushRegistration() {
|
||||
Bundle privacyData = getData();
|
||||
if (privacyData != null &&
|
||||
privacyData.containsKey(KEY_REGISTER_WHISPERPUSH) &&
|
||||
privacyData.getBoolean(KEY_REGISTER_WHISPERPUSH)) {
|
||||
SetupStats.addEvent(SetupStats.Categories.SETTING_CHANGED,
|
||||
SetupStats.Action.USE_SECURE_SMS,
|
||||
SetupStats.Label.CHECKED,
|
||||
String.valueOf(privacyData.getBoolean(KEY_REGISTER_WHISPERPUSH)));
|
||||
Log.i(TAG, "Registering with WhisperPush");
|
||||
WhisperPushUtils.startRegistration(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleEnableMetrics() {
|
||||
Bundle privacyData = getData();
|
||||
if (privacyData != null
|
||||
@@ -204,23 +186,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
return hardware.get(CMHardwareManager.FEATURE_KEY_DISABLE);
|
||||
}
|
||||
|
||||
private static boolean hideWhisperPush(Context context) {
|
||||
final int playServicesAvailable = GooglePlayServicesUtil
|
||||
.isGooglePlayServicesAvailable(context);
|
||||
try {
|
||||
PackageInfo pi = context.getPackageManager().getPackageInfo(WHISPERPUSH_PACKAGE, 0);
|
||||
if (pi == null) {
|
||||
return true;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return true;
|
||||
}
|
||||
return playServicesAvailable != ConnectionResult.SUCCESS
|
||||
|| !SetupWizardUtils.hasTelephony(context)
|
||||
|| (SetupWizardUtils.hasTelephony(context) &&
|
||||
SetupWizardUtils.isSimMissing(context));
|
||||
}
|
||||
|
||||
private static boolean hideThemeSwitch(Context context) {
|
||||
return SetupWizardUtils.getDefaultThemePackageName(context)
|
||||
.equals(ThemeConfig.SYSTEM_DEFAULT);
|
||||
@@ -234,15 +199,12 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
private View mMetricsRow;
|
||||
private View mDefaultThemeRow;
|
||||
private View mNavKeysRow;
|
||||
private View mSecureSmsRow;
|
||||
private CheckBox mMetrics;
|
||||
private CheckBox mDefaultTheme;
|
||||
private CheckBox mNavKeys;
|
||||
private CheckBox mSecureSms;
|
||||
|
||||
private boolean mHideNavKeysRow = false;
|
||||
private boolean mHideThemeRow = false;
|
||||
private boolean mHideSmsRow = false;
|
||||
|
||||
|
||||
private View.OnClickListener mMetricsClickListener = new View.OnClickListener() {
|
||||
@@ -272,15 +234,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mSecureSmsClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean checked = !mSecureSms.isChecked();
|
||||
mSecureSms.setChecked(checked);
|
||||
mPage.getData().putBoolean(KEY_REGISTER_WHISPERPUSH, checked);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void initializePage() {
|
||||
String privacy_policy = getString(R.string.services_privacy_policy);
|
||||
@@ -370,23 +323,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
isKeyDisablerActive(getActivity());
|
||||
mNavKeys.setChecked(navKeysDisabled);
|
||||
}
|
||||
|
||||
mSecureSmsRow = mRootView.findViewById(R.id.secure_sms);
|
||||
mSecureSmsRow.setOnClickListener(mSecureSmsClickListener);
|
||||
String useSecureSms = getString(R.string.services_use_secure_sms);
|
||||
String secureSmsSummary = getString(R.string.services_secure_sms_label,
|
||||
useSecureSms, getString(R.string.os_name));
|
||||
final SpannableStringBuilder secureSmsSpan =
|
||||
new SpannableStringBuilder(secureSmsSummary);
|
||||
secureSmsSpan.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD),
|
||||
0, useSecureSms.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
TextView secureSms = (TextView) mRootView.findViewById(R.id.secure_sms_summary);
|
||||
secureSms.setText(secureSmsSpan);
|
||||
mHideSmsRow = hideWhisperPush(getActivity());
|
||||
if (mHideSmsRow) {
|
||||
mSecureSmsRow.setVisibility(View.GONE);
|
||||
}
|
||||
mSecureSms = (CheckBox) mRootView.findViewById(R.id.secure_sms_checkbox);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -400,7 +336,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
/*updateDisableNavkeysOption();*/
|
||||
updateMetricsOption();
|
||||
updateThemeOption();
|
||||
updateSmsOption();
|
||||
}
|
||||
|
||||
private void updateMetricsOption() {
|
||||
@@ -427,17 +362,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSmsOption() {
|
||||
if (!mHideSmsRow) {
|
||||
final Bundle myPageBundle = mPage.getData();
|
||||
boolean smsChecked = myPageBundle.containsKey(KEY_REGISTER_WHISPERPUSH) ?
|
||||
myPageBundle.getBoolean(KEY_REGISTER_WHISPERPUSH) :
|
||||
false;
|
||||
mSecureSms.setChecked(smsChecked);
|
||||
myPageBundle.putBoolean(KEY_REGISTER_WHISPERPUSH, smsChecked);
|
||||
}
|
||||
}
|
||||
|
||||
/*private void updateDisableNavkeysOption() {
|
||||
if (!mHideNavKeysRow) {
|
||||
final Bundle myPageBundle = mPage.getData();
|
||||
|
Reference in New Issue
Block a user