Merge "Cutout emulation: string changes and ordering" into pi-dev
am: 8d82158036
Change-Id: I6d6c191e1dc511d2ab6e563f7bbea27962fe7b63
This commit is contained in:
@@ -33,6 +33,7 @@ import com.android.settings.wrapper.OverlayManagerWrapper;
|
||||
import com.android.settings.wrapper.OverlayManagerWrapper.OverlayInfo;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class EmulateDisplayCutoutPreferenceController extends
|
||||
@@ -40,6 +41,8 @@ public class EmulateDisplayCutoutPreferenceController extends
|
||||
PreferenceControllerMixin {
|
||||
|
||||
private static final String KEY = "display_cutout_emulation";
|
||||
private static final Comparator<OverlayInfo> OVERLAY_INFO_COMPARATOR =
|
||||
Comparator.comparingInt(a -> a.priority);
|
||||
|
||||
private final OverlayManagerWrapper mOverlayManager;
|
||||
private final boolean mAvailable;
|
||||
@@ -120,7 +123,7 @@ public class EmulateDisplayCutoutPreferenceController extends
|
||||
|
||||
int current = 0;
|
||||
pkgs[0] = "";
|
||||
labels[0] = mContext.getString(R.string.display_cutout_emulation_none);
|
||||
labels[0] = mContext.getString(R.string.display_cutout_emulation_device_default);
|
||||
|
||||
for (int i = 0; i < overlays.length; i++) {
|
||||
OverlayInfo o = overlays[i];
|
||||
@@ -153,6 +156,7 @@ public class EmulateDisplayCutoutPreferenceController extends
|
||||
overlayInfos.remove(i);
|
||||
}
|
||||
}
|
||||
overlayInfos.sort(OVERLAY_INFO_COMPARATOR);
|
||||
return overlayInfos.toArray(new OverlayInfo[overlayInfos.size()]);
|
||||
}
|
||||
|
||||
|
@@ -81,18 +81,21 @@ public class OverlayManagerWrapper {
|
||||
public static final String CATEGORY_THEME = android.content.om.OverlayInfo.CATEGORY_THEME;
|
||||
public final String packageName;
|
||||
public final String category;
|
||||
public final int priority;
|
||||
private final boolean mEnabled;
|
||||
|
||||
public OverlayInfo(String packageName, String category, boolean enabled) {
|
||||
public OverlayInfo(String packageName, String category, boolean enabled, int priority) {
|
||||
this.packageName = packageName;
|
||||
this.category = category;
|
||||
mEnabled = enabled;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public OverlayInfo(android.content.om.OverlayInfo info) {
|
||||
mEnabled = info.isEnabled();
|
||||
category = info.category;
|
||||
packageName = info.packageName;
|
||||
priority = info.priority;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
|
Reference in New Issue
Block a user