SetupWizard: update stats permission and package

Change-Id: I3ef19b616422ca5cc0896840753192b1c1712525
Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
Roman Birg 2015-04-24 15:15:48 -07:00
parent 2a98e6f6f6
commit 3c37b0b69c
2 changed files with 6 additions and 4 deletions

View File

@ -28,8 +28,8 @@ public class SetupStats {
private static final String TAG = SetupStats.class.getSimpleName();
private static final String ANALYTIC_INTENT = "com.cyngn.cmstats.action.SEND_ANALYTIC_EVENT";
private static final String ANALYTIC_PERMISSION = "com.cyngn.cmstats.RECEIVE_ANALYTICS";
private static final String ANALYTIC_INTENT = "com.cyngn.stats.action.SEND_ANALYTIC_EVENT";
private static final String ANALYTIC_PERMISSION = "com.cyngn.stats.SEND_ANALYTICS";
public static final String TRACKING_ID = "tracking_id";

View File

@ -18,12 +18,13 @@
package com.cyanogenmod.setupwizard.cmstats;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.provider.Settings;
public class StatsUtils {
private static final String STATS_PACKAGE = "com.cyngn.cmstats";
private static final String STATS_PACKAGE = "com.cyngn.stats";
public static boolean isStatsCollectionEnabled(Context context) {
return Settings.Secure.getInt(context.getContentResolver(),
@ -33,7 +34,8 @@ public class StatsUtils {
public static boolean isStatsPackageInstalled(Context context) {
try {
PackageInfo pi = context.getPackageManager().getPackageInfo(STATS_PACKAGE, 0);
return pi.applicationInfo.enabled;
return pi.applicationInfo.enabled
&& ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
} catch (PackageManager.NameNotFoundException e) {
return false;
}