blob: 6c2aa397d334b3a8cbd8d6e69bfc1915df394f56 [file] [log] [blame]
Joe Onorato0589f0f2010-02-08 13:44:00 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Daniel Sandler325dc232013-06-05 22:57:57 -040017package com.android.launcher3;
Joe Onorato0589f0f2010-02-08 13:44:00 -080018
Winson Chungd83f5f42012-02-13 14:27:42 -080019import android.app.ActivityManager;
Joe Onorato0589f0f2010-02-08 13:44:00 -080020import android.content.ComponentName;
Sunny Goyal4fbc3822015-02-18 16:46:50 -080021import android.content.ContentValues;
Winson Chungd83f5f42012-02-13 14:27:42 -080022import android.content.Context;
Joe Onorato0589f0f2010-02-08 13:44:00 -080023import android.content.Intent;
Michael Jurkadac85912012-05-18 15:04:49 -070024import android.content.pm.ActivityInfo;
Sunny Goyal0fc1be12014-08-11 17:05:23 -070025import android.content.pm.ApplicationInfo;
Sunny Goyal4fbc3822015-02-18 16:46:50 -080026import android.content.pm.PackageInfo;
Joe Onorato0589f0f2010-02-08 13:44:00 -080027import android.content.pm.PackageManager;
Sunny Goyal0fc1be12014-08-11 17:05:23 -070028import android.content.pm.PackageManager.NameNotFoundException;
Michael Jurkac9a96192010-11-01 11:52:08 -070029import android.content.res.Resources;
Sunny Goyal4fbc3822015-02-18 16:46:50 -080030import android.database.Cursor;
31import android.database.sqlite.SQLiteDatabase;
32import android.database.sqlite.SQLiteOpenHelper;
Joe Onorato0589f0f2010-02-08 13:44:00 -080033import android.graphics.Bitmap;
Sunny Goyal34b65272015-03-11 16:56:52 -070034import android.graphics.BitmapFactory;
Romain Guya28fd3f2010-03-15 14:44:42 -070035import android.graphics.Canvas;
Joe Onorato0589f0f2010-02-08 13:44:00 -080036import android.graphics.drawable.Drawable;
Sunny Goyal34b65272015-03-11 16:56:52 -070037import android.os.Handler;
Sunny Goyal34942622014-08-29 17:20:55 -070038import android.text.TextUtils;
Chris Wren6d0dde02014-02-10 12:16:54 -050039import android.util.Log;
Joe Onorato0589f0f2010-02-08 13:44:00 -080040
Kenny Guyed131872014-04-30 03:02:21 +010041import com.android.launcher3.compat.LauncherActivityInfoCompat;
42import com.android.launcher3.compat.LauncherAppsCompat;
43import com.android.launcher3.compat.UserHandleCompat;
44import com.android.launcher3.compat.UserManagerCompat;
Sunny Goyalb4cd42a2015-03-16 14:10:24 -070045import com.android.launcher3.util.ComponentKey;
Adam Cohen091440a2015-03-18 14:16:05 -070046import com.android.launcher3.util.Thunk;
Hyunyoung Song3f471442015-04-08 19:01:34 -070047import com.android.launcher3.widget.PackageItemInfo;
Kenny Guyed131872014-04-30 03:02:21 +010048
Joe Onorato0589f0f2010-02-08 13:44:00 -080049import java.util.HashMap;
Chris Wren6d0dde02014-02-10 12:16:54 -050050import java.util.HashSet;
Adam Cohenb6d33df2013-10-15 10:18:02 -070051import java.util.Iterator;
Sunny Goyal4fbc3822015-02-18 16:46:50 -080052import java.util.List;
Sunny Goyal0c9a3542015-04-01 16:04:21 -070053import java.util.Locale;
Adam Cohenb6d33df2013-10-15 10:18:02 -070054import java.util.Map.Entry;
Joe Onorato0589f0f2010-02-08 13:44:00 -080055
56/**
57 * Cache of application icons. Icons can be made from any thread.
58 */
59public class IconCache {
Sunny Goyal0fc1be12014-08-11 17:05:23 -070060
Joe Onorato0589f0f2010-02-08 13:44:00 -080061 private static final String TAG = "Launcher.IconCache";
62
63 private static final int INITIAL_ICON_CACHE_CAPACITY = 50;
Chris Wren6d0dde02014-02-10 12:16:54 -050064
Sunny Goyal0fc1be12014-08-11 17:05:23 -070065 // Empty class name is used for storing package default entry.
66 private static final String EMPTY_CLASS_NAME = ".";
67
Sunny Goyalbbef77d2014-09-09 16:27:55 -070068 private static final boolean DEBUG = false;
Joe Onorato0589f0f2010-02-08 13:44:00 -080069
Sunny Goyal34b65272015-03-11 16:56:52 -070070 private static final int LOW_RES_SCALE_FACTOR = 8;
71
Adam Cohen091440a2015-03-18 14:16:05 -070072 @Thunk static class CacheEntry {
Joe Onorato0589f0f2010-02-08 13:44:00 -080073 public Bitmap icon;
Kenny Guyd6fe5262014-07-21 17:11:41 +010074 public CharSequence title;
75 public CharSequence contentDescription;
Sunny Goyal34b65272015-03-11 16:56:52 -070076 public boolean isLowResIcon;
Joe Onorato0589f0f2010-02-08 13:44:00 -080077 }
78
Sunny Goyal8758ea02015-03-18 10:07:49 -070079 private final HashMap<UserHandleCompat, Bitmap> mDefaultIcons = new HashMap<>();
80 private final MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor();
81
Daniel Sandlercc8befa2013-06-11 14:45:48 -040082 private final Context mContext;
Romain Guya28fd3f2010-03-15 14:44:42 -070083 private final PackageManager mPackageManager;
Kenny Guyed131872014-04-30 03:02:21 +010084 private final UserManagerCompat mUserManager;
85 private final LauncherAppsCompat mLauncherApps;
Sunny Goyalb4cd42a2015-03-16 14:10:24 -070086 private final HashMap<ComponentKey, CacheEntry> mCache =
87 new HashMap<ComponentKey, CacheEntry>(INITIAL_ICON_CACHE_CAPACITY);
Sunny Goyal4fbc3822015-02-18 16:46:50 -080088 private final int mIconDpi;
89 private final IconDB mIconDb;
Joe Onorato0589f0f2010-02-08 13:44:00 -080090
Sunny Goyal34b65272015-03-11 16:56:52 -070091 private final Handler mWorkerHandler;
92
Daniel Sandlercc8befa2013-06-11 14:45:48 -040093 public IconCache(Context context) {
Winson Chungd83f5f42012-02-13 14:27:42 -080094 ActivityManager activityManager =
95 (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
96
Joe Onorato0589f0f2010-02-08 13:44:00 -080097 mContext = context;
98 mPackageManager = context.getPackageManager();
Kenny Guyed131872014-04-30 03:02:21 +010099 mUserManager = UserManagerCompat.getInstance(mContext);
100 mLauncherApps = LauncherAppsCompat.getInstance(mContext);
Winson Chungd83f5f42012-02-13 14:27:42 -0800101 mIconDpi = activityManager.getLauncherLargeIconDensity();
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800102 mIconDb = new IconDB(context);
Sunny Goyal34b65272015-03-11 16:56:52 -0700103
Sunny Goyal756adbc2015-04-16 15:20:51 -0700104 mWorkerHandler = new Handler(LauncherModel.getWorkerLooper());
Romain Guya28fd3f2010-03-15 14:44:42 -0700105 }
106
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800107 private Drawable getFullResDefaultActivityIcon() {
Sunny Goyal736f5af2014-10-16 14:07:29 -0700108 return getFullResIcon(Resources.getSystem(), android.R.mipmap.sym_def_app_icon);
Michael Jurkac9a96192010-11-01 11:52:08 -0700109 }
110
Sunny Goyalb50cc8c2014-10-06 16:23:56 -0700111 private Drawable getFullResIcon(Resources resources, int iconId) {
Michael Jurka721d9722011-08-03 11:49:59 -0700112 Drawable d;
Michael Jurka4842ed02011-07-07 15:33:20 -0700113 try {
Michael Jurka721d9722011-08-03 11:49:59 -0700114 d = resources.getDrawableForDensity(iconId, mIconDpi);
Michael Jurka4842ed02011-07-07 15:33:20 -0700115 } catch (Resources.NotFoundException e) {
Michael Jurka721d9722011-08-03 11:49:59 -0700116 d = null;
Michael Jurka4842ed02011-07-07 15:33:20 -0700117 }
Michael Jurka721d9722011-08-03 11:49:59 -0700118
119 return (d != null) ? d : getFullResDefaultActivityIcon();
Michael Jurkac9a96192010-11-01 11:52:08 -0700120 }
121
Winson Chung0b9fcf52011-10-31 13:05:15 -0700122 public Drawable getFullResIcon(String packageName, int iconId) {
Michael Jurkac9a96192010-11-01 11:52:08 -0700123 Resources resources;
124 try {
Winson Chung0b9fcf52011-10-31 13:05:15 -0700125 resources = mPackageManager.getResourcesForApplication(packageName);
126 } catch (PackageManager.NameNotFoundException e) {
127 resources = null;
128 }
129 if (resources != null) {
130 if (iconId != 0) {
131 return getFullResIcon(resources, iconId);
132 }
133 }
134 return getFullResDefaultActivityIcon();
135 }
136
Sunny Goyalffe83f12014-08-14 17:39:34 -0700137 public int getFullResIconDpi() {
138 return mIconDpi;
139 }
140
Michael Jurkadac85912012-05-18 15:04:49 -0700141 public Drawable getFullResIcon(ActivityInfo info) {
Winson Chung0b9fcf52011-10-31 13:05:15 -0700142 Resources resources;
143 try {
144 resources = mPackageManager.getResourcesForApplication(
Michael Jurkadac85912012-05-18 15:04:49 -0700145 info.applicationInfo);
Michael Jurkac9a96192010-11-01 11:52:08 -0700146 } catch (PackageManager.NameNotFoundException e) {
147 resources = null;
148 }
149 if (resources != null) {
Michael Jurkadac85912012-05-18 15:04:49 -0700150 int iconId = info.getIconResource();
Michael Jurkac9a96192010-11-01 11:52:08 -0700151 if (iconId != 0) {
152 return getFullResIcon(resources, iconId);
153 }
154 }
Chris Wren6d0dde02014-02-10 12:16:54 -0500155
Michael Jurkac9a96192010-11-01 11:52:08 -0700156 return getFullResDefaultActivityIcon();
157 }
158
Kenny Guyed131872014-04-30 03:02:21 +0100159 private Bitmap makeDefaultIcon(UserHandleCompat user) {
160 Drawable unbadged = getFullResDefaultActivityIcon();
161 Drawable d = mUserManager.getBadgedDrawableForUser(unbadged, user);
Romain Guya28fd3f2010-03-15 14:44:42 -0700162 Bitmap b = Bitmap.createBitmap(Math.max(d.getIntrinsicWidth(), 1),
163 Math.max(d.getIntrinsicHeight(), 1),
164 Bitmap.Config.ARGB_8888);
165 Canvas c = new Canvas(b);
166 d.setBounds(0, 0, b.getWidth(), b.getHeight());
167 d.draw(c);
Adam Cohenaaf473c2011-08-03 12:02:47 -0700168 c.setBitmap(null);
Romain Guya28fd3f2010-03-15 14:44:42 -0700169 return b;
Joe Onorato0589f0f2010-02-08 13:44:00 -0800170 }
171
172 /**
173 * Remove any records for the supplied ComponentName.
174 */
Sunny Goyal736f5af2014-10-16 14:07:29 -0700175 public synchronized void remove(ComponentName componentName, UserHandleCompat user) {
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700176 mCache.remove(new ComponentKey(componentName, user));
Joe Onorato0589f0f2010-02-08 13:44:00 -0800177 }
178
179 /**
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800180 * Remove any records for the supplied package name from memory.
Chris Wren6d0dde02014-02-10 12:16:54 -0500181 */
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800182 private void removeFromMemCacheLocked(String packageName, UserHandleCompat user) {
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700183 HashSet<ComponentKey> forDeletion = new HashSet<ComponentKey>();
184 for (ComponentKey key: mCache.keySet()) {
Kenny Guyed131872014-04-30 03:02:21 +0100185 if (key.componentName.getPackageName().equals(packageName)
186 && key.user.equals(user)) {
187 forDeletion.add(key);
Chris Wren6d0dde02014-02-10 12:16:54 -0500188 }
189 }
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700190 for (ComponentKey condemned: forDeletion) {
Kenny Guyed131872014-04-30 03:02:21 +0100191 mCache.remove(condemned);
Chris Wren6d0dde02014-02-10 12:16:54 -0500192 }
193 }
194
195 /**
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800196 * Updates the entries related to the given package in memory and persistent DB.
197 */
198 public synchronized void updateIconsForPkg(String packageName, UserHandleCompat user) {
199 removeIconsForPkg(packageName, user);
200 try {
201 PackageInfo info = mPackageManager.getPackageInfo(packageName,
202 PackageManager.GET_UNINSTALLED_PACKAGES);
203 long userSerial = mUserManager.getSerialNumberForUser(user);
204 for (LauncherActivityInfoCompat app : mLauncherApps.getActivityList(packageName, user)) {
Sunny Goyald180cf72015-04-06 12:45:40 -0700205 addIconToDBAndMemCache(app, info, userSerial);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800206 }
207 } catch (NameNotFoundException e) {
208 Log.d(TAG, "Package not found", e);
209 return;
210 }
211 }
212
213 /**
214 * Removes the entries related to the given package in memory and persistent DB.
215 */
216 public synchronized void removeIconsForPkg(String packageName, UserHandleCompat user) {
217 removeFromMemCacheLocked(packageName, user);
218 long userSerial = mUserManager.getSerialNumberForUser(user);
219 mIconDb.getWritableDatabase().delete(IconDB.TABLE_NAME,
220 IconDB.COLUMN_COMPONENT + " LIKE ? AND " + IconDB.COLUMN_USER + " = ?",
221 new String[] {packageName + "/%", Long.toString(userSerial)});
222 }
223
224 /**
225 * Updates the persistent DB, such that only entries corresponding to {@param apps} remain in
226 * the DB and are updated.
227 * @return The set of packages for which icons have updated.
228 */
229 public HashSet<String> updateDBIcons(UserHandleCompat user, List<LauncherActivityInfoCompat> apps) {
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700230 mIconDb.updateSystemStateString(mContext);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800231 long userSerial = mUserManager.getSerialNumberForUser(user);
232 PackageManager pm = mContext.getPackageManager();
233 HashMap<String, PackageInfo> pkgInfoMap = new HashMap<String, PackageInfo>();
234 for (PackageInfo info : pm.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES)) {
235 pkgInfoMap.put(info.packageName, info);
236 }
237
238 HashMap<ComponentName, LauncherActivityInfoCompat> componentMap = new HashMap<>();
239 for (LauncherActivityInfoCompat app : apps) {
240 componentMap.put(app.getComponentName(), app);
241 }
242
243 Cursor c = mIconDb.getReadableDatabase().query(IconDB.TABLE_NAME,
244 new String[] {IconDB.COLUMN_ROWID, IconDB.COLUMN_COMPONENT,
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700245 IconDB.COLUMN_LAST_UPDATED, IconDB.COLUMN_VERSION,
246 IconDB.COLUMN_SYSTEM_STATE},
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800247 IconDB.COLUMN_USER + " = ? ",
248 new String[] {Long.toString(userSerial)},
249 null, null, null);
250
251 final int indexComponent = c.getColumnIndex(IconDB.COLUMN_COMPONENT);
252 final int indexLastUpdate = c.getColumnIndex(IconDB.COLUMN_LAST_UPDATED);
253 final int indexVersion = c.getColumnIndex(IconDB.COLUMN_VERSION);
254 final int rowIndex = c.getColumnIndex(IconDB.COLUMN_ROWID);
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700255 final int systemStateIndex = c.getColumnIndex(IconDB.COLUMN_SYSTEM_STATE);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800256
257 HashSet<Integer> itemsToRemove = new HashSet<Integer>();
258 HashSet<String> updatedPackages = new HashSet<String>();
259
260 while (c.moveToNext()) {
261 String cn = c.getString(indexComponent);
262 ComponentName component = ComponentName.unflattenFromString(cn);
263 PackageInfo info = pkgInfoMap.get(component.getPackageName());
264 if (info == null) {
265 itemsToRemove.add(c.getInt(rowIndex));
266 continue;
267 }
268 if ((info.applicationInfo.flags & ApplicationInfo.FLAG_IS_DATA_ONLY) != 0) {
269 // Application is not present
270 continue;
271 }
272
273 long updateTime = c.getLong(indexLastUpdate);
274 int version = c.getInt(indexVersion);
275 LauncherActivityInfoCompat app = componentMap.remove(component);
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700276 if (version == info.versionCode && updateTime == info.lastUpdateTime &&
277 TextUtils.equals(mIconDb.mSystemState, c.getString(systemStateIndex))) {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800278 continue;
279 }
280 if (app == null) {
281 itemsToRemove.add(c.getInt(rowIndex));
282 continue;
283 }
284 ContentValues values = updateCacheAndGetContentValues(app);
285 mIconDb.getWritableDatabase().update(IconDB.TABLE_NAME, values,
Sunny Goyalece6c8b2015-04-13 11:47:00 -0700286 IconDB.COLUMN_COMPONENT + " = ? AND " + IconDB.COLUMN_USER + " = ?",
287 new String[] {cn, Long.toString(userSerial)});
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800288
289 updatedPackages.add(component.getPackageName());
290 }
291 c.close();
292 if (!itemsToRemove.isEmpty()) {
293 mIconDb.getWritableDatabase().delete(IconDB.TABLE_NAME,
294 IconDB.COLUMN_ROWID + " IN ( " + TextUtils.join(", ", itemsToRemove) +" )",
295 null);
296 }
297
298 // Insert remaining apps.
299 for (LauncherActivityInfoCompat app : componentMap.values()) {
300 PackageInfo info = pkgInfoMap.get(app.getComponentName().getPackageName());
301 if (info == null) {
302 continue;
303 }
Sunny Goyald180cf72015-04-06 12:45:40 -0700304 addIconToDBAndMemCache(app, info, userSerial);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800305 }
306 return updatedPackages;
307 }
308
Sunny Goyald180cf72015-04-06 12:45:40 -0700309 private void addIconToDBAndMemCache(LauncherActivityInfoCompat app, PackageInfo info,
310 long userSerial) {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800311 ContentValues values = updateCacheAndGetContentValues(app);
Sunny Goyald180cf72015-04-06 12:45:40 -0700312 addIconToDB(values, app.getComponentName(), info, userSerial);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800313 values.put(IconDB.COLUMN_COMPONENT, app.getComponentName().flattenToString());
Sunny Goyald180cf72015-04-06 12:45:40 -0700314 }
315
316 /**
317 * Updates {@param values} to contain versoning information and adds it to the DB.
318 * @param values {@link ContentValues} containing icon & title
319 */
320 private void addIconToDB(ContentValues values, ComponentName key,
321 PackageInfo info, long userSerial) {
322 values.put(IconDB.COLUMN_COMPONENT, key.flattenToString());
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800323 values.put(IconDB.COLUMN_USER, userSerial);
324 values.put(IconDB.COLUMN_LAST_UPDATED, info.lastUpdateTime);
325 values.put(IconDB.COLUMN_VERSION, info.versionCode);
326 mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values,
327 SQLiteDatabase.CONFLICT_REPLACE);
328 }
329
330 private ContentValues updateCacheAndGetContentValues(LauncherActivityInfoCompat app) {
331 CacheEntry entry = new CacheEntry();
332 entry.icon = Utilities.createIconBitmap(app.getBadgedIcon(mIconDpi), mContext);
333 entry.title = app.getLabel();
334 entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser());
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700335 mCache.put(new ComponentKey(app.getComponentName(), app.getUser()), entry);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800336
Sunny Goyal34b65272015-03-11 16:56:52 -0700337 return mIconDb.newContentValues(entry.icon, entry.title.toString());
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800338 }
339
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800340 /**
Joe Onorato0589f0f2010-02-08 13:44:00 -0800341 * Empty out the cache.
342 */
Sunny Goyal736f5af2014-10-16 14:07:29 -0700343 public synchronized void flush() {
344 mCache.clear();
Joe Onorato0589f0f2010-02-08 13:44:00 -0800345 }
346
347 /**
Winson Chunge5467dc2013-10-14 17:03:04 -0700348 * Empty out the cache that aren't of the correct grid size
349 */
Sunny Goyal736f5af2014-10-16 14:07:29 -0700350 public synchronized void flushInvalidIcons(DeviceProfile grid) {
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700351 Iterator<Entry<ComponentKey, CacheEntry>> it = mCache.entrySet().iterator();
Sunny Goyal736f5af2014-10-16 14:07:29 -0700352 while (it.hasNext()) {
353 final CacheEntry e = it.next().getValue();
354 if ((e.icon != null) && (e.icon.getWidth() < grid.iconSizePx
355 || e.icon.getHeight() < grid.iconSizePx)) {
356 it.remove();
Winson Chunge5467dc2013-10-14 17:03:04 -0700357 }
358 }
359 }
360
361 /**
Sunny Goyal34b65272015-03-11 16:56:52 -0700362 * Fetches high-res icon for the provided ItemInfo and updates the caller when done.
363 * @return a request ID that can be used to cancel the request.
364 */
365 public IconLoadRequest updateIconInBackground(final BubbleTextView caller, final ItemInfo info) {
366 Runnable request = new Runnable() {
367
368 @Override
369 public void run() {
370 if (info instanceof AppInfo) {
371 getTitleAndIcon((AppInfo) info, null, false);
372 } else if (info instanceof ShortcutInfo) {
373 ShortcutInfo st = (ShortcutInfo) info;
374 getTitleAndIcon(st,
375 st.promisedIntent != null ? st.promisedIntent : st.intent,
376 st.user, false);
377 }
Sunny Goyal8758ea02015-03-18 10:07:49 -0700378 mMainThreadExecutor.execute(new Runnable() {
Sunny Goyal34b65272015-03-11 16:56:52 -0700379
380 @Override
381 public void run() {
382 caller.reapplyItemInfo(info);
383 }
384 });
385 }
386 };
387 mWorkerHandler.post(request);
388 return new IconLoadRequest(request, mWorkerHandler);
389 }
390
Sunny Goyal756adbc2015-04-16 15:20:51 -0700391 private Bitmap getNonNullIcon(CacheEntry entry, UserHandleCompat user) {
392 return entry.icon == null ? getDefaultIcon(user) : entry.icon;
393 }
394
Sunny Goyal34b65272015-03-11 16:56:52 -0700395 /**
Joe Onorato0589f0f2010-02-08 13:44:00 -0800396 * Fill in "application" with the icon and label for "info."
397 */
Sunny Goyal34b65272015-03-11 16:56:52 -0700398 public synchronized void getTitleAndIcon(AppInfo application,
399 LauncherActivityInfoCompat info, boolean useLowResIcon) {
Sunny Goyal756adbc2015-04-16 15:20:51 -0700400 UserHandleCompat user = info == null ? application.user : info.getUser();
401 CacheEntry entry = cacheLocked(application.componentName, info, user,
Sunny Goyal34b65272015-03-11 16:56:52 -0700402 false, useLowResIcon);
Sunny Goyal736f5af2014-10-16 14:07:29 -0700403 application.title = entry.title;
Sunny Goyal756adbc2015-04-16 15:20:51 -0700404 application.iconBitmap = getNonNullIcon(entry, user);
Sunny Goyal736f5af2014-10-16 14:07:29 -0700405 application.contentDescription = entry.contentDescription;
Sunny Goyal34b65272015-03-11 16:56:52 -0700406 application.usingLowResIcon = entry.isLowResIcon;
Joe Onorato0589f0f2010-02-08 13:44:00 -0800407 }
408
Sunny Goyal34b65272015-03-11 16:56:52 -0700409 /**
Sunny Goyal77919b92015-05-06 16:53:21 -0700410 * Updates {@param application} only if a valid entry is found.
411 */
412 public synchronized void updateTitleAndIcon(AppInfo application) {
413 CacheEntry entry = cacheLocked(application.componentName, null, application.user,
414 false, application.usingLowResIcon);
415 if (entry.icon != null && !isDefaultIcon(entry.icon, application.user)) {
416 application.title = entry.title;
417 application.iconBitmap = entry.icon;
418 application.contentDescription = entry.contentDescription;
419 application.usingLowResIcon = entry.isLowResIcon;
420 }
421 }
422
423 /**
Sunny Goyal34b65272015-03-11 16:56:52 -0700424 * Returns a high res icon for the given intent and user
425 */
Sunny Goyal736f5af2014-10-16 14:07:29 -0700426 public synchronized Bitmap getIcon(Intent intent, UserHandleCompat user) {
427 ComponentName component = intent.getComponent();
428 // null info means not installed, but if we have a component from the intent then
429 // we should still look in the cache for restored app icons.
430 if (component == null) {
431 return getDefaultIcon(user);
Joe Onorato0589f0f2010-02-08 13:44:00 -0800432 }
Sunny Goyal736f5af2014-10-16 14:07:29 -0700433
434 LauncherActivityInfoCompat launcherActInfo = mLauncherApps.resolveActivity(intent, user);
Sunny Goyal34b65272015-03-11 16:56:52 -0700435 CacheEntry entry = cacheLocked(component, launcherActInfo, user, true, true);
Sunny Goyal736f5af2014-10-16 14:07:29 -0700436 return entry.icon;
Joe Onorato0589f0f2010-02-08 13:44:00 -0800437 }
438
Sunny Goyal34942622014-08-29 17:20:55 -0700439 /**
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800440 * Fill in {@param shortcutInfo} with the icon and label for {@param intent}. If the
441 * corresponding activity is not found, it reverts to the package icon.
Sunny Goyal34942622014-08-29 17:20:55 -0700442 */
Sunny Goyal736f5af2014-10-16 14:07:29 -0700443 public synchronized void getTitleAndIcon(ShortcutInfo shortcutInfo, Intent intent,
Sunny Goyal34b65272015-03-11 16:56:52 -0700444 UserHandleCompat user, boolean useLowResIcon) {
Sunny Goyal736f5af2014-10-16 14:07:29 -0700445 ComponentName component = intent.getComponent();
446 // null info means not installed, but if we have a component from the intent then
447 // we should still look in the cache for restored app icons.
448 if (component == null) {
449 shortcutInfo.setIcon(getDefaultIcon(user));
450 shortcutInfo.title = "";
451 shortcutInfo.usingFallbackIcon = true;
Sunny Goyal34b65272015-03-11 16:56:52 -0700452 shortcutInfo.usingLowResIcon = false;
Sunny Goyal736f5af2014-10-16 14:07:29 -0700453 } else {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800454 LauncherActivityInfoCompat info = mLauncherApps.resolveActivity(intent, user);
Sunny Goyal34b65272015-03-11 16:56:52 -0700455 getTitleAndIcon(shortcutInfo, component, info, user, true, useLowResIcon);
Sunny Goyal34942622014-08-29 17:20:55 -0700456 }
457 }
458
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800459 /**
460 * Fill in {@param shortcutInfo} with the icon and label for {@param info}
461 */
462 public synchronized void getTitleAndIcon(
463 ShortcutInfo shortcutInfo, ComponentName component, LauncherActivityInfoCompat info,
Sunny Goyal34b65272015-03-11 16:56:52 -0700464 UserHandleCompat user, boolean usePkgIcon, boolean useLowResIcon) {
465 CacheEntry entry = cacheLocked(component, info, user, usePkgIcon, useLowResIcon);
Sunny Goyal756adbc2015-04-16 15:20:51 -0700466 shortcutInfo.setIcon(getNonNullIcon(entry, user));
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800467 shortcutInfo.title = entry.title;
468 shortcutInfo.usingFallbackIcon = isDefaultIcon(entry.icon, user);
Sunny Goyal34b65272015-03-11 16:56:52 -0700469 shortcutInfo.usingLowResIcon = entry.isLowResIcon;
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800470 }
Sunny Goyal34942622014-08-29 17:20:55 -0700471
Sunny Goyald180cf72015-04-06 12:45:40 -0700472 /**
473 * Fill in {@param appInfo} with the icon and label for {@param packageName}
474 */
475 public synchronized void getTitleAndIconForApp(
Hyunyoung Song3f471442015-04-08 19:01:34 -0700476 String packageName, UserHandleCompat user, boolean useLowResIcon,
477 PackageItemInfo infoOut) {
Sunny Goyald180cf72015-04-06 12:45:40 -0700478 CacheEntry entry = getEntryForPackageLocked(packageName, user, useLowResIcon);
Sunny Goyal756adbc2015-04-16 15:20:51 -0700479 infoOut.iconBitmap = getNonNullIcon(entry, user);
Hyunyoung Song3f471442015-04-08 19:01:34 -0700480 infoOut.title = entry.title;
481 infoOut.usingLowResIcon = entry.isLowResIcon;
482 infoOut.contentDescription = entry.contentDescription;
Sunny Goyald180cf72015-04-06 12:45:40 -0700483 }
484
Sunny Goyal736f5af2014-10-16 14:07:29 -0700485 public synchronized Bitmap getDefaultIcon(UserHandleCompat user) {
Kenny Guyed131872014-04-30 03:02:21 +0100486 if (!mDefaultIcons.containsKey(user)) {
487 mDefaultIcons.put(user, makeDefaultIcon(user));
488 }
489 return mDefaultIcons.get(user);
490 }
491
Kenny Guyed131872014-04-30 03:02:21 +0100492 public boolean isDefaultIcon(Bitmap icon, UserHandleCompat user) {
493 return mDefaultIcons.get(user) == icon;
Joe Onoratoddc9c1f2010-08-30 18:30:15 -0700494 }
495
Sunny Goyal736f5af2014-10-16 14:07:29 -0700496 /**
497 * Retrieves the entry from the cache. If the entry is not present, it creates a new entry.
498 * This method is not thread safe, it must be called from a synchronized method.
499 */
Kenny Guyed131872014-04-30 03:02:21 +0100500 private CacheEntry cacheLocked(ComponentName componentName, LauncherActivityInfoCompat info,
Sunny Goyal34b65272015-03-11 16:56:52 -0700501 UserHandleCompat user, boolean usePackageIcon, boolean useLowResIcon) {
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700502 ComponentKey cacheKey = new ComponentKey(componentName, user);
Kenny Guyed131872014-04-30 03:02:21 +0100503 CacheEntry entry = mCache.get(cacheKey);
Sunny Goyal34b65272015-03-11 16:56:52 -0700504 if (entry == null || (entry.isLowResIcon && !useLowResIcon)) {
Joe Onorato0589f0f2010-02-08 13:44:00 -0800505 entry = new CacheEntry();
Kenny Guyed131872014-04-30 03:02:21 +0100506 mCache.put(cacheKey, entry);
Joe Onorato84f6a8d2010-02-12 17:53:35 -0500507
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800508 // Check the DB first.
Sunny Goyal34b65272015-03-11 16:56:52 -0700509 if (!getEntryFromDB(componentName, user, entry, useLowResIcon)) {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800510 if (info != null) {
511 entry.icon = Utilities.createIconBitmap(info.getBadgedIcon(mIconDpi), mContext);
Chris Wren6d0dde02014-02-10 12:16:54 -0500512 } else {
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700513 if (usePackageIcon) {
Sunny Goyald180cf72015-04-06 12:45:40 -0700514 CacheEntry packageEntry = getEntryForPackageLocked(
515 componentName.getPackageName(), user, false);
Sunny Goyal34942622014-08-29 17:20:55 -0700516 if (packageEntry != null) {
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700517 if (DEBUG) Log.d(TAG, "using package default icon for " +
518 componentName.toShortString());
519 entry.icon = packageEntry.icon;
Sunny Goyal34942622014-08-29 17:20:55 -0700520 entry.title = packageEntry.title;
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800521 entry.contentDescription = packageEntry.contentDescription;
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700522 }
523 }
524 if (entry.icon == null) {
525 if (DEBUG) Log.d(TAG, "using default icon for " +
526 componentName.toShortString());
527 entry.icon = getDefaultIcon(user);
528 }
Winson Chungc3eecff2011-07-11 17:44:15 -0700529 }
530 }
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800531
532 if (TextUtils.isEmpty(entry.title) && info != null) {
533 entry.title = info.getLabel().toString();
534 entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
535 }
Joe Onorato0589f0f2010-02-08 13:44:00 -0800536 }
537 return entry;
538 }
Daniel Sandler4e1cd232011-05-12 00:06:32 -0400539
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700540 /**
Sunny Goyal34942622014-08-29 17:20:55 -0700541 * Adds a default package entry in the cache. This entry is not persisted and will be removed
542 * when the cache is flushed.
543 */
Sunny Goyal736f5af2014-10-16 14:07:29 -0700544 public synchronized void cachePackageInstallInfo(String packageName, UserHandleCompat user,
Sunny Goyal34942622014-08-29 17:20:55 -0700545 Bitmap icon, CharSequence title) {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800546 removeFromMemCacheLocked(packageName, user);
Sunny Goyala22666f2014-09-18 13:25:15 -0700547
Sunny Goyald180cf72015-04-06 12:45:40 -0700548 CacheEntry entry = getEntryForPackageLocked(packageName, user, false);
Sunny Goyal34942622014-08-29 17:20:55 -0700549 if (!TextUtils.isEmpty(title)) {
550 entry.title = title;
551 }
552 if (icon != null) {
Sunny Goyal2fce90c2014-10-07 12:01:58 -0700553 entry.icon = Utilities.createIconBitmap(icon, mContext);
Sunny Goyal34942622014-08-29 17:20:55 -0700554 }
555 }
556
557 /**
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700558 * Gets an entry for the package, which can be used as a fallback entry for various components.
Sunny Goyal736f5af2014-10-16 14:07:29 -0700559 * This method is not thread safe, it must be called from a synchronized method.
Sunny Goyald180cf72015-04-06 12:45:40 -0700560 *
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700561 */
Sunny Goyald180cf72015-04-06 12:45:40 -0700562 private CacheEntry getEntryForPackageLocked(String packageName, UserHandleCompat user,
563 boolean useLowResIcon) {
564 ComponentName cn = new ComponentName(packageName, EMPTY_CLASS_NAME);
Sunny Goyalb4cd42a2015-03-16 14:10:24 -0700565 ComponentKey cacheKey = new ComponentKey(cn, user);
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700566 CacheEntry entry = mCache.get(cacheKey);
Sunny Goyald180cf72015-04-06 12:45:40 -0700567 if (entry == null || (entry.isLowResIcon && !useLowResIcon)) {
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700568 entry = new CacheEntry();
569 mCache.put(cacheKey, entry);
570
Sunny Goyald180cf72015-04-06 12:45:40 -0700571 // Check the DB first.
572 if (!getEntryFromDB(cn, user, entry, useLowResIcon)) {
573 try {
574 PackageInfo info = mPackageManager.getPackageInfo(packageName, 0);
575 ApplicationInfo appInfo = info.applicationInfo;
576 if (appInfo == null) {
577 throw new NameNotFoundException("ApplicationInfo is null");
578 }
579 Drawable drawable = mUserManager.getBadgedDrawableForUser(
580 appInfo.loadIcon(mPackageManager), user);
581 entry.icon = Utilities.createIconBitmap(drawable, mContext);
582 entry.title = appInfo.loadLabel(mPackageManager);
583 entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
584 entry.isLowResIcon = false;
585
586 // Add the icon in the DB here, since these do not get written during
587 // package updates.
588 ContentValues values =
589 mIconDb.newContentValues(entry.icon, entry.title.toString());
590 addIconToDB(values, cn, info, mUserManager.getSerialNumberForUser(user));
591
592 } catch (NameNotFoundException e) {
593 if (DEBUG) Log.d(TAG, "Application not installed " + packageName);
594 }
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700595 }
Sunny Goyal0fc1be12014-08-11 17:05:23 -0700596 }
597 return entry;
598 }
599
Chris Wren6d0dde02014-02-10 12:16:54 -0500600 /**
601 * Pre-load an icon into the persistent cache.
602 *
603 * <P>Queries for a component that does not exist in the package manager
604 * will be answered by the persistent cache.
605 *
Chris Wren6d0dde02014-02-10 12:16:54 -0500606 * @param componentName the icon should be returned for this component
607 * @param icon the icon to be persisted
608 * @param dpi the native density of the icon
609 */
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800610 public void preloadIcon(ComponentName componentName, Bitmap icon, int dpi, String label,
611 long userSerial) {
Chris Wren6d0dde02014-02-10 12:16:54 -0500612 // TODO rescale to the correct native DPI
613 try {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800614 PackageManager packageManager = mContext.getPackageManager();
Chris Wren6d0dde02014-02-10 12:16:54 -0500615 packageManager.getActivityIcon(componentName);
616 // component is present on the system already, do nothing
617 return;
618 } catch (PackageManager.NameNotFoundException e) {
619 // pass
620 }
621
Sunny Goyal34b65272015-03-11 16:56:52 -0700622 ContentValues values = mIconDb.newContentValues(icon, label);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800623 values.put(IconDB.COLUMN_COMPONENT, componentName.flattenToString());
624 values.put(IconDB.COLUMN_USER, userSerial);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800625 mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values,
626 SQLiteDatabase.CONFLICT_REPLACE);
627 }
628
Sunny Goyal34b65272015-03-11 16:56:52 -0700629 private boolean getEntryFromDB(ComponentName component, UserHandleCompat user,
630 CacheEntry entry, boolean lowRes) {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800631 Cursor c = mIconDb.getReadableDatabase().query(IconDB.TABLE_NAME,
Sunny Goyal34b65272015-03-11 16:56:52 -0700632 new String[] {lowRes ? IconDB.COLUMN_ICON_LOW_RES : IconDB.COLUMN_ICON,
633 IconDB.COLUMN_LABEL},
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800634 IconDB.COLUMN_COMPONENT + " = ? AND " + IconDB.COLUMN_USER + " = ?",
635 new String[] {component.flattenToString(),
636 Long.toString(mUserManager.getSerialNumberForUser(user))},
637 null, null, null);
Chris Wren6d0dde02014-02-10 12:16:54 -0500638 try {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800639 if (c.moveToNext()) {
Sunny Goyal34b65272015-03-11 16:56:52 -0700640 entry.icon = loadIconNoResize(c, 0);
641 entry.isLowResIcon = lowRes;
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800642 entry.title = c.getString(1);
643 if (entry.title == null) {
644 entry.title = "";
645 entry.contentDescription = "";
646 } else {
647 entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
Chris Wren6d0dde02014-02-10 12:16:54 -0500648 }
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800649 return true;
Chris Wren6d0dde02014-02-10 12:16:54 -0500650 }
Chris Wren6d0dde02014-02-10 12:16:54 -0500651 } finally {
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800652 c.close();
653 }
654 return false;
655 }
656
Sunny Goyal34b65272015-03-11 16:56:52 -0700657 public static class IconLoadRequest {
658 private final Runnable mRunnable;
659 private final Handler mHandler;
660
661 IconLoadRequest(Runnable runnable, Handler handler) {
662 mRunnable = runnable;
663 mHandler = handler;
664 }
665
666 public void cancel() {
667 mHandler.removeCallbacks(mRunnable);
668 }
669 }
670
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800671 private static final class IconDB extends SQLiteOpenHelper {
Sunny Goyal77919b92015-05-06 16:53:21 -0700672 private final static int DB_VERSION = 4;
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800673
674 private final static String TABLE_NAME = "icons";
675 private final static String COLUMN_ROWID = "rowid";
676 private final static String COLUMN_COMPONENT = "componentName";
677 private final static String COLUMN_USER = "profileId";
678 private final static String COLUMN_LAST_UPDATED = "lastUpdated";
679 private final static String COLUMN_VERSION = "version";
680 private final static String COLUMN_ICON = "icon";
Sunny Goyal34b65272015-03-11 16:56:52 -0700681 private final static String COLUMN_ICON_LOW_RES = "icon_low_res";
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800682 private final static String COLUMN_LABEL = "label";
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700683 private final static String COLUMN_SYSTEM_STATE = "system_state";
684
685 public String mSystemState;
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800686
687 public IconDB(Context context) {
688 super(context, LauncherFiles.APP_ICONS_DB, null, DB_VERSION);
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700689 updateSystemStateString(context);
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800690 }
691
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700692 public void updateSystemStateString(Context c) {
693 mSystemState = Locale.getDefault().toString() + ","
694 + c.getResources().getConfiguration().mcc;
695 }
696
697
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800698 @Override
699 public void onCreate(SQLiteDatabase db) {
700 db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
701 COLUMN_COMPONENT + " TEXT NOT NULL, " +
702 COLUMN_USER + " INTEGER NOT NULL, " +
703 COLUMN_LAST_UPDATED + " INTEGER NOT NULL DEFAULT 0, " +
704 COLUMN_VERSION + " INTEGER NOT NULL DEFAULT 0, " +
705 COLUMN_ICON + " BLOB, " +
Sunny Goyal34b65272015-03-11 16:56:52 -0700706 COLUMN_ICON_LOW_RES + " BLOB, " +
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800707 COLUMN_LABEL + " TEXT, " +
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700708 COLUMN_SYSTEM_STATE + " TEXT, " +
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800709 "PRIMARY KEY (" + COLUMN_COMPONENT + ", " + COLUMN_USER + ") " +
710 ");");
711 }
712
713 @Override
714 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
715 if (oldVersion != newVersion) {
716 clearDB(db);
Chris Wren6d0dde02014-02-10 12:16:54 -0500717 }
718 }
719
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800720 @Override
721 public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
722 if (oldVersion != newVersion) {
723 clearDB(db);
724 }
Kenny Guyed131872014-04-30 03:02:21 +0100725 }
Chris Wren6d0dde02014-02-10 12:16:54 -0500726
Sunny Goyal4fbc3822015-02-18 16:46:50 -0800727 private void clearDB(SQLiteDatabase db) {
728 db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
729 onCreate(db);
730 }
Sunny Goyal34b65272015-03-11 16:56:52 -0700731
732 public ContentValues newContentValues(Bitmap icon, String label) {
733 ContentValues values = new ContentValues();
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700734 values.put(COLUMN_ICON, Utilities.flattenBitmap(icon));
735 values.put(COLUMN_ICON_LOW_RES, Utilities.flattenBitmap(
Sunny Goyal34b65272015-03-11 16:56:52 -0700736 Bitmap.createScaledBitmap(icon,
737 icon.getWidth() / LOW_RES_SCALE_FACTOR,
738 icon.getHeight() / LOW_RES_SCALE_FACTOR, true)));
Sunny Goyal0c9a3542015-04-01 16:04:21 -0700739 values.put(COLUMN_LABEL, label);
740 values.put(COLUMN_SYSTEM_STATE, mSystemState);
Sunny Goyal34b65272015-03-11 16:56:52 -0700741 return values;
742 }
743 }
744
745 private static Bitmap loadIconNoResize(Cursor c, int iconIndex) {
746 byte[] data = c.getBlob(iconIndex);
747 try {
748 return BitmapFactory.decodeByteArray(data, 0, data.length);
749 } catch (Exception e) {
750 return null;
751 }
Chris Wren6d0dde02014-02-10 12:16:54 -0500752 }
Joe Onorato0589f0f2010-02-08 13:44:00 -0800753}