Merge pull request #2111 from LawnchairLauncher/11-dev_sysfeed-hotfix

This commit is contained in:
Patryk Michalik
2021-03-28 18:52:04 +02:00
committed by GitHub
@@ -1,5 +1,6 @@
package app.lawnchair.nexuslauncher;
import static android.content.pm.ApplicationInfo.FLAG_SYSTEM;
import static app.lawnchair.util.preferences.LawnchairPreferences.ENABLE_MINUS_ONE;
import android.app.Activity;
@@ -47,7 +48,7 @@ public class OverlayCallbackImpl
mLauncher = launcher;
mClient = new LauncherClient(mLauncher, this, new StaticInteger(
(prefs.getBoolean(LawnchairPreferences.ENABLE_MINUS_ONE,
FeedBridge.useBridge(launcher)) ? 1 : 0) | 2 | 4 | 8));
minusOneAvailable()) ? 1 : 0) | 2 | 4 | 8));
prefs.registerOnSharedPreferenceChangeListener(this);
}
@@ -123,7 +124,7 @@ public class OverlayCallbackImpl
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (ENABLE_MINUS_ONE.equals(key)) {
mClient.showOverlay(prefs.getBoolean(ENABLE_MINUS_ONE, FeedBridge.useBridge(mLauncher)));
mClient.showOverlay(prefs.getBoolean(ENABLE_MINUS_ONE, minusOneAvailable()));
}
}
@@ -176,4 +177,9 @@ public class OverlayCallbackImpl
Utilities.getDevicePrefs(mLauncher).edit().putInt(PREF_PERSIST_FLAGS, flags).apply();
}
}
boolean minusOneAvailable() {
return FeedBridge.useBridge(mLauncher)
|| ((mLauncher.getApplicationInfo().flags & FLAG_SYSTEM) == FLAG_SYSTEM);
}
}