Commit 02b212b1 by Yujin Seo

Merge branch 'feature/contract/sato/1.0.300_52521_nullpo' into 'contract/sato/1.0.300'

NullPointerExceptionの発生源にnullチェックを入れた。

See merge request !307
parents c3c89a45 5a6ba1fc
......@@ -80,9 +80,22 @@ public class DeviceInfo {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
//noinspection deprecation(API21から非推奨になった。無視)
List<RunningTaskInfo> list = am.getRunningTasks(1);
if (list != null && list.size() > 0) {
ComponentName cn = list.get(0).topActivity;
if (cn != null) {
String name = cn.getPackageName();
return name.indexOf(context.getPackageName()) > -1;
if (name != null) {
return name.contains(context.getPackageName());
} else {
Logger.d(TAG, "packageName is null");
}
} else {
Logger.d(TAG, "ComponentName is null");
}
} else {
Logger.d(TAG, "getRunningTasks is empty");
}
return false;
}
private static boolean isEmulator() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment