Merge "Move icon loading into AppEntryListManager." into pi-car-dev
diff --git a/src/com/android/car/settings/applications/specialaccess/AppEntryListManager.java b/src/com/android/car/settings/applications/specialaccess/AppEntryListManager.java
index 1039a74..7359f80 100644
--- a/src/com/android/car/settings/applications/specialaccess/AppEntryListManager.java
+++ b/src/com/android/car/settings/applications/specialaccess/AppEntryListManager.java
@@ -219,6 +219,15 @@
mMainHandler.removeMessages(MainHandler.MSG_INFO_UPDATED);
}
+ private void loadInfo(List<ApplicationsState.AppEntry> entries) {
+ if (mExtraInfoBridge != null) {
+ mExtraInfoBridge.loadExtraInfo(entries);
+ }
+ for (ApplicationsState.AppEntry entry : entries) {
+ mApplicationsState.ensureIcon(entry);
+ }
+ }
+
private static class BackgroundHandler extends Handler {
private static final int MSG_LOAD_ALL = 1;
private static final int MSG_LOAD_PKG = 2;
@@ -238,16 +247,12 @@
}
switch (msg.what) {
case MSG_LOAD_ALL:
- if (outer.mExtraInfoBridge != null) {
- outer.mExtraInfoBridge.loadExtraInfo(outer.mSession.getAllApps());
- }
+ outer.loadInfo(outer.mSession.getAllApps());
outer.mMainHandler.sendEmptyMessage(MainHandler.MSG_INFO_UPDATED);
break;
case MSG_LOAD_PKG:
ApplicationsState.AppEntry entry = (ApplicationsState.AppEntry) msg.obj;
- if (outer.mExtraInfoBridge != null) {
- outer.mExtraInfoBridge.loadExtraInfo(Collections.singletonList(entry));
- }
+ outer.loadInfo(Collections.singletonList(entry));
outer.mMainHandler.sendEmptyMessage(MainHandler.MSG_INFO_UPDATED);
break;
}
diff --git a/src/com/android/car/settings/applications/specialaccess/AppOpsPreferenceController.java b/src/com/android/car/settings/applications/specialaccess/AppOpsPreferenceController.java
index 2ce7aac..043aec9 100644
--- a/src/com/android/car/settings/applications/specialaccess/AppOpsPreferenceController.java
+++ b/src/com/android/car/settings/applications/specialaccess/AppOpsPreferenceController.java
@@ -17,7 +17,6 @@
package com.android.car.settings.applications.specialaccess;
import android.app.AppOpsManager;
-import android.app.Application;
import android.car.drivingstate.CarUxRestrictions;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -61,7 +60,6 @@
};
private final AppOpsManager mAppOpsManager;
- private final ApplicationsState mApplicationsState;
private final Preference.OnPreferenceChangeListener mOnPreferenceChangeListener =
new Preference.OnPreferenceChangeListener() {
@@ -105,8 +103,6 @@
FragmentController fragmentController, CarUxRestrictions uxRestrictions) {
super(context, preferenceKey, fragmentController, uxRestrictions);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
- mApplicationsState = ApplicationsState.getInstance(
- (Application) context.getApplicationContext());
mAppEntryListManager = new AppEntryListManager(context);
}
@@ -185,7 +181,6 @@
}
preference.removeAll();
for (AppEntry entry : mEntries) {
- mApplicationsState.ensureIcon(entry);
Preference appOpPreference = new AppOpPreference(getContext(), entry);
appOpPreference.setOnPreferenceChangeListener(mOnPreferenceChangeListener);
preference.addPreference(appOpPreference);
diff --git a/src/com/android/car/settings/applications/specialaccess/PremiumSmsAccessPreferenceController.java b/src/com/android/car/settings/applications/specialaccess/PremiumSmsAccessPreferenceController.java
index b62f9d7..1673dcb 100644
--- a/src/com/android/car/settings/applications/specialaccess/PremiumSmsAccessPreferenceController.java
+++ b/src/com/android/car/settings/applications/specialaccess/PremiumSmsAccessPreferenceController.java
@@ -16,7 +16,6 @@
package com.android.car.settings.applications.specialaccess;
-import android.app.Application;
import android.car.drivingstate.CarUxRestrictions;
import android.content.Context;
import android.os.RemoteException;
@@ -33,7 +32,6 @@
import com.android.car.settings.common.PreferenceController;
import com.android.internal.telephony.ISms;
import com.android.internal.telephony.SmsUsageMonitor;
-import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.applications.ApplicationsState.AppFilter;
@@ -67,7 +65,6 @@
};
private final ISms mSmsManager;
- private final ApplicationsState mApplicationsState;
private final Preference.OnPreferenceChangeListener mOnPreferenceChangeListener =
new Preference.OnPreferenceChangeListener() {
@@ -108,8 +105,6 @@
FragmentController fragmentController, CarUxRestrictions uxRestrictions) {
super(context, preferenceKey, fragmentController, uxRestrictions);
mSmsManager = ISms.Stub.asInterface(ServiceManager.getService("isms"));
- mApplicationsState = ApplicationsState.getInstance(
- (Application) context.getApplicationContext());
mAppEntryListManager = new AppEntryListManager(context);
}
@@ -147,7 +142,6 @@
}
preference.removeAll();
for (AppEntry entry : mEntries) {
- mApplicationsState.ensureIcon(entry);
Preference appPreference = new PremiumSmsPreference(getContext(), entry);
appPreference.setOnPreferenceChangeListener(mOnPreferenceChangeListener);
preference.addPreference(appPreference);