diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-01-11 10:48:34 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-01-11 12:52:03 -0800 |
commit | 87f784c285fdeed9091a4de8b9b44db3eca677d8 (patch) | |
tree | 94870e68378e8d0e1fb09555fc1be4ca149ba99b /src/com/android/launcher3/provider | |
parent | 41307051416b3e027d89e72301704432bd1c5eb3 (diff) | |
download | packages_apps_Trebuchet-87f784c285fdeed9091a4de8b9b44db3eca677d8.tar.gz packages_apps_Trebuchet-87f784c285fdeed9091a4de8b9b44db3eca677d8.tar.bz2 packages_apps_Trebuchet-87f784c285fdeed9091a4de8b9b44db3eca677d8.zip |
Removing static Context access using LauncherAppState
> This ensures that LauncherAppState is only accessed in the presence of
a valid context
Bug: 33032833
Change-Id: I955e5cb022f8bd6374681ae6c0720a2666d5b750
Diffstat (limited to 'src/com/android/launcher3/provider')
-rw-r--r-- | src/com/android/launcher3/provider/ImportDataTask.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher3/provider/LauncherDbUtils.java | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/com/android/launcher3/provider/ImportDataTask.java b/src/com/android/launcher3/provider/ImportDataTask.java index 808e6e3ac..b0482f8b2 100644 --- a/src/com/android/launcher3/provider/ImportDataTask.java +++ b/src/com/android/launcher3/provider/ImportDataTask.java @@ -306,7 +306,7 @@ public class ImportDataTask { } LongArrayMap<Object> hotseatItems = GridSizeMigrationTask.removeBrokenHotseatItems(mContext); - int myHotseatCount = LauncherAppState.getInstance().getInvariantDeviceProfile().numHotseatIcons; + int myHotseatCount = LauncherAppState.getIDP(mContext).numHotseatIcons; if (!FeatureFlags.NO_ALL_APPS_ICON) { myHotseatCount--; } @@ -381,8 +381,8 @@ public class ImportDataTask { return c.getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE); } - private static final int getMyHotseatLayoutId() { - return LauncherAppState.getInstance().getInvariantDeviceProfile().numHotseatIcons <= 5 + private static final int getMyHotseatLayoutId(Context context) { + return LauncherAppState.getIDP(context).numHotseatIcons <= 5 ? R.xml.dw_phone_hotseat : R.xml.dw_tablet_hotseat; } @@ -392,7 +392,7 @@ public class ImportDataTask { */ private static class HotseatLayoutParser extends DefaultLayoutParser { public HotseatLayoutParser(Context context, LayoutParserCallback callback) { - super(context, null, callback, context.getResources(), getMyHotseatLayoutId()); + super(context, null, callback, context.getResources(), getMyHotseatLayoutId(context)); } @Override diff --git a/src/com/android/launcher3/provider/LauncherDbUtils.java b/src/com/android/launcher3/provider/LauncherDbUtils.java index 89fd99b23..175835011 100644 --- a/src/com/android/launcher3/provider/LauncherDbUtils.java +++ b/src/com/android/launcher3/provider/LauncherDbUtils.java @@ -76,8 +76,7 @@ public class LauncherDbUtils { } } - new LossyScreenMigrationTask( - context, LauncherAppState.getInstance().getInvariantDeviceProfile(), db) + new LossyScreenMigrationTask(context, LauncherAppState.getIDP(context), db) .migrateScreen0(); db.setTransactionSuccessful(); return true; |