Use a temporary summary in the "Apps that can interrupt" preference

We load the list of apps in a background thread, so getting that string later was causing the preference to increase in height, with an annoyingly noticeable animation. Having a placeholder test ensures this doesn't happen (and actually loading is pretty fast, so this text lkely won't even be visible).

Fixes: 347744856
Test: atest ZenModeAppsLinkPreferenceControllerTest
Flag: android.app.modes_ui
Change-Id: I4f9f60104fb8b0abbc7c4279b87daafac481e98a
This commit is contained in:
Matías Hernández
2024-07-05 17:35:06 +02:00
parent 0037dfe9a9
commit ec376bcfce
3 changed files with 18 additions and 16 deletions

View File

@@ -21,6 +21,7 @@ import static android.provider.Settings.EXTRA_AUTOMATIC_ZEN_RULE_ID;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.ArraySet;
import androidx.annotation.NonNull;
@@ -29,6 +30,7 @@ import androidx.core.text.BidiFormatter;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.SubSettingLauncher;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.notification.modes.ZenMode;
@@ -82,6 +84,9 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
.toIntent());
mZenMode = zenMode;
mPreference = preference;
if (TextUtils.isEmpty(mPreference.getSummary())) {
mPreference.setSummary(R.string.zen_mode_apps_calculating);
}
if (mApplicationsState != null && mHost != null) {
mAppSession = mApplicationsState.newSession(mAppSessionCallbacks, mHost.getLifecycle());
}