Apply a new icon cache mechanism for memory improvement
- Avoid loading all app icons at once to decrease memory usage. - Only load visible icons when entering the apps page. - Reserve icon placeholder to alleviate icon loading flicker. - Release icon cache when low memory or leaving apps page. Bug: 187118427 Bug: 209898662 Test: manual check the smoothness and memory usage of apps pages. Change-Id: Ifc3c2a73cc88d6e42739df4e8208445afa12e0ea
This commit is contained in:
@@ -20,6 +20,7 @@ import android.app.Application;
|
||||
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
||||
import com.android.settings.homepage.SettingsHomepageActivity;
|
||||
import com.android.settingslib.applications.AppIconCacheManager;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@@ -44,4 +45,10 @@ public class SettingsApplication extends Application {
|
||||
public SettingsHomepageActivity getHomeActivity() {
|
||||
return mHomeActivity.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
AppIconCacheManager.getInstance().release();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user