Fix the flashing list on Opening link page
The bottom list flashes because it takes some time to create a DomainAppPreference, where each perference takes around 6ms to load an icon. When there are, that say, 30 apps installed, then it will take around 180ms to be ready, which introduces the flashing issue. In order to tackle icon loading, this CL applies the icon cache mechanism to speed up the loading time. Fixes: 222981986 Test: robotest Change-Id: Ia8f7cbf5af5ea9f694c352ea40ccca47bedb175c
This commit is contained in:
@@ -29,7 +29,6 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.verify.domain.DomainVerificationManager;
|
||||
import android.content.pm.verify.domain.DomainVerificationUserState;
|
||||
import android.util.IconDrawableFactory;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
@@ -49,18 +48,14 @@ public class DomainAppPreferenceControllerTest {
|
||||
|
||||
private ApplicationsState.AppEntry mAppEntry;
|
||||
private Context mContext;
|
||||
private IconDrawableFactory mIconDrawableFactory;
|
||||
|
||||
@Mock
|
||||
private DomainVerificationManager mDomainVerificationManager;
|
||||
@Mock
|
||||
private DomainVerificationUserState mDomainVerificationUserState;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
|
||||
mAppEntry = new ApplicationsState.AppEntry(
|
||||
mContext, createApplicationInfo(mContext.getPackageName()), 0);
|
||||
when(mContext.getSystemService(DomainVerificationManager.class)).thenReturn(
|
||||
@@ -75,8 +70,7 @@ public class DomainAppPreferenceControllerTest {
|
||||
doReturn(domainVerificationUserState).when(
|
||||
mDomainVerificationManager).getDomainVerificationUserState(anyString());
|
||||
doReturn(true).when(domainVerificationUserState).isLinkHandlingAllowed();
|
||||
final DomainAppPreference pref = new DomainAppPreference(
|
||||
mContext, mIconDrawableFactory, mAppEntry);
|
||||
final DomainAppPreference pref = new DomainAppPreference(mContext, mAppEntry);
|
||||
|
||||
assertThat(pref.getLayoutResource()).isEqualTo(R.layout.preference_app);
|
||||
}
|
||||
|
Reference in New Issue
Block a user