For #15403 - Adds a secret debug info screen in settings (#15540)

Co-authored-by: Elise Richards <erichards@mozilla.com>
upstream-sync
Jeff Boek 4 years ago committed by GitHub
parent 1ca34a2bc9
commit cf61c10c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,44 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.settings
import android.os.Bundle
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.leanplum.Leanplum
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.showToolbar
class SecretDebugSettingsFragment : PreferenceFragmentCompat() {
override fun onResume() {
super.onResume()
showToolbar(getString(R.string.preferences_debug_info))
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.secret_info_settings_preferences, rootKey)
requirePreference<Preference>(R.string.pref_key_leanplum_user_id).apply {
summary = Leanplum.getUserId().let {
if (it.isNullOrEmpty()) {
"No User Id"
} else {
it
}
}
}
requirePreference<Preference>(R.string.pref_key_leanplum_device_id).apply {
summary = Leanplum.getDeviceId().let {
if (it.isNullOrEmpty()) {
"No Device Id"
} else {
it
}
}
}
}
}

@ -12,9 +12,6 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar
/**
* Lets the user customize Private browsing options.
*/
class SecretSettingsFragment : PreferenceFragmentCompat() {
override fun onResume() {

@ -310,6 +310,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
resources.getString(R.string.pref_key_debug_settings) -> {
SettingsFragmentDirections.actionSettingsFragmentToSecretSettingsFragment()
}
resources.getString(R.string.pref_key_secret_debug_info) -> {
SettingsFragmentDirections.actionSettingsFragmentToSecretInfoSettingsFragment()
}
resources.getString(R.string.pref_key_override_amo_collection) -> {
val context = requireContext()
val dialogView = LayoutInflater.from(context).inflate(R.layout.amo_collection_override_dialog, null)
@ -416,6 +419,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_debug_settings)
)?.isVisible = requireContext().settings().showSecretDebugMenuThisSession
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_secret_debug_info)
)?.isVisible = requireContext().settings().showSecretDebugMenuThisSession
setupAmoCollectionOverridePreference(requireContext().settings())
}

@ -467,6 +467,13 @@
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_settingsFragment_to_secretInfoSettingsFragment"
app:destination="@id/secretInfoSettingsFragment"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_settingsFragment_to_customizationFragment"
app:destination="@id/customizationFragment"
@ -610,6 +617,10 @@
android:id="@+id/secretSettingsPreference"
android:name="org.mozilla.fenix.settings.SecretSettingsFragment"
android:label="@string/preferences_debug_settings" />
<fragment
android:id="@+id/secretInfoSettingsFragment"
android:name="org.mozilla.fenix.settings.SecretDebugSettingsFragment"
android:label="@string/preferences_debug_info" />
<fragment
android:id="@+id/crashReporterFragment"
android:name="org.mozilla.fenix.crashes.CrashReporterFragment"

@ -232,4 +232,9 @@
<string name="pref_key_camera_permissions_needed" translatable="false">pref_key_camera_permissions_needed</string>
<string name="pref_key_return_to_browser" translatable="false">pref_key_return_to_browser</string>
<!-- Secret Info Setting Keys -->
<string name="pref_key_secret_debug_info" translatable="false">pref_key_secret_debug_info</string>
<string name="pref_key_leanplum_user_id" translatable="false">pref_key_leanplum_user_id</string>
<string name="pref_key_leanplum_device_id" translatable="false">pref_key_leanplum_device_id</string>
</resources>

@ -32,6 +32,13 @@
<!-- Label for the secret settings preference -->
<string name="preferences_debug_settings">Secret Settings</string>
<!-- Label for the secret settings preference -->
<string name="preferences_debug_info" translatable="false">Secret Debug Info</string>
<!-- Label for the show top frequently visited sites preference -->
<string name="preferences_debug_settings_enable_top_frecent_sites">Show Top Frequently Visited Sites</string>
<!-- Label for the wait until first paint preference -->
<string name="preferences_debug_settings_wait_first_paint">Wait Until First Paint To Show Page Content</string>
<!-- Label for showing Synced Tabs in the tabs tray -->
<string name="preferences_debug_synced_tabs_tabs_tray">Show Synced Tabs in the tabs tray</string>
@ -56,4 +63,9 @@
<string name="mp_dialog_close_transfer">Close</string>
<string name="mp_dialog_title_transfer_failure">Transfer failed</string>
<string name="mp_dialog_message_transfer_failure">An unknown error occurred and logins could not be transferred.</string>
<!-- Secret debug info strings -->
<string name="debug_info_telemetry_title" translatable="false">Telemetry</string>
<string name="debug_info_leanplum_user_id" translatable="false">Leanplum User Id</string>
<string name="debug_info_leanplum_device_id" translatable="false">Leanplum Device Id</string>
</resources>

@ -186,5 +186,10 @@
android:key="@string/pref_key_debug_settings"
android:title="@string/preferences_debug_settings"
app:isPreferenceVisible="false" />
<androidx.preference.Preference
android:icon="@drawable/ic_info"
android:key="@string/pref_key_secret_debug_info"
android:title="@string/preferences_debug_info"
app:isPreferenceVisible="false" />
</androidx.preference.PreferenceCategory>
</androidx.preference.PreferenceScreen>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:title="@string/debug_info_telemetry_title">
<Preference
android:key="@string/pref_key_leanplum_user_id"
android:title="@string/debug_info_leanplum_user_id"
android:enabled="false" />
<Preference
android:key="@string/pref_key_leanplum_device_id"
android:title="@string/debug_info_leanplum_device_id"
android:enabled="false" />
</PreferenceCategory>
</PreferenceScreen>
Loading…
Cancel
Save