Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | |
| 17 | package com.android.launcher3; |
| 18 | |
Sunny Goyal | 4bbf419 | 2014-11-11 12:23:59 -0800 | [diff] [blame] | 19 | import android.annotation.TargetApi; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 20 | import android.app.SearchManager; |
Sunny Goyal | e755d46 | 2014-07-22 13:48:29 -0700 | [diff] [blame] | 21 | import android.content.ComponentName; |
| 22 | import android.content.ContentResolver; |
| 23 | import android.content.Context; |
| 24 | import android.content.Intent; |
| 25 | import android.content.IntentFilter; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 26 | import android.content.res.Configuration; |
Michael Jurka | 104c456 | 2013-07-08 18:03:46 -0700 | [diff] [blame] | 27 | import android.content.res.Resources; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 28 | import android.database.ContentObserver; |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 29 | import android.graphics.Point; |
Sunny Goyal | 4bbf419 | 2014-11-11 12:23:59 -0800 | [diff] [blame] | 30 | import android.os.Build; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 31 | import android.os.Handler; |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 32 | import android.util.DisplayMetrics; |
Daniel Sandler | b9eb286 | 2013-06-14 20:17:30 -0400 | [diff] [blame] | 33 | import android.util.Log; |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 34 | import android.view.Display; |
| 35 | import android.view.WindowManager; |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 36 | import com.android.launcher3.compat.LauncherAppsCompat; |
Sunny Goyal | 4390ace | 2014-10-13 11:33:11 -0700 | [diff] [blame] | 37 | import com.android.launcher3.compat.PackageInstallerCompat; |
Sunny Goyal | e755d46 | 2014-07-22 13:48:29 -0700 | [diff] [blame] | 38 | import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 39 | import java.lang.ref.WeakReference; |
Sunny Goyal | e755d46 | 2014-07-22 13:48:29 -0700 | [diff] [blame] | 40 | import java.util.ArrayList; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 41 | |
Winson Chung | 6e1c0d3 | 2013-10-25 15:24:24 -0700 | [diff] [blame] | 42 | public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 43 | private static final String TAG = "LauncherAppState"; |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 44 | |
Chris Wren | ee52336 | 2014-09-09 10:09:02 -0400 | [diff] [blame] | 45 | private static final boolean DEBUG = false; |
Chris Wren | aeff7ea | 2014-02-14 16:59:24 -0500 | [diff] [blame] | 46 | |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 47 | private final AppFilter mAppFilter; |
| 48 | private final BuildInfo mBuildInfo; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 49 | private LauncherModel mModel; |
| 50 | private IconCache mIconCache; |
| 51 | private WidgetPreviewLoader.CacheDb mWidgetPreviewCacheDb; |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 52 | private boolean mIsScreenLarge; |
| 53 | private float mScreenDensity; |
| 54 | private int mLongPressTimeout = 300; |
Michael Jurka | a6a0547 | 2013-11-13 17:59:46 +0100 | [diff] [blame] | 55 | private boolean mWallpaperChangedSinceLastCheck; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 56 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 57 | private static WeakReference<LauncherProvider> sLauncherProvider; |
| 58 | private static Context sContext; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 59 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 60 | private static LauncherAppState INSTANCE; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 61 | |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 62 | private DynamicGrid mDynamicGrid; |
| 63 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 64 | public static LauncherAppState getInstance() { |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 65 | if (INSTANCE == null) { |
| 66 | INSTANCE = new LauncherAppState(); |
| 67 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 68 | return INSTANCE; |
| 69 | } |
| 70 | |
Chris Wren | d8fe6de | 2013-10-04 10:42:14 -0400 | [diff] [blame] | 71 | public static LauncherAppState getInstanceNoCreate() { |
| 72 | return INSTANCE; |
| 73 | } |
| 74 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 75 | public Context getContext() { |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 76 | return sContext; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 77 | } |
| 78 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 79 | public static void setApplicationContext(Context context) { |
| 80 | if (sContext != null) { |
Daniel Sandler | e060b0b | 2013-06-27 21:47:55 -0400 | [diff] [blame] | 81 | Log.w(Launcher.TAG, "setApplicationContext called twice! old=" + sContext + " new=" + context); |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 82 | } |
| 83 | sContext = context.getApplicationContext(); |
| 84 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 85 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 86 | private LauncherAppState() { |
| 87 | if (sContext == null) { |
| 88 | throw new IllegalStateException("LauncherAppState inited before app context set"); |
Daniel Sandler | b9eb286 | 2013-06-14 20:17:30 -0400 | [diff] [blame] | 89 | } |
| 90 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 91 | Log.v(Launcher.TAG, "LauncherAppState inited"); |
Daniel Sandler | b9eb286 | 2013-06-14 20:17:30 -0400 | [diff] [blame] | 92 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 93 | if (sContext.getResources().getBoolean(R.bool.debug_memory_enabled)) { |
| 94 | MemoryTracker.startTrackingMe(sContext, "L"); |
| 95 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 96 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 97 | // set sIsScreenXLarge and mScreenDensity *before* creating icon cache |
Michael Jurka | 104c456 | 2013-07-08 18:03:46 -0700 | [diff] [blame] | 98 | mIsScreenLarge = isScreenLarge(sContext.getResources()); |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 99 | mScreenDensity = sContext.getResources().getDisplayMetrics().density; |
| 100 | |
Michael Jurka | 6e27f64 | 2013-12-10 13:40:30 +0100 | [diff] [blame] | 101 | recreateWidgetPreviewDb(); |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 102 | mIconCache = new IconCache(sContext); |
Bjorn Bringert | 1307f63 | 2013-10-03 22:31:03 +0100 | [diff] [blame] | 103 | |
| 104 | mAppFilter = AppFilter.loadByName(sContext.getString(R.string.app_filter_class)); |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 105 | mBuildInfo = BuildInfo.loadByName(sContext.getString(R.string.build_info_class)); |
Bjorn Bringert | 1307f63 | 2013-10-03 22:31:03 +0100 | [diff] [blame] | 106 | mModel = new LauncherModel(this, mIconCache, mAppFilter); |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 107 | final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(sContext); |
Kenny Guy | c2bd810 | 2014-06-30 12:30:31 +0100 | [diff] [blame] | 108 | launcherApps.addOnAppsChangedCallback(mModel); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 109 | |
| 110 | // Register intent receivers |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 111 | IntentFilter filter = new IntentFilter(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 112 | filter.addAction(Intent.ACTION_LOCALE_CHANGED); |
| 113 | filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 114 | sContext.registerReceiver(mModel, filter); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 115 | filter = new IntentFilter(); |
| 116 | filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED); |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 117 | sContext.registerReceiver(mModel, filter); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 118 | filter = new IntentFilter(); |
| 119 | filter.addAction(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED); |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 120 | sContext.registerReceiver(mModel, filter); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 121 | |
| 122 | // Register for changes to the favorites |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 123 | ContentResolver resolver = sContext.getContentResolver(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 124 | resolver.registerContentObserver(LauncherSettings.Favorites.CONTENT_URI, true, |
| 125 | mFavoritesObserver); |
| 126 | } |
Kenny Guy | 1317e2d | 2014-05-08 18:52:50 +0100 | [diff] [blame] | 127 | |
Michael Jurka | 6e27f64 | 2013-12-10 13:40:30 +0100 | [diff] [blame] | 128 | public void recreateWidgetPreviewDb() { |
| 129 | if (mWidgetPreviewCacheDb != null) { |
| 130 | mWidgetPreviewCacheDb.close(); |
| 131 | } |
| 132 | mWidgetPreviewCacheDb = new WidgetPreviewLoader.CacheDb(sContext); |
| 133 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 134 | |
| 135 | /** |
| 136 | * Call from Application.onTerminate(), which is not guaranteed to ever be called. |
| 137 | */ |
| 138 | public void onTerminate() { |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 139 | sContext.unregisterReceiver(mModel); |
Kenny Guy | 1317e2d | 2014-05-08 18:52:50 +0100 | [diff] [blame] | 140 | final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(sContext); |
Kenny Guy | c2bd810 | 2014-06-30 12:30:31 +0100 | [diff] [blame] | 141 | launcherApps.removeOnAppsChangedCallback(mModel); |
Sunny Goyal | 4390ace | 2014-10-13 11:33:11 -0700 | [diff] [blame] | 142 | PackageInstallerCompat.getInstance(sContext).onStop(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 143 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 144 | ContentResolver resolver = sContext.getContentResolver(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 145 | resolver.unregisterContentObserver(mFavoritesObserver); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Receives notifications whenever the user favorites have changed. |
| 150 | */ |
| 151 | private final ContentObserver mFavoritesObserver = new ContentObserver(new Handler()) { |
| 152 | @Override |
| 153 | public void onChange(boolean selfChange) { |
| 154 | // If the database has ever changed, then we really need to force a reload of the |
| 155 | // workspace on the next load |
| 156 | mModel.resetLoadedState(false, true); |
| 157 | mModel.startLoaderFromBackground(); |
| 158 | } |
| 159 | }; |
| 160 | |
| 161 | LauncherModel setLauncher(Launcher launcher) { |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 162 | if (mModel == null) { |
| 163 | throw new IllegalStateException("setLauncher() called before init()"); |
| 164 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 165 | mModel.initialize(launcher); |
| 166 | return mModel; |
| 167 | } |
| 168 | |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 169 | public IconCache getIconCache() { |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 170 | return mIconCache; |
| 171 | } |
| 172 | |
| 173 | LauncherModel getModel() { |
| 174 | return mModel; |
| 175 | } |
| 176 | |
Bjorn Bringert | 1307f63 | 2013-10-03 22:31:03 +0100 | [diff] [blame] | 177 | boolean shouldShowAppOrWidgetProvider(ComponentName componentName) { |
| 178 | return mAppFilter == null || mAppFilter.shouldShowApp(componentName); |
| 179 | } |
| 180 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 181 | WidgetPreviewLoader.CacheDb getWidgetPreviewCacheDb() { |
| 182 | return mWidgetPreviewCacheDb; |
| 183 | } |
| 184 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 185 | static void setLauncherProvider(LauncherProvider provider) { |
| 186 | sLauncherProvider = new WeakReference<LauncherProvider>(provider); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 187 | } |
| 188 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 189 | static LauncherProvider getLauncherProvider() { |
| 190 | return sLauncherProvider.get(); |
Daniel Sandler | 924b993 | 2013-06-12 00:38:25 -0400 | [diff] [blame] | 191 | } |
| 192 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 193 | public static String getSharedPreferencesKey() { |
Helena Josol | 28db280 | 2014-10-09 17:04:09 +0100 | [diff] [blame] | 194 | return LauncherFiles.SHARED_PREFERENCES_KEY; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 195 | } |
| 196 | |
Sunny Goyal | 4bbf419 | 2014-11-11 12:23:59 -0800 | [diff] [blame] | 197 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 198 | DeviceProfile initDynamicGrid(Context context) { |
| 199 | // Determine the dynamic grid properties |
| 200 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); |
| 201 | Display display = wm.getDefaultDisplay(); |
| 202 | |
| 203 | Point realSize = new Point(); |
| 204 | display.getRealSize(realSize); |
| 205 | DisplayMetrics dm = new DisplayMetrics(); |
| 206 | display.getMetrics(dm); |
| 207 | |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 208 | if (mDynamicGrid == null) { |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 209 | Point smallestSize = new Point(); |
| 210 | Point largestSize = new Point(); |
| 211 | display.getCurrentSizeRange(smallestSize, largestSize); |
| 212 | |
Winson Chung | f7d4585 | 2013-10-10 18:57:15 -0700 | [diff] [blame] | 213 | mDynamicGrid = new DynamicGrid(context, |
| 214 | context.getResources(), |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 215 | Math.min(smallestSize.x, smallestSize.y), |
| 216 | Math.min(largestSize.x, largestSize.y), |
| 217 | realSize.x, realSize.y, |
| 218 | dm.widthPixels, dm.heightPixels); |
Winson Chung | 6e1c0d3 | 2013-10-25 15:24:24 -0700 | [diff] [blame] | 219 | mDynamicGrid.getDeviceProfile().addCallback(this); |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 220 | } |
| 221 | |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 222 | // Update the icon size |
Winson Chung | 892c74d | 2013-08-22 16:15:50 -0700 | [diff] [blame] | 223 | DeviceProfile grid = mDynamicGrid.getDeviceProfile(); |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 224 | grid.updateFromConfiguration(context, context.getResources(), |
| 225 | realSize.x, realSize.y, |
| 226 | dm.widthPixels, dm.heightPixels); |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 227 | return grid; |
| 228 | } |
Winson Chung | b380024 | 2013-10-24 11:01:54 -0700 | [diff] [blame] | 229 | public DynamicGrid getDynamicGrid() { |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 230 | return mDynamicGrid; |
| 231 | } |
| 232 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 233 | public boolean isScreenLarge() { |
| 234 | return mIsScreenLarge; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 235 | } |
| 236 | |
Michael Jurka | 104c456 | 2013-07-08 18:03:46 -0700 | [diff] [blame] | 237 | // Need a version that doesn't require an instance of LauncherAppState for the wallpaper picker |
| 238 | public static boolean isScreenLarge(Resources res) { |
| 239 | return res.getBoolean(R.bool.is_large_tablet); |
| 240 | } |
| 241 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 242 | public static boolean isScreenLandscape(Context context) { |
| 243 | return context.getResources().getConfiguration().orientation == |
| 244 | Configuration.ORIENTATION_LANDSCAPE; |
| 245 | } |
| 246 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 247 | public float getScreenDensity() { |
| 248 | return mScreenDensity; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 249 | } |
| 250 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 251 | public int getLongPressTimeout() { |
| 252 | return mLongPressTimeout; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 253 | } |
Winson Chung | 6e1c0d3 | 2013-10-25 15:24:24 -0700 | [diff] [blame] | 254 | |
Michael Jurka | a6a0547 | 2013-11-13 17:59:46 +0100 | [diff] [blame] | 255 | public void onWallpaperChanged() { |
| 256 | mWallpaperChangedSinceLastCheck = true; |
| 257 | } |
| 258 | |
| 259 | public boolean hasWallpaperChangedSinceLastCheck() { |
| 260 | boolean result = mWallpaperChangedSinceLastCheck; |
| 261 | mWallpaperChangedSinceLastCheck = false; |
| 262 | return result; |
| 263 | } |
| 264 | |
Winson Chung | 6e1c0d3 | 2013-10-25 15:24:24 -0700 | [diff] [blame] | 265 | @Override |
| 266 | public void onAvailableSizeChanged(DeviceProfile grid) { |
| 267 | Utilities.setIconSize(grid.iconSizePx); |
| 268 | } |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 269 | |
| 270 | public static boolean isDisableAllApps() { |
| 271 | // Returns false on non-dogfood builds. |
| 272 | return getInstance().mBuildInfo.isDogfoodBuild() && |
Sunny Goyal | 4bbf419 | 2014-11-11 12:23:59 -0800 | [diff] [blame] | 273 | Utilities.isPropertyEnabled(Launcher.DISABLE_ALL_APPS_PROPERTY); |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 274 | } |
Jorim Jaggi | eedb00a | 2014-01-13 13:45:07 -0800 | [diff] [blame] | 275 | |
| 276 | public static boolean isDogfoodBuild() { |
| 277 | return getInstance().mBuildInfo.isDogfoodBuild(); |
| 278 | } |
Chris Wren | aeff7ea | 2014-02-14 16:59:24 -0500 | [diff] [blame] | 279 | |
Sunny Goyal | e755d46 | 2014-07-22 13:48:29 -0700 | [diff] [blame] | 280 | public void setPackageState(ArrayList<PackageInstallInfo> installInfo) { |
| 281 | mModel.setPackageState(installInfo); |
Chris Wren | aeff7ea | 2014-02-14 16:59:24 -0500 | [diff] [blame] | 282 | } |
Sunny Goyal | a22666f | 2014-09-18 13:25:15 -0700 | [diff] [blame] | 283 | |
| 284 | /** |
| 285 | * Updates the icons and label of all icons for the provided package name. |
| 286 | */ |
| 287 | public void updatePackageBadge(String packageName) { |
| 288 | mModel.updatePackageBadge(packageName); |
| 289 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 290 | } |