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 a9b92f9c9a)
This commit is contained in:
committed by
Ian Kasprzak
parent
bf20b85b31
commit
da02ab1be0
@@ -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
|
||||
}
|
||||
packageManager.setComponentEnabledSetting(chooserComponent, newState, /* flags = */ 0)
|
||||
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 { }
|
||||
|
||||
Reference in New Issue
Block a user