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

Commit da02ab1b authored by Joshua Trask's avatar Joshua Trask Committed by Ian Kasprzak
Browse files

ChooserSelector shouldn't crash w/o IntentResolver

If we don't have the new (so-called "unbundled") IntentResolver
package installed on a device, we'll just fall back to the system
Chooser -- we shouldn't crash trying to control an experiment that
wouldn't have any effect on that device in the first place.


Test: Build (will also check fixed regressions before merge)
Bug: 253190011
Change-Id: I2a6b49c6fb39a730759c182f8b8245b1ccc813c9
Merged-In: I2a6b49c6fb39a730759c182f8b8245b1ccc813c9
(cherry picked from commit a9b92f9c)
parent bf20b85b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ package com.android.systemui
import android.content.ComponentName
import android.content.Context
import android.content.pm.PackageManager
import android.util.Log
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
@@ -55,7 +56,11 @@ class ChooserSelector @Inject constructor(
        } else {
            PackageManager.COMPONENT_ENABLED_STATE_DISABLED
        }
        try {
            packageManager.setComponentEnabledSetting(chooserComponent, newState, /* flags = */ 0)
        } catch (e: IllegalArgumentException) {
            Log.w("ChooserSelector", "Unable to set IntentResolver enabled=" + enabled, e)
        }
    }

    suspend inline fun awaitCancellation(): Nothing = suspendCancellableCoroutine { }