Update icon sizing

Fixes: 233087471
Test: BridgedAppsPreferenceControllerTest, view 'see all apps' screen
Change-Id: I1090f2461f22bf87f20de969d1a0c5b8c2c6b7b7
This commit is contained in:
Julia Reynolds
2023-01-27 15:54:40 -05:00
parent 6a091f7598
commit a50c0b9636
2 changed files with 8 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.applications.AppStateBaseBridge; import com.android.settings.applications.AppStateBaseBridge;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend;
import com.android.settings.widget.AppCheckBoxPreference;
import com.android.settingslib.applications.AppUtils; import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry; import com.android.settingslib.applications.ApplicationsState.AppEntry;
@@ -126,9 +127,9 @@ public class BridgedAppsPreferenceController extends BasePreferenceController im
final AppEntry entry = apps.get(i); final AppEntry entry = apps.get(i);
final String prefKey = entry.info.packageName + "|" + entry.info.uid; final String prefKey = entry.info.packageName + "|" + entry.info.uid;
appsKeySet.add(prefKey); appsKeySet.add(prefKey);
CheckBoxPreference preference = mScreen.findPreference(prefKey); AppCheckBoxPreference preference = mScreen.findPreference(prefKey);
if (preference == null) { if (preference == null) {
preference = new CheckBoxPreference(mScreen.getContext()); preference = new AppCheckBoxPreference(mScreen.getContext());
preference.setIcon(AppUtils.getIcon(mContext, entry)); preference.setIcon(AppUtils.getIcon(mContext, entry));
preference.setTitle(entry.label); preference.setTitle(entry.label);
preference.setKey(prefKey); preference.setKey(prefKey);

View File

@@ -34,7 +34,6 @@ import android.os.Looper;
import android.service.notification.NotificationListenerFilter; import android.service.notification.NotificationListenerFilter;
import android.util.ArraySet; import android.util.ArraySet;
import androidx.preference.CheckBoxPreference;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
@@ -42,6 +41,7 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend;
import com.android.settings.widget.AppCheckBoxPreference;
import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.applications.ApplicationsState;
import org.junit.Before; import org.junit.Before;
@@ -120,7 +120,7 @@ public class BridgedAppsPreferenceControllerTest {
when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true); when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(new NotificationListenerFilter()); when(mNm.getListenerFilter(mCn, 0)).thenReturn(new NotificationListenerFilter());
CheckBoxPreference p = mock(CheckBoxPreference.class); AppCheckBoxPreference p = mock(AppCheckBoxPreference.class);
when(p.getKey()).thenReturn("pkg|12300"); when(p.getKey()).thenReturn("pkg|12300");
mScreen.addPreference(p); mScreen.addPreference(p);
@@ -161,7 +161,7 @@ public class BridgedAppsPreferenceControllerTest {
mController.onRebuildComplete(entries); mController.onRebuildComplete(entries);
CheckBoxPreference actual = mScreen.findPreference("pkg|12300"); AppCheckBoxPreference actual = mScreen.findPreference("pkg|12300");
assertThat(actual.isChecked()).isTrue(); assertThat(actual.isChecked()).isTrue();
assertThat(actual.getTitle()).isEqualTo("hi"); assertThat(actual.getTitle()).isEqualTo("hi");
@@ -178,7 +178,7 @@ public class BridgedAppsPreferenceControllerTest {
when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true); when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(nlf); when(mNm.getListenerFilter(mCn, 0)).thenReturn(nlf);
CheckBoxPreference pref = new CheckBoxPreference(mContext); AppCheckBoxPreference pref = new AppCheckBoxPreference(mContext);
pref.setKey("pkg|567"); pref.setKey("pkg|567");
mController.onPreferenceChange(pref, false); mController.onPreferenceChange(pref, false);
@@ -204,7 +204,7 @@ public class BridgedAppsPreferenceControllerTest {
when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true); when(mNm.isNotificationListenerAccessGranted(mCn)).thenReturn(true);
when(mNm.getListenerFilter(mCn, 0)).thenReturn(nlf); when(mNm.getListenerFilter(mCn, 0)).thenReturn(nlf);
CheckBoxPreference pref = new CheckBoxPreference(mContext); AppCheckBoxPreference pref = new AppCheckBoxPreference(mContext);
pref.setKey("pkg|567"); pref.setKey("pkg|567");
mController.onPreferenceChange(pref, true); mController.onPreferenceChange(pref, true);