Merge "Pass result back from RecentsRedactionActivity." into pie-cts-dev
diff --git a/apps/CameraITS/pymodules/its/cv2image.py b/apps/CameraITS/pymodules/its/cv2image.py
index 8cd7ca9..21804e9 100644
--- a/apps/CameraITS/pymodules/its/cv2image.py
+++ b/apps/CameraITS/pymodules/its/cv2image.py
@@ -158,6 +158,9 @@
print 'Finding chart in scene...'
for scale in numpy.arange(scale_start, scale_stop, scale_step):
scene_scaled = scale_img(scene_gray, scale)
+ if (scene_scaled.shape[0] < chart.shape[0] or
+ scene_scaled.shape[1] < chart.shape[1]):
+ continue
result = cv2.matchTemplate(scene_scaled, chart, cv2.TM_CCOEFF)
_, opt_val, _, top_left_scaled = cv2.minMaxLoc(result)
# print out scale and match
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 038eb70..339aafc 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -579,6 +579,9 @@
<meta-data
android:name="test_required_features"
android:value="android.hardware.bluetooth_le" />
+ <meta-data
+ android:name="test_excluded_features"
+ android:value="android.hardware.type.watch" />
</activity>
<!--
@@ -691,6 +694,9 @@
<meta-data
android:name="test_required_features"
android:value="android.hardware.bluetooth_le" />
+ <meta-data
+ android:name="test_excluded_features"
+ android:value="android.hardware.type.watch" />
</activity>
<!--
@@ -804,6 +810,9 @@
<meta-data
android:name="test_required_features"
android:value="android.hardware.bluetooth_le" />
+ <meta-data
+ android:name="test_excluded_features"
+ android:value="android.hardware.type.watch" />
</activity>
<!--
@@ -914,6 +923,9 @@
<meta-data
android:name="test_required_features"
android:value="android.hardware.bluetooth_le" />
+ <meta-data
+ android:name="test_excluded_features"
+ android:value="android.hardware.type.watch" />
</activity>
<!--
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java
index f26d228..d44b782 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java
@@ -19,6 +19,8 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.provider.Settings;
import android.os.SystemClock;
import android.os.UserManager;
@@ -82,6 +84,13 @@
return;
}
+ MediaPlayer mediaPlayer = new MediaPlayer();
+ mediaPlayer.setDataSource(mContext, Settings.System.DEFAULT_RINGTONE_URI);
+ mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+ mediaPlayer.prepare();
+ mediaPlayer.setLooping(true);
+ mediaPlayer.start();
+
try {
// Set volume of music to be 1.
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 1, /* flag= */ 0);
@@ -114,6 +123,10 @@
UserManager.DISALLOW_ADJUST_VOLUME);
waitUntil(false, mCheckIfMasterVolumeMuted);
}
+
+ mediaPlayer.stop();
+ mediaPlayer.release();
+ mediaPlayer = null;
}
public void testDisallowUnmuteMicrophone() throws Exception {
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
index 52f6d30..71fac10 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
@@ -29,7 +29,6 @@
import com.android.os.AtomsProto.FullBatteryCapacity;
import com.android.os.AtomsProto.KernelWakelock;
import com.android.os.AtomsProto.RemainingBatteryCapacity;
-import com.android.os.AtomsProto.SubsystemSleepState;
import com.android.os.StatsLog.EventMetricData;
import java.util.Arrays;
@@ -409,32 +408,6 @@
assertTrue(atom.getKernelWakelock().hasTime());
}
- public void testSubsystemSleepState() throws Exception {
- if (statsdDisabled()) {
- return;
- }
- StatsdConfig.Builder config = getPulledConfig();
- FieldMatcher.Builder dimension = FieldMatcher.newBuilder()
- .setField(Atom.SUBSYSTEM_SLEEP_STATE_FIELD_NUMBER)
- .addChild(FieldMatcher.newBuilder()
- .setField(SubsystemSleepState.SUBSYSTEM_NAME_FIELD_NUMBER));
- addGaugeAtom(config, Atom.SUBSYSTEM_SLEEP_STATE_FIELD_NUMBER, dimension);
-
- uploadConfig(config);
-
- Thread.sleep(WAIT_TIME_LONG);
- setAppBreadcrumbPredicate();
- Thread.sleep(WAIT_TIME_LONG);
-
- List<Atom> dataList = getGaugeMetricDataList();
-
- for (Atom atom: dataList) {
- assertTrue(!atom.getSubsystemSleepState().getSubsystemName().equals(""));
- assertTrue(atom.getSubsystemSleepState().getCount() >= 0);
- assertTrue(atom.getSubsystemSleepState().getTimeMillis() >= 0);
- }
- }
-
public void testWifiActivityInfo() throws Exception {
if (statsdDisabled()) {
return;
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
index 2dda663..a8e4574 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
@@ -46,6 +46,7 @@
import com.android.os.AtomsProto.WifiMulticastLockStateChanged;
import com.android.os.AtomsProto.WifiScanStateChanged;
import com.android.os.StatsLog.EventMetricData;
+import com.android.tradefed.log.LogUtil;
import java.util.Arrays;
import java.util.HashSet;
@@ -701,8 +702,14 @@
if (statsdDisabled()) {
return;
}
+ String supported = getDevice().executeShellCommand("am supports-multiwindow");
if (!hasFeature(FEATURE_WATCH, false) ||
- !hasFeature(FEATURE_PICTURE_IN_PICTURE, true)) return;
+ !hasFeature(FEATURE_PICTURE_IN_PICTURE, true) ||
+ !supported.contains("true")) {
+ LogUtil.CLog.d("Skipping picture in picture atom test.");
+ return;
+ }
+
final int atomTag = Atom.PICTURE_IN_PICTURE_STATE_CHANGED_FIELD_NUMBER;
Set<Integer> entered = new HashSet<>(
@@ -713,6 +720,7 @@
createAndUploadConfig(atomTag, false);
+ LogUtil.CLog.d("Playing video in Picture-in-Picture mode");
runActivity("VideoPlayerActivity", "action", "action.play_video_picture_in_picture_mode");
// Sorted list of events in order in which they occurred.
diff --git a/tests/autofillservice/AndroidManifest.xml b/tests/autofillservice/AndroidManifest.xml
index e47e6df..5feaf8d 100644
--- a/tests/autofillservice/AndroidManifest.xml
+++ b/tests/autofillservice/AndroidManifest.xml
@@ -99,6 +99,9 @@
<receiver android:name=".SelfDestructReceiver"
android:exported="true"
android:process="android.autofillservice.cts.outside"/>
+ <receiver android:name=".OutOfProcessLoginActivityFinisherReceiver"
+ android:exported="true"
+ android:process="android.autofillservice.cts.outside"/>
<service
android:name=".InstrumentedAutoFillService"
diff --git a/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java b/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java
index dadb3c9..a9974f1 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java
@@ -19,9 +19,10 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
+import android.util.Log;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import android.util.Log;
import java.io.File;
import java.io.IOException;
@@ -30,46 +31,50 @@
* Simple activity showing R.layout.login_activity. Started outside of the test process.
*/
public class OutOfProcessLoginActivity extends Activity {
- private static final String LOG_TAG = OutOfProcessLoginActivity.class.getSimpleName();
+ private static final String TAG = "OutOfProcessLoginActivity";
+
+ private static OutOfProcessLoginActivity sInstance;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
- Log.i(LOG_TAG, "onCreate(" + savedInstanceState + ")");
+ Log.i(TAG, "onCreate(" + savedInstanceState + ")");
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
findViewById(R.id.login).setOnClickListener((v) -> finish());
+
+ sInstance = this;
}
@Override
protected void onStart() {
- Log.i(LOG_TAG, "onStart()");
+ Log.i(TAG, "onStart()");
super.onStart();
try {
if (!getStartedMarker(this).createNewFile()) {
- Log.e(LOG_TAG, "cannot write started file");
+ Log.e(TAG, "cannot write started file");
}
} catch (IOException e) {
- Log.e(LOG_TAG, "cannot write started file");
+ Log.e(TAG, "cannot write started file: " + e);
}
}
@Override
protected void onStop() {
- Log.i(LOG_TAG, "onStop()");
+ Log.i(TAG, "onStop()");
super.onStop();
try {
getStoppedMarker(this).createNewFile();
} catch (IOException e) {
- Log.e(LOG_TAG, "cannot write stopped filed");
+ Log.e(TAG, "cannot write stopped file: " + e);
}
}
@Override
protected void onDestroy() {
- Log.i(LOG_TAG, "onDestroy()");
+ Log.i(TAG, "onDestroy()");
super.onDestroy();
}
@@ -92,4 +97,11 @@
@NonNull public static File getStartedMarker(@NonNull Context context) {
return new File(context.getFilesDir(), "started");
}
+
+ public static void finishIt() {
+ Log.v(TAG, "Finishing " + sInstance);
+ if (sInstance != null) {
+ sInstance.finish();
+ }
+ }
}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivityFinisherReceiver.java b/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivityFinisherReceiver.java
new file mode 100644
index 0000000..b75785e
--- /dev/null
+++ b/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivityFinisherReceiver.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018 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 android.autofillservice.cts;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+/**
+ * A {@link BroadcastReceiver} that finishes {@link OutOfProcessLoginActivity}.
+ */
+public class OutOfProcessLoginActivityFinisherReceiver extends BroadcastReceiver {
+
+ private static final String TAG = "OutOfProcessLoginActivityFinisherReceiver";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i(TAG, "Goodbye, unfinished business!");
+ OutOfProcessLoginActivity.finishIt();
+ }
+}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
index 9b03d0a..01098e9 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
@@ -96,6 +96,13 @@
Helper.allowAutoRotation();
}
+ @After
+ public void finishLoginActivityOnAnotherProcess() throws Exception {
+ runShellCommand("am broadcast --receiver-foreground "
+ + "-n android.autofillservice.cts/.OutOfProcessLoginActivityFinisherReceiver");
+ mUiBot.assertGoneByRelativeId(ID_USERNAME, Timeouts.ACTIVITY_RESURRECTION);
+ }
+
private void killOfProcessLoginActivityProcess() throws Exception {
// Waiting for activity to stop (stop marker appears)
eventually("getStoppedMarker()", () -> {
diff --git a/tests/autofillservice/src/android/autofillservice/cts/WebViewActivity.java b/tests/autofillservice/src/android/autofillservice/cts/WebViewActivity.java
index 08d4c70..e51bbfc 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/WebViewActivity.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/WebViewActivity.java
@@ -17,6 +17,8 @@
import static android.autofillservice.cts.Timeouts.WEBVIEW_TIMEOUT;
+import static com.google.common.truth.Truth.assertThat;
+
import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
@@ -112,6 +114,7 @@
});
mWebView.loadUrl(FAKE_URL);
+ assertThat(mWebView.isAutofillEnabled()).isTrue();
});
// Wait until it's loaded.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java
index 57bca35..7149899 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java
@@ -71,7 +71,6 @@
@Before
public void setActivity() {
mActivity = mActivityRule.getActivity();
- assertAutofillEnabledOnWebView();
}
@BeforeClass
@@ -611,8 +610,4 @@
ID_OUTSIDE2);
Helper.assertTextAndValue(outside2SaveNode, "SWEETER");
}
-
- private void assertAutofillEnabledOnWebView() {
- assertThat(mActivity.mWebView.isAutofillEnabled()).isTrue();
- }
}