File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed
androidTest/java/com/github/hiteshsondhi88/libffmpeg
main/java/com/github/hiteshsondhi88/libffmpeg Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 77import static org .assertj .core .api .Assertions .assertThat ;
88
99public class CpuArchHelperTest extends TestCase {
10-
10+
1111 public void testGetCpuArch () throws Exception {
1212 CpuArch cpuArch = CpuArchHelper .getCpuArch ();
1313 assertNotNull (cpuArch );
14- if (Build .CPU_ABI .equals (CpuArchHelper .getx86CpuAbi ())) {
14+ if (Build .CPU_ABI .equals (CpuArchHelper .getx86CpuAbi ()) || Build . CPU_ABI . equals ( CpuArchHelper . getx86_64CpuAbi ()) ) {
1515 assertEquals (cpuArch , CpuArch .x86 );
1616 } else if (Build .CPU_ABI .equals (CpuArchHelper .getArmeabiv7CpuAbi ())) {
1717 assertThat (cpuArch == CpuArch .ARMv7 || cpuArch == CpuArch .ARMv7_NEON ).isTrue ();
18- } else {
18+ } else if (Build .CPU_ABI .equals (CpuArchHelper .getArm64CpuAbi ())) {
19+ assertEquals (cpuArch , CpuArch .ARMv7 );
20+ }else {
1921 assertEquals (cpuArch , CpuArch .NONE );
2022 }
2123 }
22-
2324}
Original file line number Diff line number Diff line change 33import android .os .Build ;
44
55class CpuArchHelper {
6-
6+
77 static CpuArch getCpuArch () {
8- // check if device is x86
9- if (Build .CPU_ABI .equals (getx86CpuAbi ())) {
8+ Log .d ("Build.CPU_ABI : " + Build .CPU_ABI );
9+ // check if device is x86 or x86_64
10+ if (Build .CPU_ABI .equals (getx86CpuAbi ()) || Build .CPU_ABI .equals (getx86_64CpuAbi ())) {
1011 return CpuArch .x86 ;
1112 } else {
1213 // check if device is armeabi
@@ -21,15 +22,26 @@ static CpuArch getCpuArch() {
2122 }
2223 return CpuArch .ARMv7 ;
2324 }
25+ // check if device is arm64 which is supported by ARMV7
26+ } else if (Build .CPU_ABI .equals (getArm64CpuAbi ())) {
27+ return CpuArch .ARMv7 ;
2428 }
2529 }
2630 return CpuArch .NONE ;
2731 }
28-
32+
2933 static String getx86CpuAbi () {
3034 return "x86" ;
3135 }
32-
36+
37+ static String getx86_64CpuAbi () {
38+ return "x86_64" ;
39+ }
40+
41+ static String getArm64CpuAbi () {
42+ return "arm64-v8a" ;
43+ }
44+
3345 static String getArmeabiv7CpuAbi () {
3446 return "armeabi-v7a" ;
3547 }
You can’t perform that action at this time.
0 commit comments