Merge "Update task manager ui information on dialog opening" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
02ee782a23
@@ -228,6 +228,10 @@ class FgsManagerController @Inject constructor(
|
|||||||
synchronized(lock) {
|
synchronized(lock) {
|
||||||
if (dialog == null) {
|
if (dialog == null) {
|
||||||
|
|
||||||
|
runningServiceTokens.keys.forEach {
|
||||||
|
it.updateUiControl()
|
||||||
|
}
|
||||||
|
|
||||||
val dialog = SystemUIDialog(context)
|
val dialog = SystemUIDialog(context)
|
||||||
dialog.setTitle(R.string.fgs_manager_dialog_title)
|
dialog.setTitle(R.string.fgs_manager_dialog_title)
|
||||||
|
|
||||||
@@ -396,10 +400,20 @@ class FgsManagerController @Inject constructor(
|
|||||||
val userId: Int,
|
val userId: Int,
|
||||||
val packageName: String
|
val packageName: String
|
||||||
) {
|
) {
|
||||||
val uiControl: UIControl by lazy {
|
val uid by lazy { packageManager.getPackageUidAsUser(packageName, userId) }
|
||||||
val uid = packageManager.getPackageUidAsUser(packageName, userId)
|
|
||||||
|
|
||||||
when (activityManager.getBackgroundRestrictionExemptionReason(uid)) {
|
private var uiControlInitialized = false
|
||||||
|
var uiControl: UIControl = UIControl.NORMAL
|
||||||
|
get() {
|
||||||
|
if (!uiControlInitialized) {
|
||||||
|
updateUiControl()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
private set
|
||||||
|
|
||||||
|
fun updateUiControl() {
|
||||||
|
uiControl = when (activityManager.getBackgroundRestrictionExemptionReason(uid)) {
|
||||||
PowerExemptionManager.REASON_SYSTEM_UID,
|
PowerExemptionManager.REASON_SYSTEM_UID,
|
||||||
PowerExemptionManager.REASON_DEVICE_DEMO_MODE -> UIControl.HIDE_ENTRY
|
PowerExemptionManager.REASON_DEVICE_DEMO_MODE -> UIControl.HIDE_ENTRY
|
||||||
|
|
||||||
@@ -412,6 +426,7 @@ class FgsManagerController @Inject constructor(
|
|||||||
PowerExemptionManager.REASON_SYSTEM_MODULE -> UIControl.HIDE_BUTTON
|
PowerExemptionManager.REASON_SYSTEM_MODULE -> UIControl.HIDE_BUTTON
|
||||||
else -> UIControl.NORMAL
|
else -> UIControl.NORMAL
|
||||||
}
|
}
|
||||||
|
uiControlInitialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user