Improve App notification loading

1) Use UiBlocker, for better animations for apps with a lot of channels
2) Only load data in onResume, because the data loading step in some
of the controllers is expensive

Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.notification"
Test: load small channel and large (6000ish) channel app pages
Test: load individual channel pages
Test: load in-app channel shelf UI
Fixes: 215072888
Change-Id: I9a1c96f75b02f94b3ffc529d17d9c0cad7752de1
This commit is contained in:
Julia Reynolds
2022-07-14 16:15:26 -04:00
parent 25686219d3
commit e90507373c
34 changed files with 318 additions and 272 deletions

View File

@@ -38,7 +38,7 @@ public class BadgePreferenceController extends NotificationPreferenceController
public BadgePreferenceController(Context context,
NotificationBackend backend) {
super(context, backend);
super(context, backend, KEY_BADGE);
}
@Override
@@ -47,25 +47,29 @@ public class BadgePreferenceController extends NotificationPreferenceController
}
@Override
public boolean isAvailable() {
if (!super.isAvailable()) {
return false;
public int getAvailabilityStatus() {
if (super.getAvailabilityStatus() == CONDITIONALLY_UNAVAILABLE) {
return CONDITIONALLY_UNAVAILABLE;
}
if (mAppRow == null && mChannel == null) {
return false;
return CONDITIONALLY_UNAVAILABLE;
}
if (Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BADGING, SYSTEM_WIDE_ON) == SYSTEM_WIDE_OFF) {
return false;
return CONDITIONALLY_UNAVAILABLE;
}
if (mChannel != null) {
if (isDefaultChannel()) {
return true;
return AVAILABLE;
} else {
return mAppRow == null ? false : mAppRow.showBadge;
return mAppRow == null
? CONDITIONALLY_UNAVAILABLE
: mAppRow.showBadge
? AVAILABLE
: CONDITIONALLY_UNAVAILABLE;
}
}
return true;
return AVAILABLE;
}
@Override