Use Lawnchair DPO, remove Trace
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
1 parent
4f1e9f2d2a
commit
77994b0bb5
1 file changed
+9
-11
@@ -41,7 +41,7 @@ import android.content.res.XmlResourceParser;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Trace;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -298,14 +298,12 @@ public class InvariantDeviceProfile {
|
||||
LauncherPrefChangeListener prefListener = key -> {
|
||||
if (FIXED_LANDSCAPE_MODE.getSharedPrefKey().equals(key)
|
||||
&& isFixedLandscape != prefs.get(FIXED_LANDSCAPE_MODE)) {
|
||||
Trace.beginSection("InvariantDeviceProfile#setFixedLandscape");
|
||||
if (isFixedLandscape) {
|
||||
setCurrentGrid(context, prefs.get(NON_FIXED_LANDSCAPE_GRID_NAME));
|
||||
} else {
|
||||
prefs.put(NON_FIXED_LANDSCAPE_GRID_NAME, mPrefs.get(GRID_NAME));
|
||||
prefs.put(NON_FIXED_LANDSCAPE_GRID_NAME, getCurrentGridName(context));
|
||||
onConfigChanged(context);
|
||||
}
|
||||
Trace.endSection();
|
||||
} else if (ENABLE_TWOLINE_ALLAPPS_TOGGLE.getSharedPrefKey().equals(key)
|
||||
&& enableTwoLinesInAllApps != prefs.get(ENABLE_TWOLINE_ALLAPPS_TOGGLE)) {
|
||||
onConfigChanged(context);
|
||||
@@ -321,6 +319,10 @@ public class InvariantDeviceProfile {
|
||||
lifeCycle.addCloseable(() -> localeReceiver.unregisterReceiverSafely());
|
||||
}
|
||||
|
||||
public static String getCurrentGridName(Context context) {
|
||||
return DeviceProfileOverrides.INSTANCE.get(context).getCurrentGridName();
|
||||
}
|
||||
|
||||
public InvariantDeviceProfile(Context context, DeviceProfileOverrides.DBGridInfo dbGridInfo) {
|
||||
this.mPrefs = LauncherPrefs.get(context.getApplicationContext());
|
||||
this.mThemeManager = ThemeManager.INSTANCE.get(context.getApplicationContext());
|
||||
@@ -377,7 +379,7 @@ public class InvariantDeviceProfile {
|
||||
*/
|
||||
@Deprecated
|
||||
public void reset(Context context) {
|
||||
initGrid(context, mPrefs.get(GRID_NAME));
|
||||
initGrid(context, getCurrentGridName(context));
|
||||
}
|
||||
|
||||
private void initGrid(Context context, Info displayInfo, DisplayOption displayOption, DeviceProfileOverrides.DBGridInfo dbGridInfo) {
|
||||
@@ -548,13 +550,9 @@ public class InvariantDeviceProfile {
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void setCurrentGrid(Context context, String newGridName) {
|
||||
// Lawnchair-TODO-Merge-High: We use DPO instead of mPrefs.put
|
||||
// DeviceProfileOverrides.INSTANCE.get(context).setCurrentGrid(gridName);
|
||||
mPrefs.put(GRID_NAME, newGridName);
|
||||
DeviceProfileOverrides.INSTANCE.get(context).setCurrentGrid(newGridName);
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
Trace.beginSection("InvariantDeviceProfile#setCurrentGrid");
|
||||
onConfigChanged(context.getApplicationContext());
|
||||
Trace.endSection();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -570,7 +568,7 @@ public class InvariantDeviceProfile {
|
||||
Object[] oldState = toModelState();
|
||||
|
||||
// Re-init grid
|
||||
initGrid(context, mPrefs.get(GRID_NAME));
|
||||
initGrid(context, getCurrentGridName(context));
|
||||
|
||||
boolean modelPropsChanged = !Arrays.equals(oldState, toModelState());
|
||||
for (OnIDPChangeListener listener : mChangeListeners) {
|
||||
|
||||
Reference in new issue
Block a user