Sdksetup: Set path for display settings file for freeform display

Bug: 183668221

Test: config emualtor with display.settings.xml=freeform, run emulator
Change-Id: I7c303c82c07e467bdb4a3b587bbd2ef6d1e61ae5
This commit is contained in:
Huan Song
2021-04-20 09:53:06 -07:00
parent 10cbdd49a3
commit a9fde290dd

View File

@@ -46,6 +46,7 @@ public class DefaultActivity extends Activity {
if (Build.IS_EMULATOR) { if (Build.IS_EMULATOR) {
// Set physical keyboard layout based on the system property set by emulator host. // Set physical keyboard layout based on the system property set by emulator host.
String layoutName = SystemProperties.get("vendor.qemu.keyboard_layout"); String layoutName = SystemProperties.get("vendor.qemu.keyboard_layout");
String displaySettingsName = SystemProperties.get("ro.boot.qemu.display.settings.xml");
String deviceName = "qwerty2"; String deviceName = "qwerty2";
InputDevice device = getKeyboardDevice(deviceName); InputDevice device = getKeyboardDevice(deviceName);
if (device != null && !layoutName.isEmpty()) { if (device != null && !layoutName.isEmpty()) {
@@ -74,6 +75,12 @@ public class DefaultActivity extends Activity {
TelephonyManager mTelephony = getApplicationContext().getSystemService(TelephonyManager.class); TelephonyManager mTelephony = getApplicationContext().getSystemService(TelephonyManager.class);
mTelephony.setPreferredNetworkTypeBitmask(TelephonyManager.NETWORK_TYPE_BITMASK_NR); mTelephony.setPreferredNetworkTypeBitmask(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
if ("freeform".equals(displaySettingsName)) {
Settings.Global.putInt(getContentResolver(), "sf", 1);
Settings.Global.putString(getContentResolver(), Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, "1");
Settings.Global.putString(getContentResolver(), Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, "1");
Settings.Global.putString(getContentResolver(), Settings.Global.DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH, "vendor/etc/display_settings_freeform.xml");
}
} }
// remove this activity from the package manager. // remove this activity from the package manager.