Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bfd3abd0 authored by Roman Birg's avatar Roman Birg
Browse files

SetupWizard: hide WhisperPush if it's not installed



Change-Id: I7576a2ee0f851e1222b6ed4d53188950b20b6a16
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 7710855b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ThemeUtils;
import android.content.res.ThemeConfig;
import android.content.res.ThemeManager;
@@ -68,6 +70,8 @@ public class CyanogenSettingsPage extends SetupPage {
    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);
    }
@@ -202,6 +206,14 @@ public class CyanogenSettingsPage extends SetupPage {
    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) &&