SetupWizard: RIP Whisperpush

WISP-41
Change-Id: I20363cc80dbb1481bd66abb4bd4202212ff37028
(cherry picked from commit 962f9a89d4)
(cherry picked from commit ae793899df)
This commit is contained in:
cretin45
2016-02-01 13:52:54 -08:00
committed by Abhisek Devkota
parent 24cfa022e6
commit 1f6fe76e2e
3 changed files with 0 additions and 115 deletions

View File

@@ -44,7 +44,6 @@
<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" />
<uses-permission android:name="org.whispersystems.whisperpush.permissions.REGISTER" />
<uses-permission android:name="cyanogenmod.permission.FINISH_SETUP" />
<uses-permission android:name="cyanogenmod.permission.LEGALESE" />
<uses-permission android:name="com.cyngn.stats.SEND_ANALYTICS" />
@@ -59,9 +58,6 @@
android:protectionLevel="signatureOrSystem"
androidprv:allowViaWhitelist="true" />
<permission android:name="org.whispersystems.whisperpush.permissions.REGISTER"
android:protectionLevel="signature" />
<protected-broadcast android:name="com.cyanogenmod.setupwizard.SETUP_FINISHED"
android:permission="cyanogenmod.permission.FINISH_SETUP"/>

View File

@@ -209,41 +209,6 @@
android:text="@string/services_os_nav_keys_label"/>
</LinearLayout>
<!-- Checkbox for enabling secure SMS -->
<LinearLayout
android:id="@+id/secure_sms"
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/secure_sms_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/secure_sms_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_secure_sms_label"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>

View File

@@ -64,15 +64,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);
}
@@ -146,25 +143,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
@@ -201,23 +183,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 ThemeUtils.getDefaultThemePackageName(context).equals(ThemeConfig.SYSTEM_DEFAULT);
}
@@ -230,15 +195,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() {
@@ -268,15 +230,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);
@@ -366,23 +319,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
@@ -396,7 +332,6 @@ public class CyanogenSettingsPage extends SetupPage {
updateDisableNavkeysOption();
updateMetricsOption();
updateThemeOption();
updateSmsOption();
}
private void updateMetricsOption() {
@@ -423,17 +358,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();