Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 1 | /* |
| 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 Sandler | 325dc23 | 2013-06-05 22:57:57 -0400 | [diff] [blame] | 17 | package com.android.launcher3; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 18 | |
Winson Chung | d83f5f4 | 2012-02-13 14:27:42 -0800 | [diff] [blame] | 19 | import android.app.ActivityManager; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 20 | import android.content.ComponentName; |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 21 | import android.content.ContentValues; |
Winson Chung | d83f5f4 | 2012-02-13 14:27:42 -0800 | [diff] [blame] | 22 | import android.content.Context; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 23 | import android.content.Intent; |
Michael Jurka | dac8591 | 2012-05-18 15:04:49 -0700 | [diff] [blame] | 24 | import android.content.pm.ActivityInfo; |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 25 | import android.content.pm.ApplicationInfo; |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 26 | import android.content.pm.PackageInfo; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 27 | import android.content.pm.PackageManager; |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 28 | import android.content.pm.PackageManager.NameNotFoundException; |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 29 | import android.content.res.Resources; |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 30 | import android.database.Cursor; |
| 31 | import android.database.sqlite.SQLiteDatabase; |
| 32 | import android.database.sqlite.SQLiteOpenHelper; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 33 | import android.graphics.Bitmap; |
Romain Guy | a28fd3f | 2010-03-15 14:44:42 -0700 | [diff] [blame] | 34 | import android.graphics.Canvas; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 35 | import android.graphics.drawable.Drawable; |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 36 | import android.text.TextUtils; |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 37 | import android.util.Log; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 38 | |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 39 | import com.android.launcher3.compat.LauncherActivityInfoCompat; |
| 40 | import com.android.launcher3.compat.LauncherAppsCompat; |
| 41 | import com.android.launcher3.compat.UserHandleCompat; |
| 42 | import com.android.launcher3.compat.UserManagerCompat; |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 43 | import com.android.launcher3.util.ComponentKey; |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 44 | |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 45 | import java.util.HashMap; |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 46 | import java.util.HashSet; |
Adam Cohen | b6d33df | 2013-10-15 10:18:02 -0700 | [diff] [blame] | 47 | import java.util.Iterator; |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 48 | import java.util.List; |
Adam Cohen | b6d33df | 2013-10-15 10:18:02 -0700 | [diff] [blame] | 49 | import java.util.Map.Entry; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * Cache of application icons. Icons can be made from any thread. |
| 53 | */ |
| 54 | public class IconCache { |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 55 | |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 56 | private static final String TAG = "Launcher.IconCache"; |
| 57 | |
| 58 | private static final int INITIAL_ICON_CACHE_CAPACITY = 50; |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 59 | |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 60 | // Empty class name is used for storing package default entry. |
| 61 | private static final String EMPTY_CLASS_NAME = "."; |
| 62 | |
Sunny Goyal | bbef77d | 2014-09-09 16:27:55 -0700 | [diff] [blame] | 63 | private static final boolean DEBUG = false; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 64 | |
| 65 | private static class CacheEntry { |
| 66 | public Bitmap icon; |
Kenny Guy | d6fe526 | 2014-07-21 17:11:41 +0100 | [diff] [blame] | 67 | public CharSequence title; |
| 68 | public CharSequence contentDescription; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 69 | } |
| 70 | |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 71 | private final HashMap<UserHandleCompat, Bitmap> mDefaultIcons = |
| 72 | new HashMap<UserHandleCompat, Bitmap>(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 73 | private final Context mContext; |
Romain Guy | a28fd3f | 2010-03-15 14:44:42 -0700 | [diff] [blame] | 74 | private final PackageManager mPackageManager; |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 75 | private final UserManagerCompat mUserManager; |
| 76 | private final LauncherAppsCompat mLauncherApps; |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 77 | private final HashMap<ComponentKey, CacheEntry> mCache = |
| 78 | new HashMap<ComponentKey, CacheEntry>(INITIAL_ICON_CACHE_CAPACITY); |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 79 | private final int mIconDpi; |
| 80 | private final IconDB mIconDb; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 81 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 82 | public IconCache(Context context) { |
Winson Chung | d83f5f4 | 2012-02-13 14:27:42 -0800 | [diff] [blame] | 83 | ActivityManager activityManager = |
| 84 | (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
| 85 | |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 86 | mContext = context; |
| 87 | mPackageManager = context.getPackageManager(); |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 88 | mUserManager = UserManagerCompat.getInstance(mContext); |
| 89 | mLauncherApps = LauncherAppsCompat.getInstance(mContext); |
Winson Chung | d83f5f4 | 2012-02-13 14:27:42 -0800 | [diff] [blame] | 90 | mIconDpi = activityManager.getLauncherLargeIconDensity(); |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 91 | mIconDb = new IconDB(context); |
Romain Guy | a28fd3f | 2010-03-15 14:44:42 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 94 | private Drawable getFullResDefaultActivityIcon() { |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 95 | return getFullResIcon(Resources.getSystem(), android.R.mipmap.sym_def_app_icon); |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 96 | } |
| 97 | |
Sunny Goyal | b50cc8c | 2014-10-06 16:23:56 -0700 | [diff] [blame] | 98 | private Drawable getFullResIcon(Resources resources, int iconId) { |
Michael Jurka | 721d972 | 2011-08-03 11:49:59 -0700 | [diff] [blame] | 99 | Drawable d; |
Michael Jurka | 4842ed0 | 2011-07-07 15:33:20 -0700 | [diff] [blame] | 100 | try { |
Michael Jurka | 721d972 | 2011-08-03 11:49:59 -0700 | [diff] [blame] | 101 | d = resources.getDrawableForDensity(iconId, mIconDpi); |
Michael Jurka | 4842ed0 | 2011-07-07 15:33:20 -0700 | [diff] [blame] | 102 | } catch (Resources.NotFoundException e) { |
Michael Jurka | 721d972 | 2011-08-03 11:49:59 -0700 | [diff] [blame] | 103 | d = null; |
Michael Jurka | 4842ed0 | 2011-07-07 15:33:20 -0700 | [diff] [blame] | 104 | } |
Michael Jurka | 721d972 | 2011-08-03 11:49:59 -0700 | [diff] [blame] | 105 | |
| 106 | return (d != null) ? d : getFullResDefaultActivityIcon(); |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Winson Chung | 0b9fcf5 | 2011-10-31 13:05:15 -0700 | [diff] [blame] | 109 | public Drawable getFullResIcon(String packageName, int iconId) { |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 110 | Resources resources; |
| 111 | try { |
Winson Chung | 0b9fcf5 | 2011-10-31 13:05:15 -0700 | [diff] [blame] | 112 | resources = mPackageManager.getResourcesForApplication(packageName); |
| 113 | } catch (PackageManager.NameNotFoundException e) { |
| 114 | resources = null; |
| 115 | } |
| 116 | if (resources != null) { |
| 117 | if (iconId != 0) { |
| 118 | return getFullResIcon(resources, iconId); |
| 119 | } |
| 120 | } |
| 121 | return getFullResDefaultActivityIcon(); |
| 122 | } |
| 123 | |
Sunny Goyal | ffe83f1 | 2014-08-14 17:39:34 -0700 | [diff] [blame] | 124 | public int getFullResIconDpi() { |
| 125 | return mIconDpi; |
| 126 | } |
| 127 | |
Michael Jurka | dac8591 | 2012-05-18 15:04:49 -0700 | [diff] [blame] | 128 | public Drawable getFullResIcon(ActivityInfo info) { |
Winson Chung | 0b9fcf5 | 2011-10-31 13:05:15 -0700 | [diff] [blame] | 129 | Resources resources; |
| 130 | try { |
| 131 | resources = mPackageManager.getResourcesForApplication( |
Michael Jurka | dac8591 | 2012-05-18 15:04:49 -0700 | [diff] [blame] | 132 | info.applicationInfo); |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 133 | } catch (PackageManager.NameNotFoundException e) { |
| 134 | resources = null; |
| 135 | } |
| 136 | if (resources != null) { |
Michael Jurka | dac8591 | 2012-05-18 15:04:49 -0700 | [diff] [blame] | 137 | int iconId = info.getIconResource(); |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 138 | if (iconId != 0) { |
| 139 | return getFullResIcon(resources, iconId); |
| 140 | } |
| 141 | } |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 142 | |
Michael Jurka | c9a9619 | 2010-11-01 11:52:08 -0700 | [diff] [blame] | 143 | return getFullResDefaultActivityIcon(); |
| 144 | } |
| 145 | |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 146 | private Bitmap makeDefaultIcon(UserHandleCompat user) { |
| 147 | Drawable unbadged = getFullResDefaultActivityIcon(); |
| 148 | Drawable d = mUserManager.getBadgedDrawableForUser(unbadged, user); |
Romain Guy | a28fd3f | 2010-03-15 14:44:42 -0700 | [diff] [blame] | 149 | Bitmap b = Bitmap.createBitmap(Math.max(d.getIntrinsicWidth(), 1), |
| 150 | Math.max(d.getIntrinsicHeight(), 1), |
| 151 | Bitmap.Config.ARGB_8888); |
| 152 | Canvas c = new Canvas(b); |
| 153 | d.setBounds(0, 0, b.getWidth(), b.getHeight()); |
| 154 | d.draw(c); |
Adam Cohen | aaf473c | 2011-08-03 12:02:47 -0700 | [diff] [blame] | 155 | c.setBitmap(null); |
Romain Guy | a28fd3f | 2010-03-15 14:44:42 -0700 | [diff] [blame] | 156 | return b; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Remove any records for the supplied ComponentName. |
| 161 | */ |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 162 | public synchronized void remove(ComponentName componentName, UserHandleCompat user) { |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 163 | mCache.remove(new ComponentKey(componentName, user)); |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | /** |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 167 | * Remove any records for the supplied package name from memory. |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 168 | */ |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 169 | private void removeFromMemCacheLocked(String packageName, UserHandleCompat user) { |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 170 | HashSet<ComponentKey> forDeletion = new HashSet<ComponentKey>(); |
| 171 | for (ComponentKey key: mCache.keySet()) { |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 172 | if (key.componentName.getPackageName().equals(packageName) |
| 173 | && key.user.equals(user)) { |
| 174 | forDeletion.add(key); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 175 | } |
| 176 | } |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 177 | for (ComponentKey condemned: forDeletion) { |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 178 | mCache.remove(condemned); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 179 | } |
| 180 | } |
| 181 | |
| 182 | /** |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 183 | * Updates the entries related to the given package in memory and persistent DB. |
| 184 | */ |
| 185 | public synchronized void updateIconsForPkg(String packageName, UserHandleCompat user) { |
| 186 | removeIconsForPkg(packageName, user); |
| 187 | try { |
| 188 | PackageInfo info = mPackageManager.getPackageInfo(packageName, |
| 189 | PackageManager.GET_UNINSTALLED_PACKAGES); |
| 190 | long userSerial = mUserManager.getSerialNumberForUser(user); |
| 191 | for (LauncherActivityInfoCompat app : mLauncherApps.getActivityList(packageName, user)) { |
| 192 | addIconToDB(app, info, userSerial); |
| 193 | } |
| 194 | } catch (NameNotFoundException e) { |
| 195 | Log.d(TAG, "Package not found", e); |
| 196 | return; |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Removes the entries related to the given package in memory and persistent DB. |
| 202 | */ |
| 203 | public synchronized void removeIconsForPkg(String packageName, UserHandleCompat user) { |
| 204 | removeFromMemCacheLocked(packageName, user); |
| 205 | long userSerial = mUserManager.getSerialNumberForUser(user); |
| 206 | mIconDb.getWritableDatabase().delete(IconDB.TABLE_NAME, |
| 207 | IconDB.COLUMN_COMPONENT + " LIKE ? AND " + IconDB.COLUMN_USER + " = ?", |
| 208 | new String[] {packageName + "/%", Long.toString(userSerial)}); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Updates the persistent DB, such that only entries corresponding to {@param apps} remain in |
| 213 | * the DB and are updated. |
| 214 | * @return The set of packages for which icons have updated. |
| 215 | */ |
| 216 | public HashSet<String> updateDBIcons(UserHandleCompat user, List<LauncherActivityInfoCompat> apps) { |
| 217 | long userSerial = mUserManager.getSerialNumberForUser(user); |
| 218 | PackageManager pm = mContext.getPackageManager(); |
| 219 | HashMap<String, PackageInfo> pkgInfoMap = new HashMap<String, PackageInfo>(); |
| 220 | for (PackageInfo info : pm.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES)) { |
| 221 | pkgInfoMap.put(info.packageName, info); |
| 222 | } |
| 223 | |
| 224 | HashMap<ComponentName, LauncherActivityInfoCompat> componentMap = new HashMap<>(); |
| 225 | for (LauncherActivityInfoCompat app : apps) { |
| 226 | componentMap.put(app.getComponentName(), app); |
| 227 | } |
| 228 | |
| 229 | Cursor c = mIconDb.getReadableDatabase().query(IconDB.TABLE_NAME, |
| 230 | new String[] {IconDB.COLUMN_ROWID, IconDB.COLUMN_COMPONENT, |
| 231 | IconDB.COLUMN_LAST_UPDATED, IconDB.COLUMN_VERSION}, |
| 232 | IconDB.COLUMN_USER + " = ? ", |
| 233 | new String[] {Long.toString(userSerial)}, |
| 234 | null, null, null); |
| 235 | |
| 236 | final int indexComponent = c.getColumnIndex(IconDB.COLUMN_COMPONENT); |
| 237 | final int indexLastUpdate = c.getColumnIndex(IconDB.COLUMN_LAST_UPDATED); |
| 238 | final int indexVersion = c.getColumnIndex(IconDB.COLUMN_VERSION); |
| 239 | final int rowIndex = c.getColumnIndex(IconDB.COLUMN_ROWID); |
| 240 | |
| 241 | HashSet<Integer> itemsToRemove = new HashSet<Integer>(); |
| 242 | HashSet<String> updatedPackages = new HashSet<String>(); |
| 243 | |
| 244 | while (c.moveToNext()) { |
| 245 | String cn = c.getString(indexComponent); |
| 246 | ComponentName component = ComponentName.unflattenFromString(cn); |
| 247 | PackageInfo info = pkgInfoMap.get(component.getPackageName()); |
| 248 | if (info == null) { |
| 249 | itemsToRemove.add(c.getInt(rowIndex)); |
| 250 | continue; |
| 251 | } |
| 252 | if ((info.applicationInfo.flags & ApplicationInfo.FLAG_IS_DATA_ONLY) != 0) { |
| 253 | // Application is not present |
| 254 | continue; |
| 255 | } |
| 256 | |
| 257 | long updateTime = c.getLong(indexLastUpdate); |
| 258 | int version = c.getInt(indexVersion); |
| 259 | LauncherActivityInfoCompat app = componentMap.remove(component); |
| 260 | if (version == info.versionCode && updateTime == info.lastUpdateTime) { |
| 261 | continue; |
| 262 | } |
| 263 | if (app == null) { |
| 264 | itemsToRemove.add(c.getInt(rowIndex)); |
| 265 | continue; |
| 266 | } |
| 267 | ContentValues values = updateCacheAndGetContentValues(app); |
| 268 | mIconDb.getWritableDatabase().update(IconDB.TABLE_NAME, values, |
| 269 | IconDB.COLUMN_COMPONENT + " = ?", |
| 270 | new String[] { cn }); |
| 271 | |
| 272 | updatedPackages.add(component.getPackageName()); |
| 273 | } |
| 274 | c.close(); |
| 275 | if (!itemsToRemove.isEmpty()) { |
| 276 | mIconDb.getWritableDatabase().delete(IconDB.TABLE_NAME, |
| 277 | IconDB.COLUMN_ROWID + " IN ( " + TextUtils.join(", ", itemsToRemove) +" )", |
| 278 | null); |
| 279 | } |
| 280 | |
| 281 | // Insert remaining apps. |
| 282 | for (LauncherActivityInfoCompat app : componentMap.values()) { |
| 283 | PackageInfo info = pkgInfoMap.get(app.getComponentName().getPackageName()); |
| 284 | if (info == null) { |
| 285 | continue; |
| 286 | } |
| 287 | addIconToDB(app, info, userSerial); |
| 288 | } |
| 289 | return updatedPackages; |
| 290 | } |
| 291 | |
| 292 | private void addIconToDB(LauncherActivityInfoCompat app, PackageInfo info, long userSerial) { |
| 293 | ContentValues values = updateCacheAndGetContentValues(app); |
| 294 | values.put(IconDB.COLUMN_COMPONENT, app.getComponentName().flattenToString()); |
| 295 | values.put(IconDB.COLUMN_USER, userSerial); |
| 296 | values.put(IconDB.COLUMN_LAST_UPDATED, info.lastUpdateTime); |
| 297 | values.put(IconDB.COLUMN_VERSION, info.versionCode); |
| 298 | mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values, |
| 299 | SQLiteDatabase.CONFLICT_REPLACE); |
| 300 | } |
| 301 | |
| 302 | private ContentValues updateCacheAndGetContentValues(LauncherActivityInfoCompat app) { |
| 303 | CacheEntry entry = new CacheEntry(); |
| 304 | entry.icon = Utilities.createIconBitmap(app.getBadgedIcon(mIconDpi), mContext); |
| 305 | entry.title = app.getLabel(); |
| 306 | entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser()); |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 307 | mCache.put(new ComponentKey(app.getComponentName(), app.getUser()), entry); |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 308 | |
| 309 | ContentValues values = new ContentValues(); |
| 310 | values.put(IconDB.COLUMN_ICON, ItemInfo.flattenBitmap(entry.icon)); |
| 311 | values.put(IconDB.COLUMN_LABEL, entry.title.toString()); |
| 312 | return values; |
| 313 | } |
| 314 | |
| 315 | |
| 316 | /** |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 317 | * Empty out the cache. |
| 318 | */ |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 319 | public synchronized void flush() { |
| 320 | mCache.clear(); |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | /** |
Winson Chung | e5467dc | 2013-10-14 17:03:04 -0700 | [diff] [blame] | 324 | * Empty out the cache that aren't of the correct grid size |
| 325 | */ |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 326 | public synchronized void flushInvalidIcons(DeviceProfile grid) { |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 327 | Iterator<Entry<ComponentKey, CacheEntry>> it = mCache.entrySet().iterator(); |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 328 | while (it.hasNext()) { |
| 329 | final CacheEntry e = it.next().getValue(); |
| 330 | if ((e.icon != null) && (e.icon.getWidth() < grid.iconSizePx |
| 331 | || e.icon.getHeight() < grid.iconSizePx)) { |
| 332 | it.remove(); |
Winson Chung | e5467dc | 2013-10-14 17:03:04 -0700 | [diff] [blame] | 333 | } |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /** |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 338 | * Fill in "application" with the icon and label for "info." |
| 339 | */ |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 340 | public synchronized void getTitleAndIcon(AppInfo application, LauncherActivityInfoCompat info) { |
| 341 | CacheEntry entry = cacheLocked(application.componentName, info, info.getUser(), false); |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 342 | |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 343 | application.title = entry.title; |
| 344 | application.iconBitmap = entry.icon; |
| 345 | application.contentDescription = entry.contentDescription; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 346 | } |
| 347 | |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 348 | public synchronized Bitmap getIcon(Intent intent, UserHandleCompat user) { |
| 349 | ComponentName component = intent.getComponent(); |
| 350 | // null info means not installed, but if we have a component from the intent then |
| 351 | // we should still look in the cache for restored app icons. |
| 352 | if (component == null) { |
| 353 | return getDefaultIcon(user); |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 354 | } |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 355 | |
| 356 | LauncherActivityInfoCompat launcherActInfo = mLauncherApps.resolveActivity(intent, user); |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 357 | CacheEntry entry = cacheLocked(component, launcherActInfo, user, true); |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 358 | return entry.icon; |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 359 | } |
| 360 | |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 361 | /** |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 362 | * Fill in {@param shortcutInfo} with the icon and label for {@param intent}. If the |
| 363 | * corresponding activity is not found, it reverts to the package icon. |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 364 | */ |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 365 | public synchronized void getTitleAndIcon(ShortcutInfo shortcutInfo, Intent intent, |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 366 | UserHandleCompat user) { |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 367 | ComponentName component = intent.getComponent(); |
| 368 | // null info means not installed, but if we have a component from the intent then |
| 369 | // we should still look in the cache for restored app icons. |
| 370 | if (component == null) { |
| 371 | shortcutInfo.setIcon(getDefaultIcon(user)); |
| 372 | shortcutInfo.title = ""; |
| 373 | shortcutInfo.usingFallbackIcon = true; |
| 374 | } else { |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 375 | LauncherActivityInfoCompat info = mLauncherApps.resolveActivity(intent, user); |
| 376 | getTitleAndIcon(shortcutInfo, component, info, user, true); |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 377 | } |
| 378 | } |
| 379 | |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 380 | /** |
| 381 | * Fill in {@param shortcutInfo} with the icon and label for {@param info} |
| 382 | */ |
| 383 | public synchronized void getTitleAndIcon( |
| 384 | ShortcutInfo shortcutInfo, ComponentName component, LauncherActivityInfoCompat info, |
| 385 | UserHandleCompat user, boolean usePkgIcon) { |
| 386 | CacheEntry entry = cacheLocked(component, info, user, usePkgIcon); |
| 387 | shortcutInfo.setIcon(entry.icon); |
| 388 | shortcutInfo.title = entry.title; |
| 389 | shortcutInfo.usingFallbackIcon = isDefaultIcon(entry.icon, user); |
| 390 | } |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 391 | |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 392 | public synchronized Bitmap getDefaultIcon(UserHandleCompat user) { |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 393 | if (!mDefaultIcons.containsKey(user)) { |
| 394 | mDefaultIcons.put(user, makeDefaultIcon(user)); |
| 395 | } |
| 396 | return mDefaultIcons.get(user); |
| 397 | } |
| 398 | |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 399 | public boolean isDefaultIcon(Bitmap icon, UserHandleCompat user) { |
| 400 | return mDefaultIcons.get(user) == icon; |
Joe Onorato | ddc9c1f | 2010-08-30 18:30:15 -0700 | [diff] [blame] | 401 | } |
| 402 | |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 403 | /** |
| 404 | * Retrieves the entry from the cache. If the entry is not present, it creates a new entry. |
| 405 | * This method is not thread safe, it must be called from a synchronized method. |
| 406 | */ |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 407 | private CacheEntry cacheLocked(ComponentName componentName, LauncherActivityInfoCompat info, |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 408 | UserHandleCompat user, boolean usePackageIcon) { |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 409 | ComponentKey cacheKey = new ComponentKey(componentName, user); |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 410 | CacheEntry entry = mCache.get(cacheKey); |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 411 | if (entry == null) { |
| 412 | entry = new CacheEntry(); |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 413 | mCache.put(cacheKey, entry); |
Joe Onorato | 84f6a8d | 2010-02-12 17:53:35 -0500 | [diff] [blame] | 414 | |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 415 | // Check the DB first. |
| 416 | if (!getEntryFromDB(componentName, user, entry)) { |
| 417 | if (info != null) { |
| 418 | entry.icon = Utilities.createIconBitmap(info.getBadgedIcon(mIconDpi), mContext); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 419 | } else { |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 420 | if (usePackageIcon) { |
| 421 | CacheEntry packageEntry = getEntryForPackage( |
| 422 | componentName.getPackageName(), user); |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 423 | if (packageEntry != null) { |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 424 | if (DEBUG) Log.d(TAG, "using package default icon for " + |
| 425 | componentName.toShortString()); |
| 426 | entry.icon = packageEntry.icon; |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 427 | entry.title = packageEntry.title; |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 428 | entry.contentDescription = packageEntry.contentDescription; |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 429 | } |
| 430 | } |
| 431 | if (entry.icon == null) { |
| 432 | if (DEBUG) Log.d(TAG, "using default icon for " + |
| 433 | componentName.toShortString()); |
| 434 | entry.icon = getDefaultIcon(user); |
| 435 | } |
Winson Chung | c3eecff | 2011-07-11 17:44:15 -0700 | [diff] [blame] | 436 | } |
| 437 | } |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 438 | |
| 439 | if (TextUtils.isEmpty(entry.title) && info != null) { |
| 440 | entry.title = info.getLabel().toString(); |
| 441 | entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user); |
| 442 | } |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 443 | } |
| 444 | return entry; |
| 445 | } |
Daniel Sandler | 4e1cd23 | 2011-05-12 00:06:32 -0400 | [diff] [blame] | 446 | |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 447 | /** |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 448 | * Adds a default package entry in the cache. This entry is not persisted and will be removed |
| 449 | * when the cache is flushed. |
| 450 | */ |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 451 | public synchronized void cachePackageInstallInfo(String packageName, UserHandleCompat user, |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 452 | Bitmap icon, CharSequence title) { |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 453 | removeFromMemCacheLocked(packageName, user); |
Sunny Goyal | a22666f | 2014-09-18 13:25:15 -0700 | [diff] [blame] | 454 | |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 455 | CacheEntry entry = getEntryForPackage(packageName, user); |
| 456 | if (!TextUtils.isEmpty(title)) { |
| 457 | entry.title = title; |
| 458 | } |
| 459 | if (icon != null) { |
Sunny Goyal | 2fce90c | 2014-10-07 12:01:58 -0700 | [diff] [blame] | 460 | entry.icon = Utilities.createIconBitmap(icon, mContext); |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 461 | } |
| 462 | } |
| 463 | |
| 464 | /** |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 465 | * Gets an entry for the package, which can be used as a fallback entry for various components. |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 466 | * This method is not thread safe, it must be called from a synchronized method. |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 467 | */ |
| 468 | private CacheEntry getEntryForPackage(String packageName, UserHandleCompat user) { |
Sunny Goyal | 736f5af | 2014-10-16 14:07:29 -0700 | [diff] [blame] | 469 | ComponentName cn = new ComponentName(packageName, EMPTY_CLASS_NAME);; |
Sunny Goyal | b4cd42a | 2015-03-16 14:10:24 -0700 | [diff] [blame] | 470 | ComponentKey cacheKey = new ComponentKey(cn, user); |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 471 | CacheEntry entry = mCache.get(cacheKey); |
| 472 | if (entry == null) { |
| 473 | entry = new CacheEntry(); |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 474 | entry.title = ""; |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 475 | entry.contentDescription = ""; |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 476 | mCache.put(cacheKey, entry); |
| 477 | |
| 478 | try { |
| 479 | ApplicationInfo info = mPackageManager.getApplicationInfo(packageName, 0); |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 480 | entry.icon = Utilities.createIconBitmap(info.loadIcon(mPackageManager), mContext); |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 481 | entry.title = info.loadLabel(mPackageManager); |
| 482 | entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user); |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 483 | } catch (NameNotFoundException e) { |
| 484 | if (DEBUG) Log.d(TAG, "Application not installed " + packageName); |
| 485 | } |
Sunny Goyal | 0fc1be1 | 2014-08-11 17:05:23 -0700 | [diff] [blame] | 486 | } |
| 487 | return entry; |
| 488 | } |
| 489 | |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 490 | /** |
| 491 | * Pre-load an icon into the persistent cache. |
| 492 | * |
| 493 | * <P>Queries for a component that does not exist in the package manager |
| 494 | * will be answered by the persistent cache. |
| 495 | * |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 496 | * @param componentName the icon should be returned for this component |
| 497 | * @param icon the icon to be persisted |
| 498 | * @param dpi the native density of the icon |
| 499 | */ |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 500 | public void preloadIcon(ComponentName componentName, Bitmap icon, int dpi, String label, |
| 501 | long userSerial) { |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 502 | // TODO rescale to the correct native DPI |
| 503 | try { |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 504 | PackageManager packageManager = mContext.getPackageManager(); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 505 | packageManager.getActivityIcon(componentName); |
| 506 | // component is present on the system already, do nothing |
| 507 | return; |
| 508 | } catch (PackageManager.NameNotFoundException e) { |
| 509 | // pass |
| 510 | } |
| 511 | |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 512 | ContentValues values = new ContentValues(); |
| 513 | values.put(IconDB.COLUMN_COMPONENT, componentName.flattenToString()); |
| 514 | values.put(IconDB.COLUMN_USER, userSerial); |
| 515 | values.put(IconDB.COLUMN_ICON, ItemInfo.flattenBitmap(icon)); |
| 516 | values.put(IconDB.COLUMN_LABEL, label); |
| 517 | mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values, |
| 518 | SQLiteDatabase.CONFLICT_REPLACE); |
| 519 | } |
| 520 | |
| 521 | private boolean getEntryFromDB(ComponentName component, UserHandleCompat user, CacheEntry entry) { |
| 522 | Cursor c = mIconDb.getReadableDatabase().query(IconDB.TABLE_NAME, |
| 523 | new String[] {IconDB.COLUMN_ICON, IconDB.COLUMN_LABEL}, |
| 524 | IconDB.COLUMN_COMPONENT + " = ? AND " + IconDB.COLUMN_USER + " = ?", |
| 525 | new String[] {component.flattenToString(), |
| 526 | Long.toString(mUserManager.getSerialNumberForUser(user))}, |
| 527 | null, null, null); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 528 | try { |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 529 | if (c.moveToNext()) { |
| 530 | entry.icon = Utilities.createIconBitmap(c, 0, mContext); |
| 531 | entry.title = c.getString(1); |
| 532 | if (entry.title == null) { |
| 533 | entry.title = ""; |
| 534 | entry.contentDescription = ""; |
| 535 | } else { |
| 536 | entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 537 | } |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 538 | return true; |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 539 | } |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 540 | } finally { |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 541 | c.close(); |
| 542 | } |
| 543 | return false; |
| 544 | } |
| 545 | |
| 546 | private static final class IconDB extends SQLiteOpenHelper { |
| 547 | private final static int DB_VERSION = 1; |
| 548 | |
| 549 | private final static String TABLE_NAME = "icons"; |
| 550 | private final static String COLUMN_ROWID = "rowid"; |
| 551 | private final static String COLUMN_COMPONENT = "componentName"; |
| 552 | private final static String COLUMN_USER = "profileId"; |
| 553 | private final static String COLUMN_LAST_UPDATED = "lastUpdated"; |
| 554 | private final static String COLUMN_VERSION = "version"; |
| 555 | private final static String COLUMN_ICON = "icon"; |
| 556 | private final static String COLUMN_LABEL = "label"; |
| 557 | |
| 558 | public IconDB(Context context) { |
| 559 | super(context, LauncherFiles.APP_ICONS_DB, null, DB_VERSION); |
| 560 | } |
| 561 | |
| 562 | @Override |
| 563 | public void onCreate(SQLiteDatabase db) { |
| 564 | db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + |
| 565 | COLUMN_COMPONENT + " TEXT NOT NULL, " + |
| 566 | COLUMN_USER + " INTEGER NOT NULL, " + |
| 567 | COLUMN_LAST_UPDATED + " INTEGER NOT NULL DEFAULT 0, " + |
| 568 | COLUMN_VERSION + " INTEGER NOT NULL DEFAULT 0, " + |
| 569 | COLUMN_ICON + " BLOB, " + |
| 570 | COLUMN_LABEL + " TEXT, " + |
| 571 | "PRIMARY KEY (" + COLUMN_COMPONENT + ", " + COLUMN_USER + ") " + |
| 572 | ");"); |
| 573 | } |
| 574 | |
| 575 | @Override |
| 576 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { |
| 577 | if (oldVersion != newVersion) { |
| 578 | clearDB(db); |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 579 | } |
| 580 | } |
| 581 | |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 582 | @Override |
| 583 | public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { |
| 584 | if (oldVersion != newVersion) { |
| 585 | clearDB(db); |
| 586 | } |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 587 | } |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 588 | |
Sunny Goyal | 4fbc382 | 2015-02-18 16:46:50 -0800 | [diff] [blame] | 589 | private void clearDB(SQLiteDatabase db) { |
| 590 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); |
| 591 | onCreate(db); |
| 592 | } |
Chris Wren | 6d0dde0 | 2014-02-10 12:16:54 -0500 | [diff] [blame] | 593 | } |
Joe Onorato | 0589f0f | 2010-02-08 13:44:00 -0800 | [diff] [blame] | 594 | } |