[SdkSetup] Clean up
1, Fixed AndroidManifests.xml parsing error. 2, Connect to AndroidWifi access point for emulator only. Bug: 185242318 Signed-off-by: Weilun Du <wdu@google.com> Change-Id: I5d4863b3c5aba8e7dfccdd061739afe30ded5162
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<application>
|
||||
<activity android:name="DefaultActivity"
|
||||
android:excludeFromRecents="true">
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="3">
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -48,6 +48,16 @@ public class DefaultActivity extends Activity {
|
||||
|
||||
// Edit Settings only for Emulator
|
||||
if (Build.IS_EMULATOR) {
|
||||
// Add network with SSID "AndroidWifi"
|
||||
WifiConfiguration config = new WifiConfiguration();
|
||||
config.SSID = "\"AndroidWifi\"";
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
|
||||
WifiManager mWifiManager = getApplicationContext().getSystemService(WifiManager.class);
|
||||
int netId = mWifiManager.addNetwork(config);
|
||||
if (netId == ADD_NETWORK_FAIL || mWifiManager.enableNetwork(netId, true)) {
|
||||
Log.e(TAG, "Unable to add Wi-Fi network AndroidWifi.");
|
||||
}
|
||||
|
||||
// Set physical keyboard layout based on the system property set by emulator host.
|
||||
String layoutName = SystemProperties.get("vendor.qemu.keyboard_layout");
|
||||
String displaySettingsName = SystemProperties.get("ro.boot.qemu.display.settings.xml");
|
||||
@@ -87,15 +97,6 @@ public class DefaultActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
// Add network with SSID "AndroidWifi"
|
||||
WifiConfiguration config = new WifiConfiguration();
|
||||
config.SSID = "\"AndroidWifi\"";
|
||||
config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
|
||||
WifiManager mWifiManager = getApplicationContext().getSystemService(WifiManager.class);
|
||||
int netId = mWifiManager.addNetwork(config);
|
||||
if (netId == ADD_NETWORK_FAIL || mWifiManager.enableNetwork(netId, true)) {
|
||||
Log.e(TAG, "Unable to add Wi-Fi network AndroidWifi.");
|
||||
}
|
||||
// remove this activity from the package manager.
|
||||
PackageManager pm = getPackageManager();
|
||||
ComponentName name = new ComponentName(this, DefaultActivity.class);
|
||||
|
||||
Reference in New Issue
Block a user