Allow launch activity from background for PendingIntent
BUG: 343317785 Test: local test Flag: com.android.settings.flags.enable_bluetooth_device_details_polish Change-Id: I22c430c0d3879f034f3a491471781aa9b49a02f2
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.bluetooth.ui.view
|
package com.android.settings.bluetooth.ui.view
|
||||||
|
|
||||||
|
import android.app.ActivityOptions
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@@ -206,11 +207,7 @@ class DeviceDetailsFragmentFormatterImpl(
|
|||||||
.collectAsStateWithLifecycle(initialValue = false)
|
.collectAsStateWithLifecycle(initialValue = false)
|
||||||
|
|
||||||
val settings = contents
|
val settings = contents
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(visible = settings.isNotEmpty(), enter = fadeIn(), exit = fadeOut()) {
|
||||||
visible = settings.isNotEmpty(),
|
|
||||||
enter = fadeIn(),
|
|
||||||
exit = fadeOut(),
|
|
||||||
) {
|
|
||||||
Box {
|
Box {
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
@@ -224,7 +221,7 @@ class DeviceDetailsFragmentFormatterImpl(
|
|||||||
Color.Transparent
|
Color.Transparent
|
||||||
},
|
},
|
||||||
shape = RoundedCornerShape(28.dp),
|
shape = RoundedCornerShape(28.dp),
|
||||||
),
|
)
|
||||||
) {}
|
) {}
|
||||||
buildPreferences(settings)
|
buildPreferences(settings)
|
||||||
}
|
}
|
||||||
@@ -257,17 +254,11 @@ class DeviceDetailsFragmentFormatterImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
if (
|
if (!settings.all { it is DeviceSettingPreferenceModel.MultiTogglePreference }) {
|
||||||
!settings.all {
|
|
||||||
it is DeviceSettingPreferenceModel.MultiTogglePreference
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buildMultiTogglePreference(
|
buildMultiTogglePreference(
|
||||||
settings.filterIsInstance<
|
settings.filterIsInstance<DeviceSettingPreferenceModel.MultiTogglePreference>()
|
||||||
DeviceSettingPreferenceModel.MultiTogglePreference
|
|
||||||
>()
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,7 +366,12 @@ class DeviceDetailsFragmentFormatterImpl(
|
|||||||
context.startActivity(action.intent)
|
context.startActivity(action.intent)
|
||||||
}
|
}
|
||||||
is DeviceSettingActionModel.PendingIntentAction -> {
|
is DeviceSettingActionModel.PendingIntentAction -> {
|
||||||
action.pendingIntent.send()
|
val options =
|
||||||
|
ActivityOptions.makeBasic()
|
||||||
|
.setPendingIntentBackgroundActivityStartMode(
|
||||||
|
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS
|
||||||
|
)
|
||||||
|
action.pendingIntent.send(options.toBundle())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user