SetupWizard: update stats permission and package
Change-Id: I3ef19b616422ca5cc0896840753192b1c1712525 Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
parent
2a98e6f6f6
commit
3c37b0b69c
@ -28,8 +28,8 @@ public class SetupStats {
|
|||||||
|
|
||||||
private static final String TAG = SetupStats.class.getSimpleName();
|
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_INTENT = "com.cyngn.stats.action.SEND_ANALYTIC_EVENT";
|
||||||
private static final String ANALYTIC_PERMISSION = "com.cyngn.cmstats.RECEIVE_ANALYTICS";
|
private static final String ANALYTIC_PERMISSION = "com.cyngn.stats.SEND_ANALYTICS";
|
||||||
|
|
||||||
public static final String TRACKING_ID = "tracking_id";
|
public static final String TRACKING_ID = "tracking_id";
|
||||||
|
|
||||||
|
@ -18,12 +18,13 @@
|
|||||||
package com.cyanogenmod.setupwizard.cmstats;
|
package com.cyanogenmod.setupwizard.cmstats;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
public class StatsUtils {
|
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) {
|
public static boolean isStatsCollectionEnabled(Context context) {
|
||||||
return Settings.Secure.getInt(context.getContentResolver(),
|
return Settings.Secure.getInt(context.getContentResolver(),
|
||||||
@ -33,7 +34,8 @@ public class StatsUtils {
|
|||||||
public static boolean isStatsPackageInstalled(Context context) {
|
public static boolean isStatsPackageInstalled(Context context) {
|
||||||
try {
|
try {
|
||||||
PackageInfo pi = context.getPackageManager().getPackageInfo(STATS_PACKAGE, 0);
|
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) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user