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

Commit 80e709f9 authored by David Anderson's avatar David Anderson Committed by Android Build Coastguard Worker
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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:287181169485eb30203c7b698b1f8ee618059e29)
Merged-In: I2489a64804f068a957f9be3f87847d6911b24447
Change-Id: I2489a64804f068a957f9be3f87847d6911b24447
parent 6c50d622
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
    }