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

Commit e892df24 authored by Colin Cross's avatar Colin Cross Committed by Cherrypicker Worker
Browse files

Fix kotlin nullable errors in Launcher3

Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.

Bug: 294110802
Test: builds
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2608381792389b60ba37c08afcea09dca3c6ff9c)
Merged-In: I26edfec35dca14abe90b08e3c74de0446eda95d2
Change-Id: I26edfec35dca14abe90b08e3c74de0446eda95d2
parent bb637e04
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -101,10 +101,10 @@ constructor(
    @SuppressLint("UseSwitchCompatOrMaterialCode")
    override fun onFinishInflate() {
        super.onFinishInflate()
        val taskbarSwitchOption = findViewById<LinearLayout>(R.id.taskbar_switch_option)
        val alwaysShowTaskbarSwitch = findViewById<Switch>(R.id.taskbar_pinning_switch)
        val taskbarSwitchOption = requireViewById<LinearLayout>(R.id.taskbar_switch_option)
        val alwaysShowTaskbarSwitch = requireViewById<Switch>(R.id.taskbar_pinning_switch)
        val navigationModeChangeOption =
            findViewById<LinearLayout>(R.id.navigation_mode_switch_option)
            requireViewById<LinearLayout>(R.id.navigation_mode_switch_option)
        alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn
        taskbarSwitchOption.setOnClickListener {
            alwaysShowTaskbarSwitch.isClickable = true
+8 −7
Original line number Diff line number Diff line
@@ -156,18 +156,19 @@ class SplitSelectDataHolder(
     */
    fun setSecondTask(pendingIntent: PendingIntent) {
        secondPendingIntent = pendingIntent
        secondUser = pendingIntent.creatorUserHandle!!
        secondUser = pendingIntent.creatorUserHandle
    }

    private fun getShortcutInfo(intent: Intent?, user: UserHandle?): ShortcutInfo? {
        if (intent?.getPackage() == null) {
    private fun getShortcutInfo(intent: Intent?, user: UserHandle): ShortcutInfo? {
        val intentPackage = intent?.getPackage()
        if (intentPackage == null) {
            return null
        }
        val shortcutId = intent.getStringExtra(ShortcutKey.EXTRA_SHORTCUT_ID)
                ?: return null
        try {
            val context: Context = context.createPackageContextAsUser(
                    intent.getPackage(), 0 /* flags */, user)
                    intentPackage, 0 /* flags */, user)
            return ShortcutInfo.Builder(context, shortcutId).build()
        } catch (e: PackageManager.NameNotFoundException) {
            Log.w(TAG, "Failed to create a ShortcutInfo for " + intent.getPackage())
@@ -250,7 +251,7 @@ class SplitSelectDataHolder(
     * convert [secondIntent]
     */
    private fun convertIntentsToFinalTypes() {
        initialShortcut = getShortcutInfo(initialIntent, initialUser)
        initialShortcut = getShortcutInfo(initialIntent, checkNotNull(initialUser))
        initialPendingIntent = getPendingIntent(initialIntent, initialUser)
        initialIntent = null

@@ -264,7 +265,7 @@ class SplitSelectDataHolder(
            return
        }

        secondShortcut = getShortcutInfo(secondIntent, secondUser)
        secondShortcut = getShortcutInfo(secondIntent, checkNotNull(secondUser))
        secondPendingIntent = getPendingIntent(secondIntent, secondUser)
        secondIntent = null
    }