さらに改善、したつもり
[ofnhwx.olib.git] / src / jp / gr / java_conf / ofnhwx / olib / utils / ODebug.java
blob522910915dffc82e4cf11eb7fe40345b3d158f06
1 package jp.gr.java_conf.ofnhwx.olib.utils;
3 import android.content.Context;
4 import android.content.pm.PackageManager;
5 import android.content.pm.PackageManager.NameNotFoundException;
7 /**
8 * 自分用デバッグ機能集.
9 * @author yuta
11 public final class ODebug {
13 private static final String DEBUG_PACKAGE = "jp.gr.java_conf.ofnhwx.debug";
14 private static final String SU_PACKAGE = "com.noshufou.android.su";
16 private ODebug() {}
18 private static final boolean findPackage(Context context, String packageName) {
19 try {
20 PackageManager pm = context.getPackageManager();
21 pm.getApplicationInfo(packageName, 0);
22 return true;
23 } catch (NameNotFoundException e) {
24 return false;
28 /**
29 * デバッグ機能の有効・無効確認.
30 * @param context
31 * @return
33 public static final boolean isEnabled(Context context) {
34 return findPackage(context, DEBUG_PACKAGE);
37 /**
38 * root環境の判定.`Superuser'のインストール状態で判定を行う.
39 * @param context
40 * @return
42 public static final boolean isRooted(Context context) {
43 return findPackage(context, SU_PACKAGE);