|
20 | 20 | import android.util.Slog; |
21 | 21 |
|
22 | 22 | import com.android.internal.telephony.TelephonyProperties; |
| 23 | +import dalvik.system.VMRuntime; |
23 | 24 |
|
24 | 25 | /** |
25 | 26 | * Information about the current build, extracted from system properties. |
@@ -51,15 +52,15 @@ public class Build { |
51 | 52 | * @deprecated Use {@link #SUPPORTED_ABIS} instead. |
52 | 53 | */ |
53 | 54 | @Deprecated |
54 | | - public static final String CPU_ABI = getString("ro.product.cpu.abi"); |
| 55 | + public static final String CPU_ABI; |
55 | 56 |
|
56 | 57 | /** |
57 | 58 | * The name of the second instruction set (CPU type + ABI convention) of native code. |
58 | 59 | * |
59 | 60 | * @deprecated Use {@link #SUPPORTED_ABIS} instead. |
60 | 61 | */ |
61 | 62 | @Deprecated |
62 | | - public static final String CPU_ABI2 = getString("ro.product.cpu.abi2"); |
| 63 | + public static final String CPU_ABI2; |
63 | 64 |
|
64 | 65 | /** The manufacturer of the product/hardware. */ |
65 | 66 | public static final String MANUFACTURER = getString("ro.product.manufacturer"); |
@@ -117,6 +118,27 @@ public class Build { |
117 | 118 | getStringList("ro.product.cpu.abilist64", ","); |
118 | 119 |
|
119 | 120 |
|
| 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 | + |
120 | 142 | /** Various version strings. */ |
121 | 143 | public static class VERSION { |
122 | 144 | /** |
|
0 commit comments