content: package com.bihe0832.android.lib.utils.os;
  
  import android.content.Context;
  import android.os.Build;
  import android.provider.Settings;
  import android.text.TextUtils;
  
  import java.io.BufferedReader;
  import java.io.FileReader;
  import java.io.IOException;
  
  /**
   * @author zixie code@bihe0832.com
   * Created on 2019-07-09.
   * Description: Description
   */
  public class OSUtils {
      /**
       * 获取进程号对应的进程名
       *
       * @param pid 进程号
       * @return 进程名
       */
      public static String getProcessName(int pid) {
          BufferedReader reader = null;
          try {
              reader = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
              String processName = reader.readLine();
              if (!TextUtils.isEmpty(processName)) {
                  processName = processName.trim();
              }
              return processName;
          } catch (Throwable throwable) {
              throwable.printStackTrace();
          } finally {
              try {
                  if (reader != null) {
                      reader.close();
                  }
              } catch (IOException exception) {
                  exception.printStackTrace();
              }
          }
          return null;
      }
  
      public static boolean isAndroidQVersion() {
          return BuildUtils.INSTANCE.getSDK_INT() > Build.VERSION_CODES.P;
      }
  
      public static boolean isAirplaneMode(Context context) {
          int isAirplaneMode = Settings.System.getInt(context.getContentResolver(),
                  Settings.System.AIRPLANE_MODE_ON, 0);
          return isAirplaneMode == 1;
      }
  
  
      /**
       * 获取当前手机系统版本号
       *
       * @return 系统版本号
       */
      public static String getSystemVersion() {
          return BuildUtils.INSTANCE.getRELEASE();
      }
  
      public static int getApiLevel() {
          return BuildUtils.INSTANCE.getSDK_INT();
      }
  
  }
  