package com.novoda.notils.logger;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;

public final class AndroidHelper {

    public static final class AppName {
        public static String fromContext(Context context) {
            final PackageManager pm = context.getApplicationContext().getPackageManager();
            ApplicationInfo ai;
            try {
                ai = pm.getApplicationInfo(context.getPackageName(), 0);
            } catch (final PackageManager.NameNotFoundException e) {
                ai = null;
            }
            return ai != null ? (String) pm.getApplicationLabel(ai) : null;
        }
    }

    public static boolean isAndroid() {
        try {
            Class.forName("android.os.Build");
            return Build.VERSION.SDK_INT != 0;
        } catch (ClassNotFoundException ignored) {
            return false;
        }

    }
}

@@ -402,40 +402,8 @@
 ();%0A
-            ApplicationInfo ai;%0A
     
@@ -428,24 +428,40 @@
             
+ApplicationInfo 
 ai = pm.getA
@@ -509,32 +509,92 @@
 0);%0A            
+    
+return (String) pm.getApplicationLabel(ai);%0A            
 %7D catch (final P
@@ -586,22 +586,16 @@
  catch (
-final 
 PackageM
@@ -623,17 +623,23 @@
 ception 
-e
+ignored
 ) %7B%0A    
@@ -650,20 +650,22 @@
         
-ai =
+return
  null;%0A 
@@ -681,84 +681,8 @@
   %7D%0A
-            return ai != null ? (String) pm.getApplicationLabel(ai) : null;%0A
     

fix review issues