diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index f96ca277f9525db2d025ed23da3f7123a391113c..713cd25aede4c87afd72d461263f9a7c6bd1e921 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -201,6 +201,9 @@ Warning: This option may not work properly or lead to data loss and is therefore not recommended! + + Sentry User ID + Enable /e/OS Telemetry Enable automatic bug reporting diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml index d68b6e3b59685732a141c844da8b6c6ad2a3e26a..e5062c677bb8984b0adee5cca8ce7d1b9d9ec973 100644 --- a/res/xml/development_settings.xml +++ b/res/xml/development_settings.xml @@ -655,6 +655,14 @@ android:key="enable_telemetry" android:title="@string/enable_telemetry" android:summary="@string/telemetry_details" /> + + . + */ + +package com.android.settings.deviceinfo.firmwareversion; + +import android.content.Context; +import android.os.UserHandle; +import android.text.TextUtils; +import android.provider.Settings; + +import androidx.preference.Preference; + +import com.android.settings.R; +import com.android.settings.core.BasePreferenceController; +import com.android.settings.slices.Sliceable; + + +public class SentryDetailPreferenceController extends BasePreferenceController { + + private static final String TAG = "SentryDetailPreferenceController"; + + private static final String TELEMETRY_KEY = "e_telemetry"; + + public SentryDetailPreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public int getAvailabilityStatus() { + boolean enable = Settings.System.getInt(mContext.getContentResolver(), TELEMETRY_KEY, 0) == 1; + return enable ? AVAILABLE : UNSUPPORTED_ON_DEVICE; + } + + @Override + public boolean useDynamicSliceSummary() { + return true; + } + + @Override + public boolean isSliceable() { + return true; + } + + @Override + public CharSequence getSummary() { + String sentryId = Settings.Secure.getStringForUser( + mContext.getContentResolver(), Settings.Secure.SENTRY_USERID, + UserHandle.USER_CURRENT); + if (sentryId == null) { + return mContext.getString(R.string.unknown); + } + return sentryId; + } + + @Override + public void copy() { + Sliceable.setCopyContent(mContext, getSummary(), + mContext.getText(R.string.sentry_userid_title)); + } +}