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; |
Sunny Goyal | e755d46 | 2014-07-22 13:48:29 -0700 | [diff] [blame] | 22 | import android.content.Context; |
| 23 | import android.content.Intent; |
| 24 | import android.content.IntentFilter; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 25 | import android.content.res.Configuration; |
Michael Jurka | 104c456 | 2013-07-08 18:03:46 -0700 | [diff] [blame] | 26 | import android.content.res.Resources; |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 27 | import android.graphics.Point; |
Sunny Goyal | 4bbf419 | 2014-11-11 12:23:59 -0800 | [diff] [blame] | 28 | import android.os.Build; |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 29 | import android.util.DisplayMetrics; |
Daniel Sandler | b9eb286 | 2013-06-14 20:17:30 -0400 | [diff] [blame] | 30 | import android.util.Log; |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 31 | import android.view.Display; |
| 32 | import android.view.WindowManager; |
Sunny Goyal | 71b5c0b | 2015-01-08 16:59:04 -0800 | [diff] [blame] | 33 | |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 34 | import com.android.launcher3.compat.LauncherAppsCompat; |
Sunny Goyal | 4390ace | 2014-10-13 11:33:11 -0700 | [diff] [blame] | 35 | import com.android.launcher3.compat.PackageInstallerCompat; |
Sunny Goyal | e755d46 | 2014-07-22 13:48:29 -0700 | [diff] [blame] | 36 | import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo; |
Adam Cohen | 091440a | 2015-03-18 14:16:05 -0700 | [diff] [blame] | 37 | import com.android.launcher3.util.Thunk; |
Sunny Goyal | 71b5c0b | 2015-01-08 16:59:04 -0800 | [diff] [blame] | 38 | |
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 { |
Chris Wren | aeff7ea | 2014-02-14 16:59:24 -0500 | [diff] [blame] | 43 | |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 44 | private final AppFilter mAppFilter; |
| 45 | private final BuildInfo mBuildInfo; |
Adam Cohen | 091440a | 2015-03-18 14:16:05 -0700 | [diff] [blame] | 46 | @Thunk final LauncherModel mModel; |
Sunny Goyal | e0f58d7 | 2014-11-10 18:05:31 -0800 | [diff] [blame] | 47 | private final IconCache mIconCache; |
Sunny Goyal | 5b0e669 | 2015-03-19 14:31:19 -0700 | [diff] [blame] | 48 | private final WidgetPreviewLoader mWidgetCache; |
Sunny Goyal | e0f58d7 | 2014-11-10 18:05:31 -0800 | [diff] [blame] | 49 | |
| 50 | private final boolean mIsScreenLarge; |
| 51 | private final float mScreenDensity; |
| 52 | private final int mLongPressTimeout = 300; |
| 53 | |
Michael Jurka | a6a0547 | 2013-11-13 17:59:46 +0100 | [diff] [blame] | 54 | private boolean mWallpaperChangedSinceLastCheck; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 55 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 56 | private static WeakReference<LauncherProvider> sLauncherProvider; |
| 57 | private static Context sContext; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 58 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 59 | private static LauncherAppState INSTANCE; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 60 | |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 61 | private DynamicGrid mDynamicGrid; |
Adam Cohen | c9735cf | 2015-01-23 16:11:55 -0800 | [diff] [blame] | 62 | private LauncherAccessibilityDelegate mAccessibilityDelegate; |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 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; |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 100 | mIconCache = new IconCache(sContext); |
Sunny Goyal | 5b0e669 | 2015-03-19 14:31:19 -0700 | [diff] [blame] | 101 | mWidgetCache = new WidgetPreviewLoader(sContext, mIconCache); |
Bjorn Bringert | 1307f63 | 2013-10-03 22:31:03 +0100 | [diff] [blame] | 102 | |
| 103 | mAppFilter = AppFilter.loadByName(sContext.getString(R.string.app_filter_class)); |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 104 | mBuildInfo = BuildInfo.loadByName(sContext.getString(R.string.build_info_class)); |
Bjorn Bringert | 1307f63 | 2013-10-03 22:31:03 +0100 | [diff] [blame] | 105 | mModel = new LauncherModel(this, mIconCache, mAppFilter); |
Sunny Goyal | 2759579 | 2015-03-19 13:18:44 -0700 | [diff] [blame] | 106 | |
| 107 | LauncherAppsCompat.getInstance(sContext).addOnAppsChangedCallback(mModel); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 108 | |
| 109 | // Register intent receivers |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 110 | IntentFilter filter = new IntentFilter(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 111 | filter.addAction(Intent.ACTION_LOCALE_CHANGED); |
| 112 | filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 113 | filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 114 | filter.addAction(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED); |
Sunny Goyal | 957c13f | 2015-05-01 13:02:20 -0700 | [diff] [blame] | 115 | // For handling managed profiles |
| 116 | filter.addAction(LauncherAppsCompat.ACTION_MANAGED_PROFILE_ADDED); |
| 117 | filter.addAction(LauncherAppsCompat.ACTION_MANAGED_PROFILE_REMOVED); |
| 118 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 119 | sContext.registerReceiver(mModel, filter); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 120 | } |
Kenny Guy | 1317e2d | 2014-05-08 18:52:50 +0100 | [diff] [blame] | 121 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 122 | /** |
| 123 | * Call from Application.onTerminate(), which is not guaranteed to ever be called. |
| 124 | */ |
| 125 | public void onTerminate() { |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 126 | sContext.unregisterReceiver(mModel); |
Kenny Guy | 1317e2d | 2014-05-08 18:52:50 +0100 | [diff] [blame] | 127 | final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(sContext); |
Kenny Guy | c2bd810 | 2014-06-30 12:30:31 +0100 | [diff] [blame] | 128 | launcherApps.removeOnAppsChangedCallback(mModel); |
Sunny Goyal | 4390ace | 2014-10-13 11:33:11 -0700 | [diff] [blame] | 129 | PackageInstallerCompat.getInstance(sContext).onStop(); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | /** |
Sunny Goyal | 1d4a2df | 2015-03-30 11:11:46 -0700 | [diff] [blame] | 133 | * Reloads the workspace items from the DB and re-binds the workspace. This should generally |
| 134 | * not be called as DB updates are automatically followed by UI update |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 135 | */ |
Sunny Goyal | 1d4a2df | 2015-03-30 11:11:46 -0700 | [diff] [blame] | 136 | public void reloadWorkspace() { |
| 137 | mModel.resetLoadedState(false, true); |
| 138 | mModel.startLoaderFromBackground(); |
| 139 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 140 | |
| 141 | LauncherModel setLauncher(Launcher launcher) { |
| 142 | mModel.initialize(launcher); |
Sunny Goyal | 71b5c0b | 2015-01-08 16:59:04 -0800 | [diff] [blame] | 143 | mAccessibilityDelegate = ((launcher != null) && Utilities.isLmpOrAbove()) ? |
| 144 | new LauncherAccessibilityDelegate(launcher) : null; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 145 | return mModel; |
| 146 | } |
| 147 | |
Hyunyoung Song | 3f47144 | 2015-04-08 19:01:34 -0700 | [diff] [blame] | 148 | public LauncherAccessibilityDelegate getAccessibilityDelegate() { |
Sunny Goyal | 71b5c0b | 2015-01-08 16:59:04 -0800 | [diff] [blame] | 149 | return mAccessibilityDelegate; |
| 150 | } |
| 151 | |
Sunny Goyal | 3494262 | 2014-08-29 17:20:55 -0700 | [diff] [blame] | 152 | public IconCache getIconCache() { |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 153 | return mIconCache; |
| 154 | } |
| 155 | |
Sunny Goyal | 18bf8e2 | 2015-04-08 18:13:46 -0700 | [diff] [blame] | 156 | public LauncherModel getModel() { |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 157 | return mModel; |
| 158 | } |
| 159 | |
Bjorn Bringert | 1307f63 | 2013-10-03 22:31:03 +0100 | [diff] [blame] | 160 | boolean shouldShowAppOrWidgetProvider(ComponentName componentName) { |
| 161 | return mAppFilter == null || mAppFilter.shouldShowApp(componentName); |
| 162 | } |
| 163 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 164 | static void setLauncherProvider(LauncherProvider provider) { |
| 165 | sLauncherProvider = new WeakReference<LauncherProvider>(provider); |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 166 | } |
| 167 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 168 | static LauncherProvider getLauncherProvider() { |
| 169 | return sLauncherProvider.get(); |
Daniel Sandler | 924b993 | 2013-06-12 00:38:25 -0400 | [diff] [blame] | 170 | } |
| 171 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 172 | public static String getSharedPreferencesKey() { |
Helena Josol | 28db280 | 2014-10-09 17:04:09 +0100 | [diff] [blame] | 173 | return LauncherFiles.SHARED_PREFERENCES_KEY; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 174 | } |
| 175 | |
Sunny Goyal | 4bbf419 | 2014-11-11 12:23:59 -0800 | [diff] [blame] | 176 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 177 | DeviceProfile initDynamicGrid(Context context) { |
Chris Wren | b02e611 | 2014-11-24 16:57:54 -0500 | [diff] [blame] | 178 | mDynamicGrid = createDynamicGrid(context, mDynamicGrid); |
| 179 | mDynamicGrid.getDeviceProfile().addCallback(this); |
| 180 | return mDynamicGrid.getDeviceProfile(); |
| 181 | } |
| 182 | |
| 183 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) |
| 184 | static DynamicGrid createDynamicGrid(Context context, DynamicGrid dynamicGrid) { |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 185 | // Determine the dynamic grid properties |
| 186 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); |
| 187 | Display display = wm.getDefaultDisplay(); |
| 188 | |
| 189 | Point realSize = new Point(); |
| 190 | display.getRealSize(realSize); |
| 191 | DisplayMetrics dm = new DisplayMetrics(); |
| 192 | display.getMetrics(dm); |
| 193 | |
Chris Wren | b02e611 | 2014-11-24 16:57:54 -0500 | [diff] [blame] | 194 | if (dynamicGrid == null) { |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 195 | Point smallestSize = new Point(); |
| 196 | Point largestSize = new Point(); |
| 197 | display.getCurrentSizeRange(smallestSize, largestSize); |
| 198 | |
Chris Wren | b02e611 | 2014-11-24 16:57:54 -0500 | [diff] [blame] | 199 | dynamicGrid = new DynamicGrid(context, |
Winson Chung | f7d4585 | 2013-10-10 18:57:15 -0700 | [diff] [blame] | 200 | context.getResources(), |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 201 | Math.min(smallestSize.x, smallestSize.y), |
| 202 | Math.min(largestSize.x, largestSize.y), |
| 203 | realSize.x, realSize.y, |
| 204 | dm.widthPixels, dm.heightPixels); |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 205 | } |
| 206 | |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 207 | // Update the icon size |
Chris Wren | b02e611 | 2014-11-24 16:57:54 -0500 | [diff] [blame] | 208 | DeviceProfile grid = dynamicGrid.getDeviceProfile(); |
Sunny Goyal | 33d4438 | 2014-10-16 09:24:19 -0700 | [diff] [blame] | 209 | grid.updateFromConfiguration(context, context.getResources(), |
| 210 | realSize.x, realSize.y, |
| 211 | dm.widthPixels, dm.heightPixels); |
Chris Wren | b02e611 | 2014-11-24 16:57:54 -0500 | [diff] [blame] | 212 | return dynamicGrid; |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 213 | } |
Chris Wren | b02e611 | 2014-11-24 16:57:54 -0500 | [diff] [blame] | 214 | |
Winson Chung | b380024 | 2013-10-24 11:01:54 -0700 | [diff] [blame] | 215 | public DynamicGrid getDynamicGrid() { |
Winson Chung | 5f8afe6 | 2013-08-12 16:19:28 -0700 | [diff] [blame] | 216 | return mDynamicGrid; |
| 217 | } |
| 218 | |
Sunny Goyal | 5b0e669 | 2015-03-19 14:31:19 -0700 | [diff] [blame] | 219 | public WidgetPreviewLoader getWidgetCache() { |
| 220 | return mWidgetCache; |
| 221 | } |
| 222 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 223 | public boolean isScreenLarge() { |
| 224 | return mIsScreenLarge; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 225 | } |
| 226 | |
Michael Jurka | 104c456 | 2013-07-08 18:03:46 -0700 | [diff] [blame] | 227 | // Need a version that doesn't require an instance of LauncherAppState for the wallpaper picker |
| 228 | public static boolean isScreenLarge(Resources res) { |
| 229 | return res.getBoolean(R.bool.is_large_tablet); |
| 230 | } |
| 231 | |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 232 | public static boolean isScreenLandscape(Context context) { |
| 233 | return context.getResources().getConfiguration().orientation == |
| 234 | Configuration.ORIENTATION_LANDSCAPE; |
| 235 | } |
| 236 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 237 | public float getScreenDensity() { |
| 238 | return mScreenDensity; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 239 | } |
| 240 | |
Daniel Sandler | e4f9891 | 2013-06-25 15:13:26 -0400 | [diff] [blame] | 241 | public int getLongPressTimeout() { |
| 242 | return mLongPressTimeout; |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 243 | } |
Winson Chung | 6e1c0d3 | 2013-10-25 15:24:24 -0700 | [diff] [blame] | 244 | |
Michael Jurka | a6a0547 | 2013-11-13 17:59:46 +0100 | [diff] [blame] | 245 | public void onWallpaperChanged() { |
| 246 | mWallpaperChangedSinceLastCheck = true; |
| 247 | } |
| 248 | |
| 249 | public boolean hasWallpaperChangedSinceLastCheck() { |
| 250 | boolean result = mWallpaperChangedSinceLastCheck; |
| 251 | mWallpaperChangedSinceLastCheck = false; |
| 252 | return result; |
| 253 | } |
| 254 | |
Winson Chung | 6e1c0d3 | 2013-10-25 15:24:24 -0700 | [diff] [blame] | 255 | @Override |
| 256 | public void onAvailableSizeChanged(DeviceProfile grid) { |
| 257 | Utilities.setIconSize(grid.iconSizePx); |
| 258 | } |
Nilesh Agrawal | 16f3ea8 | 2014-01-09 17:14:01 -0800 | [diff] [blame] | 259 | |
Jorim Jaggi | eedb00a | 2014-01-13 13:45:07 -0800 | [diff] [blame] | 260 | public static boolean isDogfoodBuild() { |
| 261 | return getInstance().mBuildInfo.isDogfoodBuild(); |
| 262 | } |
Daniel Sandler | cc8befa | 2013-06-11 14:45:48 -0400 | [diff] [blame] | 263 | } |