Make stable enableability of AppPermissionPreference, HibernationSwitchPreference buttons when app is archived
Test: n/a Bug: 315770669 Change-Id: I0b4a1f8a2d3bbe9c6e8b59b5b1e16c606d26e8ed
This commit is contained in:
@@ -55,7 +55,11 @@ class AppPermissionSummaryLiveData(
|
||||
|
||||
override fun onActive() {
|
||||
userPackageManager.addOnPermissionsChangeListener(onPermissionsChangedListener)
|
||||
update()
|
||||
if (app.isArchived) {
|
||||
postValue(noPermissionRequestedState())
|
||||
} else {
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInactive() {
|
||||
|
||||
@@ -93,6 +93,10 @@ private class HibernationSwitchPresenter(context: Context, private val app: Appl
|
||||
DeviceConfig.getBoolean(NAMESPACE_APP_HIBERNATION, PROPERTY_APP_HIBERNATION_ENABLED, true)
|
||||
|
||||
val isEligibleFlow = flow {
|
||||
if (app.isArchived) {
|
||||
emit(false)
|
||||
return@flow
|
||||
}
|
||||
val eligibility = getEligibility()
|
||||
emit(
|
||||
eligibility != HIBERNATION_ELIGIBILITY_EXEMPT_BY_SYSTEM &&
|
||||
|
||||
Reference in New Issue
Block a user