1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.compatibility.common.util; 18 19 import android.os.Build; 20 21 public class CpuFeatures { 22 23 public static final String ARMEABI_V7 = "armeabi-v7a"; 24 25 public static final String ARMEABI = "armeabi"; 26 27 public static final String MIPSABI = "mips"; 28 29 public static final String X86ABI = "x86"; 30 31 public static final int HWCAP_VFP = (1 << 6); 32 33 public static final int HWCAP_NEON = (1 << 12); 34 35 public static final int HWCAP_VFPv3 = (1 << 13); 36 37 public static final int HWCAP_VFPv4 = (1 << 16); 38 39 public static final int HWCAP_IDIVA = (1 << 17); 40 41 public static final int HWCAP_IDIVT = (1 << 18); 42 43 static { 44 System.loadLibrary("cts_jni"); 45 } 46 isArmCpu()47 public static native boolean isArmCpu(); 48 isX86Cpu()49 public static native boolean isX86Cpu(); 50 isArm64Cpu()51 public static native boolean isArm64Cpu(); 52 isX86_64Cpu()53 public static native boolean isX86_64Cpu(); 54 getHwCaps()55 public static native int getHwCaps(); 56 isNativeBridgedCpu()57 public static native boolean isNativeBridgedCpu(); 58 isArm64CpuIn32BitMode()59 public static boolean isArm64CpuIn32BitMode() { 60 if (!isArmCpu()) { 61 return false; 62 } 63 64 for (String abi : Build.SUPPORTED_64_BIT_ABIS) { 65 if (abi.equals("arm64-v8a")) { 66 return true; 67 } 68 } 69 70 return false; 71 } 72 } 73