Reland: 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
Exempt-From-Owner-Approval: Previously approved, no new changes.
Change-Id: Ifb6f6236aab2c40fd51abb9c6587eafcc8983857
This commit is contained in:
Dianne Hackborn
2019-10-28 16:36:15 -07:00
committed by Narayan Kamath
parent 21276e72d6
commit 95108c4b38
7 changed files with 7 additions and 7 deletions

View File

@@ -737,7 +737,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()) return new AlertDialog.Builder(getActivity())
.setMessage(getContext().getString(R.string.storage_detail_dialog_system, .setMessage(getContext().getString(R.string.storage_detail_dialog_system,
Build.VERSION.RELEASE)) Build.VERSION.RELEASE_OR_CODENAME))
.setPositiveButton(android.R.string.ok, null) .setPositiveButton(android.R.string.ok, null)
.create(); .create();
} }

View File

@@ -75,7 +75,7 @@ public class FirmwareVersionDetailPreferenceController extends BasePreferenceCon
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
return Build.VERSION.RELEASE; return Build.VERSION.RELEASE_OR_CODENAME;
} }
@Override @Override

View File

@@ -34,6 +34,6 @@ public class FirmwareVersionPreferenceController extends BasePreferenceControlle
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
return Build.VERSION.RELEASE; return Build.VERSION.RELEASE_OR_CODENAME;
} }
} }

View File

@@ -89,7 +89,7 @@ public class SystemUpdatePreferenceController extends BasePreferenceController {
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
CharSequence summary = mContext.getString(R.string.android_version_summary, CharSequence summary = mContext.getString(R.string.android_version_summary,
Build.VERSION.RELEASE); Build.VERSION.RELEASE_OR_CODENAME);
final FutureTask<Bundle> bundleFutureTask = new FutureTask<>( final FutureTask<Bundle> bundleFutureTask = new FutureTask<>(
// Put the API call in a future to avoid StrictMode violation. // Put the API call in a future to avoid StrictMode violation.
() -> mUpdateManager.retrieveSystemUpdateInfo()); () -> mUpdateManager.retrieveSystemUpdateInfo());

View File

@@ -63,7 +63,7 @@ public class FirmwareVersionDetailPreferenceControllerTest {
@Test @Test
public void getSummary_shouldGetBuildVersion() { public void getSummary_shouldGetBuildVersion() {
assertThat(mController.getSummary()).isEqualTo(Build.VERSION.RELEASE); assertThat(mController.getSummary()).isEqualTo(Build.VERSION.RELEASE_OR_CODENAME);
} }
@Test @Test

View File

@@ -65,6 +65,6 @@ public class FirmwareVersionPreferenceControllerTest {
public void updatePreference_shouldSetSummaryToBuildNumber() { public void updatePreference_shouldSetSummaryToBuildNumber() {
mController.updateState(mPreference); mController.updateState(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(Build.VERSION.RELEASE); assertThat(mPreference.getSummary()).isEqualTo(Build.VERSION.RELEASE_OR_CODENAME);
} }
} }

View File

@@ -139,7 +139,7 @@ public class SystemUpdatePreferenceControllerTest {
assertThat(mPreference.getSummary()) assertThat(mPreference.getSummary())
.isEqualTo(mContext.getString(R.string.android_version_summary, .isEqualTo(mContext.getString(R.string.android_version_summary,
Build.VERSION.RELEASE)); Build.VERSION.RELEASE_OR_CODENAME));
} }
@Test @Test