Skip to content

Commit 7dc7f67

Browse files
narayankAndroid (Google) Code Review
authored andcommitted
Merge "Set Build.CPU_ABI{2} from SUPPORTED_{32,64}_BIT_ABIS" into lmp-dev
2 parents 42d0c35 + eff258c commit 7dc7f67

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

core/java/android/os/Build.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.util.Slog;
2121

2222
import com.android.internal.telephony.TelephonyProperties;
23+
import dalvik.system.VMRuntime;
2324

2425
/**
2526
* Information about the current build, extracted from system properties.
@@ -51,15 +52,15 @@ public class Build {
5152
* @deprecated Use {@link #SUPPORTED_ABIS} instead.
5253
*/
5354
@Deprecated
54-
public static final String CPU_ABI = getString("ro.product.cpu.abi");
55+
public static final String CPU_ABI;
5556

5657
/**
5758
* The name of the second instruction set (CPU type + ABI convention) of native code.
5859
*
5960
* @deprecated Use {@link #SUPPORTED_ABIS} instead.
6061
*/
6162
@Deprecated
62-
public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");
63+
public static final String CPU_ABI2;
6364

6465
/** The manufacturer of the product/hardware. */
6566
public static final String MANUFACTURER = getString("ro.product.manufacturer");
@@ -117,6 +118,27 @@ public class Build {
117118
getStringList("ro.product.cpu.abilist64", ",");
118119

119120

121+
static {
122+
/*
123+
* Adjusts CPU_ABI and CPU_ABI2 depending on whether or not a given process is 64 bit.
124+
* 32 bit processes will always see 32 bit ABIs in these fields for backward
125+
* compatibility.
126+
*/
127+
final String[] abiList;
128+
if (VMRuntime.getRuntime().is64Bit()) {
129+
abiList = SUPPORTED_64_BIT_ABIS;
130+
} else {
131+
abiList = SUPPORTED_32_BIT_ABIS;
132+
}
133+
134+
CPU_ABI = abiList[0];
135+
if (abiList.length > 1) {
136+
CPU_ABI2 = abiList[1];
137+
} else {
138+
CPU_ABI2 = "";
139+
}
140+
}
141+
120142
/** Various version strings. */
121143
public static class VERSION {
122144
/**

0 commit comments

Comments
 (0)