Skip to content

Commit ed3d9e8

Browse files
tony-makAndrewScull
authored andcommitted
Add the missing O target
1. Add the missing O target (I thought the default one is built, but it is not) 2. Build.VERSION_CODES.O can be both 26 and 10000, handle both cases Change-Id: Ida39ed17c75d048c921a9953a4d16b5fbe84097b Fix: 38220744
1 parent e924170 commit ed3d9e8

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ android {
1919
defaultConfig {
2020
applicationId "com.afwsamples.testdpc"
2121
minSdkVersion 21
22-
targetSdkVersion 25
22+
targetSdkVersion 26
2323
versionCode versionMajor * 1000 + versionMinor * 100 + versionBuild
2424
versionName "${versionMajor}.${versionMinor}.${versionBuild}"
2525
jackOptions {
@@ -38,6 +38,10 @@ android {
3838
target25 {
3939
targetSdkVersion 25
4040
}
41+
42+
targetO {
43+
targetSdkVersion 'O'
44+
}
4145
}
4246

4347
lintOptions {

app/src/main/java/com/afwsamples/testdpc/common/preference/DpcPreferenceHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ public void disableIfConstraintsNotMet() {
220220
*/
221221
private CharSequence findConstraintViolation() {
222222
if (getDeviceSdkInt() < mMinSdkVersion) {
223-
if (mMinSdkVersion == Build.VERSION_CODES.O) {
223+
// FIXME: Remove this special checking once O is out.
224+
if (mMinSdkVersion >= 26) {
224225
return mContext.getString(R.string.requires_preview_release);
225226
}
226227
return mContext.getString(R.string.requires_android_api_level, mMinSdkVersion);

app/src/main/res/values/attrs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<enum name="L" value="21" />
2626
<enum name="M" value="23" />
2727
<enum name="N" value="24" />
28+
<enum name="O" value="26" />
2829
<!-- Build.VERSION_CODES.CUR_DEVELOPMENT, fill in the sdk int once it is finalized -->
29-
<enum name="O" value="10000" />
3030
</attr>
3131

3232
<!-- Constrain a preference to DO or PO admins. -->
@@ -55,4 +55,4 @@
5555
<flag name="any" value="0x7" /> <!-- default -->
5656
</attr>
5757
</declare-styleable>
58-
</resources>
58+
</resources>

0 commit comments

Comments
 (0)