(SHIFT) deviceinfo: add build id preference
This adds the build id to settings to let users verify
the base AOSP tag we are based on.
The entry can be found at:
- Settings -> About -> Android version -> Build id
Change-Id: I29eb961c6b63d5381859aeb34cdc658d75dbe201
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/res/values-de/shiftos_strings.xml b/res/values-de/shiftos_strings.xml
index 6e3e454..a0adeb7 100644
--- a/res/values-de/shiftos_strings.xml
+++ b/res/values-de/shiftos_strings.xml
@@ -17,4 +17,5 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="shiftos_version">ShiftOS-Version</string>
<string name="shiftos_license_title">Rechtliche Hinweise zu ShiftOS</string>
+ <string name="shiftos_build_id">Build-ID</string>
</resources>
diff --git a/res/values/shiftos_strings.xml b/res/values/shiftos_strings.xml
index 1c3e7c8..2c81402 100644
--- a/res/values/shiftos_strings.xml
+++ b/res/values/shiftos_strings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2022 SHIFT GmbH
+ Copyright (C) 2022-2023 SHIFT GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,4 +17,5 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="shiftos_version">ShiftOS version</string>
<string name="shiftos_license_title">ShiftOS legal</string>
+ <string name="shiftos_build_id">Build id</string>
</resources>
diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml
index 9dcf0ae..019e8fc 100644
--- a/res/xml/firmware_version.xml
+++ b/res/xml/firmware_version.xml
@@ -82,6 +82,15 @@
settings:enableCopying="true"
settings:controller="com.android.settings.deviceinfo.firmwareversion.KernelVersionPreferenceController"/>
+ <!-- Build id -->
+ <Preference
+ android:key="os_build_id"
+ android:title="@string/shiftos_build_id"
+ android:summary="@string/summary_placeholder"
+ android:selectable="false"
+ settings:enableCopying="true"
+ settings:controller="com.android.settings.deviceinfo.firmwareversion.ShiftOsBuildIdPreferenceController"/>
+
<!-- Build date -->
<Preference
android:key="os_build_date"
diff --git a/src/com/android/settings/deviceinfo/firmwareversion/ShiftOsBuildIdPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/ShiftOsBuildIdPreferenceController.java
new file mode 100644
index 0000000..9b82802
--- /dev/null
+++ b/src/com/android/settings/deviceinfo/firmwareversion/ShiftOsBuildIdPreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 The LineageOS Project
+ * Copyright (C) 2023 SHIFT GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.deviceinfo.firmwareversion;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+public class ShiftOsBuildIdPreferenceController extends BasePreferenceController {
+
+ private static final String TAG = "ShiftOsBuildIdCtrl";
+
+ private static final String KEY_BUILD_ID_PROP = "ro.build.id";
+
+ public ShiftOsBuildIdPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ @Override
+ public CharSequence getSummary() {
+ return SystemProperties.get(KEY_BUILD_ID_PROP,
+ mContext.getString(R.string.unknown));
+ }
+}