summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kiryanov <rkir@google.com>2024-04-24 15:22:17 -0700
committerRoman Kiryanov <rkir@google.com>2024-04-24 15:39:24 -0700
commitf1e65147195c883d72009255fa89b7a721d330fb (patch)
treef5ba193f7727ea4e9f130e5c7472715eb4465481
parent0075642a1c6f861c74433c16a745baa8123ffdbb (diff)
downloadgoldfish-f1e65147195c883d72009255fa89b7a721d330fb.tar.gz
Retire the SettingsProvider overlay
and move its values into the provisioning library. Let's have one place to initialize the device state. Bug: 314839713 Test: boot emulator Change-Id: I75ea4814af110623e912506ced0e8c54c87d88f3 Signed-off-by: Roman Kiryanov <rkir@google.com>
-rw-r--r--overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml32
-rw-r--r--provision/EmulatorProvisonLib/src/com/android/sdksetup/ProvisionActivity.java9
2 files changed, 8 insertions, 33 deletions
diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
deleted file mode 100644
index 7b206e46..00000000
--- a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2015, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<resources>
- <bool name="def_lockscreen_disabled">true</bool>
- <bool name="def_wifi_on">true</bool>
- <!-- Allow scanning even if WiFi is disabled -->
- <integer name="def_wifi_scan_always_available">1</integer>
-
- <!-- maximize the timeout to INT_MAX about 500+ hours -->
- <integer name="def_screen_off_timeout">2147483647</integer>
-
- <!-- Allow users to use both the on-screen keyboard, as well as a real
- keyboard -->
- <bool name="def_show_ime_with_hard_keyboard">true</bool>
-</resources>
diff --git a/provision/EmulatorProvisonLib/src/com/android/sdksetup/ProvisionActivity.java b/provision/EmulatorProvisonLib/src/com/android/sdksetup/ProvisionActivity.java
index 8ba2c913..8ce1fff5 100644
--- a/provision/EmulatorProvisonLib/src/com/android/sdksetup/ProvisionActivity.java
+++ b/provision/EmulatorProvisonLib/src/com/android/sdksetup/ProvisionActivity.java
@@ -97,6 +97,12 @@ public abstract class ProvisionActivity extends Activity {
protected void provisionWifi(final String ssid) {
Settings.Global.putInt(getContentResolver(), Settings.Global.TETHER_OFFLOAD_DISABLED, 1);
+ final WifiManager mWifiManager = getApplicationContext().getSystemService(WifiManager.class);
+ if (!mWifiManager.setWifiEnabled(true)) {
+ Log.e(TAG(), "Unable to turn on Wi-Fi");
+ return;
+ }
+
final int ADD_NETWORK_FAIL = -1;
final String quotedSsid = "\"" + ssid + "\"";
@@ -104,7 +110,6 @@ public abstract class ProvisionActivity extends Activity {
config.SSID = quotedSsid;
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
- final WifiManager mWifiManager = getApplicationContext().getSystemService(WifiManager.class);
final int netId = mWifiManager.addNetwork(config);
if (netId == ADD_NETWORK_FAIL || !mWifiManager.enableNetwork(netId, true)) {
@@ -114,6 +119,8 @@ public abstract class ProvisionActivity extends Activity {
// Set physical keyboard layout based on the system property set by emulator host.
protected void provisionKeyboard(final String deviceName) {
+ Settings.Secure.putInt(getContentResolver(), Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, 1);
+
final String layoutName = SystemProperties.get("vendor.qemu.keyboard_layout");
final InputDevice device = getKeyboardDevice(deviceName);
if (device != null && !layoutName.isEmpty()) {