Snap for 4455664 from 79cb583c60340439a5f8ef02530a1f3e3fae80b4 to oreo-vts-release
Change-Id: I96e43f6d35d2140453f987014351fe7a31013bda
diff --git a/PMC/AndroidManifest.xml b/PMC/AndroidManifest.xml
index d8485b9..127e11d 100644
--- a/PMC/AndroidManifest.xml
+++ b/PMC/AndroidManifest.xml
@@ -1,20 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2017 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.
--->
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.pmc"
android:versionCode="3"
@@ -35,12 +19,6 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
- <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
- <uses-permission android:name="android.permission.MANAGE_USB" />
- <uses-permission android:name="android.permission.WRITE_SETTINGS" />
- <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
<application
android:allowBackup="true"
diff --git a/PMC/res/layout/activity_linear.xml b/PMC/res/layout/activity_linear.xml
index 0df847b..6461b4d 100644
--- a/PMC/res/layout/activity_linear.xml
+++ b/PMC/res/layout/activity_linear.xml
@@ -1,19 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2017 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.
--->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@@ -81,12 +66,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/iperf_client" />
-
- <RadioButton
- android:id="@+id/rb_usb_tethering"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/usb_tethering" />
</RadioGroup>
<Button
diff --git a/PMC/res/values/strings.xml b/PMC/res/values/strings.xml
index 1114856..2d37c06 100644
--- a/PMC/res/values/strings.xml
+++ b/PMC/res/values/strings.xml
@@ -1,19 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2017 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>
<string name="app_name">PMC</string>
@@ -38,6 +23,5 @@
<string name="interval">Download/Scan Interval (seconds)</string>
<string name="iperf_bandwidth">Iperf Bandwidth</string>
<string name="iperf_logfile">Iperf Logfile</string>
- <string name="usb_tethering">USB Tethering</string>
</resources>
diff --git a/PMC/src/com/android/pmc/A2dpReceiver.java b/PMC/src/com/android/pmc/A2dpReceiver.java
index 676093b..7cb4ece 100644
--- a/PMC/src/com/android/pmc/A2dpReceiver.java
+++ b/PMC/src/com/android/pmc/A2dpReceiver.java
@@ -142,6 +142,8 @@
private boolean initialize() {
Log.d(TAG, "Start initialize()");
+ mPMCStatusLogger = new PMCStatusLogger(TAG + ".log", TAG);
+
// Check if any Bluetooth devices are connected
ArrayList<BluetoothDevice> results = new ArrayList<BluetoothDevice>();
Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices();
@@ -205,9 +207,6 @@
String musicUrl;
String tmpStr;
- // Create the logger object
- mPMCStatusLogger = new PMCStatusLogger(TAG + ".log", TAG);
-
// For a baseline case when Blueooth is off but music is playing with speaker is muted
boolean bt_off_mute = false;
@@ -217,19 +216,10 @@
Log.e(TAG, "No parameters specified");
return;
}
-
- if (extras.containsKey("BT_OFF_Mute")) {
- Log.v(TAG, "Mute is specified for Bluetooth off baseline case");
- bt_off_mute = true;
- }
-
- // initialize() if we are testing over Bluetooth, we do NOT test
- // over bluetooth for the play music with Bluetooth off test case.
- if (!bt_off_mute) {
- if (!initialize()) {
- mPMCStatusLogger.logStatus("initialize() Failed");
- return;
- }
+ // Always initialize()
+ if (!initialize()) {
+ mPMCStatusLogger.logStatus("initialize() Failed");
+ return;
}
// Check if it is baseline Bluetooth is on but not stream
if (extras.containsKey("BT_ON_NotPlay")) {
@@ -261,7 +251,11 @@
return;
}
// Check if it is the baseline that Bluetooth is off but streaming with speakers muted
- if (!bt_off_mute) {
+ if (extras.containsKey("BT_OFF_Mute")) {
+ Log.v(TAG, "Mute is specified for Bluetooth off baseline case");
+ bt_off_mute = true;
+ } else {
+
if (!extras.containsKey("CodecType")) {
Log.e(TAG, "No Codec Type specified");
return;
@@ -319,7 +313,7 @@
if (codecType == BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID
|| sampleRate == BluetoothCodecConfig.SAMPLE_RATE_NONE
|| bitsPerSample == BluetoothCodecConfig.BITS_PER_SAMPLE_NONE) {
- Log.d(TAG, "Invalid parameters");
+ Log.d(TAG, "Invalid paramters");
return;
}
}
@@ -344,7 +338,7 @@
* Function to setup MediaPlayer and play music
*
* @param musicURL - Music URL
- * @param btOffMute - true is to mute speakers
+ * @param bt_off_mute - true is to mute speakers
*
*/
private boolean playMusic(String musicURL, boolean btOffMute) {
@@ -363,6 +357,7 @@
Log.d(TAG, "Set Normal Volume for speakers");
mPlayer.setVolume(NORMAL_VOLUME, NORMAL_VOLUME);
}
+
// Play Music now and setup looping
mPlayer.start();
mPlayer.setLooping(true);
diff --git a/PMC/src/com/android/pmc/BleScanReceiver.java b/PMC/src/com/android/pmc/BleScanReceiver.java
index cb33a68..56532dd 100644
--- a/PMC/src/com/android/pmc/BleScanReceiver.java
+++ b/PMC/src/com/android/pmc/BleScanReceiver.java
@@ -106,14 +106,6 @@
mBleScanner = bleAdaptor.getBluetoothLeScanner();
mScanFilterList = new ArrayList<ScanFilter>();
-
- // Create ScanFilter object, to force scan even with screen OFF
- // using deviceName string of "dummy" for example
- ScanFilter scanFilterDeviceName = new ScanFilter.Builder().setDeviceName(
- "dummy").build();
- // Add the object to FilterList
- mScanFilterList.add(scanFilterDeviceName);
-
Log.d(TAG, "End BleScanListener()");
}
diff --git a/PMC/src/com/android/pmc/PMCMainActivity.java b/PMC/src/com/android/pmc/PMCMainActivity.java
index 8f59ef2..d134bdc 100644
--- a/PMC/src/com/android/pmc/PMCMainActivity.java
+++ b/PMC/src/com/android/pmc/PMCMainActivity.java
@@ -23,7 +23,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.net.ConnectivityManager;
import android.net.wifi.WifiScanner;
import android.net.wifi.WifiScanner.ChannelSpec;
import android.net.wifi.WifiScanner.ScanSettings;
@@ -69,7 +68,6 @@
private WifiGScanReceiver mGScanR = null;
private WifiDownloadReceiver mDR = null;
private IperfClient mIperfClient = null;
- private boolean mTethered = false;
private RadioGroup mRadioGroup;
private Button mBtnStart;
private Button mBtnStop;
@@ -79,23 +77,13 @@
private A2dpReceiver mA2dpReceiver;
private AlarmManager mAlarmManager;
private PowerManager.WakeLock mWakeLock;
- private ConnectivityManager mConnManager;
- private int mProvisionCheckSleep = 1250;
- class OnStartTetheringCallback extends ConnectivityManager.OnStartTetheringCallback {
- @Override
- public void onTetheringStarted() {
- mTethered = true;
- }
- }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Initiate wifi service manger
mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
- mConnManager = (ConnectivityManager)
- this.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
mPIGScan = PendingIntent.getBroadcast(this, 0, new Intent(sGScanAction), 0);
mPIDownload = PendingIntent.getBroadcast(this, 0, new Intent(sDownloadAction), 0);
mPIConnScan = PendingIntent.getBroadcast(this, 0, new Intent(sConnScanAction), 0);
@@ -157,9 +145,6 @@
case R.id.rb_iperf_client:
startIperfClient();
break;
- case R.id.rb_usb_tethering:
- startUSBTethering();
- break;
default:
return;
}
@@ -173,7 +158,6 @@
stopDownloadFile();
stopGScan();
stopIperfClient();
- stopUSBTethering();
mBtnStart.setEnabled(true);
}
});
@@ -302,32 +286,6 @@
}
}
- private void startUSBTethering() {
- OnStartTetheringCallback tetherCallback = new OnStartTetheringCallback();
- mConnManager.startTethering(ConnectivityManager.TETHERING_USB, true, tetherCallback);
- // sleep until provisioning check for tethering is done
- try {
- Thread.sleep(mProvisionCheckSleep);
- } catch (InterruptedException e) {
- Log.d(TAG, "Sleep exception after enabling USB tethering");
- }
- if (mTethered) {
- mBtnStart.setEnabled(false);
- mRadioGroup.setFocusable(false);
- mTextView.setText("Started usb tethering");
- }
- }
-
- private void stopUSBTethering() {
- if (mTethered) {
- mConnManager.stopTethering(ConnectivityManager.TETHERING_USB);
- mTethered = false;
- mBtnStart.setEnabled(true);
- mRadioGroup.setFocusable(true);
- mTextView.setText("Stopped usb tethering");
- }
- }
-
private void turnScreenOn(Context context) {
if (mWakeLock == null) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
@@ -437,10 +395,6 @@
startIperfClient();
} else if (actionstring.equalsIgnoreCase("StopIperfClient")) {
stopIperfClient();
- } else if (actionstring.equalsIgnoreCase("StartUSBTethering")) {
- startUSBTethering();
- } else if (actionstring.equalsIgnoreCase("StopUSBTethering")) {
- stopUSBTethering();
} else if (actionstring.equalsIgnoreCase("TurnScreenOn")) {
turnScreenOn(context);
} else if (actionstring.equalsIgnoreCase("TurnScreenOff")) {
diff --git a/UID/Android.mk b/UID/Android.mk
deleted file mode 100644
index 19851f6..0000000
--- a/UID/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-## Copyright (C) 2017 Google, Inc.
-#
-## 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := ConnectivityUIDTest
-LOCAL_CERTIFICATE := platform
-LOCAL_DEX_PREOPT := false
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/UID/AndroidManifest.xml b/UID/AndroidManifest.xml
deleted file mode 100644
index 0baa509..0000000
--- a/UID/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2017 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.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.tests.connectivity.uid"
- android:versionCode="3"
- android:versionName="3.0" >
-
- <uses-sdk
- android:minSdkVersion="19"
- android:targetSdkVersion="26" />
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
- <application
- android:allowBackup="true"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <!-- Dummy activity -->
- <activity
- android:name="com.android.tests.connectivity.uid.ConnectivityTestActivity"
- android:configChanges="keyboardHidden|orientation|screenSize"
- android:label="@string/app_name" >
- </activity>
- </application>
-
-</manifest>
diff --git a/UID/res/values/strings.xml b/UID/res/values/strings.xml
deleted file mode 100644
index 9f0cf32..0000000
--- a/UID/res/values/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2017 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>
-
- <string name="app_name">ConnectivityUIDTest</string>
- <string name="settings">Settings</string>
-
-</resources>
diff --git a/UID/res/values/styles.xml b/UID/res/values/styles.xml
deleted file mode 100644
index 2847191..0000000
--- a/UID/res/values/styles.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- Copyright 2017 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>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-
-
-</resources>
diff --git a/UID/src/com/android/tests/connectivity/uid/ConnectivityTestActivity.java b/UID/src/com/android/tests/connectivity/uid/ConnectivityTestActivity.java
deleted file mode 100644
index 49c6c14..0000000
--- a/UID/src/com/android/tests/connectivity/uid/ConnectivityTestActivity.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2017 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.tests.connectivity.uid;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Bundle;
-import android.os.StrictMode;
-import android.util.Log;
-import java.io.*;
-import java.lang.Thread;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-public class ConnectivityTestActivity extends Activity {
-
- ConnectivityManager connectivityManager;
- NetworkInfo netInfo;
- public static final String TAG = "ConnectivityUIDTest";
- private static final String RESULT = "result";
-
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- StrictMode.ThreadPolicy policy =
- new StrictMode.ThreadPolicy.Builder().permitAll().build();
- StrictMode.setThreadPolicy(policy);
- }
-
- public void onResume() {
- super.onResume();
- boolean conn = checkNow(this.getApplicationContext());
- Intent returnIntent = new Intent();
- returnIntent.putExtra(RESULT, conn);
- setResult(RESULT_OK, returnIntent);
- finish();
- }
-
- public boolean checkNow(Context con) {
- try{
- connectivityManager = (ConnectivityManager)
- con.getSystemService(Context.CONNECTIVITY_SERVICE);
- netInfo = connectivityManager.getActiveNetworkInfo();
- return netInfo.isConnected() && httpRequest();
- } catch(Exception e) {
- Log.e(TAG, "CheckConnectivity exception: ", e);
- }
-
- return false;
- }
-
- private boolean httpRequest() throws IOException {
- URL targetURL = new URL("http://www.google.com/generate_204");
- HttpURLConnection urlConnection = null;
- try {
- urlConnection = (HttpURLConnection) targetURL.openConnection();
- urlConnection.connect();
- int respCode = urlConnection.getResponseCode();
- return (respCode == 204);
- } catch (IOException e) {
- Log.e(TAG, "Checkconnectivity exception: ", e);
- }
- return false;
- }
-}