Merge "[SdkSetup] Clean up"

This commit is contained in:
Weilun Du
2021-06-30 23:52:32 +00:00
committed by Gerrit Code Review
2 changed files with 11 additions and 10 deletions

View File

@@ -28,7 +28,7 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application> <application>
<activity android:name="DefaultActivity" <activity android:name="DefaultActivity"
android:excludeFromRecents="true"> android:excludeFromRecents="true"
android:exported="true"> android:exported="true">
<intent-filter android:priority="3"> <intent-filter android:priority="3">
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@@ -48,6 +48,16 @@ public class DefaultActivity extends Activity {
// Edit Settings only for Emulator // Edit Settings only for Emulator
if (Build.IS_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. // 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 deviceName = "qwerty2"; String deviceName = "qwerty2";
@@ -80,15 +90,6 @@ public class DefaultActivity extends Activity {
mTelephony.setPreferredNetworkTypeBitmask(TelephonyManager.NETWORK_TYPE_BITMASK_NR); mTelephony.setPreferredNetworkTypeBitmask(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
} }
// 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. // remove this activity from the package manager.
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();
ComponentName name = new ComponentName(this, DefaultActivity.class); ComponentName name = new ComponentName(this, DefaultActivity.class);