diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-12-04 01:25:18 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-12-04 01:25:18 +0000 |
commit | 1a1ffea1f59c60cdc2942ca08b3414782f4248a6 (patch) | |
tree | d3f03d36e2ccb33a91a4bd20beef3953a9c05217 | |
parent | 55f00edae49bbbcd7bacaf58886434218e0aca63 (diff) | |
parent | b9de727efcf8f0355e0cd1bca37e2b6e0a9d7c3c (diff) | |
download | cts-sparse-7968940-L63800000952240950.tar.gz |
Merge "Merge cherrypicks of [1885870, 1815899, 1891195] into sparse-7903266-L96800000952159595." into sparse-7903266-L96800000952159595sparse-7968940-L63800000952240950
6 files changed, 23 insertions, 208 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml index 9ce58609115..8afed73b337 100644 --- a/apps/CtsVerifier/AndroidManifest.xml +++ b/apps/CtsVerifier/AndroidManifest.xml @@ -22,7 +22,6 @@ <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30"/> - <uses-permission android:name="android.car.permission.CAR_EXTERIOR_ENVIRONMENT" /> <uses-permission android:name="android.car.permission.CAR_POWERTRAIN" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> @@ -4683,20 +4682,6 @@ android:value="multi_display_mode" /> </activity> - <activity android:name=".car.NightModeTestActivity" - android:label="@string/night_mode_test"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.cts.intent.category.MANUAL_TEST" /> - </intent-filter> - <meta-data android:name="test_category" android:value="@string/test_category_car" /> - <meta-data - android:name="test_required_features" - android:value="android.hardware.type.automotive"/> - <meta-data android:name="display_mode" - android:value="multi_display_mode" /> - </activity> - <activity android:name=".car.ParkingBrakeOnTestActivity" android:label="@string/parking_brake_on_test"> <intent-filter> diff --git a/apps/CtsVerifier/res/layout/night_mode_test.xml b/apps/CtsVerifier/res/layout/night_mode_test.xml deleted file mode 100644 index cdba03257f3..00000000000 --- a/apps/CtsVerifier/res/layout/night_mode_test.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2019 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. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> - <TextView - android:id="@+id/night_mode_instruction" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:gravity="center" - android:textSize="50dip" /> - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="2" - android:orientation="horizontal"> - <TextView - android:id="@+id/current_night_mode_value_title" - android:layout_width="0dp" - android:layout_weight="2" - android:layout_height="match_parent" - android:gravity="center" - android:text="@string/current_night_mode_value_title" - android:textSize="50dip" /> - <TextView - android:id="@+id/current_night_mode_value" - android:layout_width="0dp" - android:layout_weight="1" - android:layout_height="match_parent" - android:gravity="center" - android:textSize="50dip" /> - </LinearLayout> - <include layout="@layout/pass_fail_buttons" /> -</LinearLayout> diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml index 2b5aad9d9f9..91db588b9d9 100755 --- a/apps/CtsVerifier/res/values/strings.xml +++ b/apps/CtsVerifier/res/values/strings.xml @@ -155,12 +155,6 @@ implemented gears then the pass button will be enabled.</string> <string name="expected_gear_selection_title">Expected Gear Selection</string> <string name="current_gear_selection_title">Current Gear Selection</string> - <string name="night_mode_test">NIGHT_MODE Test</string> - <string name="night_mode_test_desc">This test ensures that the NIGHT_MODE vehicle property is - implemented correctly.\n\nFollow the instructions on the screen to engage and disengage - NIGHT_MODE through the vehicle HAL. When the instructions are completed, the pass button - will be enabled.</string> - <string name="current_night_mode_value_title">Current NIGHT_MODE Value:</string> <string name="parking_brake_on_test">PARKING_BRAKE_ON Test</string> <string name="parking_brake_on_test_desc">This test ensures that the PARKING_BRAKE_ON property is implemented correctly.\n\nFollow the diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/car/NightModeTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/car/NightModeTestActivity.java deleted file mode 100644 index 786dc5786ec..00000000000 --- a/apps/CtsVerifier/src/com/android/cts/verifier/car/NightModeTestActivity.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2019 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.cts.verifier.car; - -import android.car.Car; -import android.car.hardware.CarPropertyConfig; -import android.car.hardware.CarPropertyValue; -import android.car.hardware.property.CarPropertyManager; -import android.car.VehicleAreaType; -import android.car.VehiclePropertyIds; -import android.os.Bundle; -import android.widget.TextView; -import android.util.ArraySet; -import android.util.Log; - -import com.android.cts.verifier.PassFailButtons; -import com.android.cts.verifier.R; - -import java.util.Arrays; -import java.util.List; - -/** A CTS Verifier test case to verify NIGHT_MODE is implemented correctly.*/ -public class NightModeTestActivity extends PassFailButtons.Activity { - private static final String TAG = NightModeTestActivity.class.getSimpleName(); - private static final int TOTAL_MATCHES_NEEDED_TO_FINISH = 2; - private static final String TOTAL_TIMES_NEW_VALUE_MATCHED_INSTRUCTION = - "TotalTimesNewValueMatchedInstruction"; - private static final String CURRENT_NIGHT_MODE_VALUE = "CurrentNightModeValue"; - private Boolean mCurrentNightModeValue; - private TextView mInstructionTextView; - private TextView mCurrentNightModeValueTextView; - private int mTotalTimesNewValueMatchedInstruction = 0; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Setup the UI. - setContentView(R.layout.night_mode_test); - setPassFailButtonClickListeners(); - setInfoResources(R.string.night_mode_test, R.string.night_mode_test_desc, -1); - getPassButton().setEnabled(false); - - mInstructionTextView = (TextView) findViewById(R.id.night_mode_instruction); - mInstructionTextView.setText("Waiting to get first NIGHT_MODE callback from Vehicle HAL"); - mCurrentNightModeValueTextView = (TextView) findViewById(R.id.current_night_mode_value); - - - CarPropertyManager carPropertyManager = - (CarPropertyManager) Car.createCar(this).getCarManager(Car.PROPERTY_SERVICE); - - if(!carPropertyManager.registerCallback(mCarPropertyEventCallback, - VehiclePropertyIds.NIGHT_MODE, CarPropertyManager.SENSOR_RATE_ONCHANGE)) { - mInstructionTextView.setText("ERROR: Unable to register for NIGHT_MODE callback"); - Log.e(TAG, "Failed to register callback for NIGHT_MODE with CarPropertyManager"); - } - } - - // Need to save the state because of the UI Mode switch with the change in the NIGHT_MODE - // property value. - @Override - protected void onSaveInstanceState(final Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean(CURRENT_NIGHT_MODE_VALUE, mCurrentNightModeValue); - outState.putInt(TOTAL_TIMES_NEW_VALUE_MATCHED_INSTRUCTION, - mTotalTimesNewValueMatchedInstruction); - } - - @Override - protected void onRestoreInstanceState(final Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - mCurrentNightModeValue = savedInstanceState.getBoolean(CURRENT_NIGHT_MODE_VALUE); - mTotalTimesNewValueMatchedInstruction = - savedInstanceState.getInt(TOTAL_TIMES_NEW_VALUE_MATCHED_INSTRUCTION); - } - - private final CarPropertyManager.CarPropertyEventCallback mCarPropertyEventCallback = - new CarPropertyManager.CarPropertyEventCallback() { - @Override - public void onChangeEvent(CarPropertyValue value) { - if(value.getStatus() != CarPropertyValue.STATUS_AVAILABLE) { - Log.e(TAG, "New CarPropertyValue's status is not available - propId: " + - value.getPropertyId() + " status: " + value.getStatus()); - return; - } - - Boolean newValue = (Boolean) value.getValue(); - Log.i(TAG, "New NIGHT_MODE value: " + newValue); - - // On the first callback, mCurrentNightModeValue will be null, so just save the - // current value. All other callbacks, check if the NIGHT_MODE value has switched. - // If switched, update the count. - if (mCurrentNightModeValue != null && !mCurrentNightModeValue.equals(newValue)) { - mTotalTimesNewValueMatchedInstruction++; - } - - mCurrentNightModeValue = newValue; - mCurrentNightModeValueTextView.setText(mCurrentNightModeValue.toString()); - - // Check if the test is finished. If not finished, update the instructions. - if(mTotalTimesNewValueMatchedInstruction >= TOTAL_MATCHES_NEEDED_TO_FINISH) { - mInstructionTextView.setText("Test Finished!"); - getPassButton().setEnabled(true); - } else if(mCurrentNightModeValue) { - mInstructionTextView.setText("Toggle off NIGHT_MODE through Vehicle HAL"); - } else { - mInstructionTextView.setText("Toggle on NIGHT_MODE through Vehicle HAL"); - } - } - - @Override - public void onErrorEvent(int propId, int zone) { - Log.e(TAG, "propId: " + propId + " zone: " + zone); - } - }; -} diff --git a/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java b/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java index 55d4c5e547d..1aa87e94c68 100644 --- a/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java +++ b/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java @@ -251,13 +251,17 @@ public class StrictJavaPackagesTest extends BaseHostJUnit4Test { ); ImmutableSet<String> overlapBurndownList; if (hasFeature(FEATURE_AUTOMOTIVE)) { - overlapBurndownList = ImmutableSet.<String>builder() - .addAll(BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST) - .addAll(AUTOMOTIVE_HIDL_OVERLAP_BURNDOWN_LIST).build(); + final Set<String> allDuplicatedFiles = Sets.union( + BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST, + AUTOMOTIVE_HIDL_OVERLAP_BURNDOWN_LIST + ); + overlapBurndownList = ImmutableSet.copyOf(allDuplicatedFiles); } else if (hasFeature(FEATURE_WEARABLE)) { - overlapBurndownList = ImmutableSet.<String>builder() - .addAll(BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST) - .addAll(WEAR_HIDL_OVERLAP_BURNDOWN_LIST).build(); + final Set<String> allDuplicatedFiles = Sets.union( + BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST, + WEAR_HIDL_OVERLAP_BURNDOWN_LIST + ); + overlapBurndownList = ImmutableSet.copyOf(allDuplicatedFiles); } else { overlapBurndownList = ImmutableSet.copyOf(BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST); } diff --git a/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java b/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java index eaab3202ea0..602f353ce28 100644 --- a/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java +++ b/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java @@ -857,7 +857,7 @@ public class ScopedStorageTest { ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE); assertRWR(readPfd, writePfd); - assertLowerFsFd(writePfd); + assertLowerFsFdWithPassthrough(writePfd); } finally { file.delete(); } @@ -895,7 +895,7 @@ public class ScopedStorageTest { ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE); assertRWR(readPfd, writePfd); - assertLowerFsFd(readPfd); + assertLowerFsFdWithPassthrough(readPfd); } finally { file.delete(); } @@ -915,8 +915,8 @@ public class ScopedStorageTest { assertRWR(readPfd, writePfd); assertRWR(writePfd, readPfd); // Can read on 'w' only pfd - assertLowerFsFd(writePfd); - assertLowerFsFd(readPfd); + assertLowerFsFdWithPassthrough(writePfd); + assertLowerFsFdWithPassthrough(readPfd); } finally { file.delete(); } @@ -940,7 +940,7 @@ public class ScopedStorageTest { writePfd.close(); assertRWR(readPfd, writePfdDup); - assertLowerFsFd(writePfdDup); + assertLowerFsFdWithPassthrough(writePfdDup); } } } finally { @@ -3056,6 +3056,14 @@ public class ScopedStorageTest { assertThat(Os.readlink("/proc/self/fd/" + pfd.getFd()).startsWith("/mnt/user")).isTrue(); } + private void assertLowerFsFdWithPassthrough(ParcelFileDescriptor pfd) throws Exception { + if (getBoolean("persist.sys.fuse.passthrough.enable", false)) { + assertUpperFsFd(pfd); + } else { + assertLowerFsFd(pfd); + } + } + private static void assertCanCreateFile(File file) throws IOException { // If the file somehow managed to survive a previous run, then the test app was uninstalled // and MediaProvider will remove our its ownership of the file, so it's not guaranteed that |