M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
# This builds "SmokeTestApp"
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_PACKAGE_NAME := SmokeTestApp
include $(BUILD_PACKAGE)
# This builds "SmokeTest"
include $(call all-makefiles-under,$(LOCAL_PATH))
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 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.smoketest">
<application>
<uses-library android:name="android.test.runner" />
<activity android:name=".SmokeTestActivity"
android:label="Smoke Tests">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.TEST" />
</intent-filter>
</activity>
</application>
</manifest>
+8
View File
@@ -0,0 +1,8 @@
The tests in this folder are a very controlled set of tests that will be run by
the build system on every single build. They are intended to run very quickly.
Please use caution when adding tests here.
If you wish to run these tests, issue the command:
adb shell am instrument \
-w com.android.smoketest/.tests.SmokeTestInstrumentationTestRunner
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2008 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.smoketest;
import android.app.LauncherActivity;
import android.content.Intent;
/**
* Initial launcher for UI access to smoke tests. This does not actually launch the tests,
* it simply provides manual access to the various UI activities that are used by the tests.
*
* To run all of the tests in this suite:
* adb shell am instrument \
* -w com.android.smoketest/.tests.SmokeTestInstrumentationTestRunner
*/
public class SmokeTestActivity extends LauncherActivity {
@Override
protected Intent getTargetIntent() {
// TODO: partition into categories by label like the sample code app
Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
// TODO: Do we add a new top-level intent? Or just leave it hardcoded like this?
targetIntent.addCategory("android.intent.category.SMOKETEST_INSTRUMENTATION_TEST");
targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return targetIntent;
}
}
+21
View File
@@ -0,0 +1,21 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
LOCAL_JAVA_LIBRARIES := android.test.runner
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Notice that we don't have to include the src files of SmokeTestApp because, by
# running the tests using an instrumentation targeting SmokeTestApp, we
# automatically get all of its classes loaded into our environment.
LOCAL_PACKAGE_NAME := SmokeTest
LOCAL_INSTRUMENTATION_FOR := SmokeTestApp
include $(BUILD_PACKAGE)
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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 name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.smoketest.tests">
<!-- We add an application tag here just so that we can indicate that
this package needs to link against the android.test library,
which is needed when building test cases. -->
<application>
<uses-library android:name="android.test.runner" />
</application>
<!--
This declares that this app uses the instrumentation test runner targeting
the package of com.android.smoketest. To run the tests use the command:
"adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner"
-->
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.smoketest"
android:label="System Smoke Tests"/>
</manifest>
@@ -0,0 +1,103 @@
/*
* Copyright (C) 2008 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.smoketest;
import com.android.internal.os.RuntimeInit;
import android.app.ActivityManager;
import android.content.Context;
import android.test.AndroidTestCase;
import android.util.Log;
import java.util.Iterator;
import java.util.List;
/**
* This smoke test is designed to quickly sniff for any error conditions
* encountered after initial startup.
*/
public class ProcessErrorsTest extends AndroidTestCase {
private final String TAG = "ProcessErrorsTest";
protected ActivityManager mActivityManager;
@Override
public void setUp() throws Exception {
super.setUp();
mActivityManager = (ActivityManager)
getContext().getSystemService(Context.ACTIVITY_SERVICE);
}
public void testSetUpConditions() throws Exception {
assertNotNull(mActivityManager);
}
public void testNoProcessErrors() throws Exception {
List<ActivityManager.ProcessErrorStateInfo> errList;
errList = mActivityManager.getProcessesInErrorState();
// note: this contains information about each process that is currently in an error
// condition. if the list is empty (null) then "we're good".
// if the list is non-empty, then it's useful to report the contents of the list
// we'll put a copy in the log, and we'll report it back to the framework via the assert.
final String reportMsg = reportListContents(errList);
if (reportMsg != null) {
Log.w(TAG, reportMsg);
}
// report a non-empty list back to the test framework
assertNull(reportMsg, errList);
}
/**
* This helper function will dump the actual error reports.
*
* @param errList The error report containing one or more error records.
* @return Returns a string containing all of the errors.
*/
private String reportListContents(List<ActivityManager.ProcessErrorStateInfo> errList) {
if (errList == null) return null;
StringBuilder builder = new StringBuilder();
Iterator<ActivityManager.ProcessErrorStateInfo> iter = errList.iterator();
while (iter.hasNext()) {
ActivityManager.ProcessErrorStateInfo entry = iter.next();
String condition;
switch (entry.condition) {
case ActivityManager.ProcessErrorStateInfo.CRASHED:
condition = "CRASHED";
break;
case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
condition = "ANR";
break;
default:
condition = "<unknown>";
break;
}
builder.append("Process error ").append(condition).append(" ");
builder.append(" ").append(entry.shortMsg);
builder.append(" detected in ").append(entry.processName).append(" ").append(entry.tag);
}
return builder.toString();
}
}