SetupWizard: RIP Whisperpush
Change-Id: I20363cc80dbb1481bd66abb4bd4202212ff37028
This commit is contained in:
parent
95246f2063
commit
962f9a89d4
@ -40,7 +40,6 @@
|
|||||||
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
||||||
<uses-permission android:name="cyanogenmod.permission.HARDWARE_ABSTRACTION_ACCESS" />
|
<uses-permission android:name="cyanogenmod.permission.HARDWARE_ABSTRACTION_ACCESS" />
|
||||||
<uses-permission android:name="android.permission.BACKUP" />
|
<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.FINISH_SETUP" />
|
||||||
<uses-permission android:name="cyanogenmod.permission.LEGALESE" />
|
<uses-permission android:name="cyanogenmod.permission.LEGALESE" />
|
||||||
<uses-permission android:name="com.cyngn.stats.SEND_ANALYTICS" />
|
<uses-permission android:name="com.cyngn.stats.SEND_ANALYTICS" />
|
||||||
@ -57,9 +56,6 @@
|
|||||||
android:protectionLevel="signatureOrSystem"
|
android:protectionLevel="signatureOrSystem"
|
||||||
androidprv:allowViaWhitelist="true" />
|
androidprv:allowViaWhitelist="true" />
|
||||||
|
|
||||||
<permission android:name="org.whispersystems.whisperpush.permissions.REGISTER"
|
|
||||||
android:protectionLevel="signature" />
|
|
||||||
|
|
||||||
<protected-broadcast android:name="com.cyanogenmod.setupwizard.SETUP_FINISHED"
|
<protected-broadcast android:name="com.cyanogenmod.setupwizard.SETUP_FINISHED"
|
||||||
android:permission="cyanogenmod.permission.FINISH_SETUP"/>
|
android:permission="cyanogenmod.permission.FINISH_SETUP"/>
|
||||||
|
|
||||||
|
@ -209,41 +209,6 @@
|
|||||||
android:text="@string/services_os_nav_keys_label"/>
|
android:text="@string/services_os_nav_keys_label"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</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>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -65,15 +65,12 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
public static final String TAG = "CyanogenSettingsPage";
|
public static final String TAG = "CyanogenSettingsPage";
|
||||||
|
|
||||||
public static final String KEY_SEND_METRICS = "send_metrics";
|
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_ENABLE_NAV_KEYS = "enable_nav_keys";
|
||||||
public static final String KEY_APPLY_DEFAULT_THEME = "apply_default_theme";
|
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 SETTING_METRICS = "settings.cyanogen.allow_metrics";
|
||||||
public static final String PRIVACY_POLICY_URI = "https://cyngn.com/oobe-legal?hideHeader=1";
|
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) {
|
public CyanogenSettingsPage(Context context, SetupDataCallbacks callbacks) {
|
||||||
super(context, callbacks);
|
super(context, callbacks);
|
||||||
}
|
}
|
||||||
@ -147,25 +144,10 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
handleWhisperPushRegistration();
|
|
||||||
handleEnableMetrics();
|
handleEnableMetrics();
|
||||||
handleDefaultThemeSetup();
|
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() {
|
private void handleEnableMetrics() {
|
||||||
Bundle privacyData = getData();
|
Bundle privacyData = getData();
|
||||||
if (privacyData != null
|
if (privacyData != null
|
||||||
@ -204,23 +186,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
return hardware.get(CMHardwareManager.FEATURE_KEY_DISABLE);
|
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) {
|
private static boolean hideThemeSwitch(Context context) {
|
||||||
return SetupWizardUtils.getDefaultThemePackageName(context)
|
return SetupWizardUtils.getDefaultThemePackageName(context)
|
||||||
.equals(ThemeConfig.SYSTEM_DEFAULT);
|
.equals(ThemeConfig.SYSTEM_DEFAULT);
|
||||||
@ -234,15 +199,12 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
private View mMetricsRow;
|
private View mMetricsRow;
|
||||||
private View mDefaultThemeRow;
|
private View mDefaultThemeRow;
|
||||||
private View mNavKeysRow;
|
private View mNavKeysRow;
|
||||||
private View mSecureSmsRow;
|
|
||||||
private CheckBox mMetrics;
|
private CheckBox mMetrics;
|
||||||
private CheckBox mDefaultTheme;
|
private CheckBox mDefaultTheme;
|
||||||
private CheckBox mNavKeys;
|
private CheckBox mNavKeys;
|
||||||
private CheckBox mSecureSms;
|
|
||||||
|
|
||||||
private boolean mHideNavKeysRow = false;
|
private boolean mHideNavKeysRow = false;
|
||||||
private boolean mHideThemeRow = false;
|
private boolean mHideThemeRow = false;
|
||||||
private boolean mHideSmsRow = false;
|
|
||||||
|
|
||||||
|
|
||||||
private View.OnClickListener mMetricsClickListener = new View.OnClickListener() {
|
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
|
@Override
|
||||||
protected void initializePage() {
|
protected void initializePage() {
|
||||||
String privacy_policy = getString(R.string.services_privacy_policy);
|
String privacy_policy = getString(R.string.services_privacy_policy);
|
||||||
@ -370,23 +323,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
isKeyDisablerActive(getActivity());
|
isKeyDisablerActive(getActivity());
|
||||||
mNavKeys.setChecked(navKeysDisabled);
|
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
|
@Override
|
||||||
@ -400,7 +336,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
|||||||
/*updateDisableNavkeysOption();*/
|
/*updateDisableNavkeysOption();*/
|
||||||
updateMetricsOption();
|
updateMetricsOption();
|
||||||
updateThemeOption();
|
updateThemeOption();
|
||||||
updateSmsOption();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMetricsOption() {
|
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() {
|
/*private void updateDisableNavkeysOption() {
|
||||||
if (!mHideNavKeysRow) {
|
if (!mHideNavKeysRow) {
|
||||||
final Bundle myPageBundle = mPage.getData();
|
final Bundle myPageBundle = mPage.getData();
|
||||||
|
Loading…
Reference in New Issue
Block a user