From a92fb3206042275c6fd6b2f7bc09de1ae1cc9921 Mon Sep 17 00:00:00 2001 From: althafvly Date: Wed, 12 Jul 2023 11:34:20 +0530 Subject: [PATCH 1/2] Settings: add preference for license id Change-Id: I60872ebd4df79b977b8a93926b3d3436e8bb8ab0 --- res/values/cm_strings.xml | 3 + res/xml/my_device_info.xml | 9 +++ .../LicenseIDDetailPreferenceController.java | 62 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 src/com/android/settings/deviceinfo/firmwareversion/LicenseIDDetailPreferenceController.java diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 165c7cd9aa9..be805662405 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -190,6 +190,9 @@ /e/ OS version + + /e/ OS license ID + /e/ legal diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml index 1135e794d18..8052e4019f2 100644 --- a/res/xml/my_device_info.xml +++ b/res/xml/my_device_info.xml @@ -141,6 +141,15 @@ android:selectable="false" settings:enableCopying="true" settings:controller="com.android.settings.deviceinfo.firmwareversion.LineageVersionDetailPreferenceController"/> + + + . + */ + +package com.android.settings.deviceinfo.firmwareversion; + +import android.content.Context; +import android.os.UserHandle; +import android.provider.Settings; + +import androidx.preference.Preference; + +import com.android.settings.R; +import com.android.settings.core.BasePreferenceController; + + +public class LicenseIDDetailPreferenceController extends BasePreferenceController { + + private static final String TAG = "LicenseIDDetailPreferenceController"; + + public LicenseIDDetailPreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public int getAvailabilityStatus() { + return AVAILABLE; + } + + @Override + public boolean useDynamicSliceSummary() { + return true; + } + + @Override + public boolean isSliceable() { + return true; + } + + @Override + public CharSequence getSummary() { + String eLicenseID = Settings.Secure.getStringForUser( + mContext.getContentResolver(), Settings.Secure.E_LICENSE_ID, + UserHandle.USER_CURRENT); + if (eLicenseID == null) { + return mContext.getString(R.string.unknown); + } + return eLicenseID; + } +} -- GitLab From 8d8f9551e2ed90591826afeafe577d1a9160f6f6 Mon Sep 17 00:00:00 2001 From: althafvly Date: Thu, 13 Jul 2023 10:44:58 +0530 Subject: [PATCH 2/2] Settings: Move position of preference Change-Id: Id4efc8bca33119e9147650ea0c292ee37ec029e3 --- res/xml/my_device_info.xml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml index 8052e4019f2..7c83d1e2b98 100644 --- a/res/xml/my_device_info.xml +++ b/res/xml/my_device_info.xml @@ -141,15 +141,6 @@ android:selectable="false" settings:enableCopying="true" settings:controller="com.android.settings.deviceinfo.firmwareversion.LineageVersionDetailPreferenceController"/> - - - + + +