Merge changes from topic "261990919" into tm-qpr-dev am: 938aed255a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20692108 Change-Id: I04ff6149d5378482dd8ce7fb7a9fdc21637e0010 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -69,12 +69,14 @@ class ControlsServiceInfo(
|
||||
private var resolved: Boolean = false
|
||||
|
||||
@WorkerThread
|
||||
fun resolvePanelActivity() {
|
||||
fun resolvePanelActivity(
|
||||
allowAllApps: Boolean = false
|
||||
) {
|
||||
if (resolved) return
|
||||
resolved = true
|
||||
val validPackages = context.resources
|
||||
.getStringArray(R.array.config_controlsPreferredPackages)
|
||||
if (componentName.packageName !in validPackages) return
|
||||
if (componentName.packageName !in validPackages && !allowAllApps) return
|
||||
panelActivity = _panelActivity?.let {
|
||||
val resolveInfos = mPm.queryIntentActivitiesAsUser(
|
||||
Intent().setComponent(it),
|
||||
|
||||
@@ -98,7 +98,9 @@ class ControlsListingControllerImpl @VisibleForTesting constructor(
|
||||
backgroundExecutor.execute {
|
||||
if (userChangeInProgress.get() > 0) return@execute
|
||||
if (featureFlags.isEnabled(Flags.USE_APP_PANELS)) {
|
||||
newServices.forEach(ControlsServiceInfo::resolvePanelActivity)
|
||||
val allowAllApps = featureFlags.isEnabled(Flags.APP_PANELS_ALL_APPS_ALLOWED)
|
||||
newServices.forEach {
|
||||
it.resolvePanelActivity(allowAllApps) }
|
||||
}
|
||||
|
||||
if (newServices != availableServices) {
|
||||
|
||||
@@ -94,8 +94,7 @@ object Flags {
|
||||
unreleasedFlag(259217907, "notification_group_dismissal_animation", teamfood = true)
|
||||
|
||||
// TODO(b/257506350): Tracking Bug
|
||||
@JvmField
|
||||
val FSI_CHROME = unreleasedFlag(117, "fsi_chrome")
|
||||
@JvmField val FSI_CHROME = unreleasedFlag(117, "fsi_chrome")
|
||||
|
||||
@JvmField
|
||||
val SIMPLIFIED_APPEAR_FRACTION =
|
||||
@@ -421,6 +420,10 @@ object Flags {
|
||||
// 2000 - device controls
|
||||
@Keep @JvmField val USE_APP_PANELS = unreleasedFlag(2000, "use_app_panels", teamfood = true)
|
||||
|
||||
@JvmField
|
||||
val APP_PANELS_ALL_APPS_ALLOWED =
|
||||
unreleasedFlag(2001, "app_panels_all_apps_allowed", teamfood = true)
|
||||
|
||||
// 2100 - Falsing Manager
|
||||
@JvmField val FALSING_FOR_LONG_TAPS = releasedFlag(2100, "falsing_for_long_taps")
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.controls.ControlsServiceInfo
|
||||
import com.android.systemui.dump.DumpManager
|
||||
import com.android.systemui.flags.FeatureFlags
|
||||
import com.android.systemui.flags.Flags.APP_PANELS_ALL_APPS_ALLOWED
|
||||
import com.android.systemui.flags.Flags.USE_APP_PANELS
|
||||
import com.android.systemui.settings.UserTracker
|
||||
import com.android.systemui.util.concurrency.FakeExecutor
|
||||
@@ -119,6 +120,8 @@ class ControlsListingControllerImplTest : SysuiTestCase() {
|
||||
|
||||
// Return true by default, we'll test the false path
|
||||
`when`(featureFlags.isEnabled(USE_APP_PANELS)).thenReturn(true)
|
||||
// Return false by default, we'll test the true path
|
||||
`when`(featureFlags.isEnabled(APP_PANELS_ALL_APPS_ALLOWED)).thenReturn(false)
|
||||
|
||||
val wrapper = object : ContextWrapper(mContext) {
|
||||
override fun createContextAsUser(user: UserHandle, flags: Int): Context {
|
||||
@@ -517,6 +520,37 @@ class ControlsListingControllerImplTest : SysuiTestCase() {
|
||||
assertNull(controller.getCurrentServices()[0].panelActivity)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPackageNotPreferred_allowAllApps_correctPanel() {
|
||||
`when`(featureFlags.isEnabled(APP_PANELS_ALL_APPS_ALLOWED)).thenReturn(true)
|
||||
|
||||
mContext.orCreateTestableResources
|
||||
.addOverride(R.array.config_controlsPreferredPackages, arrayOf<String>())
|
||||
|
||||
val serviceInfo = ServiceInfo(
|
||||
componentName,
|
||||
activityName
|
||||
)
|
||||
|
||||
`when`(packageManager.getComponentEnabledSetting(eq(activityName)))
|
||||
.thenReturn(PackageManager.COMPONENT_ENABLED_STATE_ENABLED)
|
||||
|
||||
setUpQueryResult(listOf(
|
||||
ActivityInfo(
|
||||
activityName,
|
||||
exported = true,
|
||||
permission = Manifest.permission.BIND_CONTROLS
|
||||
)
|
||||
))
|
||||
|
||||
val list = listOf(serviceInfo)
|
||||
serviceListingCallbackCaptor.value.onServicesReloaded(list)
|
||||
|
||||
executor.runAllReady()
|
||||
|
||||
assertEquals(activityName, controller.getCurrentServices()[0].panelActivity)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testListingsNotModifiedByCallback() {
|
||||
// This test checks that if the list passed to the callback is modified, it has no effect
|
||||
|
||||
Reference in New Issue
Block a user