SetupWizard: hide WhisperPush if it's not installed
Change-Id: I7576a2ee0f851e1222b6ed4d53188950b20b6a16
Signed-off-by: Roman Birg <roman@cyngn.com>
(cherry picked from commit bfd3abd0c7
)
This commit is contained in:
@@ -20,6 +20,8 @@ import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Context;
|
||||
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;
|
||||
@@ -64,6 +66,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);
|
||||
}
|
||||
@@ -201,6 +205,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) &&
|
||||
|
Reference in New Issue
Block a user