SetupWizard: hide WhisperPush if it's not installed
Change-Id: I7576a2ee0f851e1222b6ed4d53188950b20b6a16 Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
parent
7710855b72
commit
bfd3abd0c7
@ -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) &&
|
||||
|
Loading…
Reference in New Issue
Block a user