Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28718116 authored by David Anderson's avatar David Anderson
Browse files

Allow overriding DeviceDiagnosticsPreferenceController.

Allow devices to specify their own flags by overriding this class.
Additionally, fix a missing PackageManager lookup in getIntent().

Bug: 348647186
Test: launch Settings on Pixel and on AOSP
Change-Id: I2489a64804f068a957f9be3f87847d6911b24447
parent b67c157e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import com.android.settings.R
import com.android.settings.core.BasePreferenceController
import com.android.settings.flags.Flags

class DeviceDiagnosticsPreferenceController(context: Context, preferenceKey: String) :
open class DeviceDiagnosticsPreferenceController(context: Context, preferenceKey: String) :
    BasePreferenceController(context, preferenceKey) {

    override fun getAvailabilityStatus(): Int {
@@ -59,6 +59,12 @@ class DeviceDiagnosticsPreferenceController(context: Context, preferenceKey: Str
        val packageName = mContext.getResources().getString(
                R.string.config_device_diagnostics_package_name)
        intent.setPackage(packageName)

        val info = mContext.getPackageManager().resolveActivity(intent, 0)
        if (info == null) {
            return null
        }

        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        return intent
    }