android 推断是否支持闪光灯

近期在做录制视频功能,在找一些资料时发现 要推断是否支持闪关灯,在这记录下来,怕以后忘记

public static boolean isSupportCameraLedFlash(PackageManager pm) {
       if (pm != null) {
           FeatureInfo[] features = pm.getSystemAvailableFeatures();
           if (features != null) {
               for (FeatureInfo f : features) {
                   if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) 
                       return true;
               }
           }
       }
       return false;
   }

原文地址:https://www.cnblogs.com/cxchanpin/p/7043424.html