[adb-wireless] Add Wireless Debugging Switch in Developer options.
Bug: 111434128 Bug: 119492574 Test: make RunSettingsRoboTests ROBOTEST_FILTER=WirelessDebugging Change-Id: I188badb43035172642cf235bb27e56d3a1dea169
This commit is contained in:
56
src/com/android/settings/wifi/dpp/AdbQrCode.java
Normal file
56
src/com/android/settings/wifi/dpp/AdbQrCode.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* Extension of WifiQrCode to support ADB QR code format.
|
||||
* It will be based on the ZXing format:
|
||||
*
|
||||
* WIFI:T:ADB;S:myname;P:mypassword;;
|
||||
*/
|
||||
public class AdbQrCode extends WifiQrCode {
|
||||
static final String SECURITY_ADB = "ADB";
|
||||
|
||||
private WifiNetworkConfig mAdbConfig;
|
||||
|
||||
public AdbQrCode(String qrCode) throws IllegalArgumentException {
|
||||
super(qrCode);
|
||||
|
||||
// Only accept the zxing format.
|
||||
if (!WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG.equals(getScheme())) {
|
||||
throw new IllegalArgumentException("DPP format not supported for ADB QR code");
|
||||
}
|
||||
|
||||
mAdbConfig = getWifiNetworkConfig();
|
||||
if (!SECURITY_ADB.equals(mAdbConfig.getSecurity())) {
|
||||
throw new IllegalArgumentException("Invalid security type");
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(mAdbConfig.getSsid())) {
|
||||
throw new IllegalArgumentException("Empty service name");
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(mAdbConfig.getPreSharedKey())) {
|
||||
throw new IllegalArgumentException("Empty password");
|
||||
}
|
||||
}
|
||||
|
||||
public WifiNetworkConfig getAdbNetworkConfig() {
|
||||
return mAdbConfig;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user