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
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 00e4bf4..4dc5a97 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -48,7 +48,7 @@
private InvariantDeviceProfile mInvariantDeviceProfile;
- public static LauncherAppState getInstance() {
+ public static LauncherAppState getInstance(Context context) {
if (INSTANCE == null) {
INSTANCE = new LauncherAppState();
}
@@ -159,4 +159,11 @@
public InvariantDeviceProfile getInvariantDeviceProfile() {
return mInvariantDeviceProfile;
}
+
+ /**
+ * Shorthand for {@link #getInvariantDeviceProfile()}
+ */
+ public static InvariantDeviceProfile getIDP(Context context) {
+ return LauncherAppState.getInstance(context).getInvariantDeviceProfile();
+ }
}