Remove speed graph for Play store installs

This commit is contained in:
M66B 2015-12-14 16:13:30 +01:00
parent e1bb6536df
commit 3a87823c8c
3 changed files with 8 additions and 1 deletions

View File

@ -130,6 +130,9 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
pref_stats_base.setTitle(getString(R.string.setting_stats_base, prefs.getString("stats_base", "5")));
pref_stats_frequency.setTitle(getString(R.string.setting_stats_frequency, prefs.getString("stats_frequency", "1000")));
pref_stats_samples.setTitle(getString(R.string.setting_stats_samples, prefs.getString("stats_samples", "90")));
PreferenceCategory stats = (PreferenceCategory) screen.findPreference("category_stats");
if (Util.isPlayStoreInstall(this))
screen.removePreference(stats);
// Handle export
Preference pref_export = screen.findPreference("export");

View File

@ -269,7 +269,7 @@ public class SinkholeService extends VpnService {
private void startStats() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
boolean enabled = (!stats && prefs.getBoolean("show_stats", false));
boolean enabled = (!stats && prefs.getBoolean("show_stats", false) && !Util.isPlayStoreInstall(SinkholeService.this));
Log.i(TAG, "Stats start enabled=" + enabled);
if (enabled) {
t = -1;

View File

@ -281,6 +281,10 @@ public class Util {
return ((context.getApplicationContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
}
public static boolean isPlayStoreInstall(Context context) {
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
}
public static boolean hasValidFingerprint(Context context) {
try {
PackageManager pm = context.getPackageManager();