Rework platform version to hide codenames.
The public platform version no longer can be a codename, it is
always the most recently released platform. A new build property
and API provides either the offical version or the current codename
as appropriate. This will avoid breaking apps that look at the
platform version while development is under a codename.
Bug: 143175463
Test: manual
Change-Id: I711ca20c4c8ce389697e940696051a336f5fd808
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index 8e6158b..08d6ca4 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -737,7 +737,7 @@
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
.setMessage(getContext().getString(R.string.storage_detail_dialog_system,
- Build.VERSION.RELEASE))
+ Build.VERSION.RELEASE_OR_CODENAME))
.setPositiveButton(android.R.string.ok, null)
.create();
}
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java
index daa10d2..5b975ef 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceController.java
@@ -70,7 +70,7 @@
@Override
public CharSequence getSummary() {
- return Build.VERSION.RELEASE;
+ return Build.VERSION.RELEASE_OR_CODENAME;
}
@Override
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
index 41d9566..dcff4c3 100644
--- a/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceController.java
@@ -34,6 +34,6 @@
@Override
public CharSequence getSummary() {
- return Build.VERSION.RELEASE;
+ return Build.VERSION.RELEASE_OR_CODENAME;
}
}
diff --git a/src/com/android/settings/system/SystemUpdatePreferenceController.java b/src/com/android/settings/system/SystemUpdatePreferenceController.java
index 38a88b9..92819d6 100644
--- a/src/com/android/settings/system/SystemUpdatePreferenceController.java
+++ b/src/com/android/settings/system/SystemUpdatePreferenceController.java
@@ -89,7 +89,7 @@
@Override
public CharSequence getSummary() {
CharSequence summary = mContext.getString(R.string.android_version_summary,
- Build.VERSION.RELEASE);
+ Build.VERSION.RELEASE_OR_CODENAME);
final FutureTask<Bundle> bundleFutureTask = new FutureTask<>(
// Put the API call in a future to avoid StrictMode violation.
() -> mUpdateManager.retrieveSystemUpdateInfo());
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java
index adfff25..0d0d6f3 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionDetailPreferenceControllerTest.java
@@ -64,7 +64,7 @@
@Test
public void getSummary_shouldGetBuildVersion() {
- assertThat(mController.getSummary()).isEqualTo(Build.VERSION.RELEASE);
+ assertThat(mController.getSummary()).isEqualTo(Build.VERSION.RELEASE_OR_CODENAME);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java
index 77ae4e2..4306955 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerTest.java
@@ -65,6 +65,6 @@
public void updatePreference_shouldSetSummaryToBuildNumber() {
mController.updateState(mPreference);
- assertThat(mPreference.getSummary()).isEqualTo(Build.VERSION.RELEASE);
+ assertThat(mPreference.getSummary()).isEqualTo(Build.VERSION.RELEASE_OR_CODENAME);
}
}
diff --git a/tests/robotests/src/com/android/settings/system/SystemUpdatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/system/SystemUpdatePreferenceControllerTest.java
index fbd87c9..95c95bb 100644
--- a/tests/robotests/src/com/android/settings/system/SystemUpdatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/system/SystemUpdatePreferenceControllerTest.java
@@ -139,7 +139,7 @@
assertThat(mPreference.getSummary())
.isEqualTo(mContext.getString(R.string.android_version_summary,
- Build.VERSION.RELEASE));
+ Build.VERSION.RELEASE_OR_CODENAME));
}
@Test