From 02d4ce54b909bd733f12e9f3fa4c1b03cf2d6f45 Mon Sep 17 00:00:00 2001 From: huangcm <1263938474@qq.com> Date: Fri, 11 Apr 2025 08:04:47 +0000 Subject: [PATCH] feat(DeviceTest): add Factory DeviceTest App code --- android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VersionTestActivity.java | 127 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LcdTestView.java | 72 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on_disable.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/headsetmictest.xml | 56 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratest.xml | 44 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/versiontest.xml | 105 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LevelTestActivity.java | 75 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/leveltest.xml | 12 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FirstRun.java | 946 ++ android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mobilenettest.xml | 60 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/camerawithflashtest.xml | 34 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MrioUSBTestActivity.java | 100 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/powertest.xml | 72 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/WifiTestActivity.java | 458 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiUtil.java | 42 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main.xml | 43 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LcdTestActivity.java | 159 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/test_music.mp3 | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/vibrationtest.xml | 34 android/vendor/aw/public/package/apk/DeviceTest_V1/Android.mk | 31 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ConfigUtil.java | 26 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/fmradiotest.xml | 47 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/flashlighttest.xml | 44 android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub.class | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LightsensorTestActivity.java | 119 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml.bak | 44 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/compasstest.xml | 21 android/vendor/aw/public/package/apk/DeviceTest_V1/res/values/strings.xml | 284 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/DeviceTest.java | 768 ++ android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PCIETestActivity.java | 171 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RockVideoPlayer.java | 398 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraBackTestActivity.java | 341 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HardwareInfoTestActivity.java | 170 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HeadsetMicTestActivity.java | 270 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SdCardTestActivity.java | 462 + android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/per_bk.9.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/sdcardtest.xml | 42 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/PCIEInfo.java | 44 android/vendor/aw/public/package/apk/DeviceTest_V1/res/xml/control_buttons.xml | 36 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbhosttest.xml | 41 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LevelView.java | 88 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/msensortest.xml | 49 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EthernetTestActivity.java | 522 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/TouchTestActivity.java | 70 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hardwareinfotest.xml | 50 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/phonemictest.xml | 73 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/simcardtest.xml | 24 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java.bak | 196 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/android_wallpaper.jpg | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraTestActivity.java | 70 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VUMeter.java | 90 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storageactivitytest.xml | 68 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/infomation.xml | 116 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RuninTestActivity.java | 599 + android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbdevicetest.xml | 58 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsLocationTestActivity.java | 255 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiInfo.java | 89 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BrightnessTestActivity.java | 195 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/DrawClock.java | 167 android/vendor/aw/public/package/apk/DeviceTest_V1/res/values-zh-rCN/strings.xml | 265 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/memtester | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CompassTestActivity.java | 195 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HdmiTestActivity.java | 232 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/IrdaTestActivity.java | 267 android/vendor/aw/public/package/apk/DeviceTest_V1/user_mode.jar | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/CompassView.java | 61 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageActivity.java | 235 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VibrationTestActivity.java | 57 android/vendor/aw/public/package/apk/DeviceTest_V1/proguard.cfg | 40 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/rtctest.xml | 40 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SATATestActivity.java | 9 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyGridView.java | 100 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MsensorTestActivity.java | 120 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/StorageInfo.java | 35 android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/ntt/east/hardware/IrRemoteController.java | 156 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MySpinnerView.java | 20 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/irda/IrdaTestUtil.java | 24 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hdmitest.xml | 49 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ledtest.xml | 34 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PowerTestActivity.java | 226 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lightsensortest.xml | 50 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SimCardTestActivity.java | 68 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/UsbHostTestActivity.java | 584 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PhoneMicTestActivity.java | 241 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/GsensorBall.java | 76 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/brightnesstest.xml | 37 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main_display_land.xml | 42 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/InfomationActivity.java | 259 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemInfoUtil.java | 578 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/PointerLocationView.java | 368 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FMRadioTestActivity.java | 69 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/alert_dialog_text_entry.xml | 67 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageTestActivity.java | 178 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/layout_nofile.xml | 23 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MobileNetTestActivity.java | 114 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java | 168 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/compass.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/novideofile.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ethernettest.xml | 51 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GsensorTestActivity.java | 234 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/KeyboardTestActivity.java | 237 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cirtest.xml | 24 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/TestCase.java | 88 android/vendor/aw/public/package/apk/DeviceTest_V1/org.apache.http.legacy.jar | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TouchSurfaceView.java | 127 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/devicetest_icon.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/speakertest.xml | 36 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/ClockTestActivity.java | 139 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyItemView.java | 169 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/irdatest.xml | 44 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpslocationtest.xml | 32 android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/toshiba/newtion/cir/RemoteControl.java | 112 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gyroscopetest.xml | 92 android/vendor/aw/public/package/apk/DeviceTest_V1/DeviceTestConfig.xml | 34 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VideoListAdapter.java | 305 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CirTestActivity.java | 114 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/icon.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BluetoothTestActivity.java | 325 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/Recorder.java | 215 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EnableAppReceiver.java | 61 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GyroscopeTestActivity.java | 237 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storagetest.xml | 21 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/USBDeviceTestActivity.java | 186 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ControlButtonUtil.java | 130 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/irda_test | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/touchtest.xml | 32 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/video_icon.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/vumeter.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lcdtest.xml | 29 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/myclocktest.xml | 27 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/runintest.xml | 66 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/keyboadtest.xml | 35 android/vendor/aw/public/package/apk/DeviceTest_V1/AndroidManifest.xml | 612 + android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/wifitest.xml | 37 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/itemclickbk.xml | 5 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/Cube.java | 100 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/bluetoothtest.xml | 63 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsTestActivity.java | 347 + android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SpeakerTestActivity.java | 156 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/firstrun_layout.xml | 308 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemUtil.java | 139 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratestv.xml | 16 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/gps_coldstart | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LedTestActivity.java | 158 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml | 58 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gsensortest.xml | 67 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TestView.java | 65 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mriousbtest.xml | 77 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/Ethernet2TestActivity.java | 9 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpstest.xml | 32 android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/video_item_land.xml | 63 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_K5C.xml | 58 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/KeyTestView.java | 123 android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub$Proxy.class | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_CN.xml | 53 android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/arrow_up.png | 0 android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RTCTestActivity.java | 139 158 files changed, 19,551 insertions(+), 0 deletions(-) diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/Android.mk b/android/vendor/aw/public/package/apk/DeviceTest_V1/Android.mk new file mode 100755 index 0000000..8e6c178 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/Android.mk @@ -0,0 +1,31 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +ifneq ($(PLATFORM_VERSION),8.1.0) +LOCAL_PRIVATE_PLATFORM_APIS := true +endif + +LOCAL_PACKAGE_NAME := DeviceTest + +LOCAL_JAVA_LIBRARIES := javax.obex + +LOCAL_STATIC_JAVA_LIBRARIES += user_mode + +LOCAL_STATIC_JAVA_LIBRARIES += apache + +LOCAL_CERTIFICATE := platform + +LOCAL_DEX_PREOPT := false + +include $(BUILD_PACKAGE) + +include $(CLEAR_VARS) + +LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := user_mode:user_mode.jar \ + apache:org.apache.http.legacy.jar + +include $(BUILD_MULTI_PREBUILT) diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/AndroidManifest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/AndroidManifest.xml new file mode 100755 index 0000000..bc3564f --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/AndroidManifest.xml @@ -0,0 +1,612 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.DeviceTest" + android:sharedUserId="android.uid.system" + android:exported="true" + > + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> + <uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> + <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.WRITE_SETTINGS" /> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> + <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> + <uses-permission android:name="android.permission.BLUETOOTH" /> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.RECORD_AUDIO" /> + <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> + <uses-permission android:name="android.permission.READ_CONTACTS" /> + <uses-permission android:name="android.permission.WRITE_SETTINGS" /> + <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" /> + <uses-permission android:name="android.permission.HARDWARE_TEST" /> + <uses-permission android:name="android.permission.DEVICE_POWER" /> + <uses-permission android:name="android.permission.FLASHLIGHT" /> + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> + <uses-permission android:name="android.permission.BATTERY_STATS" /> + <uses-permission android:name="android.permission.INJECT_EVENTS" /> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.CAMERA" /> + <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" /> + <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" /> + <uses-permission android:name="android.permission.DEVICE_POWER"/> + <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" /> + + <!-- <queries> + <package android:name="com.example.cam" /> + </queries> --> + + <application + android:resizeableActivity="true" + android:icon="@drawable/devicetest_icon" + android:label="@string/app_name" + android:exported="true"> + <activity + android:name=".FirstRun" + android:label="@string/app_name" + android:screenOrientation="landscape" + android:configChanges="orientation|keyboardHidden" + android:exported="true"> + <intent-filter> + <action android:name="rk.intent.action.FIRSTRUN" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name="com.DeviceTest.DeviceTest" + android:screenOrientation="landscape" + android:configChanges="orientation|keyboardHidden" + android:exported="true"> + <intent-filter> + <action android:name="rk.intent.action.startDevicetest" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".InfomationActivity" + android:screenOrientation="landscape" + android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" > + </activity> + + <activity + android:name=".VersionTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action android:name="rk.intent.action.VersionTestActivity" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".StorageActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action android:name="rk.intent.action.StorageActivity" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".LcdTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action android:name="rk.intent.action.LcdTestActivity" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".TouchTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.TouchTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".CameraTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.CameraTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".CameraBackTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.CameraBackTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + <activity + android:name=".VibrationTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.VibrationTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".SpeakerTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.SpeakerTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".GsensorTestActivity" + android:screenOrientation="sensor" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.GsensorTestActivity" + android:screenOrientation="portrait" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".MsensorTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.MsensorTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".GyroscopeTestActivity" + android:screenOrientation="portrait" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.GyroscopeTestActivity" + android:screenOrientation="portrait" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".LightsensorTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.LightsensorTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".BluetoothTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.BluetoothTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".WifiTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.WifiTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".HeadsetMicTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.HeadsetMicTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".PhoneMicTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.PhoneMicTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".GpsTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.GpsTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".GpsLocationTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.GpsLocationTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".SdCardTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.SdCardTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".PowerTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.PowerTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name="BrightnessTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.BrightnessTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".KeyboardTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.KeyboardTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name="MrioUSBTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.MrioUSBTestActivity" + android:screenOrientation="landscape" /> + <action android:name="android.hardware.Usb.ACTION_USB_STATE" /> + <action android:name="android.hardware.Usb.ACTION_USB_CONNECTED" /> + <action android:name="android.hardware.Usb.ACTION_USB_DISCONNECTED" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".SimCardTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.SimCardTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".FMRadioTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.FMRadioTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".CompassTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.CompassTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".HdmiTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.HdmiTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".LevelTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.LevelTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name="StorageTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.StorageTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".UsbHostTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.UsbHostTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".PCIETestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.PCIETestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".SATATestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.SATATestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".EthernetTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.EthernetTestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".Ethernet2TestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.EthernetTestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + <activity + android:name=".HardwareInfoTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.HardwareInfoTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".CirTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.CirTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".LedTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.LedTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".IrdaTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.IrdaTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".RuninTestActivity" + android:configChanges="orientation" + android:screenOrientation="portrait" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.RuninTestActivity" + android:screenOrientation="landscape" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + <activity android:name=".RockVideoPlayer" + android:label="@string/app_name" + android:configChanges="orientation|keyboardHidden" + android:clearTaskOnLaunch="true" android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action android:name="rk.intent.action.RuninTestActivity"/> + <action android:name="rk.intent.action.RockVideoPlayer" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity + android:name=".ClockTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.ClockTestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + <activity + android:name=".MobileNetTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.MobileNetTestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".USBDeviceTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.USBDeviceTestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <activity + android:name=".RTCTestActivity" + android:screenOrientation="landscape" + android:exported="true"> + <intent-filter> + <action + android:name="rk.intent.action.RTCTestActivity" + android:screenOrientation="landscape" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + <receiver android:name=".EnableAppReceiver" + android:exported="true" > + <intent-filter> + <action android:name="android.rockchip.devicetest.action.APP_STATE_CHANGE" /> + </intent-filter> + </receiver> + </application> + + <uses-permission android:name="android.permission.VIBRATE" /> + + <supports-screens + android:anyDensity="true" + android:largeScreens="true" /> + +</manifest> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/DeviceTestConfig.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/DeviceTestConfig.xml new file mode 100755 index 0000000..0a35552 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/DeviceTestConfig.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCaseList> + + <TestCase class_name="VersionTestActivity" test_group="rest">Version</TestCase> + <TestCase class_name="HardwareInfoTestActivity" test_group="auto_judged">Hardware</TestCase> + <!-- <TestCase class_name="LcdTestActivity" test_group="rest">LCD</TestCase> --> + <!-- <TestCase class_name="TouchTestActivity" test_group="rest">Touch</TestCase> --> + <TestCase class_name="CameraTestActivity" test_group="rest">Camera</TestCase> + <!-- <TestCase class_name="VibrationTestActivity" test_group="rest">Vibration</TestCase> --> + <!-- <TestCase class_name="GsensorTestActivity" test_group="auto_judged">Gsensor</TestCase> --> + <!-- <TestCase class_name="MsensorTestActivity" test_group="rest">Msensor</TestCase> --> + <!-- <TestCase class_name="LightsensorTestActivity" test_group="rest">Lightsensor</TestCase> --> + <TestCase class_name="CompassTestActivity" test_group="rest">Compass</TestCase> + <!--<TestCase class_name="LevelTestActivity" test_group="rest">Level</TestCase> --> + <TestCase class_name="BluetoothTestActivity" test_group="auto_judged">Bluetooth</TestCase> + <TestCase class_name="WifiTestActivity" test_group="auto_judged">Wifi</TestCase> + <TestCase class_name="GpsTestActivity" test_group="auto_judged">Gps</TestCase> + <!--<TestCase class_name="HeadsetMicTestActivity" test_group="rest">Headset MIC</TestCase> --> + <TestCase class_name="PhoneMicTestActivity" test_group="rest">MIC</TestCase> + <TestCase class_name="SpeakerTestActivity" test_group="rest">Speaker</TestCase> + <TestCase class_name="PowerTestActivity" test_group="auto_judged">Battery</TestCase> + <TestCase class_name="BrightnessTestActivity" test_group="rest">Brightness</TestCase> + <TestCase class_name="KeyboardTestActivity" test_group="auto_judged">Keyboard</TestCase> + <!-- <TestCase class_name="SimCardTestActivity" test_group="rest">Sim Card</TestCase> --> + <!-- <TestCase class_name="FMRadioTestActivity" test_group="rest">FM Radio</TestCase> --> + <!-- <TestCase class_name="SdCardTestActivity" test_group="rest">SD Card</TestCase> --> + <TestCase class_name="StorageTestActivity" test_group="auto_judged">Storage R/W</TestCase> + <!-- <TestCase class_name="MrioUSBTestActivity" test_group="auto_judged">Mrio USB</TestCase> --> + <TestCase class_name="LedTestActivity" test_group="rest">LED</TestCase> + <TestCase class_name="CirTestActivity" test_group="rest">Cir</TestCase> + <TestCase class_name="IrdaTestActivity" test_group="rest">IrDA</TestCase> + <TestCase class_name="RuninTestActivity" test_group="rest">Runin</TestCase> + +</TestCaseList> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml new file mode 100755 index 0000000..cbc893b --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCaseList> + <!-- <TestCase class_name="VersionTestActivity" test_group="TEST ALL">Version</TestCase> --> + <!-- <TestCase class_name="LcdTestActivity" test_group="TEST ALL">LCD</TestCase> --> + <!--<TestCase class_name="CameraTestActivity" test_group="TEST ALL" first_test="yc">Camera_only3</TestCase>--> + <!--TestCase class_name="VibrationTestActivity" test_group="TEST ALL">Vibration</TestCase--> + <!-- <TestCase class_name="GsensorTestActivity" test_group="TEST ALL" first_test="yc">Gsensor</TestCase> --> + <!-- <TestCase class_name="HardwareInfoTestActivity" test_group="TEST AUTO">Hardware</TestCase> --> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPS</TestCase> --> + + <!-- <TestCase class_name="StorageTestActivity" test_group="TEST AUTO">Storage R/W</TestCase> --> + <!-- <TestCase class_name="PowerTestActivity" test_group="TEST ALL">Battery</TestCase> --> + <!-- <TestCase class_name="KeyboardTestActivity" test_group="TEST ALL" first_test="yc">Keyboard</TestCase> --> + <!-- <TestCase class_name="BrightnessTestActivity" test_group="TEST ALL">Brightness</TestCase> --> + + <TestCase class_name="BluetoothTestActivity" test_group="TEST ALL">Bluetooth</TestCase> + <TestCase class_name="WifiTestActivity" test_group="TEST ALL" first_test="yc">Wifi</TestCase> + <TestCase class_name="SdCardTestActivity" test_group="TEST ALL" first_test="yc">SD Card</TestCase> + <TestCase class_name="PCIETestActivity" test_group="TEST ALL">PCIE</TestCase> + <TestCase class_name="SATATestActivity" test_group="TEST ALL">SATA</TestCase> + <TestCase class_name="EthernetTestActivity" test_group="TEST ALL">Ethernet1</TestCase> + <TestCase class_name="Ethernet2TestActivity" test_group="TEST ALL">Ethernet2</TestCase> + <TestCase class_name="MobileNetTestActivity" test_group="TEST ALL">MobileNet</TestCase> + + <TestCase class_name="InfomationActivity" test_group="TEST ALL" first_test="yc">DDR/eMMC</TestCase> + <TestCase class_name="TouchTestActivity" test_group="TEST ALL">Touch</TestCase> + <TestCase class_name="SpeakerTestActivity" test_group="TEST ALL" first_test="yc">Speaker</TestCase> + <TestCase class_name="PhoneMicTestActivity" test_group="TEST ALL" first_test="yc">MIC</TestCase> + <TestCase class_name="USBDeviceTestActivity" test_group="TEST ALL">USB Device</TestCase> + <TestCase class_name="RTCTestActivity" test_group="TEST ALL">RTC</TestCase> + <TestCase class_name="CameraBackTestActivity" test_group="TEST ALL" first_test="yc">Camera_only</TestCase> + <!-- <TestCase class_name="RtcTestActivity" test_group="TEST ALL">RTC</TestCase> --> + <!-- TestCase class_name="GpsLocationTestActivity" test_group="TEST 2">GPS Location</TestCase> --> + <!-- <TestCase class_name="MrioUSBTestActivity" test_group="TEST 2">Mrio USB</TestCase> --> + + <!-- <TestCase class_name="HdmiTestActivity" test_group="TEST ALL">HDMI</TestCase> --> + <!-- <TestCase class_name="GpsLocationTestActivity" test_group="TEST ALL">GPS</TestCase> --> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPSTest</TestCase> --> + <!-- <TestCase class_name="StorageActivity" test_group="TEST ALL" first_test="yc">Storage</TestCase>--> + <!-- <TestCase class_name="CompassTestActivity" test_group="TEST ALL">Compass</TestCase> --> + + <!--<TestCase class_name="LevelTestActivity" test_group="rest">Level</TestCase> --> + <!--<TestCase class_name="MsensorTestActivity" test_group="TEST ALL">Msensor</TestCase>--> + <!--<TestCase class_name="GyroscopeTestActivity" test_group="TEST ALL">Gyroscope</TestCase>--> + <!--<TestCase class_name="LightsensorTestActivity" test_group="TEST ALL">Lightsensor</TestCase>--> + <!--<TestCase class_name="RockVideoPlayer" test_group="TEST ALL">VideoPlayer</TestCase>--> + <!-- <TestCase class_name="ClockTestActivity" test_group="TEST ALL">Clock</TestCase>--> + + <!--<TestCase class_name="HeadsetMicTestActivity" test_group="rest">Headset MIC</TestCase> --> + <!-- <TestCase class_name="SimCardTestActivity" test_group="rest">Sim Card</TestCase> --> + <!-- <TestCase class_name="FMRadioTestActivity" test_group="rest">FM Radio</TestCase> --> +<!-- <TestCase class_name="LedTestActivity" test_group="TEST 1">LED</TestCase> + <TestCase class_name="CirTestActivity" test_group="TEST 1">Cir</TestCase> + <TestCase class_name="IrdaTestActivity" test_group="TEST 1">IrDA</TestCase> --> +<!-- <TestCase class_name="CompassTestActivity" test_group="TEST 3">Compass</TestCase> --> + <!-- <TestCase class_name="RuninTestActivity" test_group="RunIn">Runin</TestCase> --> + +</TestCaseList> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml.bak b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml.bak new file mode 100755 index 0000000..d8c8063 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig.xml.bak @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCaseList> + <TestCase class_name="VersionTestActivity" test_group="TEST ALL">Version</TestCase> + <TestCase class_name="LcdTestActivity" test_group="TEST ALL">LCD</TestCase> + <TestCase class_name="TouchTestActivity" test_group="TEST ALL">Touch</TestCase> + <TestCase class_name="CameraTestActivity" test_group="TEST ALL">Camera</TestCase> + <!-- <TestCase class_name="VibrationTestActivity" test_group="rest">Vibration</TestCase> --> + <TestCase class_name="SpeakerTestActivity" test_group="TEST ALL" first_test="yc">Speaker</TestCase> + <TestCase class_name="GsensorTestActivity" test_group="TEST ALL" first_test="yc">Gsensor</TestCase> + <!-- <TestCase class_name="HardwareInfoTestActivity" test_group="TEST AUTO">Hardware</TestCase> --> + <TestCase class_name="BluetoothTestActivity" test_group="TEST ALL">Bluetooth</TestCase> + <TestCase class_name="WifiTestActivity" test_group="TEST ALL" first_test="yc">Wifi</TestCase> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPS</TestCase> --> + <TestCase class_name="PhoneMicTestActivity" test_group="TEST ALL" first_test="yc">MIC</TestCase> + <!-- <TestCase class_name="StorageTestActivity" test_group="TEST AUTO">Storage R/W</TestCase> --> + <TestCase class_name="PowerTestActivity" test_group="TEST ALL">Battery</TestCase> + <TestCase class_name="SdCardTestActivity" test_group="TEST ALL" first_test="yc">SD Card</TestCase> + <TestCase class_name="KeyboardTestActivity" test_group="TEST ALL" first_test="yc">Keyboard</TestCase> + <TestCase class_name="BrightnessTestActivity" test_group="TEST ALL">Brightness</TestCase> + <TestCase class_name="UsbHostTestActivity" test_group="TEST ALL">UsbHost</TestCase> + + <!-- TestCase class_name="GpsLocationTestActivity" test_group="TEST 2">GPS Location</TestCase> --> + <!-- <TestCase class_name="MrioUSBTestActivity" test_group="TEST 2">Mrio USB</TestCase> --> + + <TestCase class_name="HdmiTestActivity" test_group="TEST ALL">HDMI</TestCase> + <TestCase class_name="GpsLocationTestActivity" test_group="TEST ALL">GPS</TestCase> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPSTest</TestCase> --> + <TestCase class_name="StorageActivity" test_group="TEST ALL" first_test="yc">Storage</TestCase> + <TestCase class_name="CompassTestActivity" test_group="TEST ALL">Compass</TestCase> --> + + <!--<TestCase class_name="LevelTestActivity" test_group="rest">Level</TestCase> --> + <TestCase class_name="MsensorTestActivity" test_group="TEST ALL">Msensor</TestCase> + <TestCase class_name="GyroscopeTestActivity" test_group="TEST ALL">Gyroscope</TestCase> + <TestCase class_name="LightsensorTestActivity" test_group="TEST ALL">Lightsensor</TestCase> + <!--<TestCase class_name="HeadsetMicTestActivity" test_group="rest">Headset MIC</TestCase> --> + <!-- <TestCase class_name="SimCardTestActivity" test_group="rest">Sim Card</TestCase> --> + <!-- <TestCase class_name="FMRadioTestActivity" test_group="rest">FM Radio</TestCase> --> +<!-- <TestCase class_name="LedTestActivity" test_group="TEST 1">LED</TestCase> + <TestCase class_name="CirTestActivity" test_group="TEST 1">Cir</TestCase> + <TestCase class_name="IrdaTestActivity" test_group="TEST 1">IrDA</TestCase> --> +<!-- <TestCase class_name="CompassTestActivity" test_group="TEST 3">Compass</TestCase> --> + <!-- <TestCase class_name="RuninTestActivity" test_group="RunIn">Runin</TestCase> --> + +</TestCaseList> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_CN.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_CN.xml new file mode 100755 index 0000000..738e99d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_CN.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCaseList> + <TestCase class_name="VersionTestActivity" test_group="TEST ALL">版本</TestCase> + <TestCase class_name="InfomationActivity" test_group="TEST ALL" first_test="yc">硬件信息</TestCase> + <TestCase class_name="LcdTestActivity" test_group="TEST ALL">LCD</TestCase> + <TestCase class_name="TouchTestActivity" test_group="TEST ALL">触屏</TestCase> + <TestCase class_name="CameraTestActivity" test_group="TEST ALL">摄像头</TestCase> + <TestCase class_name="CameraBackTestActivity" test_group="TEST ALL">单摄像头</TestCase> + <TestCase class_name="VibrationTestActivity" test_group="TEST ALL">震动</TestCase> + <TestCase class_name="SpeakerTestActivity" test_group="TEST ALL" first_test="yc">喇叭</TestCase> + <TestCase class_name="GsensorTestActivity" test_group="TEST ALL" first_test="yc">重力感应</TestCase> + <!-- <TestCase class_name="HardwareInfoTestActivity" test_group="TEST AUTO">Hardware</TestCase> --> + <TestCase class_name="BluetoothTestActivity" test_group="TEST ALL">蓝牙</TestCase> + <TestCase class_name="WifiTestActivity" test_group="TEST ALL" first_test="yc">无线</TestCase> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPS</TestCase> --> + <TestCase class_name="PhoneMicTestActivity" test_group="TEST ALL" first_test="yc">录音</TestCase> + <!-- <TestCase class_name="StorageTestActivity" test_group="TEST AUTO">Storage R/W</TestCase> --> + <TestCase class_name="PowerTestActivity" test_group="TEST ALL">电池</TestCase> + <TestCase class_name="SdCardTestActivity" test_group="TEST ALL" first_test="yc">sd卡</TestCase> + <TestCase class_name="KeyboardTestActivity" test_group="TEST ALL" first_test="yc">键盘</TestCase> + <TestCase class_name="BrightnessTestActivity" test_group="TEST ALL">亮度</TestCase> + <TestCase class_name="UsbHostTestActivity" test_group="TEST ALL">u盘</TestCase> + <TestCase class_name="PCIETestActivity" test_group="TEST ALL">PCIE</TestCase> + <TestCase class_name="SATATestActivity" test_group="TEST ALL">SATA</TestCase> + <TestCase class_name="EthernetTestActivity" test_group="TEST ALL">以太网</TestCase> + <TestCase class_name="Ethernet2TestActivity" test_group="TEST ALL">以太网2</TestCase> + + <!-- TestCase class_name="GpsLocationTestActivity" test_group="TEST 2">GPS Location</TestCase> --> + <!-- <TestCase class_name="MrioUSBTestActivity" test_group="TEST 2">Mrio USB</TestCase> --> + + <TestCase class_name="HdmiTestActivity" test_group="TEST ALL">HDMI</TestCase> + <TestCase class_name="GpsLocationTestActivity" test_group="TEST ALL">GPS</TestCase> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPSTest</TestCase> --> + <TestCase class_name="StorageActivity" test_group="TEST ALL" first_test="yc">存储</TestCase> + <TestCase class_name="CompassTestActivity" test_group="TEST ALL">罗盘</TestCase> --> + + <!--<TestCase class_name="LevelTestActivity" test_group="rest">Level</TestCase> --> + <TestCase class_name="MsensorTestActivity" test_group="TEST ALL">磁场感应</TestCase> + <TestCase class_name="GyroscopeTestActivity" test_group="TEST ALL">陀螺仪</TestCase> + <TestCase class_name="LightsensorTestActivity" test_group="TEST ALL">光感</TestCase> + <TestCase class_name="RockVideoPlayer" test_group="TEST ALL">视频播放</TestCase> + <!-- <TestCase class_name="ClockTestActivity" test_group="TEST ALL">Clock</TestCase>--> + + <!--<TestCase class_name="HeadsetMicTestActivity" test_group="rest">Headset MIC</TestCase> --> + <!-- <TestCase class_name="SimCardTestActivity" test_group="rest">Sim Card</TestCase> --> + <!-- <TestCase class_name="FMRadioTestActivity" test_group="rest">FM Radio</TestCase> --> +<!-- <TestCase class_name="LedTestActivity" test_group="TEST 1">LED</TestCase> + <TestCase class_name="CirTestActivity" test_group="TEST 1">Cir</TestCase> + <TestCase class_name="IrdaTestActivity" test_group="TEST 1">IrDA</TestCase> --> +<!-- <TestCase class_name="CompassTestActivity" test_group="TEST 3">Compass</TestCase> --> + <!-- <TestCase class_name="RuninTestActivity" test_group="RunIn">Runin</TestCase> --> + +</TestCaseList> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_K5C.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_K5C.xml new file mode 100755 index 0000000..6157447 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/DeviceTestConfig_K5C.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TestCaseList> + <!-- <TestCase class_name="VersionTestActivity" test_group="TEST ALL">Version</TestCase> --> + <!-- <TestCase class_name="LcdTestActivity" test_group="TEST ALL">LCD</TestCase> --> + <!--<TestCase class_name="CameraTestActivity" test_group="TEST ALL" first_test="yc">Camera_only3</TestCase>--> + <!--TestCase class_name="VibrationTestActivity" test_group="TEST ALL">Vibration</TestCase--> + <!-- <TestCase class_name="GsensorTestActivity" test_group="TEST ALL" first_test="yc">Gsensor</TestCase> --> + <!-- <TestCase class_name="HardwareInfoTestActivity" test_group="TEST AUTO">Hardware</TestCase> --> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPS</TestCase> --> + + <!-- <TestCase class_name="StorageTestActivity" test_group="TEST AUTO">Storage R/W</TestCase> --> + <!-- <TestCase class_name="PowerTestActivity" test_group="TEST ALL">Battery</TestCase> --> + <!-- <TestCase class_name="KeyboardTestActivity" test_group="TEST ALL" first_test="yc">Keyboard</TestCase> --> + <!-- <TestCase class_name="BrightnessTestActivity" test_group="TEST ALL">Brightness</TestCase> --> + + <TestCase class_name="WifiTestActivity" test_group="TEST ALL" first_test="yc">Wifi</TestCase> + <TestCase class_name="BluetoothTestActivity" test_group="TEST ALL">Bluetooth</TestCase> + <!-- <TestCase class_name="SdCardTestActivity" test_group="TEST ALL" first_test="yc">SD Card</TestCase> --> + <!-- <TestCase class_name="PCIETestActivity" test_group="TEST ALL">PCIE</TestCase> --> + <!-- <TestCase class_name="SATATestActivity" test_group="TEST ALL">SATA</TestCase> --> + <!-- <TestCase class_name="Ethernet2TestActivity" test_group="TEST ALL">Ethernet0</TestCase> --> + <!-- <TestCase class_name="EthernetTestActivity" test_group="TEST ALL">Ethernet1</TestCase> --> + <!-- <TestCase class_name="MobileNetTestActivity" test_group="TEST ALL">MobileNet</TestCase> --> + + <TestCase class_name="InfomationActivity" test_group="TEST ALL" first_test="yc">DDR/eMMC</TestCase> + <TestCase class_name="TouchTestActivity" test_group="TEST ALL">Touch</TestCase> + <TestCase class_name="SpeakerTestActivity" test_group="TEST ALL" first_test="yc">Speaker</TestCase> + <!-- <TestCase class_name="PhoneMicTestActivity" test_group="TEST ALL" first_test="yc">MIC</TestCase> --> + <!-- <TestCase class_name="USBDeviceTestActivity" test_group="TEST ALL">USB Device</TestCase> --> + <!-- <TestCase class_name="RTCTestActivity" test_group="TEST ALL">RTC</TestCase> --> + <!-- <TestCase class_name="CameraBackTestActivity" test_group="TEST ALL" first_test="yc">Camera_only</TestCase> --> + <!-- <TestCase class_name="RtcTestActivity" test_group="TEST ALL">RTC</TestCase> --> + <!-- TestCase class_name="GpsLocationTestActivity" test_group="TEST 2">GPS Location</TestCase> --> + <!-- <TestCase class_name="MrioUSBTestActivity" test_group="TEST 2">Mrio USB</TestCase> --> + + <!-- <TestCase class_name="HdmiTestActivity" test_group="TEST ALL">HDMI</TestCase> --> + <!-- <TestCase class_name="GpsLocationTestActivity" test_group="TEST ALL">GPS</TestCase> --> + <!-- <TestCase class_name="GpsTestActivity" test_group="TEST ALL">GPSTest</TestCase> --> + <!-- <TestCase class_name="StorageActivity" test_group="TEST ALL" first_test="yc">Storage</TestCase>--> + <!-- <TestCase class_name="CompassTestActivity" test_group="TEST ALL">Compass</TestCase> --> + + <!--<TestCase class_name="LevelTestActivity" test_group="rest">Level</TestCase> --> + <!--<TestCase class_name="MsensorTestActivity" test_group="TEST ALL">Msensor</TestCase>--> + <!--<TestCase class_name="GyroscopeTestActivity" test_group="TEST ALL">Gyroscope</TestCase>--> + <!--<TestCase class_name="LightsensorTestActivity" test_group="TEST ALL">Lightsensor</TestCase>--> + <!--<TestCase class_name="RockVideoPlayer" test_group="TEST ALL">VideoPlayer</TestCase>--> + <!-- <TestCase class_name="ClockTestActivity" test_group="TEST ALL">Clock</TestCase>--> + + <!--<TestCase class_name="HeadsetMicTestActivity" test_group="rest">Headset MIC</TestCase> --> + <!-- <TestCase class_name="SimCardTestActivity" test_group="rest">Sim Card</TestCase> --> + <!-- <TestCase class_name="FMRadioTestActivity" test_group="rest">FM Radio</TestCase> --> +<!-- <TestCase class_name="LedTestActivity" test_group="TEST 1">LED</TestCase> + <TestCase class_name="CirTestActivity" test_group="TEST 1">Cir</TestCase> + <TestCase class_name="IrdaTestActivity" test_group="TEST 1">IrDA</TestCase> --> +<!-- <TestCase class_name="CompassTestActivity" test_group="TEST 3">Compass</TestCase> --> + <!-- <TestCase class_name="RuninTestActivity" test_group="RunIn">Runin</TestCase> --> + +</TestCaseList> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/gps_coldstart b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/gps_coldstart new file mode 100755 index 0000000..d496db8 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/gps_coldstart Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/irda_test b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/irda_test new file mode 100755 index 0000000..b917d0b --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/irda_test Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/memtester b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/memtester new file mode 100755 index 0000000..cfe19b6 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/memtester Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/test_music.mp3 b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/test_music.mp3 new file mode 100755 index 0000000..4208b5e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/assets/test_music.mp3 Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub$Proxy.class b/android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub$Proxy.class new file mode 100755 index 0000000..6b80d49 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub$Proxy.class Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub.class b/android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub.class new file mode 100755 index 0000000..5c9524d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/lib/android/os/IPowerManager$Stub.class Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/org.apache.http.legacy.jar b/android/vendor/aw/public/package/apk/DeviceTest_V1/org.apache.http.legacy.jar new file mode 100755 index 0000000..3705bf1 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/org.apache.http.legacy.jar Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/proguard.cfg b/android/vendor/aw/public/package/apk/DeviceTest_V1/proguard.cfg new file mode 100755 index 0000000..f0b04dc --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/proguard.cfg @@ -0,0 +1,40 @@ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontpreverify +-verbose +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* + +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class com.android.vending.licensing.ILicensingService + +-keepclasseswithmembernames class * { + native <methods>; +} + +-keepclasseswithmembers class * { + public <init>(android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembers class * { + public <init>(android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/android_wallpaper.jpg b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/android_wallpaper.jpg new file mode 100755 index 0000000..9a62b88 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/android_wallpaper.jpg Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/arrow_up.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/arrow_up.png new file mode 100755 index 0000000..43590f2 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/arrow_up.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on.png new file mode 100755 index 0000000..4c83e2e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on_disable.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on_disable.png new file mode 100755 index 0000000..f1bf178 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/btn_check_on_disable.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/compass.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/compass.png new file mode 100755 index 0000000..7f452fc --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/compass.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/devicetest_icon.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/devicetest_icon.png new file mode 100755 index 0000000..73fefcb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/devicetest_icon.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/icon.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/icon.png new file mode 100755 index 0000000..1095584 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/icon.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/itemclickbk.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/itemclickbk.xml new file mode 100755 index 0000000..898f0ba --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/itemclickbk.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/icon" /> +</selector> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/novideofile.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/novideofile.png new file mode 100755 index 0000000..4cc9e38 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/novideofile.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/per_bk.9.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/per_bk.9.png new file mode 100755 index 0000000..96795ff --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/per_bk.9.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/video_icon.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/video_icon.png new file mode 100755 index 0000000..3678536 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/video_icon.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/vumeter.png b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/vumeter.png new file mode 100755 index 0000000..ff87f2e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/drawable/vumeter.png Binary files differ diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/alert_dialog_text_entry.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/alert_dialog_text_entry.xml new file mode 100755 index 0000000..2ff2ba6 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/alert_dialog_text_entry.xml @@ -0,0 +1,67 @@ +<?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. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + +<!-- <TextView + android:id="@+id/username_view" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginRight="20dip" + android:text="@string/alert_dialog_username" + android:gravity="left" + android:textAppearance="?android:attr/textAppearanceMedium" /> + + <EditText + android:id="@+id/username_edit" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_marginLeft="20dip" + android:layout_marginRight="20dip" + android:scrollHorizontally="true" + android:autoText="false" + android:capitalize="none" + android:gravity="fill_horizontal" + android:textAppearance="?android:attr/textAppearanceMedium" /> + --> + <TextView + android:id="@+id/password_view" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginRight="20dip" + android:text="@string/alert_dialog_password" + android:gravity="left" + android:textAppearance="?android:attr/textAppearanceMedium" /> + + <EditText + android:id="@+id/password_edit" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_marginLeft="20dip" + android:layout_marginRight="20dip" + android:scrollHorizontally="true" + android:autoText="false" + android:capitalize="none" + android:gravity="fill_horizontal" + android:password="true" + android:textAppearance="?android:attr/textAppearanceMedium" /> + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/bluetoothtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/bluetoothtest.xml new file mode 100755 index 0000000..8b7ad34 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/bluetoothtest.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android" +> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip" + > + + <TextView + android:id="@+id/textTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="24sp" + android:text="@string/BluetoothTitle" +/> + + + <TextView + android:id="@+id/textSubTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="20sp" + android:text="@string/BluetoothSubTitle" + /> + <TextView + android:id="@+id/resultText" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="18sp" + android:visibility="visible" + /> + + <RelativeLayout android:gravity="center_horizontal" android:layout_width="match_parent" android:id="@+id/relativeLayout1" android:layout_height="wrap_content"> + + <ProgressBar android:visibility="visible" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:id="@+id/progress"/> + </RelativeLayout> + + + + </LinearLayout> + + <include layout="@xml/control_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/brightnesstest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/brightnesstest.xml new file mode 100755 index 0000000..7861f1d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/brightnesstest.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView android:id="@+id/backLightTitle" + android:visibility="visible" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="center_horizontal" android:paddingTop="20px" + android:textSize="24sp" android:text="@string/BrightnessTitle" /> + + + <TextView android:id="@+id/backLightSubTitle" + android:visibility="visible" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="center_horizontal" android:paddingTop="20px" + android:text="@string/BrightnessSubTitle" /> + + + + </LinearLayout> + + <ProgressBar android:id="@+id/brightnessBar" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="horizontal" android:layout_centerInParent="true" + style="?android:attr/progressBarStyleHorizontal" /> + <TextView android:id="@+id/progressText" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_above="@id/brightnessBar" android:gravity="center_horizontal" + android:paddingTop="20px" /> + + <include layout="@xml/control_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratest.xml new file mode 100755 index 0000000..43ab01d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratest.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android" +> + + <TextView + android:id="@+id/CameratestTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:textSize="24sp" + android:text="@string/CameraTitle" + android:paddingTop = "20px" + /> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip" + android:layout_below="@id/CameratestTitle" + > + + + <TextView android:id="@+id/CameratextMsg" + android:visibility="visible" + android:layout_height="wrap_content" + android:text="@string/CameratextMsgText" + android:layout_width="fill_parent" + android:gravity="center_horizontal" + android:paddingTop = "40px" + android:textSize="18sp" + /> + + + + </LinearLayout> + + <include layout="@xml/control_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratestv.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratestv.xml new file mode 100755 index 0000000..b5a8960 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cameratestv.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <ImageView + android:id="@+id/imgV" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:src="@drawable/arrow_up"/> + + +<include layout="@xml/control_buttons" android:id="@+id/compass_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/camerawithflashtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/camerawithflashtest.xml new file mode 100755 index 0000000..aea24ae --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/camerawithflashtest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <TextView + android:id="@+id/CameratestTitle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:text="@string/CameraFlashTitle" + android:textSize="24sp" + android:visibility="visible" /> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/CameratestTitle" + android:orientation="vertical" + android:paddingBottom="60dip" > + + <TextView + android:id="@+id/CameratextMsg" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:textSize="18sp" + android:paddingTop="40px" + android:text="@string/CameraFlashtextFront" + android:visibility="visible" /> + </LinearLayout> + <include layout="@xml/control_buttons" android:id="@+id/compass_buttons"/> +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cirtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cirtest.xml new file mode 100755 index 0000000..7529ceb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/cirtest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <TextView android:id="@+id/CirTest" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_alignParentTop="true" + android:gravity="center_horizontal" android:paddingBottom="20px" + android:textSize="24sp" android:visibility="visible" android:text="@string/CirTestTitle" /> + <TextView android:id="@+id/CirResult" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_below="@id/CirTest" + android:gravity="center_horizontal" android:textSize="20sp" /> + <TextView android:id="@+id/CirSendData" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_below="@id/CirResult" + android:gravity="center_horizontal" android:textSize="20sp" /> + + <include layout="@xml/control_buttons"/> + + + <Button android:id="@+id/send" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:text="@string/CirSend" + android:layout_below="@id/CirSendData" /> + + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/compasstest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/compasstest.xml new file mode 100755 index 0000000..e1d8a5d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/compasstest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:layout_width="fill_parent" + android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> + + <RelativeLayout android:layout_width="fill_parent" + android:layout_height="60sp" android:id="@+id/Titles"> + <TextView android:id="@+id/compassText" + android:layout_alignParentLeft="true" android:layout_width="wrap_content" + android:layout_height="fill_parent" android:textSize="20sp" /> + <Button android:id="@+id/Start" + android:layout_alignParentRight="true" android:layout_height="wrap_content" + android:layout_width="wrap_content" android:text="@string/start" /> + </RelativeLayout> + +<include layout="@xml/control_buttons" android:id="@+id/compass_buttons"/> + <com.DeviceTest.view.CompassView + android:id="@+id/compasstestview" android:layout_above="@id/compass_buttons" + android:layout_below="@id/Titles" android:layout_width="match_parent" + android:layout_height="match_parent" /> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ethernettest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ethernettest.xml new file mode 100755 index 0000000..52cbfb7 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ethernettest.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="60dp"> + + <TextView + android:id="@+id/textTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:text="@string/EthernetTitle" + android:textSize="24sp" + android:visibility="visible" /> + + <TextView + android:id="@+id/txt_ethInfo" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="20sp" + android:visibility="visible" /> + + <ProgressBar + android:id="@+id/progress" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:visibility="gone" /> + + <TextView + android:id="@+id/txt_result" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:text="@string/EthernetConnectWarn" + android:textSize="18sp" + android:visibility="visible" /> + + </LinearLayout> + + <include layout="@xml/control_buttons" /> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/firstrun_layout.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/firstrun_layout.xml new file mode 100755 index 0000000..8cf8683 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/firstrun_layout.xml @@ -0,0 +1,308 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical"> + <!-- firmeware version --> + <LinearLayout + android:background="@drawable/per_bk" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1" + android:orientation="horizontal"> + <TextView + android:id="@+id/product_name" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:gravity="center_vertical" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"/> + <TextView + android:id="@+id/product_version" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:gravity="center_vertical" + android:maxLines="1" + android:layout_width="0dip" + android:layout_weight="3" + android:layout_height="fill_parent"/> + </LinearLayout> + + <!-- Storage inforamtion --> + <LinearLayout + android:background="@drawable/per_bk" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1"> + <TextView + android:id="@+id/nand_storage" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:gravity="center_vertical" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"/> + <TextView + android:id="@+id/available_nand_storage" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:gravity="center_vertical" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"/> + </LinearLayout> + + <!-- wifi & sdcard & otg --> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="2"> + <com.DeviceTest.view.TestView + android:background="@drawable/per_bk" + android:id="@+id/wifitestview" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:paddingTop="20dip" + android:textSize="22sp" + android:text="@string/Wifitest"/> + <com.DeviceTest.view.TestView + android:background="@drawable/per_bk" + android:id="@+id/sdcardtestview" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:paddingTop="20dip" + android:textSize="22sp" + android:text="@string/SdCardTitle"/> + <com.DeviceTest.view.TestView + android:background="@drawable/per_bk" + android:id="@+id/usbhosttestview" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent" + android:textColor="@android:color/white" + android:paddingLeft="20dip" + android:paddingTop="20dip" + android:textSize="22sp" + android:text="@string/UsbHostTestTitle"/> + </LinearLayout> + + <!--powerinformation & gsensor & camera --> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="4" + android:orientation="horizontal"> + <LinearLayout + android:orientation="vertical" + android:background="@drawable/per_bk" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"> + <TextView + android:textColor="@android:color/white" + android:textSize="22sp" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10sp" + android:visibility="visible" android:id="@+id/chargeStatusText" /> + <TextView + android:textColor="@android:color/white" + android:textSize="22sp" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10sp" + android:visibility="visible" android:id="@+id/voltageText" /> + <TextView + android:textColor="@android:color/white" + android:textSize="22sp" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10sp" + android:visibility="visible" android:id="@+id/currentText" /> + <TextView + android:textColor="@android:color/white" + android:textSize="22sp" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10sp" + android:visibility="visible" android:id="@+id/capacityText" /> + <TextView + android:textColor="@android:color/white" + android:textSize="22sp" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10sp" + android:visibility="visible" android:id="@+id/plugText" /> + </LinearLayout> + <FrameLayout + android:background="@drawable/per_bk" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"> + <com.DeviceTest.view.GsensorBall + android:id="@+id/gsensorball" + android:layout_width="fill_parent" + android:layout_height="fill_parent"/> + <TextView + android:id="@+id/gsensortext" + android:textColor="@android:color/white" + android:textSize="22sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + </FrameLayout> + <FrameLayout + android:background="@drawable/per_bk" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"> + <SurfaceView + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/camera_preview"/> + <Button + android:layout_gravity="top|right" + android:layout_width="100dip" + android:layout_height="60dip" + android:id="@+id/camera_switch_btu" + android:text="@string/camera_switch" + android:textStyle="bold" + android:textSize="20sp" + android:textColor="#ffffff00"/> + <TextView + android:id="@+id/nocamera" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:text="@string/nocamera" + android:visibility="gone" + android:textStyle="bold" + android:textSize="20sp" + android:textColor="#ffff0000"/> + </FrameLayout> + </LinearLayout> + + + <!-- record & button(single test & close application) --> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="0dip" + android:orientation="horizontal" + android:layout_weight="5" + > + <LinearLayout + android:background="@drawable/per_bk" + android:orientation="vertical" + android:layout_width="0dip" + android:layout_weight="2" + android:layout_height="fill_parent"> + <!-- brightness --> + <LinearLayout + android:background="@drawable/per_bk" + android:layout_width="fill_parent" + android:layout_height="50dp" + android:orientation="horizontal"> + <Button + android:id="@+id/brightnesstestbut" + android:layout_width="0dip" + android:layout_weight="3" + android:layout_height="fill_parent" + android:text="@string/BrightnessTitle" + android:textStyle="bold" + android:textSize="18sp" + android:textColor="#ffffff00"/> + <ProgressBar android:id="@+id/brightnessBar" + android:layout_gravity="center_vertical" + android:layout_width="0dip" + android:layout_weight="7" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_centerInParent="true" + style="?android:attr/progressBarStyleHorizontal" /> + </LinearLayout> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="horizontal"> + <LinearLayout + android:background="@drawable/per_bk" + android:orientation="vertical" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"> + <com.DeviceTest.helper.VUMeter android:id="@+id/uvMeter" + android:background="@drawable/vumeter" + android:layout_gravity="center_horizontal" + android:layout_width="150dp" + android:layout_height="40dp" + android:layout_centerInParent="true" /> + <LinearLayout + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <TextView + android:gravity="center_vertical|center_horizontal" + android:textSize="20sp" + android:id="@+id/recordtext" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"/> + <Button + android:id="@+id/recordtestbutton" + android:text="@string/RecordTest" + android:textStyle="bold" + android:textSize="20sp" + android:textColor="#ffffff00" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"/> + </LinearLayout> + </LinearLayout> + <LinearLayout + android:background="@drawable/per_bk" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent" + android:orientation="vertical"> + <TextView + android:text="@string/KeyboardTestTitle" + android:textColor="@android:color/white" + android:textSize="18sp" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + /> + <com.DeviceTest.view.KeyTestView + android:id="@+id/keytestview" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + /> + </LinearLayout> + </LinearLayout> + </LinearLayout> + <LinearLayout + android:background="@drawable/per_bk" + android:orientation="vertical" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="fill_parent"> + <Button + android:id="@+id/singletest" + android:text="@string/SingleTest" + android:textStyle="bold" + android:textSize="22sp" + android:textColor="#ffffff00" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1"/> + <Button + android:id="@+id/closefirstrun" + android:text="@string/Cancel" + android:textStyle="bold" + android:textSize="22sp" + android:textColor="#ffffff00" + android:layout_marginTop="5dip" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1"/> + </LinearLayout> + </LinearLayout> +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/flashlighttest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/flashlighttest.xml new file mode 100755 index 0000000..c84012b --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/flashlighttest.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="wrap_content" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView android:id="@+id/textTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="24sp" android:text="@string/FlashLightTest" android:paddingTop="20px" /> + + + <TextView android:id="@+id/textSubTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:text="@string/FlashLightTestSubText" android:textSize="20sp" android:paddingTop="20px" /> + </LinearLayout> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_centerVertical="true" + > + + <Button android:id="@+id/btn_open_flashlight" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/OpenFlashLight" + /> + + <Button android:id="@+id/btn_shutdown_flashlight" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/ShutDownFlashLight" + /> + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/compass_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/fmradiotest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/fmradiotest.xml new file mode 100755 index 0000000..8e26de3 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/fmradiotest.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android" +> + <TextView + android:id="@+id/FMRadioTestId" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:textSize="24sp" + android:text="@string/FMRadioTestTitle" + android:paddingTop = "20px"/> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip" + android:layout_below="@id/FMRadioTestId"> + + <TextView + android:id="@+id/FMRadioTextMsgID" + android:visibility="visible" + android:layout_height="wrap_content" + android:text="@string/FMRadioTextMsgText" + android:layout_width="fill_parent" + android:gravity="center_horizontal" + android:paddingTop = "40px"/> + + <TextView + android:id="@+id/FMRadioTestResult" + android:visibility="invisible" + android:layout_height="wrap_content" + android:text="@string/OKText" + android:layout_width="fill_parent" + android:gravity="center_horizontal" + android:paddingTop = "40px"/> + + + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/compass_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpslocationtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpslocationtest.xml new file mode 100755 index 0000000..c0ff53a --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpslocationtest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView android:id="@+id/textTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="24sp" android:paddingTop="20px" android:text="@string/GpsLocationTestTitle" /> + + + <TextView android:id="@+id/textSubTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:paddingTop="20px" android:textSize="20sp" /> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="center_horizontal" android:paddingTop="20px" + android:textSize="18sp" android:visibility="visible" android:id="@+id/gpslocationresultText" /> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="center_horizontal" android:paddingTop="20px" + android:textSize="18sp" android:visibility="visible" android:id="@+id/nmealocationresultText" /> + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/compass_buttons"/> + + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpstest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpstest.xml new file mode 100755 index 0000000..1399649 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gpstest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + + <include layout="@xml/control_buttons" android:id="@+id/gps_btns"/> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:layout_above="@id/gps_btns" android:layout_alignParentTop="true"> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal" + > + <TextView android:id="@+id/gpsTTFF" android:visibility="visible" + android:layout_width="0dip" android:layout_height="wrap_content" + android:textSize="30sp" android:layout_weight="2"/> + <TextView android:id="@+id/gpsCN" android:visibility="visible" + android:layout_width="0dip" android:layout_height="wrap_content" + android:textSize="30sp" android:layout_weight="2"/> + <TextView android:id="@+id/gpsTimer" android:visibility="visible" + android:layout_width="0dip" android:layout_height="wrap_content" + android:textSize="30sp" android:layout_weight="1"/> + + </LinearLayout> + + <TextView android:id="@+id/gpsSatellite" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="fill_parent" + android:textSize="20sp"/> + </LinearLayout> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gsensortest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gsensortest.xml new file mode 100755 index 0000000..9f91a58 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gsensortest.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:background="@drawable/android_wallpaper"> + + <RelativeLayout android:layout_height="wrap_content" + android:layout_width="wrap_content" android:id="@+id/relativeLayout1" + > + <TextView android:text="@string/GsensorTest" android:id="@+id/txtTitle" + android:textSize="30dip" android:gravity="center" + android:layout_centerHorizontal="true" android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + + <TextView android:id="@+id/Accelerometer" + android:layout_below="@id/txtTitle" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" + android:text="@string/Accelerometer" /> + <TextView android:id="@+id/prompt" + android:layout_below="@id/Accelerometer" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" + android:text="@string/prompt" /> + + <Button android:id="@+id/save_calibration_button" + android:layout_below="@id/prompt" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:textSize="20dip" + android:text="@string/save_calibration" /> + <!-- for accelerator --> + <ScrollView + android:layout_below="@id/Accelerometer" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:visibility="gone"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical"> + + <TextView android:id="@+id/gsensorTestX" + android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="40dip" android:text="@string/Gsensor_x" + android:visibility="invisible" /> + <TextView android:id="@+id/gsensorTestY" + android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="40dip" android:text="@string/Gsensor_y" + android:visibility="invisible" /> + <TextView android:id="@+id/gsensorTestZ" + android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="40dip" android:text="@string/Gsensor_z" + android:visibility="invisible" /> + </LinearLayout> + </ScrollView> + </RelativeLayout> + + <!-- com.DeviceTest.view.GsensorBall + android:id="@+id/gsensorball" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1"/>--> + +<RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom"> + <include layout="@xml/control_buttons" android:id="@+id/acc_buttons"/> +</RelativeLayout> + +</FrameLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gyroscopetest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gyroscopetest.xml new file mode 100755 index 0000000..a05d9bf --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/gyroscopetest.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> + + <RelativeLayout android:layout_height="wrap_content" + android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + <TextView android:text="@string/GyroscopeTest" android:id="@+id/txtTitle" + android:textSize="30dip" android:gravity="center" + android:layout_centerHorizontal="true" android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + + <!-- for Magnetic --> + <TextView android:id="@+id/Gyroscope" android:layout_below="@id/txtTitle" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/Gyroscope" /> + + + <!-- <RelativeLayout android:layout_height="wrap_content" + android:layout_width="wrap_content" android:id="@+id/gy_buttons"> + <include layout="@xml/control_buttons" /> + </RelativeLayout> --> + + <!-- for accelerator --> + <ScrollView android:layout_below="@+id/Gyroscope" android:id="@+id/gy_xyz" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical"> + <TextView android:id="@+id/magnetic_info" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" /> + <TextView android:id="@+id/magnetic_x" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/sensor_x" /> + + <TextView android:id="@+id/magnetic_y" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/sensor_y" /> + <TextView android:id="@+id/magnetic_z" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/sensor_z" /> + </LinearLayout> + </ScrollView> + + <TextView android:id="@+id/prompt_Gyroscope" + android:layout_below="@id/gy_xyz" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" + android:text="@string/prompt_Gyroscope" /> + + <Button android:id="@+id/save_calibration_button" + android:layout_below="@id/prompt_Gyroscope" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:textSize="20dip" + android:text="@string/save_calibration" /> + +<LinearLayout android:id="@+id/gy_buttons" android:layout_below="@+id/save_calibration_button" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > +<Button + android:id="@+id/btn_return" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnreturnText" /> + <Button + android:id="@+id/btn_Pass" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnPassText" /> + + <Button + android:id="@+id/btn_Fail" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnFailText" /> + + <Button + android:id="@+id/btn_Skip" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnSkipText" /> + +</LinearLayout> + </RelativeLayout> +<RelativeLayout android:layout_height="wrap_content" + android:layout_width="wrap_content" android:id="@+id/relativeLayout2"/> + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hardwareinfotest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hardwareinfotest.xml new file mode 100755 index 0000000..50de704 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hardwareinfotest.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent"> + + <RelativeLayout android:layout_height="match_parent" + android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + + <include layout="@xml/control_buttons" android:id="@+id/hd_buttons"/> + + <LinearLayout android:id="@+id/switch_btns" + android:layout_above="@id/hd_buttons" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal"> + <Button android:id="@+id/btn_cpu" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/CpuInfo" /> + <Button android:id="@+id/btn_mem" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/MemInfo" /> + <Button android:id="@+id/btn_dmi" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/DmiInfo" /> + </LinearLayout> + + <TextView android:id="@+id/hwinfoText" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" /> + + <ScrollView android:layout_above="@id/switch_btns" + android:layout_below="@id/hwinfoText" + android:layout_width="fill_parent" android:layout_height="wrap_content"> + <FrameLayout android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <TextView android:id="@+id/cpu_info" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" + android:visibility="gone" /> + + <TextView android:id="@+id/mem_info" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" + android:visibility="gone" /> + + <TextView android:id="@+id/dmi_info" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:textSize="20dip" + android:visibility="gone" /> + </FrameLayout> + </ScrollView> + + </RelativeLayout> + + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hdmitest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hdmitest.xml new file mode 100755 index 0000000..6232ac4 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/hdmitest.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <com.DeviceTest.view.LcdTestView + android:id="@+id/lcdtestview" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <TextView + android:id="@+id/hdmitestTitle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingTop="20dp" + android:text="@string/HdmiTestTitle" + android:textSize="24sp" + android:visibility="visible" /> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/hdmitestTitle" + android:orientation="vertical" + android:paddingBottom="60dip" > + + <TextView + android:id="@+id/result" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:paddingTop="40dp" + android:visibility="visible" /> + </LinearLayout> + + <TextView + android:id="@+id/TimeShow" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:layout_centerInParent="true" + android:textSize="30sp" + android:visibility="visible" /> + + <include layout="@xml/control_buttons" android:id="@+id/acc_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/headsetmictest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/headsetmictest.xml new file mode 100755 index 0000000..f3e5875 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/headsetmictest.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android" +> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip" + > + + <TextView + android:id="@+id/textTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:textSize="24sp" + android:paddingTop="20px" + android:text="@string/HeadsetMicTitle" +/> + + + <TextView + android:id="@+id/textSubTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="20sp" + android:text="@string/HeadsetMicSubTitle" + /> + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="18sp" + android:visibility="visible" android:id="@+id/headsetresultText"/> + + + + + + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/acc_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/infomation.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/infomation.xml new file mode 100755 index 0000000..036c859 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/infomation.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginTop="20dip" + android:text="@string/cpu_title" + android:textSize="20sp" + android:textStyle="bold" /> + + <TextView + android:id="@+id/cpuinfo_tv" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip" + android:layout_marginTop="10dip" + android:textSize="22sp" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginTop="20dip" + android:text="@string/memory_title" + android:textSize="20sp" + android:textStyle="bold" /> + + <TextView + android:id="@+id/meminfo_tv" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip" + android:layout_marginTop="10dip" + android:textSize="22sp" /> + + <!--TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginTop="20dip" + android:text="@string/storage_title" + android:textSize="20sp" + android:textStyle="bold" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip" + android:layout_marginTop="20dip" + android:text="@string/nand_flash" + android:textSize="20sp" /> + + <TextView + android:id="@+id/nand_total_tv" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="60dip" + android:layout_marginTop="10dip" + android:text="@string/total_space" + android:textSize="22sp" /> + + <TextView + android:id="@+id/nand_avail_tv" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="60dip" + android:layout_marginTop="10dip" + android:text="@string/available_space" + android:textSize="22sp" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip" + android:layout_marginTop="20dip" + android:text="@string/internal_storage" + android:textSize="20sp" + android:textStyle="bold" /--> + + <TextView + android:id="@+id/internal_avail_tv" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginTop="20dip" + android:text="@string/total_space" + android:textSize="22sp" + android:textStyle="bold"/> + + <TextView + android:id="@+id/internal_avail_size_tv" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip" + android:layout_marginTop="20dip" + android:textSize="20sp" /> + + </LinearLayout> + + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom"> + <include layout="@xml/control_buttons" android:id="@+id/acc_buttons"/> +</RelativeLayout> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/irdatest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/irdatest.xml new file mode 100755 index 0000000..b752dfb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/irdatest.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <TextView android:id="@+id/IrdaTest" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_alignParentTop="true" + android:gravity="center_horizontal" android:paddingBottom="20px" + android:textSize="24sp" android:visibility="visible" android:text="@string/IrdaTestTitle" /> + +<include layout="@xml/control_buttons" android:id="@+id/irda_btns"/> + + <LinearLayout android:layout_above="@id/irda_btns" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="vertical"> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal"> + <Button android:id="@+id/sir_send" android:layout_width="0dip" + android:layout_weight="1" android:layout_height="wrap_content" + android:text="@string/SirSend" android:textSize="30sp"/> + <Button android:id="@+id/sir_receive" android:layout_width="0dip" + android:layout_weight="1" android:layout_height="wrap_content" + android:text="@string/SirReceive" android:textSize="30sp"/> + + </LinearLayout> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal"> + <Button android:id="@+id/fir_send" android:layout_width="0dip" + android:layout_weight="1" android:layout_height="wrap_content" + android:text="@string/FirSend" android:textSize="30sp"/> + <Button android:id="@+id/fir_receive" android:layout_width="0dip" + android:layout_weight="1" android:layout_height="wrap_content" + android:text="@string/FirReceive" android:textSize="30sp"/> + + </LinearLayout> + <ProgressBar android:id="@+id/irda_progress" + android:visibility="invisible" android:layout_width="wrap_content" + android:paddingTop="20px" android:layout_height="wrap_content" + android:layout_gravity="center"></ProgressBar> + + </LinearLayout> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/keyboadtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/keyboadtest.xml new file mode 100755 index 0000000..3f4a108 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/keyboadtest.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:layout_width="fill_parent" + android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> + <TextView android:textSize="24.0sp" android:gravity="center" + android:id="@+id/keyboardtest_title" android:text="@string/KeyboardTestTitle" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_marginTop="50.0dip" android:layout_alignParentTop="true" /> + + <LinearLayout android:layout_below="@id/keyboardtest_title" + android:orientation="horizontal" android:layout_width="fill_parent" + android:layout_height="fill_parent" android:gravity="center"> + <Button android:id="@+id/bt_sounddown" android:layout_width="wrap_content" + android:layout_height="50.0dip" style="@+style/Keyboard" + android:text="@string/VolDown" android:layout_marginLeft="5dip"/> + <Button android:id="@+id/bt_soundup" android:layout_width="wrap_content" + android:layout_height="50.0dip" style="@+style/Keyboard" + android:text="@string/VolUp" android:layout_marginLeft="5dip"/> + <Button android:id="@+id/bt_back" android:layout_width="wrap_content" + android:layout_height="50.0dip" style="@+style/Keyboard" + android:text="@string/Back" android:layout_marginLeft="5dip"/> + + <Button android:id="@+id/bt_menu" android:layout_width="wrap_content" + android:layout_height="50.0dip" style="@+style/Keyboard" + android:text="@string/Menu" android:layout_marginLeft="5dip"/> + + <Button android:id="@+id/bt_home" android:layout_width="wrap_content" + android:layout_height="50.0dip" style="@+style/Keyboard" + android:text="@string/Home" android:layout_marginLeft="5dip" + android:visibility="gone"/> + + </LinearLayout> + + + <include layout="@xml/control_buttons" android:id="@+id/result_bt_layout"/> +</RelativeLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/layout_nofile.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/layout_nofile.xml new file mode 100755 index 0000000..9ef9bb6 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/layout_nofile.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Rockchip Android MID 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. +--> + +<merge xmlns:android="http://schemas.android.com/apk/res/android"> + <ImageView + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_gravity="center_horizontal" + android:background="@drawable/novideofile"/> +</merge> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lcdtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lcdtest.xml new file mode 100755 index 0000000..413cdeb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lcdtest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:layout_width="fill_parent" + android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> + <com.DeviceTest.view.LcdTestView android:id="@+id/lcdtestview" android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <TextView android:id="@+id/lcdtextTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:gravity="center_horizontal" android:textSize="24sp" + android:text="@string/LcdTestTitle" android:paddingTop="20px" /> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip" android:layout_below="@id/lcdtextTitle"> + + + <TextView android:id="@+id/lcdtestresult" android:visibility="visible" + android:layout_height="wrap_content" android:text="@string/LcdTestStart" + android:layout_width="fill_parent" android:gravity="center_horizontal" + android:paddingTop="40px" + android:textSize="18sp" /> + + + + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/acc_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ledtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ledtest.xml new file mode 100755 index 0000000..30a1087 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/ledtest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent"> + + <RelativeLayout android:layout_height="match_parent" + android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + <TextView android:id="@+id/LedTest" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_alignParentTop="true" + android:gravity="center_horizontal" android:paddingBottom="20px" + android:textSize="24sp" android:visibility="visible" android:text="@string/LedTestTitle" /> + + + <include layout="@xml/control_buttons" android:id="@+id/led_buttons"/> + + <LinearLayout android:layout_above="@id/led_buttons" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="horizontal"> + <Button android:id="@+id/red_btn" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Red" /> + <Button android:id="@+id/green_btn" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Green" /> + <Button android:id="@+id/blue_btn" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Blue" /> + <!-- Button android:id="@+id/power_btn" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" /--> + </LinearLayout> + </RelativeLayout> + + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/leveltest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/leveltest.xml new file mode 100755 index 0000000..a248400 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/leveltest.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:layout_width="fill_parent" + android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> + + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + + <com.DeviceTest.view.LevelView android:id="@+id/leveltestview" + android:layout_above="@id/level_buttons" android:layout_width="match_parent" + android:layout_height="match_parent" /> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lightsensortest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lightsensortest.xml new file mode 100755 index 0000000..7c9df4a --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/lightsensortest.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout android:layout_height="match_parent" android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + <TextView + android:text="@string/LightsensorTest" + android:id="@+id/txtTitle" + android:textSize= "30dip" + android:gravity="center" + android:layout_centerHorizontal="true" + android:layout_width="fill_parent" + android:layout_height="wrap_content"/> + + + +<!-- for Light --> +<TextView + android:id="@+id/Light" + android:layout_below="@id/txtTitle" + android:textSize= "25dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/Light" + /> + + <TextView + android:id="@+id/txt_sensor_info" + android:textSize= "20dip" + android:layout_below="@+id/Light" + android:layout_width="fill_parent" + android:layout_height="wrap_content"/> + + <TextView + android:id="@+id/txt_sensor_event" + android:textSize="20dip" + android:layout_marginTop="30dp" + android:layout_below="@id/txt_sensor_info" + android:layout_width="fill_parent" + android:layout_height="wrap_content"/> + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + + </RelativeLayout> + + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main.xml new file mode 100755 index 0000000..5dd0f67 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:background="@android:color/black" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + + + <LinearLayout android:id="@+id/btnLayout" + android:layout_margin="10dip" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="horizontal" android:layout_alignParentBottom="true"> + <Spinner android:id="@+id/GroupTestSpinner" + android:visibility="gone" + android:layout_width="0dip" android:layout_height="wrap_content" + android:layout_weight="2" /> + + <Button android:id="@+id/btn_testall" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/testall" /> + <Button android:id="@+id/btn_cancel" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Cancel" /> + <Button android:id="@+id/btn_save" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Save" /> + <Button android:id="@+id/btn_clear" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Clear" /> + + <Button android:id="@+id/btn_uninstall" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Uninstall" /> + + </LinearLayout> + + <LinearLayout android:layout_alignParentTop="true" + android:layout_above="@id/btnLayout" android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <com.DeviceTest.view.MyGridView + android:id="@+id/myGridView" android:layout_width="fill_parent" + android:layout_height="fill_parent" /> + </LinearLayout> +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main_display_land.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main_display_land.xml new file mode 100755 index 0000000..f41ed2d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/main_display_land.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Rockchip Android MID 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. +--> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="fill_parent" + android:layout_width="fill_parent" + android:id="@+id/main_layout" + android:orientation="vertical"> + <LinearLayout android:id="@+id/novideofile" + android:layout_height="fill_parent" + android:layout_width="fill_parent" + android:visibility="gone"> + <ImageView android:id="@+id/novideofile_image" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_gravity="center_horizontal" + android:background="@drawable/novideofile" + /> + </LinearLayout> + <ListView android:id="@android:id/list" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + > + <include layout="@xml/control_buttons" android:id="@+id/btns" /> + </RelativeLayout> +</FrameLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mobilenettest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mobilenettest.xml new file mode 100755 index 0000000..a167300 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mobilenettest.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip"> + + <TextView + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="24sp" + android:text="@string/MobileNetTitle"/> + + + <TextView + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="20sp" + android:text="@string/MobileNetSubTitle"/> + + <TextView + android:id="@+id/simView" + android:visibility="visible" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:layout_marginLeft="200dp" + android:textSize="30sp"/> + + <TextView + android:id="@+id/moduleView" + android:visibility="visible" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:layout_marginLeft="200dp" + android:textSize="30sp"/> + + </LinearLayout> + + <include layout="@xml/control_buttons"/> +</RelativeLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mriousbtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mriousbtest.xml new file mode 100755 index 0000000..5f524ba --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/mriousbtest.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView + android:id="@+id/textTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:textSize="24sp" + android:paddingTop="20px" + android:text="@string/MrioUSBTitle" + /> + + + <TextView + android:id="@+id/infoText" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:paddingBottom="20px" + android:textSize="20sp" + android:text="@string/MrioUSBsubTitle"/> + + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + > + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="left" + android:paddingTop="10px" + android:textSize="40sp" + android:visibility="visible" + android:id="@+id/unplugTest" + android:text="@string/UsbUnplug" + android:textColor="#ff0000"/> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="left" + android:paddingTop="10px" + android:textSize="40sp" + android:visibility="visible" + android:id="@+id/pluginTest" + android:text="@string/UsbPlugin" + android:textColor="#ff0000"/> + + </LinearLayout> + + + + + + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/msensortest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/msensortest.xml new file mode 100755 index 0000000..e704be6 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/msensortest.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent"> + + <RelativeLayout android:layout_height="match_parent" + android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + <TextView android:text="@string/MsensorTest" android:id="@+id/txtTitle" + android:textSize="30dip" android:gravity="center" + android:layout_centerHorizontal="true" android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + + <include layout="@xml/control_buttons" android:id="@+id/ms_buttons"/> + + <!-- for Magnetic --> + <TextView android:id="@+id/Magnetic" android:layout_below="@id/txtTitle" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/Magnetic_Field" /> + + + <!-- for accelerator --> + <ScrollView android:layout_below="@id/Magnetic" + android:layout_above="@id/ms_buttons" android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical"> + <TextView android:id="@+id/magnetic_info" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" /> + + + <TextView android:id="@+id/magnetic_x" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/sensor_x" /> + + <TextView android:id="@+id/magnetic_y" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/sensor_y" /> + <TextView android:id="@+id/magnetic_z" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="20dip" android:text="@string/sensor_z" /> + </LinearLayout> + </ScrollView> + + + </RelativeLayout> + + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/myclocktest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/myclocktest.xml new file mode 100755 index 0000000..6642004 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/myclocktest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="60dip" > + + <TextView + android:layout_width="fill_parent" + android:layout_height="50dip" + android:text="@string/clock_test" /> + + <LinearLayout + android:id="@+id/clock1" + android:layout_width="300dip" + android:layout_height="300dip" + android:layout_gravity="center" /> + </LinearLayout> + + <include layout="@xml/control_buttons" /> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/phonemictest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/phonemictest.xml new file mode 100755 index 0000000..9a0d663 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/phonemictest.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android" +> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip" + > + + <TextView + android:id="@+id/textTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:textSize="24sp" + android:paddingTop="20px" + android:text="@string/PhoneMictTitle" + /> + <TextView + android:id="@+id/textSubTitle" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="20sp" + android:text="@string/PhoneMicSubTitle" + /> + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="18sp" + android:visibility="visible" android:id="@+id/phoneresultText"/> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <com.DeviceTest.helper.VUMeter android:id="@+id/uvMeter" + android:background="@drawable/vumeter" + android:layout_width="150px" + android:layout_height="60px" + android:layout_centerInParent="true" /> + </RelativeLayout> + + <Button android:id="@+id/btn_retest" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/btnRetest" + android:layout_gravity="center_horizontal" + android:gravity="center_horizontal" + android:textSize="22sp" + android:textStyle="bold" + /> + + + </LinearLayout> + + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/powertest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/powertest.xml new file mode 100755 index 0000000..ac47568 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/powertest.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView android:id="@+id/textTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="24sp" android:paddingTop="20px" android:text="@string/PowertestTitle" /> + + + + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical"> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10px" android:textSize="18sp" + android:visibility="visible" android:id="@+id/chargeStatusText" /> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10px" android:textSize="18sp" + android:visibility="visible" android:id="@+id/voltageText" /> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10px" android:textSize="18sp" + android:visibility="visible" android:id="@+id/currentText" /> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10px" android:textSize="18sp" + android:visibility="visible" android:id="@+id/capacityText" /> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="left" android:paddingTop="10px" android:textSize="18sp" + android:visibility="visible" android:id="@+id/plugText" /> +<!-- <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="left" + android:paddingTop="10px" + android:textSize="30sp" + android:visibility="visible" + android:id="@+id/unplugTest" + android:text="@string/AcUnplug" + android:textColor="#ff0000"/> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="left" + android:paddingTop="10px" + android:textSize="30sp" + android:visibility="visible" + android:id="@+id/pluginTest" + android:text="@string/AcPlugin" + android:textColor="#ff0000"/> + --> + </LinearLayout> + + + + + + </LinearLayout> + + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/rtctest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/rtctest.xml new file mode 100755 index 0000000..f8454c9 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/rtctest.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip"> + + <TextView + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="24sp" + android:text="@string/RTCTitle"/> + + + + + <TextView + android:id="@+id/RTCResult" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="40px" + android:textSize="40sp"/> + + + </LinearLayout> + + <include layout="@xml/control_buttons"/> +</RelativeLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/runintest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/runintest.xml new file mode 100755 index 0000000..be3b430 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/runintest.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + + + <include layout="@xml/control_buttons" android:id="@+id/btns"/> + <Button android:id="@+id/StopVideo" + android:layout_alignParentBottom="true" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:text="@string/stop" + android:visibility="gone" /> + + <VideoView android:id="@+id/VideoView" android:visibility="gone" + android:layout_width="fill_parent" android:layout_height="fill_parent" + android:layout_above="@id/StopVideo" /> + <TextView android:id="@+id/textTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:gravity="center_horizontal" android:textSize="24sp" + android:text="@string/RuninTestTitle" /> + + + + <TextView android:id="@+id/SleepWakeText" + android:layout_height="wrap_content" android:layout_width="wrap_content" + android:textSize="55sp" android:layout_below="@id/textTitle" /> + + <Spinner android:id="@+id/SleepWakeTimesSpinner" + android:layout_width="wrap_content" android:layout_height="55sp" + android:layout_alignParentRight="true" android:layout_marginTop="10sp" + android:layout_alignTop="@id/SleepWakeText" /> + + <TextView android:id="@+id/MemText" android:layout_height="wrap_content" + android:layout_width="wrap_content" android:textSize="55sp" + android:gravity="center_horizontal" android:layout_below="@id/SleepWakeText" /> + + <Spinner android:id="@+id/MemSizeSpinner" android:layout_width="wrap_content" + android:layout_height="55sp" android:layout_alignParentRight="true" + android:layout_marginTop="10sp" android:layout_alignTop="@id/MemText" /> + + <TextView android:id="@+id/VideoText" android:layout_height="wrap_content" + android:layout_width="wrap_content" android:textSize="55sp" + android:layout_below="@id/MemText" /> + + <Spinner android:id="@+id/VideoLengthSpinner" + android:layout_width="wrap_content" android:layout_height="55sp" + android:layout_alignParentRight="true" android:layout_marginTop="10sp" + android:layout_alignTop="@id/VideoText" /> + + <TextView android:id="@+id/BatteryTempText" + android:layout_height="wrap_content" android:layout_width="wrap_content" + android:textSize="55sp" android:layout_below="@id/VideoText"/> + + <ScrollView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_above="@id/btns" + android:layout_below="@id/MemText"> + <TextView android:id="@+id/MemResult" android:layout_height="wrap_content" + android:layout_width="wrap_content" android:textSize="18sp" + android:visibility="gone" /> + </ScrollView> + <Button android:id="@+id/TestStart" android:layout_below="@id/BatteryTempText" + android:layout_width="wrap_content" android:layout_height="wrap_content" /> + + <ProgressBar android:visibility="gone" + android:layout_below="@id/BatteryTempText" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:id="@+id/progress" /> +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/sdcardtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/sdcardtest.xml new file mode 100755 index 0000000..4149add --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/sdcardtest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="60dip" > + + <TextView + android:id="@+id/textTitle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:text="@string/SdCardTitle" + android:textSize="24sp" + android:visibility="visible" /> + + <ScrollView + android:layout_width="fill_parent" + android:layout_height="wrap_content" > + + <TextView + android:id="@+id/sdresultText" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingTop="20px" + android:textSize="18sp" + android:text="@string/InsertSdCard" + android:visibility="visible" /> + </ScrollView> + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/simcardtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/simcardtest.xml new file mode 100755 index 0000000..1f75438 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/simcardtest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView android:id="@+id/SimCardTestTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="40sp" android:text="@string/SimCardTestTitle" android:paddingTop="20px" /> + + <TextView android:id="@+id/text" + android:layout_gravity="center_vertical" + android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="20sp" android:paddingTop="80px" /> + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/btns"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/speakertest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/speakertest.xml new file mode 100755 index 0000000..71c5f7fc --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/speakertest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" android:layout_height="match_parent"> + + <RelativeLayout android:layout_height="match_parent" + android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + <TextView android:text="@string/SpeakerTitle" android:id="@+id/txtTitle" + android:textSize="30dip" android:gravity="center" + android:layout_centerHorizontal="true" android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + + <TextView android:id="@+id/txtContent" android:layout_below="@+id/txtTitle" + android:gravity="center" android:layout_centerHorizontal="true" + android:layout_width="fill_parent" android:layout_height="wrap_content" /> + + + <include layout="@xml/control_buttons" android:id="@+id/spk_btn"/> + + <LinearLayout android:layout_centerInParent="true" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:orientation="horizontal"> + + <Button android:id="@+id/spk_btn_left" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Left" /> + + <Button android:id="@+id/spk_btn_right" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" + android:text="@string/Right" /> + + </LinearLayout> + + </RelativeLayout> + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storageactivitytest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storageactivitytest.xml new file mode 100755 index 0000000..119f222 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storageactivitytest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <TextView + android:text="@string/nand_flash" + android:textStyle="bold" + android:textSize="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginTop="20dip"/> + <TextView + android:text="@string/total_space" + android:textSize="22dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip" + android:layout_marginTop="10dip"/> + <TextView + android:id="@+id/nand_total_space" + android:textSize="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="50dip"/> + <TextView + android:layout_marginTop="10dip" + android:text="@string/available_space" + android:textSize="22dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip"/> + <TextView + android:id="@+id/nand_available_space" + android:textSize="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="50dip"/> + + <TextView + android:text="@string/internal_storage" + android:textStyle="bold" + android:textSize="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="20dip" + android:layout_marginTop="20dip"/> + <TextView + android:layout_marginTop="10dip" + android:text="@string/available_space" + android:textSize="22dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="40dip"/> + <TextView + android:id="@+id/data_available_space" + android:textSize="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="50dip"/> + + <TextView + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1"/> + <include layout="@xml/control_buttons" android:id="@+id/btns"/> +</LinearLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storagetest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storagetest.xml new file mode 100755 index 0000000..321d08a --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/storagetest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + <TextView android:text="@string/StorageTestTitle" android:id="@+id/storageTitle" + android:textSize="30dip" android:gravity="center" + android:layout_centerHorizontal="true" android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + + <TextView android:id="@+id/resultText" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_centerInParent="true" + android:gravity="center_horizontal" android:paddingTop="20px" + android:textSize="18sp" android:visibility="visible" /> + + </LinearLayout> + <include layout="@xml/control_buttons" android:id="@+id/btns"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/touchtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/touchtest.xml new file mode 100755 index 0000000..9cf6428 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/touchtest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:layout_width="fill_parent" + android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> + + <include layout="@xml/control_buttons" android:id="@+id/btns"/> + + <com.DeviceTest.view.PointerLocationView + android:id="@+id/pointerview" android:layout_width="fill_parent" + android:layout_height="fill_parent" /> + + <TextView android:id="@+id/TouchtextTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:gravity="center_horizontal" android:textSize="24sp" + android:text="@string/TouchtestTitle" android:paddingTop="20px" /> + <TextView android:id="@+id/TouchInfoText" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:gravity="center_horizontal" android:textSize="24sp" + android:text="@string/TouchtestSubTitle" android:paddingTop="20px" + android:layout_below="@id/TouchtextTitle" /> + + <LinearLayout android:layout_width="wrap_content" + android:layout_height="wrap_content" android:paddingBottom="20dip" + android:layout_below="@id/TouchInfoText"> + + + <TextView android:id="@+id/TouchtextMsg" android:visibility="visible" + android:layout_height="wrap_content" android:text="@string/TouchtestSubTitle" + android:layout_width="wrap_content" android:paddingTop="20px" /> + </LinearLayout> + + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbdevicetest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbdevicetest.xml new file mode 100755 index 0000000..112ccd1 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbdevicetest.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom= "60dip"> + + <Button + android:id="@+id/goOTGModeSetBtn" + android:layout_marginLeft="40dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:text="OTG 模式切换" + android:onClick="onGoOtgModeSetBtnClick"/> + + <TextView + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="24sp" + android:text="@string/USBDeviceTitle"/> + + <TextView + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:textSize="20sp" + android:text="@string/USBDeviceSubTitle"/> + + + + <TextView + android:id="@+id/USBNum" + android:visibility="visible" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="40px" + android:textSize="40sp"/> + + + </LinearLayout> + + <include layout="@xml/control_buttons"/> +</RelativeLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbhosttest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbhosttest.xml new file mode 100755 index 0000000..9e39376 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/usbhosttest.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="60dip" > + + <TextView + android:id="@+id/textTitle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center_horizontal" + android:paddingTop="20px" + android:text="@string/UsbHostTestTitle" + android:textSize="24sp" + android:visibility="visible" /> + + <ScrollView + android:layout_width="fill_parent" + android:layout_height="wrap_content" > + + <TextView + android:id="@+id/sdresultText" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingTop="20px" + android:textSize="18sp" + android:text="@string/InsertSdCard" + android:visibility="visible" /> + </ScrollView> + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/level_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/versiontest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/versiontest.xml new file mode 100755 index 0000000..5fa78b8 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/versiontest.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/layout1" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <TextView + android:id="@+id/textTitle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal" + android:text="@string/VersionTitle" + android:textSize="24sp" + android:visibility="visible" /> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/textTitle" + android:orientation="vertical" + android:paddingBottom="60dip" > + + <LinearLayout + android:id="@+id/versionlayout1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > + + <TextView + android:layout_width="130px" + android:layout_height="wrap_content" + android:text="@string/Firmwareversion" + android:visibility="visible" /> + + <TextView + android:id="@+id/TextFirmwareversion" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="visible" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/versionlayout2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/versionlayout1" + android:orientation="horizontal" > + + <TextView + android:layout_width="130px" + android:layout_height="wrap_content" + android:text="@string/Kernelversion" + android:visibility="visible" /> + + <TextView + android:id="@+id/TextKernelversion" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="visible" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/versionlayout3" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/versionlayout2" + android:orientation="horizontal" > + + <TextView + android:layout_width="130px" + android:layout_height="wrap_content" + android:text="@string/Basebandversion" + android:visibility="visible" /> + + <TextView + android:id="@+id/TextBasebandversion" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="visible" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/versionlayout4" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/versionlayout3" + android:orientation="horizontal" > + + <TextView + android:layout_width="130px" + android:layout_height="wrap_content" + android:text="@string/Buildversion" + android:visibility="visible" /> + + <TextView + android:id="@+id/TextBuildversion" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="visible" /> + </LinearLayout> + </LinearLayout> + + <include layout="@xml/control_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/vibrationtest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/vibrationtest.xml new file mode 100755 index 0000000..a080af5 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/vibrationtest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- android:layout_centerHorizontal="true" --> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <RelativeLayout android:layout_height="match_parent" android:layout_width="wrap_content" android:id="@+id/relativeLayout1"> + <TextView + android:text="@string/VibrationTest" + android:id="@+id/txtTitle" + android:textSize= "30dip" + android:gravity="center" + android:layout_centerHorizontal="true" + android:layout_width="fill_parent" + android:layout_height="wrap_content"/> + + <TextView + android:id="@+id/txtContent" + android:layout_below ="@+id/txtTitle" + android:gravity="center" + android:layout_centerHorizontal="true" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + + /> + + <include layout="@xml/control_buttons" android:id="@+id/btns"/> + + </RelativeLayout> + + + + +</LinearLayout> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/video_item_land.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/video_item_land.xml new file mode 100755 index 0000000..f0213f9 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/video_item_land.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Rockchip Android MID 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 android:id="@+id/video_item" + android:layout_width="fill_parent" + android:layout_height="80dip" + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal"> + <ImageView android:id="@+id/video_image" + android:layout_height="79dip" + android:layout_width="140dip"/> + <LinearLayout android:id="@+id/video_info" + android:layout_width="510dip" + android:layout_height="80dip" + android:orientation="vertical"> + <TextView android:id="@+id/video_name" + android:layout_width="fill_parent" + android:gravity="center_vertical" + android:layout_height="45dip" + android:paddingLeft="1dip" + android:singleLine="true" + android:textSize="22dip"/> + <LinearLayout android:id="@+id/video_info" + android:layout_width="fill_parent" + android:layout_height="35dip" + android:orientation="horizontal"> + <TextView android:id="@+id/time_info" + android:layout_width="120dip" + android:singleLine="true" + android:layout_height="35dip" + android:paddingLeft="1dip" + android:textSize="15dip"/> + <TextView android:id="@+id/type_info" + android:layout_width="110dip" + android:singleLine="true" + android:layout_height="35dip" + android:paddingLeft="1dip" + android:textSize="15dip"/> + </LinearLayout> + </LinearLayout> + <TextView android:id="@+id/size_info" + android:layout_width="150dip" + android:singleLine="true" + android:layout_height="80dip" + android:paddingLeft="45dip" + android:paddingRight="15dip" + android:paddingTop="30dip" + android:textSize="25dip" + android:gravity="right"/> + + </LinearLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/wifitest.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/wifitest.xml new file mode 100755 index 0000000..a7325d2 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/layout/wifitest.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout android:id="@+id/layout1" + android:layout_width="fill_parent" android:layout_height="fill_parent" + xmlns:android="http://schemas.android.com/apk/res/android"> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="vertical" + android:paddingBottom="60dip"> + + <TextView android:id="@+id/textTitle" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="24sp" android:text="@string/Wifitest" + android:paddingTop="20px" /> + + + <TextView android:id="@+id/wifiInfoText" android:visibility="visible" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:layout_centerInParent="true" android:gravity="center_horizontal" + android:textSize="20sp" android:paddingTop="20px" /> + + <RelativeLayout android:gravity="center_horizontal" + android:layout_width="match_parent" android:id="@+id/relativeLayout1" + android:layout_height="wrap_content"> + <ProgressBar android:id="@+id/wifiprogress" + android:visibility="visible" android:layout_width="wrap_content" + android:layout_height="wrap_content"></ProgressBar> + </RelativeLayout> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" android:visibility="visible" + android:textSize="18sp" android:text="@string/WifiResultText" + android:id="@+id/wifiresultText" /> + + </LinearLayout> + + <include layout="@xml/control_buttons" android:id="@+id/acc_buttons"/> + +</RelativeLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/values-zh-rCN/strings.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/values-zh-rCN/strings.xml new file mode 100755 index 0000000..2b6b4fb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/values-zh-rCN/strings.xml @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">设备测试工具</string> + + <string name="SpeakerTitle">扬声器测试</string> + <string name="SpeakerContent">是否听到声音?</string> + <string name="Left">左</string> + <string name="Right">右</string> + <string name="SpeakerTip">左:男, 右:女</string> + + <string name="BrightnessTitle">背光测试</string> + <string name="BrightnessTitleStop">停止背光测试</string> + <string name="BrightnessSubTitle">请观察背光的变化</string> + + <string name="BluetoothTitle">蓝牙测试</string> + <string name="BluetoothSubTitle">请察看设备</string> + <string name="BluetoothAdapterFail">获取适配器失败!</string> + <string name="BluetoothScan">搜索设备...</string> + <string name="BluetoothInit">请等待设备初始化.</string> + <string name="BluetoothOpenF">打开蓝牙失败!</string> + <string name="BluetoothFindF">查找设备失败.</string> + <string name="BluetoothFindS">找到设备....\n 通过!</string> + + <string name="CameraTitle">摄像头测试</string> + <string name="CameratextMsgText">请点击屏幕打开摄像头</string> + <string name="CameraFlashTitle">照相和闪光灯测试</string> + <string name="CameraFlashtextFront">请点击屏幕打开摄像头\n然后点击预览屏幕拍照</string> + <string name="CameraFlashtextBack">请点击屏幕打开摄像头\n然后点击预览屏幕拍照,并注意闪光灯是否亮起</string> + <string name="btnRetestText">重测</string> + + <string name="GpsTestTitle">Gps C/No 测试</string> + <string name="GpsTestSubTitle">请察看设备</string> + <string name="GpsTestResult">请等待设备初始化</string> + + <string name="GpsLocationTestTitle">Gps Location test</string> + <string name="GpsLocationTestSubTitle">Please observe the equipment</string> + <string name="GpsLocationTestResult">Please wait for init the equipment</string> + <string name="gpstextx">X axis C/No:</string> + <string name="gpstexty">Y axis C/No:</string> + <string name="gpstestx">Test X axis</string> + <string name="gpstesty">Test Y axis</string> + + <string name="HeadsetMicTitle">Headset MIC Test</string> + <string name="HeadsetMicSubTitle">Please say something to the headset\'s mic and hear + from the headset</string> + + <string name="LcdTestTitle">显示屏测试</string> + <string name="LcdTestStart">点击屏幕开始测试</string> + + <string name="PhoneMictTitle">录音测试</string> + <string name="PhoneMicSubTitle">请说话,马上开始录音,录音后将自动播放刚才说的内容</string> + + <string name="PowertestTitle">电池信息</string> + <string name="PowertestSubTitle"> </string> + <string name="AcUnplug">未充电测试(unplug ac):</string> + <string name="AcPlugin">充电测试(plug in ac):</string> + <string name="ChargeState">电池状态</string> + <string name="Voltage">电池电压:</string> + <string name="Capacity">电池电量:</string> + <string name="Plug">电池连接:</string> + + <string name="SdCardTitle">SD卡测试</string> + <string name="SdCardSubTitle">请察看设备</string> + <string name="SdCardFail">失败!找不到SD卡</string> + <string name="SdCardFind">发现SD卡,容量大小: </string> + + <string name="TouchtestTitle">触摸测试</string> + <string name="TouchtestSubTitle">请先做单点滑动测试,再做多点测试 + </string> + + <string name="VersionTitle">版本测试</string> + <string name="Firmwareversion">固件版本:</string> + <string name="Kernelversion">内核版本:</string> + <string name="Basebandversion">基带版本:</string> + <string name="Buildversion">产品版本:</string> + + <string name="VibrationTest">Vibration Test</string> + + <string name="Wifitest">无线测试</string> + <string name="WifiSubText">请查看设备</string> + <string name="WifiResultText">请等待设备初始化</string> + <string name="WifiError">无线测试失败!</string> + <string name="WifiFind">找到网络-</string> + <string name="WifiTry">尝试连接到 </string> + <string name="WifiConnect">已连接到 </string> + <string name="WifiConnectErr">找不到一个可连接的路由!</string> + <string name="WifiPing">Ping 测试 : </string> + <string name="WifiHttp">Http 连接测试: </string> + <string name="WifiSignal3">信号(强)</string> + <string name="WifiSignal2">信号(中)</string> + <string name="WifiSignal1">信号(弱)</string> + <string name="WifiSignal0">信号(差)</string> + <string name="SensorTest">感应器测试</string> + <string name="num200">200</string> + <string name="gsensorvalue">gsensor值: </string> + <string name="Accelerometer">=== 加速仪 === </string> + <string name="prompt">请将设备屏幕朝上,并按下按钮存储校准数据!</string> + <string name="save_calibration">存储校准数据</string> + <string name="save_isok">保存成功!</string> + <string name="prompt_Gyroscope">按下按钮存储校准数据!</string> + + <string name="name_acc"> 名字:</string> + <string name="vendor_acc"> 厂家:</string> + <string name="version_acc">版本:</string> + <string name="maxRange_acc">最大值:</string> + <string name="resolution_acc">解析度:</string> + <string name="power_acc">电源:</string> + <string name="sensor_x">x:</string> + <string name="sensor_y">y:</string> + <string name="sensor_z">z:</string> + <string name="Orientation">=== 方向 === </string> + <string name="Azimuth"> 方位角:</string> + <string name="Pitch"> Pitch:</string> + <string name="Roll"> Roll:</string> + <string name="Light">=== 光感 === </string> + <string name="lightvalue">光感:</string> + <string name="Proximity">=== Proximity === </string> + <string name="Magnetic_Field">=== Magnetic_Field === </string> + <string name="Temperature">=== Temperature === </string> + <string name="Gyroscope">=== 陀螺仪 === </string> + <string name="Gsensor_x">x轴朝上(x:9,y:0,z:0)</string> + <string name="Gsensor_y">y轴朝上(x:0,y:9,z:0)</string> + <string name="Gsensor_z">z轴朝上(x:0,y:0,z:9)</string> + + <string name="GsensorTest">重力感应测试</string> + <string name="MsensorTest">磁感应测试</string> + <string name="GyroscopeTest">陀螺仪测试</string> + <string name="LightsensorTest">光感应测试</string> + + <string name="KeyboardTestTitle">按键测试</string> + <string name="KeyboardTestSubTitle">请测试所有按键</string> + + <string name="VolUp">Vol+</string> + <string name="VolDown">Vol-</string> + <string name="Back">Back</string> + <string name="Menu">Menu</string> + <string name="Home">Home</string> + + + <string name="FlashLightTest">FlashLight Test</string> + <string name="FlashLightTestSubText">Please observe the flashlight of your device when + you touch the buttons</string> + <string name="OpenFlashLight">Open Flash Light</string> + <string name="ShutDownFlashLight">Shut Down Flash Light</string> + + <string name="SimCardTestTitle">Sim Card Test</string> + + <string name="MrioUSBTitle">Mrio USB Test</string> + <string name="MrioUSBsubTitle">Plug in usb and unplug usb</string> + <string name="UsbUnplug">Unplug usb test:</string> + <string name="UsbPlugin">Plug in usb test:</string> + <string name="UsbHostTestFail">失败!找不到USB设备</string> + <string name="UsbFind">发现USB设备,容量大小: </string> + <string name="PCIETestFail">失败!找不到PCIE存储设备</string> + <string name="PCIEFind">发现PCIE存储设备,容量大小: </string> + <string name="SATATestFail">失败!找不到SATA存储设备</string> + <string name="SATAFind">发现SATA存储设备,容量大小: </string> + + <string name="EthernetTitle">以太网</string> + <string name="EthernetManagerFail">当前系统不支持以太网</string> + <string name="EthernetInterfacesFail">未找到以太网配置</string> + <string name="EthernetGetInfoTimeoutFail">获取以太网信息超时</string> + <string name="EthernetConnectWarn">测试时请确保以太网是连接的</string> + + <string name="FMRadioTestTitle">FM Radio Test</string> + <string name="FMRadioTextMsgText">Please touch the screen, Open the FM Radio</string> + + <string name="CirTestTitle">Cir Test</string> + <string name="CirSend">Send</string> + + <string name="CpuInfo">CPU 信息</string> + <string name="MemInfo">内存信息</string> + <string name="DmiInfo">存储空间信息</string> + <string name="cpu_title">CPU 信息:</string> + <string name="memory_title">内存信息 :</string> + <string name="storage_title">存储空间信息 :</string> + + <string name="IrdaTestTitle">IrDA Test</string> + <string name="SirSend">Sir Send</string> + <string name="SirReceive">Sir Receive</string> + <string name="SirTest">Sir Test</string> + <string name="FirSend">Fir Send</string> + <string name="FirReceive">Fir Receive</string> + <string name="FirTest">Fir Test</string> + + <string name="InsertSdCard">请插入SD卡!</string> + <string name="SdCardNospace">SD卡没有空间!</string> + + <string name="RecordTest">录音测试</string> + <string name="HeadsetRecodrSuccess">录音成功!开始回放.</string> + <string name="RecordError">录音失败!</string> + + <string name="LedTestTitle">Led Test</string> + <string name="Red">RED</string> + <string name="Green">GREEN</string> + <string name="Blue">BLUE</string> + + <string name="HdmiTestTitle">HDMI测试</string> + <string name="HdmiNoInsert">请插入HDMI并点击屏幕开始测试!</string> + <string name="HdmiPrepare">HDMI初始化... 请等待3秒左右.</string> + <string name="HdmiResult">测试完成 \n屏幕能正常显示吗?</string> + <string name="HdmiStart">开始测试!</string> + <string name="HdmiStartFail">启动失败! 请确认HDMI是否插入.</string> + + <string name="StorageTestTitle">存储读写测试</string> + <string name="StorageSDNoFind">SD卡路径未找到...\n</string> + <string name="StorageSDCopyF">复制到SD卡失败!\n</string> + <string name="StorageSDCopyS">复制到SD卡成功!\n</string> + <string name="StorageUsbNoFind">Usb host路径未找到...\n</string> + <string name="StorageUsbCopyF">复制到UbsHost 失败!\n</string> + <string name="StorageUsbCopyS">复制到UbsHost 成功!\n</string> + + <string name="RuninTestTitle">Run In Test</string> + <string name="stop">Stop</string> + <string name="start">Start</string> + + <string name="btnPassText">通过</string> + <string name="btnFailText">失败</string> + <string name="btnSkipText">返回上一项测试</string> + <string name="OKText">OK!</string> + + <string name="Testall">Test all</string> + <string name="Cancel">关闭</string> + <string name="Save">保存结果</string> + <string name="Clear">清除</string> + <string name="Uninstall">卸载</string> + + <string name="success">成功</string> + <string name="fail">失败</string> + + <string name="UsbHostTestTitle">Usb Host测试</string> + <string name="PCIETestTitle">PCIE存储测试</string> + <string name="SATATestTitle">SATA存储测试</string> + <string name="Hardware">硬件 : </string> + <string name="HostStorageState">存储状态 : </string> + <string name="Writable">写测试 : </string> + <string name="WriteData">写数据! </string> + <string name="ReadData">读数据! </string> + <string name="MakeDir">创建文件夹 </string> + <string name="CreateFile">创建新文件 </string> + <string name="FileDel">删除文件 </string> + <string name="DirDel">删除文件夹 </string> + <string name="Compare">文件比较 </string> + <string name="HardwareSupport">硬件 : 支持. \n发现设备 :</string> + <string name="HardwareNoSupport">硬件 : 找不到设备! \n请插入设备并等待5秒左右.</string> + <string name="total_space">总存储空间</string> + <string name="available_space">可用存储空间</string> + <string name="camera_switch">切换</string> + <string name="SingleTest">单项测试</string> + <string name="testall">测试选中的选项</string> + <string name="nocamera">没有摄像头</string> + <string name="btnRetest">重测</string> + <string name="btnreturnText">返回测试界面</string> + <string name="alert_dialog_text_entry">请输入你的密码确保拥有相应的权限 </string> + <string name="alert_dialog_ok">确定</string> + <string name="alert_dialog_cancel">取消</string> + <string name="alert_dialog_warning_title">警告</string> + <string name="alert_dialog_password">密码:</string> + <string name="MobileNetTitle">移动网络测试</string> + <string name="MobileNetSubTitle">请插入4G模块和SIM卡</string> + <string name="USBDeviceTitle">USB设备测试</string> + <string name="USBDeviceSubTitle">请插入USB设备,并观察USB设备数量</string> + + <string name="RTCTitle">RTC设备测试</string> +</resources> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/values/strings.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/values/strings.xml new file mode 100755 index 0000000..834d5f5 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/values/strings.xml @@ -0,0 +1,284 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">DeviceTest</string> + <string name="VibrationTitle">Vibration Test</string> + <string name="VibrationContent">Please judge that if the equipment is vibrating + </string> + + <string name="SpeakerTitle">Speaker Test</string> + <string name="SpeakerContent">Can you hear from the sound?</string> + <string name="Left">Left</string> + <string name="Right">Right</string> + <string name="SpeakerTip">left:man, right:woman</string> + + <string name="BrightnessTitle">Brightness Test</string> + <string name="BrightnessTitleStop">Stop Test</string> + <string name="BrightnessSubTitle">Please observe the changes of brightness</string> + + <string name="BluetoothTitle">Bluetooth Test</string> + <string name="BluetoothSubTitle">Please observe the equipment</string> + <string name="BluetoothAdapterFail">Get adapter failed!</string> + <string name="BluetoothScan">Scanning equipment...</string> + <string name="BluetoothInit">Please wait for init the equipment.</string> + <string name="BluetoothOpenF">Open bluetooth failed.</string> + <string name="BluetoothFindF">Find equitment failed.</string> + <string name="BluetoothFindS">Find equipment....\n Pass!</string> + + <string name="CameraTitle">Camera Test</string> + <string name="CameratextMsgText">Please touch the screen , open the camera</string> + <string name="CameraFlashTitle">Camera and Flash Test</string> + <string name="CameraFlashtextFront">Please click screen to open camera,then click preview screen to take photo</string> + <string name="CameraFlashtextBack">Please click screen to open camera,then click preview screen to take photo with flash on</string> + <string name="btnRetestText">Retest</string> + + <string name="GpsTestTitle">Gps C/No test</string> + <string name="GpsTestSubTitle">Please observe the equipment</string> + <string name="GpsTestResult">Please wait for init the equipment</string> + + <string name="GpsLocationTestTitle">Gps Location test</string> + <string name="GpsLocationTestSubTitle">Please observe the equipment</string> + <string name="GpsLocationTestResult">Please wait for init the equipment</string> + <string name="gpstextx">X axis C/No:</string> + <string name="gpstexty">Y axis C/No:</string> + <string name="gpstestx">Test X axis</string> + <string name="gpstesty">Test Y axis</string> + + <string name="HeadsetMicTitle">Headset MIC Test</string> + <string name="HeadsetMicSubTitle">Please say something to the headset\'s mic and hear + from the headset</string> + + <string name="LcdTestTitle">LCD Test</string> + <string name="LcdTestStart">Click LCD to start</string> + + <string name="PhoneMictTitle">Mobile phone MIC test</string> + <string name="PhoneMicSubTitle">Please say something to the mobile and hear from + the speaker</string> + + <string name="PowertestTitle">Battery Information</string> + <string name="PowertestSubTitle"> </string> + <string name="AcUnplug">Discharge test(unplug ac):</string> + <string name="AcPlugin">Charge test(plug in ac):</string> + <string name="ChargeState">Charge status:</string> + <string name="Voltage">Voltage:</string> + <string name="Capacity">Capacity:</string> + <string name="Plug">Plug:</string> + + <string name="SdCardTitle">SD card test</string> + <string name="SdCardSubTitle">Please observe the equipment</string> + <string name="SdCardFail">Fail! Can not find SD card</string> + <string name="SdCardFind">Find sd card, total space: </string> + <string name="resume_findSD">Please wait......</string> + + <string name="TouchtestTitle">Touch test</string> + <string name="TouchtestSubTitle">Do diagonal test before multi-touch point test + </string> + + <string name="VersionTitle">Version test</string> + <string name="Firmwareversion">Firmware version:</string> + <string name="Kernelversion">Kernel version:</string> + <string name="Basebandversion">Baseband version:</string> + <string name="Buildversion">Product version:</string> + + <string name="VibrationTest">Vibration Test</string> + <string name="testall">Test Checked</string> + <string name="Wifitest">Wifi test</string> + <string name="WifiError">Wifi test fail</string> + <string name="WifiFind">Wifi has find</string> + <string name="WifiTry">Try to connect </string> + <string name="wififindtest">Wifi has find</string> + <string name="WifiConnect">Wifi has connect</string> + <string name="WifiPing">Ping test : </string> + <string name="WifiHttp">Http connect test: </string> + <string name="WifiConnectErr">Can not get connection</string> + <string name="WifiSubText">Please observe the equipment</string> + <string name="WifiResultText">Please wait for init the equipment</string> + <string name="WifiSignal3">信号(强)</string> + <string name="WifiSignal2">信号(中)</string> + <string name="WifiSignal1">信号(弱)</string> + <string name="WifiSignal0">信号(差)</string> + + <string name="SensorTest">Sensor Test</string> + <string name="num200">200</string> + <string name="gsensorvalue">gsensor value: </string> + <string name="Accelerometer">=== Accelerometer === </string> + <string name="prompt">Please make device screen above and touch button to save calibration value!</string> + <string name="save_calibration">Save calibration value </string> + <string name="save_isok">Save Success!</string> + <string name="prompt_Gyroscope">touch button to save calibration value!</string> + + <string name="name_acc"> name:</string> + <string name="vendor_acc"> vendor:</string> + <string name="version_acc">version:</string> + <string name="maxRange_acc">maxRange:</string> + <string name="resolution_acc">resolution:</string> + <string name="power_acc">power:</string> + <string name="sensor_x">x:</string> + <string name="sensor_y">y:</string> + <string name="sensor_z">z:</string> + <string name="Orientation">=== Orientation === </string> + <string name="Azimuth"> Azimuth:</string> + <string name="Pitch"> Pitch:</string> + <string name="Roll"> Roll:</string> + <string name="Light">=== Light === </string> + <string name="lightvalue">Light:</string> + <string name="Proximity">=== Proximity === </string> + <string name="Magnetic_Field">=== Magnetic_Field === </string> + <string name="Temperature">=== Temperature === </string> + <string name="Gyroscope">=== Gyroscope === </string> + + <string name="Gsensor_x">x axis points up(x:9,y:0,z:0)</string> + <string name="Gsensor_y">y axis points up(x:0,y:9,z:0)</string> + <string name="Gsensor_z">z axis points up(x:0,y:0,z:9)</string> + + <string name="GsensorTest">Gsensor Test</string> + <string name="MsensorTest">Msensor Test</string> + <string name="LightsensorTest">Lightsensor Test</string> + <string name="GyroscopeTest">Gyroscope Test</string> + <string name="KeyboardTestTitle">Keyboard Test</string> + <string name="KeyboardTestSubTitle">Please test all keys</string> + + <string name="VolUp">Vol+</string> + <string name="VolDown">Vol-</string> + <string name="Back">Back</string> + <string name="Menu">Menu</string> + <string name="Home">Home</string> + + + <string name="FlashLightTest">FlashLight Test</string> + <string name="FlashLightTestSubText">Please observe the flashlight of your device when + you touch the buttons</string> + <string name="OpenFlashLight">Open Flash Light</string> + <string name="ShutDownFlashLight">Shut Down Flash Light</string> + + <string name="SimCardTestTitle">Sim Card Test</string> + + <string name="MrioUSBTitle">Mrio USB Test</string> + <string name="MrioUSBsubTitle">Plug in usb and unplug usb</string> + <string name="UsbUnplug">Unplug usb test:</string> + <string name="UsbPlugin">Plug in usb test:</string> + <string name="UsbHostTestFail">Fail! Cannot find the USB</string> + <string name="UsbFind">USB found, memory: </string> + <string name="PCIETestFail">Fail! Cannot find the PCIE Storage</string> + <string name="PCIEFind">PCIE Storage found, memory: </string> + <string name="SATATestFail">Fail! Cannot find the SATA storage</string> + <string name="SATAFind">SATA storage found, memory: </string> + + <string name="EthernetTitle">Ethernet test</string> + <string name="EthernetManagerFail">System not support ethernet</string> + <string name="EthernetInterfacesFail">Not ethernet interfaces</string> + <string name="EthernetGetInfoTimeoutFail">Get ethernet info timeout</string> + <string name="EthernetConnectWarn">Confirm ethernet is connect during test</string> + + <string name="FMRadioTestTitle">FM Radio Test</string> + <string name="FMRadioTextMsgText">Please touch the screen, Open the FM Radio</string> + + <string name="CirTestTitle">Cir Test</string> + <string name="CirSend">Send</string> + + <string name="CpuInfo">CPU info</string> + <string name="MemInfo">MEM info</string> + <string name="DmiInfo">DMI info</string> + + <string name="cpu_title">CPU Info:</string> + <string name="memory_title">Memory Info:</string> + <string name="storage_title">Storage Info:</string> + + <string name="IrdaTestTitle">IrDA Test</string> + <string name="SirSend">Sir Send</string> + <string name="SirReceive">Sir Receive</string> + <string name="SirTest">Sir Test</string> + <string name="FirSend">Fir Send</string> + <string name="FirReceive">Fir Receive</string> + <string name="FirTest">Fir Test</string> + + <string name="InsertSdCard">Please Insert SD Card!</string> + <string name="SdCardNospace">SD Card No Space!</string> + + <string name="RecordTest">RecordTest</string> + <string name="HeadsetRecodrSuccess">record successs!start Play back.</string> + <string name="RecordError">Record error!</string> + + <string name="LedTestTitle">Led Test</string> + <string name="Red">RED</string> + <string name="Green">GREEN</string> + <string name="Blue">BLUE</string> + + <string name="HdmiTestTitle">HDMI Test</string> + <string name="HdmiNoInsert">Please insert HDMI and Touch screen to start test!</string> + <string name="HdmiPrepare">Please Wait 3 seconds for Hdmi init!</string> + <string name="HdmiResult">Test Finish! \nCan you see the right color in Screen?</string> + <string name="HdmiStart">Start Test!</string> + <string name="HdmiStartFail">Start failed! Please make sure the HDMI is inserted.</string> + + <string name="StorageTestTitle">Storage R/W Test</string> + <string name="StorageSDNoFind">Sdcard path not found...\n</string> + <string name="StorageSDCopyF">Failed copy to sdcard!\n</string> + <string name="StorageSDCopyS">Copy to sdcard success!\n</string> + <string name="StorageUsbNoFind">Usb host path not found...\n</string> + <string name="StorageUsbCopyF">Failed copy to usb host!\n</string> + <string name="StorageUsbCopyS">Copy to usb host success!\n</string> + + + + <string name="RuninTestTitle">Run In Test</string> + <string name="stop">Stop</string> + <string name="start">Start</string> + + <string name="btnPassText">Pass</string> + <string name="btnFailText">Fail</string> + <string name="btnSkipText">Back</string> + <string name="OKText">OK!</string> + + <string name="Testall">Test all</string> + <string name="Cancel">Close</string> + <string name="Save">Save Result</string> + <string name="Clear">Clear</string> + <string name="Uninstall">Uninstall</string> + + <string name="success">Success</string> + <string name="fail">Fail</string> + + <string name="Version">V20210722</string> + <string name="UsbHostTestTitle">Usb Host Test </string> + <string name="PCIETestTitle">PCIE Stoarage Test </string> + <string name="SATATestTitle">SATA Storage Test </string> + <string name="Hardware">Hardware : </string> + <string name="HostStorageState">HostStorageState : </string> + <string name="Writable">Write Test : </string> + <string name="WriteData">Write Data! </string> + <string name="ReadData">Read Data! </string> + <string name="MakeDir">Create Dir </string> + <string name="CreateFile">Create New File </string> + <string name="FileDel">File delete </string> + <string name="DirDel">Dir delete </string> + <string name="Compare">Compare </string> + <string name="HardwareSupport">Hardware : Support. \nFind Device : </string> + <string name="HardwareNoSupport">Hardware : Can\'t find Device! \nPlease insert USB device and wait 5 seconds.</string> + <string name="nand_flash">NAND flash</string> + <string name="total_space">Total space</string> + <string name="available_space">Available space</string> + <string name="internal_storage">Internal storage</string> + <string name="nand_unavailable">Unavailable</string> + <string name="read_only">\u0020(Read-only)</string> + <string name="camera_switch">Switch</string> + <string name="SingleTest">SingleTest</string> + <string name="nocamera">No Camera</string> + + <string name="btnRetest">Test again</string> + <string name="btnreturnText">Return Main Test</string> + <string name="load_title">Loading..</string> + <string name="wait">Please wait for a moment</string> + <string name="no_mediafiles">No media files</string> + <string name="alert_checkfile">Please check whether the video file is exist.</string> + <string name="clock_test">Clock Test</string> + <string name="alert_dialog_text_entry">Please enter your password make sure you have the appropriate permissions</string> + <string name="alert_dialog_ok">OK</string> + <string name="alert_dialog_cancel">Cancle</string> + <string name="alert_dialog_warning_title">Warning</string> + <string name="alert_dialog_password">Password:</string> + <string name="MobileNetTitle">MobileNetwork Test</string> + <string name="MobileNetSubTitle">Please insert the 4G module and sim card</string> + <string name="USBDeviceTitle">USB Device Test</string> + <string name="USBDeviceSubTitle">Please insert the USB device, and observe the USB device number</string> + <string name="RTCTitle">RTC Device Test</string> +</resources> diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/res/xml/control_buttons.xml b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/xml/control_buttons.xml new file mode 100755 index 0000000..60e76fc --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/res/xml/control_buttons.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_gravity="bottom" + android:orientation="horizontal" + android:background="#000000" > +<Button + android:id="@+id/btn_return" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnreturnText" /> + <Button + android:id="@+id/btn_Pass" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnPassText" /> + + <Button + android:id="@+id/btn_Fail" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnFailText" /> + + <Button + android:id="@+id/btn_Skip" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btnSkipText" /> + +</LinearLayout> \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BluetoothTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BluetoothTestActivity.java new file mode 100755 index 0000000..63c4a22 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BluetoothTestActivity.java @@ -0,0 +1,325 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.util.ArrayList; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.TestCase.RESULT; + +import android.app.Activity; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.wifi.WifiManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; + +public class BluetoothTestActivity extends Activity { + private static final String TAG = BluetoothTestActivity.class + .getSimpleName(); + private final static String ERRMSG = "FAIL!Can not find a bluetooth equipment!"; + + private static final int MSG_OPEN = 0; + private static final int MSG_FAILED = 1; + private static final int MSG_FINISH_TEST = 2; + + private boolean isTestFinish = false; +// private boolean isUnRegOver = false; + private BluetoothAdapter mAdapter; + private BroadcastReceiver mBluetoothReceiver; + +// private ArrayList<String> mDeviceNames; + private Handler mHandler; + private TextView mResult; + private int mTestCount; + private int mTestOpen; + private ProgressBar progressBar; + boolean stop = false; + + public BluetoothTestActivity() { +// this.mDeviceNames = new ArrayList<String>(); + this.mHandler = new MyHandler(); + this.mBluetoothReceiver = new MyBroadcastReceiver(); + + } + + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.bluetoothtest); + + mResult = (TextView) findViewById(R.id.resultText); + + progressBar = (ProgressBar) findViewById(R.id.progress); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + //findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + ControlButtonUtil.initControlButtonView(this); + //findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + + this.mAdapter = BluetoothAdapter.getDefaultAdapter(); + + /*if (mAdapter == null) { + Log.d(TAG, "cdy --- mAdapter == null"); +// isTestFinish = true; + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + this.mResult.setText(getString(R.string.BluetoothAdapterFail)); + progressBar.setVisibility(View.GONE); + //failed(); + }*/ + + } + + + protected void onResume() { + + super.onResume(); + stop = false; + if ((this.mAdapter != null)){ +// if ((this.mAdapter != null) && (!this.isTestFinish)) { + +// this.isUnRegOver = false; + + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); + intentFilter + .addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED); + intentFilter + .addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); + intentFilter.addAction(BluetoothDevice.ACTION_FOUND); + + registerReceiver(this.mBluetoothReceiver, intentFilter); + +// this.mDeviceNames.clear(); + + if(this.mAdapter == null) + { + Log.d(TAG, "cdy --onResume- mAdapter == null"); + + } + Log.d(TAG, "cdy --onResume else- mAdapter == null"); + if (this.mAdapter.isEnabled()) { + mAdapter.startDiscovery(); + mResult.setText(getString(R.string.BluetoothScan)); + } else { + this.mHandler.sendEmptyMessage(MSG_OPEN); + mResult.setText(getString(R.string.BluetoothInit)); + } + }else + { + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + this.mResult.setText(getString(R.string.BluetoothAdapterFail)); + progressBar.setVisibility(View.GONE); + //failed(); + } + } + + + public void onPause() { + super.onPause(); + stop = true; +// if ((this.mAdapter == null) || (this.isTestFinish)) { +// return; +// } +// this.isUnRegOver = true; + if (this.mAdapter == null) { + return; + } + unregisterReceiver(mBluetoothReceiver); + mAdapter.cancelDiscovery(); + // this.mAdapter.disable(); + mHandler.removeMessages(MSG_FAILED); + } + + + + class MyHandler extends Handler { + + public void handleMessage(Message msg) { + if(stop) { + return; + } + switch (msg.what) { + case MSG_OPEN: + +// if ((isTestFinish) && (!isUnRegOver)) { +// isUnRegOver = true; +// removeMessages(MSG_OPEN); +// +// unregisterReceiver(mBluetoothReceiver); +// // mAdapter.disable(); +// +// break; +// } + Log.i(TAG, "142,mAdapter.isEnabled()" + mAdapter.isEnabled()); + if (mAdapter.isEnabled()) { + + Log.i(TAG, "145,bluetooth is open and then startDiscovery!"); + mAdapter.startDiscovery(); + + removeMessages(MSG_OPEN); + + } else { + + if (mTestOpen < 15) { + + Log.i(TAG, + "bluetooth is close and then open it! mTestOpen=" + + mTestOpen); + + mTestOpen++; + + mAdapter.enable(); + sendEmptyMessageDelayed(MSG_OPEN, 1000L); + + } else { + +// isTestFinish = true; + progressBar.setVisibility(View.GONE); + mResult.setText(getString(R.string.BluetoothOpenF)); + failed(); + } + + } + + break; + case MSG_FAILED: + ((Button)findViewById(R.id.btn_Fail)).performClick(); + break; + case MSG_FINISH_TEST: + removeMessages(MSG_OPEN); + ((Button)findViewById(R.id.btn_Pass)).performClick(); + } + } + } + + private void failed() { + mHandler.removeMessages(MSG_FAILED); + mHandler.sendEmptyMessageAtTime(MSG_FAILED, DeviceTest.TEST_FAILED_DELAY); + } + + class MyBroadcastReceiver extends BroadcastReceiver { + + + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if(stop) { + return; + } + if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { + int state = intent.getIntExtra( + BluetoothAdapter.EXTRA_STATE, + Integer.MIN_VALUE); + if (state == BluetoothAdapter.STATE_ON) { + Log.i(TAG, "onReceive -- STATE_ON"); + mAdapter.startDiscovery(); + } else if (state == BluetoothAdapter.STATE_OFF) { + Log.i(TAG, "onReceive -- STATE_OFF"); + + } + + } else if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_STARTED)) { + Log.i(TAG, "onReceive -- ACTION_DISCOVERY_STARTED mTestCount=" + + mTestCount); + + mResult.setText(getString(R.string.BluetoothScan)); + + } else if (action + .equals(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)) { + Log.i(TAG, "onReceive -- ACTION_DISCOVERY_FINISHED"); + +// if (!mDeviceNames.isEmpty()) { + /* + * progressBar.setVisibility(View.GONE); String findstr = + * "Find equipment-"; StringBuilder sb = new + * StringBuilder().append(findstr) .append("\n"); + * + * for (int i = 0; i < mDeviceNames.size(); i++) { + * + * sb.append(" <"); String name = (String) + * mDeviceNames.get(i); + * sb.append(name).append(">").append("\n"); } + * + * mResult.setText(sb.toString()); + */ +// } else { + +// if ((isTestFinish) && (!isUnRegOver)) { +// isUnRegOver = true; +// mHandler.removeMessages(0); +// unregisterReceiver(mBluetoothReceiver); +// progressBar.setVisibility(View.GONE); +// mResult.setText(ERRMSG); +// } + if(isTestFinish) return; + if (mTestCount < 15 ) { + mTestCount++; + mAdapter.startDiscovery(); + + } else { + + + progressBar.setVisibility(View.GONE); + mResult.setText(getString(R.string.BluetoothFindF)); + + failed(); + } + +// } + + } else if (action.equals(BluetoothDevice.ACTION_FOUND)) { + BluetoothDevice device = intent + .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); + + // String name = + // intent.getStringExtra("android.bluetooth.device.extra.NAME"); + if (device != null) { + isTestFinish = true; + progressBar.setVisibility(View.GONE); + StringBuilder sb = new StringBuilder().append(getString(R.string.BluetoothFindS)).append( + ":"); + sb.append( + " \t- name :" + + device.getName() + ).append( + "\n"); + mResult.setText(sb.toString()); + // mDeviceNames.add(device.getName() + "-" + + // device.getAddress()); + mHandler.sendEmptyMessageDelayed(MSG_FINISH_TEST, 2000); + } + + // String address = localBluetoothDevice.getAddress(); + // mDeviceNames.add(address); + + } + + } + + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BrightnessTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BrightnessTestActivity.java new file mode 100755 index 0000000..86887e0 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/BrightnessTestActivity.java @@ -0,0 +1,195 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.*; + +import com.DeviceTest.helper.ConfigUtil; +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.Context; +import android.hardware.display.DisplayManager; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; +import android.os.RemoteException; +import android.os.SystemClock; +import android.provider.Settings; +import android.provider.Settings.SettingNotFoundException; +import android.util.Log; +import android.view.KeyEvent; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.os.IPowerManager; +import android.os.ServiceManager; + +import java.lang.reflect.Method; + +public class BrightnessTestActivity extends Activity { + private static final String TAG = BrightnessTestActivity.class + .getSimpleName(); + static final int MAXIMUM_BRIGHTNESS = 255; + static final int MINIMUM_BRIGHTNESS = 2; + static final int MSG_TEST_BRIGHTNESS = 0; + private int mCurBrightness = -1; + static final int ONE_STAGE = 2; + MyHandler mHandler; + TextView mText; + TextView mTitle; + TextView progressText; + int mBrightness = 30; + boolean increase = true; + private static final int SEEK_BAR_RANGE = 10000; + private static final int MAXIMUM_BACKLIGHT = android.os.PowerManager.BRIGHTNESS_ON; + private float oldScreenBrightness; + private int mScreenBrightnessDim = 20; + private DisplayManager mDisplayManager = null; + + public BrightnessTestActivity() { + mHandler = new MyHandler(); + + } + + ProgressBar progressBar; + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setContentView(R.layout.brightnesstest); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + progressBar = (ProgressBar) findViewById(R.id.brightnessBar); + progressBar.setClickable(false); + progressBar.setMax(MAXIMUM_BACKLIGHT); + //mSeekBar.setMax(SEEK_BAR_RANGE); + progressText = (TextView) findViewById(R.id.progressText); + ControlButtonUtil.initControlButtonView(this); + WindowManager.LayoutParams lp = getWindow().getAttributes(); + oldScreenBrightness = lp.screenBrightness; + Log.d(TAG, oldScreenBrightness + " _____________________- onPause()"); + } + + protected void onResume() { + super.onResume(); + this.mHandler.sendEmptyMessage(MSG_TEST_BRIGHTNESS); + } + + protected void onPause() { + super.onPause(); + Log.d(TAG, " _____________________- onPause()"); + this.mHandler.removeMessages(MSG_TEST_BRIGHTNESS); + } + + @Override + protected void onDestroy() { + setBrightnessToSystem(140); + Log.d(TAG, oldScreenBrightness + " _____________________- onDestroy()"); + super.onDestroy(); + } + + private void setBrightness(int paramInt) { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + + /*float brightness = 0; + + int range = (MAXIMUM_BACKLIGHT - mScreenBrightnessDim); + brightness = (paramInt*range)/SEEK_BAR_RANGE + mScreenBrightnessDim; + mCurBrightness =(int) brightness;*/ + float brightness = (float) paramInt / MAXIMUM_BRIGHTNESS; + lp.screenBrightness = (float) paramInt / MAXIMUM_BRIGHTNESS; + System.out.println(mBrightness + "-------------------------------------------" + brightness); + getWindow().setAttributes(lp); + } + + class MyHandler extends Handler { + MyHandler() { + } + + public void handleMessage(Message msg) { + + super.handleMessage(msg); + int delay = 25; + if (msg.what == MSG_TEST_BRIGHTNESS) { + if (increase) { + mBrightness += ONE_STAGE; + if (mBrightness >= MAXIMUM_BRIGHTNESS) { + mBrightness = MAXIMUM_BRIGHTNESS; + increase = false; + delay = 500; + } + } else { + mBrightness -= ONE_STAGE; + if (mBrightness <= MINIMUM_BRIGHTNESS) { + mBrightness = MINIMUM_BRIGHTNESS; + increase = true; + delay = 500; + } + } + // System.out.println("==========================================="+mBrightness); + setBrightnessToSystem(mBrightness); + float brightness = mBrightness * 100; + + brightness = (brightness - mScreenBrightnessDim) + / (MAXIMUM_BACKLIGHT - mScreenBrightnessDim); + + brightness = (int) (brightness * SEEK_BAR_RANGE); + //System.out.println("------------SEEK_BAR_RANGE-------------------"+mBrightness); + progressBar.setProgress(mBrightness); + progressText.setText(mBrightness + "/" + MAXIMUM_BRIGHTNESS); + //setBrightness(mBrightness); + + sendEmptyMessageDelayed(MSG_TEST_BRIGHTNESS, delay); + + } + } + + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + private void setBrightnessToSystem(int brightness) { + try { + if (null == mDisplayManager) { + mDisplayManager = getSystemService(DisplayManager.class); + } + if (Build.VERSION.SDK_INT >= ConfigUtil.ANDROID_SDK_VERSION_S) { + float fBrightness = 1.0f * brightness / MAXIMUM_BRIGHTNESS; + Method m = DisplayManager.class.getMethod("setTemporaryBrightness", int.class, float.class); + Method m2 = Context.class.getMethod("getDisplayId"); + int displayId = Integer.parseInt(m2.invoke(this).toString()); + m.invoke(mDisplayManager, displayId, fBrightness); + } else if (Build.VERSION.SDK_INT == ConfigUtil.ANDROID_SDK_VERSION_R) {//Build.VERSION_CODES.R + float fBrightness = 1.0f * brightness / MAXIMUM_BRIGHTNESS; + Method m = DisplayManager.class.getMethod("setTemporaryBrightness", float.class); + m.invoke(mDisplayManager, fBrightness); + } else if (Build.VERSION.SDK_INT >= ConfigUtil.ANDROID_SDK_VERSION_P) { + Method m = DisplayManager.class.getMethod("setTemporaryBrightness", int.class); + m.invoke(mDisplayManager, brightness); + } else { + IPowerManager power = IPowerManager.Stub.asInterface( + ServiceManager.getService(Context.POWER_SERVICE)); + if (null != power) { + Method m = IPowerManager.class.getMethod("setTemporaryScreenBrightnessSettingOverride", int.class); + m.invoke(power, brightness); + } + } + } catch (Exception doe) { + doe.printStackTrace(); + } + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraBackTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraBackTestActivity.java new file mode 100755 index 0000000..3240e29 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraBackTestActivity.java @@ -0,0 +1,341 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ConfigUtil; +import com.DeviceTest.helper.ControlButtonUtil; + +import java.io.FileOutputStream; +import android.content.Intent; + +import android.app.Activity; +import android.content.Context; +import android.hardware.Camera; +import android.os.Bundle; +import android.os.Environment; +import android.util.Log; +import android.view.MotionEvent; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.Window; +import android.view.WindowManager; +import android.view.KeyEvent; +import android.widget.Button; +import android.widget.TextView; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.view.View; +import android.os.Handler; +import android.os.Message; +import android.view.Surface; +import android.widget.ImageView; +import android.content.pm.PackageManager; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.app.ActivityManager; +import java.lang.reflect.Method; + + +public class CameraBackTestActivity extends Activity{ + + private static final String TAG="CameraWithFlashTestActivity"; + + private static final int MSG_TAKE_OVER = 1; + private static final int MSG_TAKE_ERROR = 2; + private TextView tv_prompt; + private ImageView imageView; + private boolean isTakeStat=false; //FOR ESC key + private boolean isCanTake=true; //if in taking process,click preview screen should not call take photo again! +// private int CameraCount=0; +// private int testCount=0; + private Bitmap bitmap; + private int testCameraID=0; + private boolean mCameraPrepared; + public void onCreate(Bundle bundle) { + super.onCreate(bundle); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + requestWindowFeature(Window.FEATURE_NO_TITLE); + // setContentView(new CameraView(this)); + setContentView(R.layout.camerawithflashtest); + tv_prompt=(TextView)findViewById(R.id.CameratextMsg); + // tv_prompt.setText("请点击屏幕打开后置摄像头\n然后点击预览屏幕拍照"); + tv_prompt.setText(getString(R.string.CameraFlashtextBack)); + ControlButtonUtil.initControlButtonView(this); +// CameraCount=getCameraCount(); + if(isAppInstalled(this, "com.example.cam")) { + Intent intent = getPackageManager().getLaunchIntentForPackage("com.example.cam"); + if( intent != null ) { + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + stopAppByForce(CameraBackTestActivity.this,"com.example.cam"); + } + }, 5000); + } + } + private void stopAppByForce(Context context , String packageName) { + ActivityManager mActivityManager = (ActivityManager) + context.getSystemService(Context.ACTIVITY_SERVICE); + Method method = null; + try { + method = Class.forName("android.app.ActivityManager").getMethod("forceStopPackage", String.class); + method.invoke(mActivityManager, packageName); + } catch (Exception e) { + e.printStackTrace(); + } + } + protected void onResume() { + super.onResume(); +// Log.d(TAG,"onResume... CameraCount="+CameraCount); + //findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + // findViewById(R.id.btn_Pass).setEnabled(false); + isTakeStat=false; + isCanTake=true; +// testCount=0; + + } + + public boolean isAppInstalled(Context context, String packageName) { + PackageManager packageManager = context.getPackageManager(); + try { + packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); + android.util.Log.d("RRRRRRRR", "com.example.cam can use"); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + public boolean onTouchEvent(MotionEvent paramMotionEvent) { + if(isCanTake){ + if (paramMotionEvent.getAction() == MotionEvent.ACTION_DOWN) { + + if(isAppInstalled(this, "com.example.cam")) { + android.util.Log.d("RRRRRRRR", "com.example.cam"); + Intent intent = getPackageManager().getLaunchIntentForPackage("com.example.cam"); + if( intent != null ) { + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + return true; + } + Log.d("RRRRR", "CameraExample Not Available"); + } + + setContentView(new CameraView(this,testCameraID)); + testCameraID=0; + isTakeStat=true; + } + } + return super.onTouchEvent(paramMotionEvent); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + //open camera maybe error,allow user back. + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + if(isTakeStat) + { + myHandler.sendEmptyMessage(MSG_TAKE_OVER); + } + else + return false; + } + return super.dispatchKeyEvent(event); + } + +// private int getCameraCount() +// { +// int cameraCount = 0; +// Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); +// cameraCount = Camera.getNumberOfCameras(); // get cameras number c +// return cameraCount; +// } + + Handler myHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_TAKE_OVER: + setContentView(R.layout.cameratestv); + ControlButtonUtil.initControlButtonView(CameraBackTestActivity.this); + imageView=(ImageView) findViewById(R.id.imgV); + imageView.setImageBitmap(bitmap); + //Log.i("lzx", "-------------bitmap----"+bitmap.toString()); + findViewById(R.id.btn_Pass).setVisibility(View.VISIBLE); + // findViewById(R.id.btn_Pass).setEnabled(true); + break; + case MSG_TAKE_ERROR: + isTakeStat=false; + isCanTake=true; +// testCount=0; + setContentView(R.layout.camerawithflashtest); + + ControlButtonUtil.initControlButtonView(CameraBackTestActivity.this); + //findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + if (!mCameraPrepared) { + findViewById(R.id.btn_Fail).performClick(); + } + //findViewById(R.id.btn_Pass).setEnabled(false); + break; + + } + super.handleMessage(msg); + } + }; + + public class CameraView extends SurfaceView implements SurfaceHolder.Callback, Camera.PictureCallback { + private SurfaceHolder holder; + private Camera camera; + private boolean af; + private int cameraId; + + public CameraView(Context context) { + super(context); + Log.d(TAG,"constructed..."); + holder = getHolder(); + holder.addCallback(this); + + //holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + } + + public CameraView(Context context,int camera_Id) { + super(context); + Log.d(TAG,"constructed... 2"); + holder = getHolder(); + holder.addCallback(this); + cameraId=camera_Id; + + //holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);// + } + + public void surfaceCreated(SurfaceHolder holder) {// + try { + + camera = Camera.open(cameraId); + Log.d(TAG,"surfaceCreated:camera!=null is:"+(camera!=null)+",cameraId="+cameraId); + camera.setPreviewDisplay(holder); +// if (cameraId == 0 && !ConfigUtil.isSpecialEvb()) { +// Camera.Parameters parameters = camera.getParameters(); +// //parameters.setPreviewSize(width, height); +// parameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON); +// camera.setParameters(parameters); +// } + setRightCameraOrientation(cameraId, camera); + camera.startPreview(); + mCameraPrepared = true; + } catch (Exception e) { + Log.w(TAG,"surfaceCreated e:"+e.getMessage()); + myHandler.sendEmptyMessage(MSG_TAKE_ERROR); + } + } + + @Override + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + + } + + public void surfaceDestroyed(SurfaceHolder holder) { + if(null != camera) + { + camera.setPreviewCallback(null); + camera.stopPreview(); + camera.release(); + camera = null; + } + Log.d(TAG,"surfaceDestroyed"); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + if (!mCameraPrepared) { + Log.d(TAG,"!mCameraPrepared not do onTouchEvent"); + return true; + } + if (event.getAction() == MotionEvent.ACTION_DOWN) { + Log.d(TAG,"MotionEvent.ACTION_DOWN"); + if(null != camera) + { + camera.autoFocus(null); + af = true; + Log.i("lzx", "-------------------------touch event---------------------"); + } + else + { + + myHandler.sendEmptyMessage(MSG_TAKE_ERROR); + } + } + if (event.getAction() == MotionEvent.ACTION_UP){ + Log.d(TAG,"event.getAction() == MotionEvent.ACTION_UP"); + if( af == true && isCanTake) { + camera.takePicture(null, null, this); + isCanTake=false; + af = false; + + } + } + return true; + } + + public void onPictureTaken(byte[] data, Camera camera) { + try { + isTakeStat=false; + isCanTake=false; + bitmap= BitmapFactory.decodeByteArray(data, 0, data.length); + } catch (Exception e) { + } + // camera.startPreview(); + + myHandler.sendEmptyMessage(MSG_TAKE_OVER); + Log.i("lzx", "-------------picture-bitmap---"+bitmap.toString()); + } + + private void data2file(byte[] w, String fileName) throws Exception { + FileOutputStream out = null; + try { + out = new FileOutputStream(fileName); + out.write(w); + out.close(); + } catch (Exception e) { + if (out != null) + out.close(); + throw e; + } + } + + } + private void setRightCameraOrientation(int cameraId, Camera mCamera) { + Camera.CameraInfo info = new Camera.CameraInfo(); + Camera.getCameraInfo(cameraId, info); + int rotation = this.getWindowManager().getDefaultDisplay() + .getRotation(); + int degrees = 0; + switch (rotation) { + case Surface.ROTATION_0: + degrees = 0; + break; + case Surface.ROTATION_90: + degrees = 90; + break; + case Surface.ROTATION_180: + degrees = 180; + break; + case Surface.ROTATION_270: + degrees = 270; + break; + } + int result; + if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { + result = (info.orientation + degrees) % 360; + result = (360 - result) % 360; // compensate the mirror + } else { // back-facing + result = (info.orientation - degrees + 360) % 360; + } + mCamera.setDisplayOrientation(result); + } + } + + diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraTestActivity.java new file mode 100755 index 0000000..14b6453 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CameraTestActivity.java @@ -0,0 +1,70 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.Intent; +import android.hardware.Camera; +import android.os.Bundle; + +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; +import android.util.Log; + +public class CameraTestActivity extends Activity { + private static final int mRequestCode = 1000; + private boolean isCanUse = true; + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.cameratest); + + ControlButtonUtil.initControlButtonView(this); + isCameraCanUse(); + if(!isCanUse) + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + } + public boolean isCameraCanUse() { + Camera mCamera = null; + try { + mCamera = Camera.open(); + if(null == mCamera) isCanUse = false; + } catch (Exception e) { + isCanUse = false; + } + + if (mCamera != null && isCanUse) { + mCamera.release(); + mCamera = null; + } + return isCanUse; + } + + + public boolean onTouchEvent(MotionEvent paramMotionEvent) { + if (paramMotionEvent.getAction() == MotionEvent.ACTION_DOWN && isCanUse) { + Intent localIntent = new Intent( + "android.media.action.IMAGE_CAPTURE"); + startActivityIfNeeded(localIntent, 10); + } + return super.onTouchEvent(paramMotionEvent); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CirTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CirTestActivity.java new file mode 100755 index 0000000..e769ebe --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CirTestActivity.java @@ -0,0 +1,114 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.IOException; + +import com.DeviceTest.helper.ControlButtonUtil; + +import jp.co.ntt.east.hardware.IrRemoteController; +import jp.co.ntt.east.hardware.IrRemoteController.Data; +import jp.co.toshiba.newtion.cir.RemoteControl; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.TextView; + +public class CirTestActivity extends Activity implements OnClickListener { + /** Called when the activity is first created. */ + public Button btn_send; + // public Button btn_stop; + String TAG = "CirTest"; + int ret; + // IrRemoteController ir_ctl = null; + // IrRemoteController.Data[] data; + + private TextView resultView; + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.cirtest); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + this.btn_send = (Button) findViewById(R.id.send); + // this.btn_stop = (Button) findViewById(R.id.stop); + this.btn_send.setOnClickListener(this); + // this.btn_stop.setOnClickListener(this); + + // ir_ctl = IrRemoteController.getInstance(); + // Log.i("Cir", "init"); + // data = new IrRemoteController.Data[2]; + // + // data[0] = new IrRemoteController.Data(); + // + // data[0].setCarrier(8, 18); + // data[0].setDuration(1080); + // data[0].setParameter(9000, 4500, 560); + // data[0].setPulse(0, 560, 560, 0, 1690, 560); + // + // data[1] = new IrRemoteController.Data(); + // data[1].setCarrier(8, 18); + // data[1].setDuration(1080); + // data[1].setParameter(9000, 2250, 560); + // data[1].setPulse(0, 560, 560, 0, 1690, 560); + + ControlButtonUtil.initControlButtonView(this); + resultView = (TextView) findViewById(R.id.CirResult); + ((TextView) findViewById(R.id.CirSendData)) + .setText("Send command:COMMAND_POWER(0x12)"); + } + + public void onClick(View v) { + // TODO Auto-generated method stub + // if (v.getId() == R.id.send) { + Log.d(TAG, "cir send"); + resultView.setText(onCirSend() ? "Pass!" : "Failed!"); + // } else if (v.getId() == R.id.stop) { + // Log.d(TAG, "cir stop"); + // resultView.setText(onCirStop() ? "Pass!" : "Failed!"); + // } + // v.setEnabled(false); + } + + public boolean onCirSend() { + return RemoteControl.sendCommand(RemoteControl.COMMAND_POWER); + } + + // + // public boolean onCirStop() { + // + // try { + // ir_ctl.stop(); + // return true; + // } catch (IOException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // Log.e(TAG, "stop err!"); + // return false; + // } + // + // } + + protected void onDestroy() { + // TODO Auto-generated method stub + super.onDestroy(); + + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/ClockTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/ClockTestActivity.java new file mode 100755 index 0000000..26bdd12 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/ClockTestActivity.java @@ -0,0 +1,139 @@ + +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.view.DrawClock; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; + +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.Window; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.util.Log; + +public class ClockTestActivity extends Activity { + protected static final int MSG_CLOCK = 0x1234; + + private LinearLayout clock_pannel; + + private DrawClock clock; + + public Handler mHandler; + + private Thread mClockThread; + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.myclocktest); + + clock_pannel = (LinearLayout) findViewById(R.id.clock1); + + clock = new DrawClock(this); + + clock_pannel.addView(clock); + + mHandler = new Handler() + { + + public void handleMessage(Message msg) + + { + + switch (msg.what) + + { + + case ClockTestActivity.MSG_CLOCK: + + { + + clock_pannel.removeView(clock); + + clock = new DrawClock(ClockTestActivity.this); + + clock_pannel.addView(clock); + + } + + break; + + } + + super.handleMessage(msg); + + } + + }; + + mClockThread = new LooperThread(); + + mClockThread.start(); + ControlButtonUtil.initControlButtonView(this); + } + + class LooperThread extends Thread + + { + + public void run() + + { + + super.run(); + + try + + { + + do + + { + + Thread.sleep(1000); + + Message m = new Message(); + + m.what = ClockTestActivity.MSG_CLOCK; + + ClockTestActivity.this.mHandler.sendMessage(m); + + } while (ClockTestActivity.LooperThread.interrupted() == false); + + } + + catch (Exception e) + + { + + e.printStackTrace(); + + } + + } + + } + + + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CompassTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CompassTestActivity.java new file mode 100755 index 0000000..9e16f7b --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/CompassTestActivity.java @@ -0,0 +1,195 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.view.CompassView; + +import android.app.Activity; +import android.content.Context; +import android.hardware.SensorListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.os.Handler; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +public class CompassTestActivity extends Activity { + + private CompassView compassView; + private float firstYaw = 0; + private int count; + private float lastYaw = 0; + private float STABLE_VALUE = 0.5F; + private int STABLE_COUNT = 10; + TextView compassText; + String accuracyStr = ""; + + int[] yawRange = new int[] { 285 - 30, 285 + 30 }; + boolean start = false; + + private static enum STATE { + WAIT_FOR_FIRST_STABLE, WAIT_FOR_ROTATE, WAIT_FOR_SECOND_STABLE, UNDEF + }; + + Button startButton; + STATE state; + boolean stop = false; + Handler mHandler = new Handler(); + Runnable mFailedRunnable = new Runnable() { + + public void run() { + if (stop) { + return; + } + mHandler.removeCallbacks(mFailedRunnable); + findViewById(R.id.btn_Fail).performClick(); + } + }; + protected String text = ""; + + @SuppressWarnings("deprecation") + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.compasstest); + compassView = (CompassView) findViewById(R.id.compasstestview); + state = STATE.WAIT_FOR_FIRST_STABLE; + count = 0; + compassText = (TextView) findViewById(R.id.compassText); + + startButton = (Button) findViewById(R.id.Start); + startButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + start = true; + count = 0; + state = STATE.WAIT_FOR_FIRST_STABLE; + startButton.setEnabled(false); + text = "wait for stable data..."; + } + }); + + final SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); + + sensorManager.registerListener(new SensorListener() { + public void onSensorChanged(int sensor, float[] values) { + if (stop) { + sensorManager.unregisterListener(this); + } + if ((int) values[0] == 0 || values[0] == 360) { + return; + } + + float yaw = values[0]; + compassView.update(yaw); + Log.e("jeffy", "yaw:" + yaw); + if (!start) { + return; + } + boolean pass = Math.abs(lastYaw - yaw) < STABLE_VALUE; + if (state == STATE.WAIT_FOR_ROTATE) { + pass = !pass; + } + + if (pass) { + count++; + } else { + count = 0; + } + if (count >= STABLE_COUNT) { + switch (state) { + case WAIT_FOR_FIRST_STABLE: + firstYaw = yaw; + if (firstYaw < yawRange[0] || firstYaw > yawRange[1]) { + text = "invalid orientation:" + (int) firstYaw; + + state = STATE.UNDEF; + mHandler.postDelayed(mFailedRunnable, 2000); + sensorManager.unregisterListener(this); + break; + } + + state = STATE.WAIT_FOR_ROTATE; + count = 0; + text = "valid orientation, first stable data:" + + (int) firstYaw + ", wait for rotate..."; + break; + case WAIT_FOR_ROTATE: + state = STATE.WAIT_FOR_SECOND_STABLE; + count = 0; + text = "first stable data:" + (int) firstYaw + + ", wait for stable data..."; + break; + case WAIT_FOR_SECOND_STABLE: + state = STATE.UNDEF; + float deltaYaw = Math.abs(yaw - firstYaw); + if (deltaYaw <= 5) { + findViewById(R.id.btn_Pass).performClick(); + } else { + findViewById(R.id.btn_Fail).performClick(); + } + count = 0; + sensorManager.unregisterListener(this); + text = "first stable data:" + (int) firstYaw + + ", second stable data:" + (int) yaw; + break; + default: + return; + } + } + compassText.setText(accuracyStr + "\n" + text); + lastYaw = yaw; + } + + public void onAccuracyChanged(int sensor, int accuracy) { + Log.e("Jeffy", "onAccuracyChanged" + accuracy); + accuracyStr = "accuracy:" + accuracy; + if (accuracy == 3) { + accuracyStr += ",pass"; + if (!start) { + accuracyStr += ",ready"; + startButton.setEnabled(true); + } + } else { + accuracyStr += ",failed"; + accuracyStr += ",needs correction!"; + state = STATE.UNDEF; + start = false; + text = ""; + startButton.setEnabled(false); + } + + compassText.setText(accuracyStr + "\n" + text); + } + }, SensorManager.SENSOR_ORIENTATION); + ControlButtonUtil.initControlButtonView(this); + // findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + // findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + } + + protected void onStop() { + super.onStop(); + stop = true; + mHandler.removeCallbacks(mFailedRunnable); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/DeviceTest.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/DeviceTest.java new file mode 100755 index 0000000..aee224f --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/DeviceTest.java @@ -0,0 +1,768 @@ +package com.DeviceTest; +import android.os.Environment; +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.database.DataSetObserver; +import android.net.Uri; +import android.os.Bundle; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.StreamCorruptedException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.xmlpull.v1.XmlSerializer; + +import com.DeviceTest.helper.ConfigUtil; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.helper.TestCase; +import com.DeviceTest.helper.XmlDeal; +import com.DeviceTest.helper.TestCase.RESULT; +import com.DeviceTest.view.MyGridView; +import com.DeviceTest.view.MyItemView; + +import android.view.ContextMenu; +import android.view.LayoutInflater; +import android.view.View.OnLongClickListener; +import android.view.ViewGroup; +import android.view.ViewParent; +import android.view.ContextMenu.ContextMenuInfo; +import android.view.View.OnClickListener; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemSelectedListener; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.Spinner; +import android.widget.SpinnerAdapter; +import android.widget.Toast; +import android.view.View; +import android.util.Log; +import android.util.Xml; +import android.content.res.Resources; + +public class DeviceTest extends Activity { + + public static final int DEVICE_TEST_MAX_NUM = 1000; + public static final int TEST_FAILED_DELAY = 5000; + public static final String EXTRA_TEST_PROGRESS = "test progress"; + public static final String EXTRA_TEST_RESULT_INFO = "test result info"; + + public static final String RESULT_INFO_HEAD = ";"; + public static final String RESULT_INFO_HEAD_JUST_INFO = "just info;"; + + public static final String EXTRA_PATH = "/vendor/etc/"; + private static final String CONFIG_FILE_NAME = "DeviceTestConfig.xml"; + private static final String CONFIG_FILE_NAME_CN = "DeviceTestConfig_CN1.xml"; + private static final String EXTRA_CONFIG_FILE_NAME = EXTRA_PATH + + CONFIG_FILE_NAME; + private static final String EXTRA_CONFIG_FILE_NAME_CN = EXTRA_PATH + + CONFIG_FILE_NAME_CN; + public static final String DATA_PATH = "/data/data/com.DeviceTest/"; + private static final String SAVE_FILE_PATH = EXTRA_PATH + + "DeviceTestResult"; + private static final String TAG = "DeviceTest"; + private static final String SAVE_DATA_PATH = DATA_PATH + "DeviceTest.tmp"; + public static final String TEMP_FILE_PATH = DeviceTest.DATA_PATH + "test"; + private static final String[] BLACK_LIST_SPECIAL_EVB = new String[] { + "VibrationTestActivity", + "BrightnessTestActivity", + "GpsLocationTestActivity", + "CompassTestActivity", + "MsensorTestActivity", + "GyroscopeTestActivity", + "LightsensorTestActivity", + }; + private static final String[] WHITE_LIST_SPECIAL_EVB = new String[] { + //"PCIETestActivity", + //"SATATestActivity", + //"Ethernet2TestActivity", + }; + + private XmlDeal xmldoc = null; + private Spinner mGroupTestSpinner; + private Button mButtonCancel; + private Button mTestChecked; + MyGridView myGridView; + + private List<TestCase> mTestCases; + private List<TestCase> mCurrentCaseGroup; + private Object[] mTestGroupNames; + private int mPosition =-1; + /** Called when the activity is first created. */ + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); +// Environment.getFlashStorageDirectory(); + setContentView(R.layout.main); + if (!InitTestData()) { + System.exit(-1); + } + this.setTitle("DeviceTest Version:" + + getResources().getString(R.string.Version) + " (for 8.1~12.0)"); + mTestCases = new ArrayList<TestCase>(); + for (TestCase temp : xmldoc.mTestCases) { + boolean skip = false; + if (ConfigUtil.isSpecialEvb()) { + for (String black: BLACK_LIST_SPECIAL_EVB) { + if (temp.getClassName().equals(black)) { + skip = true; + break; + } + } + } else { + for (String black: WHITE_LIST_SPECIAL_EVB) { + if (temp.getClassName().equals(black)) { + skip = true; + break; + } + } + } + if (!skip) { + mTestCases.add(temp); + } + } + try { + loadData(); + } catch (Exception e) { + Log.e("Jeffy", "load data error."); + e.printStackTrace(); + } + + myGridView = (MyGridView) findViewById(R.id.myGridView); + myGridView.setColumnCount(3); + + for (TestCase testCase : mTestCases) { + MyItemView itemView = new MyItemView(this); + itemView.setText(testCase.getTestName()); + itemView.setTag(testCase.getTestNo()); + itemView.setCheck(testCase.getneedtest()); + if (testCase.isShowResult()) { + RESULT result = testCase.getResult(); + itemView.setResult(result); + } + System.out.println("================="+testCase.getTestName()); + myGridView.addView(itemView); + } + + myGridView.setOnItemClickListener(new MyGridView.OnItemClickListener() { + public void onItemClick(ViewParent parent, View view, int position) { + if(((MyItemView)view). getTemcheckclick()){ + showDialog(DIALOG_PASSWORK_ID); + mPosition =position; + return; + } + if(enableitemclick) + enableitemclick = false; + else + return; + Intent intent = new Intent(); + try { + if (mTestCases.get(position) != null) { + String strClsPath = "com.DeviceTest." + + mTestCases.get(position).getClassName(); + intent.setClass(DeviceTest.this, + Class.forName(strClsPath).newInstance() + .getClass()); + intent.putExtra(EXTRA_TEST_PROGRESS, "0/1"); + startActivityForResult(intent, position); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + mGroupTestSpinner = (Spinner) findViewById(R.id.GroupTestSpinner); + + mTestGroupNames = xmldoc.mCaseGroups.keySet().toArray(); + String[] testGroupTexts = new String[mTestGroupNames.length + 1]; + for (int i = 1; i < testGroupTexts.length; i++) { + testGroupTexts[i] = "Group: " + mTestGroupNames[i - 1].toString(); + } + testGroupTexts[0] = "CaseGroups"; + + ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, + android.R.layout.simple_spinner_dropdown_item, testGroupTexts); + mGroupTestSpinner.setAdapter(adapter); + mGroupTestSpinner.setSelection(0, false); + mGroupTestSpinner + .setOnItemSelectedListener(new OnItemSelectedListener() { + + public void onItemSelected(AdapterView<?> parent, + View view, int position, long id) { + if (position == 0) { + return; + } + testGroup(mTestGroupNames[position - 1].toString()); + mGroupTestSpinner.setSelection(0, false); + } + + public void onNothingSelected(AdapterView<?> parent) { + + } + }); + + mButtonCancel = (Button) findViewById(R.id.btn_cancel); + mButtonCancel.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + try { + save(SAVE_FILE_PATH); + } catch (Exception e) { + Log.e(TAG, "Failed to save test result!"); + e.printStackTrace(); + } + finish(); + } + + }); + mTestChecked = (Button) findViewById(R.id.btn_testall); + mTestChecked.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + testGroup(mTestGroupNames[0].toString()); + } + }); + + Button saveButton = (Button) findViewById(R.id.btn_save); + saveButton.setOnClickListener(new OnClickListener() + { + + @Override + public void onClick(View v) + { + // TODO Auto-generated method stub + // zyt ++ + File savefile = new File("/cache/Result.txt"); + if (savefile.exists()) + { + savefile.delete(); + } + if (!savefile.exists()) + { + try + { + savefile.createNewFile(); + } catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < myGridView.getChildCount(); i++) + { + MyItemView myItemView = (MyItemView) myGridView.getChildAt(i); + RESULT r = myItemView.getResult(); + String testName = mTestCases.get(i).getTestName(); + String result = mAkeEnumToString(r); + sb.append(testName).append(":").append(result).append("\n"); + + /* + * myItemView.setResult(RESULT.UNDEF); + * myItemView.setCheck(true); + * mTestCases.get(i).setShowResult(false); + * mTestCases.get(i).setneedtest(true); + */ + } + String sbStirng = sb.toString(); + FileOutputStream fos = null; + try + { + fos = new FileOutputStream(savefile, false); + fos.write(sbStirng.getBytes()); + fos.close(); + } catch (FileNotFoundException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally + { + if (fos != null) + { + try + { + fos.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + } + Toast.makeText(getApplicationContext(), getString(R.string.save_isok), Toast.LENGTH_SHORT).show(); + + + } + }); + + + + Button clearButton = (Button) findViewById(R.id.btn_clear); + clearButton.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + showDialog(DIALOG_CLEAR_ID); + } + }); + + Button uninstallButton = (Button) findViewById(R.id.btn_uninstall); + uninstallButton.setOnClickListener(new OnClickListener() { + + public void onClick(View v) { + uninstallPackage("com.DeviceTest"); + } + }); + createAssetFile("memtester", MEMTESTER_PATH); + createAssetFile("gps_coldstart", GPS_COLD_START_PATH); + } + private boolean enableitemclick = true; + @Override + protected void onResume() { + enableitemclick = true; + mPosition =-1; + super.onResume(); + } + private void createAssetFile(String name, String destPath) { + + InputStream is = null; + OutputStream os = null; + try { + is = getAssets().open(name); + os = new FileOutputStream(destPath); + int data = 0; + while (true) { + data = is.read(); + if (data < 0) { + break; + } + os.write(data); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (is != null) { + try { + is.close(); + } catch (Exception e) { + } + } + if (os != null) { + try { + os.close(); + } catch (Exception e) { + } + } + SystemUtil.execRootCmd("chmod 777 " + destPath); + } + } + + public final static String MEMTESTER_PATH = DeviceTest.DATA_PATH + + "memtester"; + public final static String GPS_COLD_START_PATH = DeviceTest.DATA_PATH + + "gps_coldstart"; + private static final int DIALOG_CLEAR_ID = 10; + private static final int DIALOG_PASSWORK_ID =11; + protected Dialog onCreateDialog(int id) { + switch(id){ + case DIALOG_CLEAR_ID: + AlertDialog.Builder builder = new AlertDialog.Builder(this); + return builder.setMessage("Clear all test status?") + .setCancelable(false) + .setPositiveButton("Yes", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + for (int i = 0; i < myGridView.getChildCount(); i++) { + MyItemView myItemView = (MyItemView) myGridView + .getChildAt(i); + myItemView.setResult(RESULT.UNDEF); + myItemView.setCheck(true); + mTestCases.get(i).setShowResult(false); + mTestCases.get(i).setneedtest(true); + } + try { + save(SAVE_FILE_PATH); + } catch (IOException e) { + e.printStackTrace(); + } + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }).create(); + case DIALOG_PASSWORK_ID: + LayoutInflater factory = LayoutInflater.from(this); + final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); + final EditText text = (EditText)textEntryView.findViewById(R.id.password_edit); + return new AlertDialog.Builder(this) + .setIconAttribute(android.R.attr.alertDialogIcon) + .setTitle(R.string.alert_dialog_warning_title) + .setMessage(R.string.alert_dialog_text_entry) + .setView(textEntryView) + .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + String password = text.getText().toString(); + if("123456".equals(password)){ + MyItemView myItemView = (MyItemView) myGridView + .getChildAt(mPosition); + if(myItemView.setCheckClick()){ + if(!(myItemView).getischeck()){ + mTestCases.get(mPosition).setneedtest(false); + }else{ + mTestCases.get(mPosition).setneedtest(true); + } + } + + }else{ + Toast.makeText(DeviceTest.this, + " Password error !!! ", + Toast.LENGTH_LONG).show(); + } + /* User clicked OK so do some stuff */ + } + }) + .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + + /* User clicked cancel so do some stuff */ + } + }) + .create(); + } + return null; + } + + private void loadData() throws Exception { + ObjectInputStream ois = new ObjectInputStream(new FileInputStream( + SAVE_DATA_PATH)); + try{ + List<TestCase> savedData = (List<TestCase>) ois.readObject(); + for (TestCase savedCase : savedData) { + for (TestCase testCase : mTestCases) { + if (testCase.getClassName().equals(savedCase.getClassName())) { + testCase.setResult(savedCase.getResult()); + testCase.setDetail(savedCase.getDetail()); + testCase.setShowResult(savedCase.isShowResult()); + } + } + } + }catch(Exception e){ + e.printStackTrace(); + }finally{ + if(ois != null){ + ois.close(); + } + } + + } + + public static String formatResult(String testName, RESULT result, + String detail) { + if (detail == null) { + return "[" + testName + "]\n" + result.name(); + } + if (detail.startsWith(RESULT_INFO_HEAD_JUST_INFO)) { + return detail.substring(RESULT_INFO_HEAD_JUST_INFO.length()); + } + return "[" + testName + "]\n" + result.name() + detail; + } + + synchronized private void save(String saveFilePath) throws IOException { + FileWriter fw; + String tempSavePath = DATA_PATH + "save"; + fw = new FileWriter(tempSavePath); + FileWriter fw2 = null; + if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ + fw2 = new FileWriter("/mnt/sdcard/testResult.txt"); + } + for (TestCase testCase : mTestCases) { + if (testCase.getClassName().equals( + RuninTestActivity.class.getSimpleName())) { + if (testCase.getDetail() == null) { + testCase.setDetail(new RuninTestActivity().getResult()); + } + } else if(testCase.getClassName().equals(GpsTestActivity.class.getSimpleName())) { + if (testCase.getDetail() == null) { + testCase.setDetail(new GpsTestActivity().getResult()); + } + } + fw.write(formatResult(testCase.getTestName(), testCase.getResult(), + testCase.getDetail()) + "\n"); + if(fw2 != null){ + fw2.write(formatResult(testCase.getTestName(), testCase.getResult(), + testCase.getDetail()) + "\n"); + } + } + fw.close(); + if(fw2!=null){ + fw2.close(); + } + SystemUtil.execScriptCmd("cat " + tempSavePath + ">" + saveFilePath, + TEMP_FILE_PATH, true); + + ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream( + SAVE_DATA_PATH)); + oos.writeObject(mTestCases); + oos.close(); + } + + protected void testGroup(String selectGroup) { + mCurrentCaseGroup = xmldoc.mCaseGroups.get(selectGroup); + int pos = 0; + if (pos < mCurrentCaseGroup.size()) { + while(!mCurrentCaseGroup.get(pos).getneedtest()){ + pos ++; + if(pos >= mCurrentCaseGroup.size()){ + return; + } + } + } + Intent intent = new Intent(); + if (mCurrentCaseGroup != null && mCurrentCaseGroup.get(pos) != null) { + try { + String strClsPath = "com.DeviceTest." + + mCurrentCaseGroup.get(pos).getClassName(); + intent.setClass(DeviceTest.this, Class.forName(strClsPath) + .newInstance().getClass()); + intent.putExtra(EXTRA_TEST_PROGRESS, + pos+"/" + mCurrentCaseGroup.size()); + // we use nagtiv value to keep the sequence number when + // do a all test. + startActivityForResult(intent,pos + DEVICE_TEST_MAX_NUM); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } + } + } + + + private void uninstallPackage(String packageName) { + String cmd = "mount -o remount,rw /system /system\n" + + "rm -r /data/data/*DeviceTest*\n" + + "rm /data/app/*DeviceTest*\n" + + "rm /system/app/*DeviceTest*\n"; + SystemUtil.execScriptCmd(cmd, TEMP_FILE_PATH, true); + + Uri uninstallUri = Uri.parse("package:" + packageName); + Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, uninstallUri); + startActivity(uninstallIntent); + } + + protected void onActivityResult(int requestCode, int resultCode, + Intent paramIntent) { + super.onActivityResult(requestCode, resultCode, paramIntent); + Log.i("Jeffy", " -------------------- onResult---request:" + requestCode + ",result:" + + resultCode); + if(resultCode == RESULT_OK) return; + + if(mCurrentCaseGroup != null && (requestCode - DEVICE_TEST_MAX_NUM) >= mCurrentCaseGroup.size()) + return; + + int pos = requestCode; + boolean ignore = (resultCode == RESULT.UNDEF.ordinal()); + + if (requestCode >= DEVICE_TEST_MAX_NUM) { + if(mCurrentCaseGroup == null){ + Log.d(TAG, " _________________ mCurrentCaseGroup == null~~~~!!!!!"); + }else{ + // test auto judged. + TestCase tmpTestCase = mCurrentCaseGroup.get(requestCode - DEVICE_TEST_MAX_NUM); + + if(tmpTestCase == null){ + Log.d(TAG, " _________________ tmpTestCase == null~~~~!!!!!"); + }else{ + pos = tmpTestCase.getTestNo(); + Log.d(TAG, " _________________ tmpTestCas-----------~~~~!!!!!"+pos); + } + } + } + + if (!ignore && pos < mTestCases.size()) { + MyItemView itemView = (MyItemView) myGridView.getChildAt(pos); + RESULT result = RESULT.values()[resultCode]; + itemView.setResult(result); + mTestCases.get(pos).setResult(result); + mTestCases.get(pos).setShowResult(true); + try { + String detail = paramIntent + .getStringExtra(EXTRA_TEST_RESULT_INFO); + mTestCases.get(pos).setDetail(detail); + Log.d(TAG, " _________________ tmpTestCas---------detail--~~~~!!!!!"+detail); + } catch (Exception e) { + e.printStackTrace(); + } + + try { + save(SAVE_FILE_PATH); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + + if (requestCode >= DEVICE_TEST_MAX_NUM) { + // test next autojuaged. + pos = requestCode - DEVICE_TEST_MAX_NUM; + if(!ignore) + pos++; + else + pos --; + if(pos < 0 || pos >= mCurrentCaseGroup.size()) return; + Log.d(TAG, " _________________ tmpTestCas---------pos--1~~~~!!!!!"+pos); + Intent intent = new Intent(); + if ( pos >= 0 && pos < mCurrentCaseGroup.size()) { + while(!ignore && !mCurrentCaseGroup.get(pos).getneedtest()){ + pos ++; + if(pos >= mCurrentCaseGroup.size()){ + return; + } + } + while(ignore && !mCurrentCaseGroup.get(pos).getneedtest()){ + pos --; + if(pos < 0 ){ + return; + } + } + } + Log.d(TAG, " _________________ tmpTestCas---------pos--2~~~~!!!!!"+pos); + try { + String strClsPath = "com.DeviceTest." + + mCurrentCaseGroup.get(pos).getClassName(); + intent.setClass(DeviceTest.this, Class.forName(strClsPath) + .newInstance().getClass()); + + intent.putExtra(EXTRA_TEST_PROGRESS, pos + "/" + + mCurrentCaseGroup.size()); + + // we use nagtiv value to keep the sequence number when + // do a all test. + startActivityForResult(intent, pos + DEVICE_TEST_MAX_NUM); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } + + } + + } + + private boolean InitTestData(InputStream is) { + if (is == null) { + return false; + } + try { + xmldoc = new XmlDeal(is); + } catch (Exception e) { + Log.e(TAG, "parse the xmlfile is fail"); + return false; + } + return true; + + } + + private boolean InitTestData() { + InputStream is = null; + try { + if(Resources.getSystem().getConfiguration().locale.getCountry().equals("CN")){ + File configFile = new File(EXTRA_CONFIG_FILE_NAME_CN); + if (configFile.exists()) { + Log.i("Jeffy", "Use extra config file:" + + EXTRA_CONFIG_FILE_NAME_CN); + if (InitTestData(new FileInputStream(configFile))) { + return true; + } + } + + // is = this.openFileInput(strXmlPath); + is = getAssets().open(CONFIG_FILE_NAME_CN); + }else{ + File configFile = new File(EXTRA_CONFIG_FILE_NAME); + if (configFile.exists()) { + Log.i("Jeffy", "Use extra config file:" + + EXTRA_CONFIG_FILE_NAME); + if (InitTestData(new FileInputStream(configFile))) { + return true; + } + } + // is = this.openFileInput(strXmlPath); + is = getAssets().open(CONFIG_FILE_NAME); + } + try { + xmldoc = new XmlDeal(is); + } catch (Exception e) { + Log.e(TAG, "parse the xmlfile is fail"); + return false; + } + } catch (IOException e) { + + e.printStackTrace(); + Log.e(TAG, "read the xmlfile is fail" + e.getMessage()); + // ForwardErrorActive(); + return false; + } + + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return true; + + } + + private String mAkeEnumToString(RESULT r) + { + + if (r == RESULT.OK) + { + return "OK"; + } else if (r == RESULT.NG) + { + return "NG"; + } else if (r == RESULT.SKIP) + { + return "SKIP"; + } else + { + return "UNDEF"; + } + + } + + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EnableAppReceiver.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EnableAppReceiver.java new file mode 100755 index 0000000..3909860 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EnableAppReceiver.java @@ -0,0 +1,61 @@ +package com.DeviceTest; + +import android.app.ActivityManager; +import android.content.Context; + +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.content.pm.PackageManager; +import android.graphics.Path; +import android.net.Uri; +import android.content.Intent; +import android.os.Build; +import android.os.Environment; +import android.os.Bundle; +import android.util.Log; +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.ArrayList; + + + + +public class EnableAppReceiver extends BroadcastReceiver +{ + private final static String TAG = "EnableAppReceiver"; + public static final String PACKAGENAME = "packageName"; + public static final String CLASSNAME = "className"; + public static final String STATE = "state"; + private final static String ACTION_APP_STATE_CHANGE ="android.rockchip.devicetest.action.APP_STATE_CHANGE"; + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + Uri uri = intent.getData(); + Log.d(TAG,"action ================================= "+action); + Bundle extras = intent.getExtras(); + String packageName = extras.getString(PACKAGENAME); + String className = extras.getString(CLASSNAME); + int state = extras.getInt(STATE); + if(packageName == null || className == null || state < 0) { + return; + } + PackageManager pm = context.getPackageManager(); + if (pm == null) { + return; + } + // check that device test app package is known to the PackageManager + ComponentName cName = new ComponentName(packageName, + className); + + try { + pm.setComponentEnabledSetting(cName, state, + PackageManager.DONT_KILL_APP); + } catch (Exception e) { + + } + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/Ethernet2TestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/Ethernet2TestActivity.java new file mode 100755 index 0000000..7f065ba --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/Ethernet2TestActivity.java @@ -0,0 +1,9 @@ +package com.DeviceTest; + +public class Ethernet2TestActivity extends EthernetTestActivity { + + @Override + protected void preData() { + mAssignIfaceName = "eth1"; + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EthernetTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EthernetTestActivity.java new file mode 100755 index 0000000..f95745e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/EthernetTestActivity.java @@ -0,0 +1,522 @@ +package com.DeviceTest; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.net.EthernetManager; +import android.net.IpConfiguration; +import android.net.IpConfiguration.IpAssignment; +import android.net.IpConfiguration.ProxySettings; +import android.net.StaticIpConfiguration; +import android.net.NetworkInfo; +import android.net.LinkAddress; +import android.net.LinkProperties; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.SystemProperties; +import android.text.TextUtils; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.DeviceTest.helper.ConfigUtil; +import com.DeviceTest.helper.ControlButtonUtil; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +public class EthernetTestActivity extends Activity { + private static final String TAG = EthernetTestActivity.class.getSimpleName(); + + public enum ETHERNET_STATE { + ETHER_STATE_DISCONNECTED, + ETHER_STATE_CONNECTING, + ETHER_STATE_CONNECTED + } + + private static final String HTTP_TEST_URL = "https://www.baidu.com/"; + private static final String nullIpInfo = "0.0.0.0"; + private static final String gettingIpInfo = "gettings..."; + private static final int TEST_GET_INFO_TIMEOUT_DELAY = 5000; + private static final int TEST_FINISH_DELAY = 1500; + + private static final int MSG_GET_ETHERNET_STATE = 1; + private static final int MSG_GET_ETHERNET_TIMEOUT = 2; + private static final int MSG_HTTP_TEST = 3; + private static final int MSG_TEST_FAILED = 4; + private static final int MSG_TEST_SUCCESS = 5; + + private TextView txt_ethInfo; + private TextView txt_result; + private ProgressBar progressBar; + private boolean mReadyToGetEthInfo; + private boolean mStop; + + private EthernetManager mEthManager; + private BroadcastReceiver mReceiver; + private String mIfaceName; + private String mEthIpAddress = null; + private String mEthNetmask = null; + private String mEthGateway = null; + private String mEthdns1 = null; + private String mEthdns2 = null; + + protected String mAssignIfaceName; + + protected void preData() { + } + + private Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + if (mStop) { + return; + } + switch (msg.what) { + case MSG_GET_ETHERNET_STATE: + Log.v(TAG, "MSG_GET_ETHERNET_STATE"); + if (mReadyToGetEthInfo) { + handleEtherStateChange((ETHERNET_STATE) msg.obj); + } + break; + case MSG_GET_ETHERNET_TIMEOUT: + if (mReadyToGetEthInfo) { + mReadyToGetEthInfo = false; + Log.e(TAG, "MSG_GET_ETHERNET_TIMEOUT"); + mHandler.removeMessages(MSG_GET_ETHERNET_TIMEOUT); + progressBar.setVisibility(View.GONE); + txt_result.setText(R.string.EthernetGetInfoTimeoutFail); + mHandler.sendEmptyMessageDelayed(MSG_TEST_FAILED, TEST_FINISH_DELAY); + } + break; + case MSG_HTTP_TEST: + Log.v(TAG, "MSG_HTTP_TEST"); + txt_result.setText("waiting test connect:\n" + HTTP_TEST_URL); + progressBar.setVisibility(View.VISIBLE); + new Thread(new Runnable() { + @Override + public void run() { + mHandler.sendEmptyMessageDelayed(httpUrlTest() ? MSG_TEST_SUCCESS + : MSG_TEST_FAILED, TEST_FINISH_DELAY); + } + }).start(); + break; + case MSG_TEST_SUCCESS: + Log.v(TAG, "MSG_TEST_SUCCESS"); + mHandler.removeMessages(MSG_TEST_SUCCESS); + mStop = true; + findViewById(R.id.btn_Pass).performClick(); + break; + case MSG_TEST_FAILED: + Log.v(TAG, "MSG_TEST_FAILED"); + mHandler.removeMessages(MSG_TEST_FAILED); + mStop = true; + findViewById(R.id.btn_Fail).performClick(); + break; + default: + break; + } + } + }; + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + setContentView(R.layout.ethernettest); + + preData(); + txt_ethInfo = (TextView) findViewById(R.id.txt_ethInfo); + txt_result = (TextView) findViewById(R.id.txt_result); + progressBar = (ProgressBar) findViewById(R.id.progress); + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + + mEthManager = (EthernetManager) getSystemService(Context.ETHERNET_SERVICE); + if (null == mEthManager) { + Log.e(TAG, "get ethernet manager failed"); + txt_result.setText(R.string.EthernetManagerFail); + mHandler.sendEmptyMessageDelayed(MSG_TEST_FAILED, TEST_FINISH_DELAY); + return; + } + String[] ifaces = new String[]{"eth0"}; + if (Build.VERSION.SDK_INT >= ConfigUtil.ANDROID_SDK_VERSION_P) { + try { + Method m = EthernetManager.class.getMethod("getAvailableInterfaces", null); + ifaces = (String[]) m.invoke(mEthManager, null); + } catch (Exception e) { + e.printStackTrace(); + ifaces = null; + } + } + if (ifaces.length > 0) { + if (ConfigUtil.isSpecialEvb() && TextUtils.isEmpty(mAssignIfaceName)) { + mAssignIfaceName = "eth0"; + } + if (TextUtils.isEmpty(mAssignIfaceName)) { + mIfaceName = ifaces[0];//"eth0"; + } else { + for (String iface : ifaces) { + if (null != iface && iface.equals(mAssignIfaceName)) { + mIfaceName = iface; + break; + } + } + } + } + + Log.v(TAG, "mIfaceName=" + mIfaceName); + if (null == mIfaceName) { + Log.e(TAG, "get ethernet ifaceName failed"); + txt_result.setText(R.string.EthernetInterfacesFail); + mHandler.sendEmptyMessageDelayed(MSG_TEST_FAILED, TEST_FINISH_DELAY); + return; + } + mReadyToGetEthInfo = true; + progressBar.setVisibility(View.VISIBLE); + mReceiver = new MyBroadcastReceiver(); + mHandler.sendEmptyMessageDelayed(MSG_GET_ETHERNET_TIMEOUT, TEST_GET_INFO_TIMEOUT_DELAY); + } + + protected void onResume() { + super.onResume(); + + if (null != mReceiver) { + IntentFilter localIntentFilter = new IntentFilter(); + localIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); + registerReceiver(mReceiver, localIntentFilter); + } + } + + public void onPause() { + super.onPause(); + + if (null != mReceiver) { + unregisterReceiver(mReceiver); + } + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mReadyToGetEthInfo = false; + mStop = false; + mHandler.removeMessages(MSG_GET_ETHERNET_STATE); + mHandler.removeMessages(MSG_GET_ETHERNET_TIMEOUT); + mHandler.removeMessages(MSG_TEST_FAILED); + mHandler.removeMessages(MSG_TEST_SUCCESS); + } + + private void getEthInfo() throws Exception { + /* + mEthHwAddress = mEthManager.getEthernetHwaddr(mEthManager.getEthernetIfaceName()); + if (mEthHwAddress == null) mEthHwAddress = nullIpInfo; + */ + IpConfiguration ipConfiguration = null; + if (Build.VERSION.SDK_INT >= ConfigUtil.ANDROID_SDK_VERSION_P) { + Method m = EthernetManager.class.getMethod("getConfiguration", String.class); + ipConfiguration = (IpConfiguration) m.invoke(mEthManager, mIfaceName); + } else { + Method m = EthernetManager.class.getMethod("getConfiguration", null); + ipConfiguration = (IpConfiguration) m.invoke(mEthManager, null); + } + IpAssignment mode = ipConfiguration.getIpAssignment(); + if (mode == IpAssignment.DHCP || mode == IpAssignment.UNASSIGNED) { + getEthInfoFromDhcp(); + } else if (mode == IpAssignment.STATIC) { + getEthInfoFromStaticIp(); + } + } + + public void getEthInfoFromDhcp() throws Exception { + boolean isSdkAfterO = Build.VERSION.SDK_INT >= ConfigUtil.ANDROID_SDK_VERSION_P; + String tempIpInfo; + if (isSdkAfterO) { + Method m = EthernetManager.class.getMethod("getIpAddress", String.class); + tempIpInfo = (String) m.invoke(mEthManager, mIfaceName); + } else { + Method m = EthernetManager.class.getMethod("getIpAddress", null); + tempIpInfo = (String) m.invoke(mEthManager, null); + } + + if ((tempIpInfo != null) && (!tempIpInfo.equals(""))) { + mEthIpAddress = tempIpInfo; + } else { + mEthIpAddress = nullIpInfo; + } + + if (isSdkAfterO) { + Method m = EthernetManager.class.getMethod("getNetmask", String.class); + tempIpInfo = (String) m.invoke(mEthManager, mIfaceName); + } else { + Method m = EthernetManager.class.getMethod("getNetmask", null); + tempIpInfo = (String) m.invoke(mEthManager, null); + } + + if ((tempIpInfo != null) && (!tempIpInfo.equals(""))) { + mEthNetmask = tempIpInfo; + } else { + mEthNetmask = nullIpInfo; + } + + if (isSdkAfterO) { + Method m = EthernetManager.class.getMethod("getGateway", String.class); + tempIpInfo = (String) m.invoke(mEthManager, mIfaceName); + } else { + Method m = EthernetManager.class.getMethod("getGateway", null); + tempIpInfo = (String) m.invoke(mEthManager, null); + } + if ((tempIpInfo != null) && (!tempIpInfo.equals(""))) { + mEthGateway = tempIpInfo; + } else { + mEthGateway = nullIpInfo; + } + + if (isSdkAfterO) { + Method m = EthernetManager.class.getMethod("getDns", String.class); + tempIpInfo = (String) m.invoke(mEthManager, mIfaceName); + } else { + Method m = EthernetManager.class.getMethod("getDns", null); + tempIpInfo = (String) m.invoke(mEthManager, null); + } + if ((tempIpInfo != null) && (!tempIpInfo.equals(""))) { + String data[] = tempIpInfo.split(","); + mEthdns1 = data[0]; + if (data.length <= 1) { + mEthdns2 = nullIpInfo; + } else { + mEthdns2 = data[1]; + } + } else { + mEthdns1 = nullIpInfo; + } + } + + public void getEthInfoFromStaticIp() throws Exception { + IpConfiguration ipConfiguration = null; + if (Build.VERSION.SDK_INT >= ConfigUtil.ANDROID_SDK_VERSION_P) { + Method m = EthernetManager.class.getMethod("getConfiguration", String.class); + ipConfiguration = (IpConfiguration) m.invoke(mEthManager, mIfaceName); + } else { + Method m = EthernetManager.class.getMethod("getConfiguration", null); + ipConfiguration = (IpConfiguration) m.invoke(mEthManager, null); + } + StaticIpConfiguration staticIpConfiguration = ipConfiguration.getStaticIpConfiguration(); + + if (staticIpConfiguration == null) { + return; + } + /* + LinkAddress ipAddress = staticIpConfiguration.ipAddress; + InetAddress gateway = staticIpConfiguration.gateway; + ArrayList<InetAddress> dnsServers = staticIpConfiguration.dnsServers; + + if (ipAddress != null) { + mEthIpAddress = ipAddress.getAddress().getHostAddress(); + mEthNetmask = interMask2String(ipAddress.getPrefixLength()); + } + if (gateway != null) { + mEthGateway = gateway.getHostAddress(); + } + mEthdns1 = dnsServers.get(0).getHostAddress(); + + if (dnsServers.size() > 1) { // 只保留两个 + mEthdns2 = dnsServers.get(1).getHostAddress(); + } + */ + } + + private void handleEtherStateChange(ETHERNET_STATE EtherState, long delayMillis) { + mHandler.removeMessages(MSG_GET_ETHERNET_STATE); + if (delayMillis > 0) { + Message msg = new Message(); + msg.what = MSG_GET_ETHERNET_STATE; + msg.obj = EtherState; + mHandler.sendMessageDelayed(msg, delayMillis); + } else { + handleEtherStateChange(EtherState); + } + } + + private void handleEtherStateChange(ETHERNET_STATE EtherState) { + Log.v(TAG, "curEtherState" + EtherState); + progressBar.setVisibility(View.VISIBLE); + switch (EtherState) { + case ETHER_STATE_DISCONNECTED: + /*mEthIpAddress = nullIpInfo; + mEthNetmask = nullIpInfo; + mEthGateway = nullIpInfo; + mEthdns1 = nullIpInfo; + mEthdns2 = nullIpInfo; + refreshUI(); + break;*/ + case ETHER_STATE_CONNECTING: + mEthIpAddress = gettingIpInfo; + mEthNetmask = gettingIpInfo; + mEthGateway = gettingIpInfo; + mEthdns1 = gettingIpInfo; + mEthdns2 = gettingIpInfo; + txt_ethInfo.setText(gettingIpInfo); + break; + case ETHER_STATE_CONNECTED: + try { + getEthInfo(); + refreshUI(); + } catch (Exception e) { + e.printStackTrace(); + } + break; + default: + break; + } + } + + private void refreshUI() { + StringBuilder sb = new StringBuilder(); + sb.append(mIfaceName + "\n"); + sb.append("ip: " + mEthIpAddress + "\n"); + sb.append("netmask: " + mEthNetmask + "\n"); + sb.append("gateway: " + mEthGateway + "\n"); + sb.append("dns1: " + mEthdns1 + "\n"); + sb.append("dns2: " + mEthdns2 + "\n"); + Log.v(TAG, sb.toString()); + txt_ethInfo.setText(sb.toString()); + progressBar.setVisibility(View.GONE); + if (null == mEthIpAddress || mEthIpAddress.equals(nullIpInfo) || mEthIpAddress.equals(gettingIpInfo) + || null == mEthNetmask || mEthNetmask.equals(nullIpInfo) || mEthNetmask.equals(gettingIpInfo) + || null == mEthGateway || mEthGateway.equals(nullIpInfo) || mEthGateway.equals(gettingIpInfo) + || null == mEthdns1 || mEthdns1.equals(nullIpInfo) || mEthdns1.equals(gettingIpInfo) + /*|| null == mEthdns2 || mEthdns2.equals(nullIpInfo) || mEthdns2.equals(gettingIpInfo)*/) { + + } else if (mReadyToGetEthInfo) { + mReadyToGetEthInfo = false; + mHandler.removeMessages(MSG_GET_ETHERNET_TIMEOUT); + mHandler.sendEmptyMessage(MSG_HTTP_TEST); + } + } + + //将子网掩码转换成ip子网掩码形式,比如输入32输出为255.255.255.255 + public String interMask2String(int prefixLength) { + String netMask = null; + int inetMask = prefixLength; + + int part = inetMask / 8; + int remainder = inetMask % 8; + int sum = 0; + + for (int i = 8; i > 8 - remainder; i--) { + sum = sum + (int) Math.pow(2, i - 1); + } + + if (part == 0) { + netMask = sum + ".0.0.0"; + } else if (part == 1) { + netMask = "255." + sum + ".0.0"; + } else if (part == 2) { + netMask = "255.255." + sum + ".0"; + } else if (part == 3) { + netMask = "255.255.255." + sum; + } else if (part == 4) { + netMask = "255.255.255.255"; + } + + return netMask; + } + + private boolean httpUrlTest() { + HttpURLConnection conn = null; + InputStream is = null; + String resultData = ""; + try { + URL url = new URL(HTTP_TEST_URL); + conn = (HttpURLConnection) url.openConnection(); + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setUseCaches(false); + conn.setRequestMethod("GET"); + conn.setConnectTimeout(10000); + conn.setReadTimeout(1000); + if (HttpURLConnection.HTTP_OK == conn.getResponseCode()) { + is = conn.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + BufferedReader bufferReader = new BufferedReader(isr); + String inputLine = ""; + while ((inputLine = bufferReader.readLine()) != null) { + resultData += inputLine + "\n"; + } + Log.v(TAG, "http respond:" + resultData); + return resultData.length() > 20; + } else { + Log.e(TAG, "==========error code:" + conn.getResponseCode()); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + if (conn != null) { + conn.disconnect(); + } + } + return false; + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + class MyBroadcastReceiver extends BroadcastReceiver { + + public void onReceive(Context context, Intent intent) { + if (!mReadyToGetEthInfo || mStop) { + return; + } + String action = intent.getAction(); + Log.v(TAG, "action:" + action); + if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) { + NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); + Log.v(TAG, "===" + info.toString()); + if (null != info && ConnectivityManager.TYPE_ETHERNET == info.getType()) { + if (NetworkInfo.State.CONNECTED == info.getState()) { + handleEtherStateChange(ETHERNET_STATE.ETHER_STATE_CONNECTED, 0); + } else if (NetworkInfo.State.DISCONNECTED == info.getState()) { + handleEtherStateChange(ETHERNET_STATE.ETHER_STATE_DISCONNECTED, 0); + } + } + } + } + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FMRadioTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FMRadioTestActivity.java new file mode 100755 index 0000000..46619d6 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FMRadioTestActivity.java @@ -0,0 +1,69 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; +import android.util.Log; + +public class FMRadioTestActivity extends Activity { + private static final int REQUEST_START_FM_RADIO = 1001; + private static final int KEY_BACK = 4; + TextView mResult; + + + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == REQUEST_START_FM_RADIO) + mResult.setVisibility(View.VISIBLE); + } + + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.fmradiotest); + + mResult = (TextView) findViewById(R.id.FMRadioTestResult); + + ControlButtonUtil.initControlButtonView(this); + } + + + public boolean onKeyDown(int keyCode, KeyEvent keyEvent) { + if (keyCode == KEY_BACK) + setResult(KEY_BACK); + return super.onKeyDown(keyCode, keyEvent); + } + + + public boolean onTouchEvent(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + Intent intent = new Intent("com.rk.FMRadio"); + startActivityIfNeeded(intent, REQUEST_START_FM_RADIO); + } + return super.onTouchEvent(event); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FirstRun.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FirstRun.java new file mode 100755 index 0000000..6155646 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/FirstRun.java @@ -0,0 +1,946 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import com.DeviceTest.WifiTestActivity.MyBroadcastReceiver; +import com.DeviceTest.helper.Recorder; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.helper.VUMeter; +import com.DeviceTest.view.GsensorBall; +import com.DeviceTest.view.KeyTestView; +import com.DeviceTest.view.TestView; + +import android.app.Activity; +import android.app.Dialog; +import android.app.KeyguardManager; +import android.app.KeyguardManager.KeyguardLock; +import android.content.BroadcastReceiver; +import android.content.ContentProviderClient; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.res.Resources; +import android.graphics.PixelFormat; +import android.hardware.Camera; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.media.AudioManager; +import android.net.wifi.ScanResult; +import android.net.wifi.WifiManager; +import android.os.BatteryManager; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.storage.StorageEventListener; +import android.os.SystemProperties; +import android.text.format.Formatter; +import android.util.Log; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.View; +import android.view.View.OnKeyListener; +import android.view.Window; +import android.view.WindowManager; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; + +import android.os.ServiceManager; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + + +public class FirstRun extends Activity implements SurfaceHolder.Callback{ + private static final String TAG = "FirstRun"; + + public enum TEST_STATUS{ + WAITING, + TESTING, + FAILED, + SUCCEED, + } + private TEST_STATUS wifi_test_status = TEST_STATUS.WAITING; + private TEST_STATUS sdcard_test_status = TEST_STATUS.WAITING; + private TEST_STATUS otg_test_status = TEST_STATUS.WAITING; + + private View v = null; + private WindowManager wm = null; + KeyguardLock kl = null; + + private Resources mRes; + private StorageManager mStorageManager = null; + + private int testszie = 21; + private TextView productname = null; + private TextView productversion = null; + private TextView nandstorage = null; + private TextView availablenandstorage = null; + + private TestView mSDcardTestView = null; + private TestView mUsbHostTestView = null; + private TestView mWifiTestView = null; + private WifiManager mWifiManager; + private BroadcastReceiver mWifiReceiver; + private Handler mWifiHandler; + private boolean mReadyToTest = false; + private final static int WIFI_MSG_SCAN = 0; + + private SensorManager sensorManager; + private SensorEventListener lsn = null; + private GsensorBall mGsensorBall; + private TextView gsensortext = null; + + private Camera mCameraDevice; + private View nocamera; + private boolean hasCamera = false; + private ContentProviderClient mMediaProviderClient; + private SurfaceView mSurfaceView; + private Button mSwitchBut; + private SurfaceHolder mSurfaceHolder = null; + private int mNumberOfCameras = 0; + private int mCurrentCameraId = 0; + + private final static int MAXIMUM_BRIGHTNESS = 255; + private final static int MINIMUM_BRIGHTNESS = 2; + private final static int ONE_STAGE = 5; + + private ProgressBar progressBar; + private Button brightnessbut; + private boolean isTestBrightness = false; + private BrightnessHandler mBrightnessHandler = new BrightnessHandler(); + private static final int BRIGHTNESS_MSG = 0; + + private VUMeter mVUMeter; + private Button recordtestbutton; + private TextView recordtext; + private Recorder mRecorder; + private AudioManager mAudioManager; + private int mOldVolume; + private boolean mSpeakerOn = false; + private RecordHandler mRecordHandler = new RecordHandler(); + private final static int RECORD_TIME = 5; + + private static final String CURRENT_PATH = "/sys/class/power_supply/battery/capacity"; + PowerBroadcastReceiver mPowerBroadcastReceiver = new PowerBroadcastReceiver(); + private TextView mChargeStatus; + private TextView mVoltage; + private TextView mCurrent; + private TextView mCapacity; + private TextView mPlug; + + private KeyTestView mKeyTestView; + private String mKeyNames[] = { "HOME", + "MENU", + "VOLUME+", + "VOLUME-", + "BACK", + "SEARCH"}; + private int mKeyCodes[] = { KeyEvent.KEYCODE_HOME, + KeyEvent.KEYCODE_MENU, + KeyEvent.KEYCODE_VOLUME_UP, + KeyEvent.KEYCODE_VOLUME_DOWN, + KeyEvent.KEYCODE_BACK, + KeyEvent.KEYCODE_SEARCH}; + + private Button mSingletestBut; + private Button mClosefirstrunBut; + + public static String flash_path = null; + public static String sdcard_path = null; + public static String usb_path = null; + private int flash_pit = 0; + private int sdcard_pit = 1; + private int usb_pit = 2; + private StorageVolume[] storageVolumes = null; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); +// requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); + setContentView(R.layout.firstrun_layout); + initView(); + InitStorage(); + flash_path = getStoragePath(this, false);//storageVolumes[flash_pit].getPath(); + sdcard_path = getStoragePath(this, true); + GetDevieInformation(); + } + private void initView(){ + v = new View(FirstRun.this); + wm = (WindowManager)FirstRun.this.getSystemService(WINDOW_SERVICE); + + KeyguardManager km= (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); + kl = km.newKeyguardLock("unLock"); + + mRes = getResources(); + productname = (TextView)findViewById(R.id.product_name); + productversion = (TextView)findViewById(R.id.product_version); + nandstorage = (TextView)findViewById(R.id.nand_storage); + availablenandstorage = (TextView)findViewById(R.id.available_nand_storage); + productname.setTextSize(testszie + 2); + productversion.setTextSize(testszie); + nandstorage.setTextSize(testszie); + availablenandstorage.setTextSize(testszie); + + mWifiTestView = (TestView)findViewById(R.id.wifitestview); + mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE); + mWifiReceiver = new MyBroadcastReceiver(); + mWifiHandler = new WifiHandler(); + + mSDcardTestView = (TestView)findViewById(R.id.sdcardtestview); + mUsbHostTestView = (TestView)findViewById(R.id.usbhosttestview); + + sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE); + mGsensorBall = (GsensorBall)findViewById(R.id.gsensorball); + gsensortext = (TextView)findViewById(R.id.gsensortext); + lsn = new SensorEventListener() { + public void onAccuracyChanged(Sensor sensor, int accuracy) { + } + public void onSensorChanged(SensorEvent e) { + float x = e.values[0]; + float y = e.values[1]; + float z = e.values[2]; + mGsensorBall.setXYZ(x, y, z); + gsensortext.setText(mRes.getString(R.string.GsensorTest) + "\nX: " + x + "\nY: " + y + "\nZ: " + z); + } + }; + + nocamera = findViewById(R.id.nocamera); + mSurfaceView = (SurfaceView)findViewById(R.id.camera_preview); + mSwitchBut = (Button)findViewById(R.id.camera_switch_btu); + mSwitchBut.setOnClickListener(mOnClickListener); + mNumberOfCameras = Camera.getNumberOfCameras(); + if(mNumberOfCameras <= 1) + mSwitchBut.setVisibility(View.GONE); + + progressBar = (ProgressBar) findViewById(R.id.brightnessBar); + progressBar.setClickable(false); + progressBar.setMax(MAXIMUM_BRIGHTNESS); + brightnessbut = (Button)findViewById(R.id.brightnesstestbut); + brightnessbut.setOnClickListener(mOnClickListener); + + mVUMeter = (VUMeter) findViewById(R.id.uvMeter); + mRecorder = new Recorder(); + mVUMeter.setRecorder(mRecorder); + mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + mOldVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); + recordtestbutton = (Button)findViewById(R.id.recordtestbutton); + recordtestbutton.setOnClickListener(mOnClickListener); + recordtext = (TextView)findViewById(R.id.recordtext); + + mChargeStatus = (TextView) findViewById(R.id.chargeStatusText); + mVoltage = (TextView) findViewById(R.id.voltageText); + mCurrent = (TextView) findViewById(R.id.currentText); + mCapacity = (TextView) findViewById(R.id.capacityText); + mPlug = (TextView) findViewById(R.id.plugText); + + mKeyTestView = (KeyTestView)findViewById(R.id.keytestview); + if(mKeyNames.length == mKeyCodes.length){ + for(int i = 0; i < mKeyNames.length; i ++){ + mKeyTestView.addKey(mKeyNames[i], mKeyCodes[i]); + } + } + mSingletestBut = (Button)findViewById(R.id.singletest); + mSingletestBut.setOnClickListener(mOnClickListener); + mClosefirstrunBut = (Button)findViewById(R.id.closefirstrun); + mClosefirstrunBut.setOnClickListener(mOnClickListener); + } + @Override + protected void onResume() { + super.onResume(); + updateMemoryStatus(flash_path); + kl.disableKeyguard(); +// addWindow(); + IntentFilter localIntentFilter = new IntentFilter(); + localIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); + localIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); + localIntentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION); + registerReceiver(mWifiReceiver, localIntentFilter); + Log.i("Jeffy-------", "try to enable wifi"); + mWifiTestView.setStatus(TEST_STATUS.TESTING); + mWifiManager.setWifiEnabled(true); + + mSDcardTestView.setStatus(TEST_STATUS.TESTING); + if(testSdcard()){ + mSDcardTestView.setStatus(TEST_STATUS.SUCCEED); + }else{ + mSDcardTestView.setStatus(TEST_STATUS.FAILED); + } + + mUsbHostTestView.setStatus(TEST_STATUS.TESTING); + if(testUSBHost()){ + mUsbHostTestView.setStatus(TEST_STATUS.SUCCEED); + }else{ + mUsbHostTestView.setStatus(TEST_STATUS.FAILED); + } + + Sensor sensors = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); + sensorManager.registerListener(lsn, sensors, SensorManager.SENSOR_DELAY_NORMAL); + + SurfaceHolder holder = mSurfaceView.getHolder(); + holder.addCallback(this); + holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + + registerReceiver(mPowerBroadcastReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); + } + @Override + protected void onPause() { + super.onPause(); + // removeWindow(); + kl.reenableKeyguard(); + unregisterReceiver(mWifiReceiver); + unregisterReceiver(mPowerBroadcastReceiver); + sensorManager.unregisterListener(lsn); + mWifiHandler.removeMessages(WIFI_MSG_SCAN); + Log.d(TAG, " __________________---------- oldBrightness = " + oldBrightness); + + switch (mRecorder.state()) { + case Recorder.IDLE_STATE: + mRecorder.delete(); + break; + case Recorder.PLAYING_STATE: + mRecorder.stop(); + mRecorder.delete(); + break; + case Recorder.RECORDING_STATE: + mRecorder.stop(); + mRecorder.clear(); + break; + } + mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, mOldVolume, 0); + if (mSpeakerOn) { + mAudioManager.setSpeakerphoneOn(false); + } +// unregisterReceiver(mPowerBroadcastReceiver); + } + + @Override + protected void onDestroy() { + if (mStorageManager != null && mStorageListener != null) { + mStorageManager.unregisterListener(mStorageListener); + } + if(mCameraDevice != null) + mCameraDevice.release(); + super.onDestroy(); + } + + /****************************************************************** + * about DeviceInfo + */ + private void GetDevieInformation(){ + productname.setText(Build.DEVICE); + productversion.setText(mRes.getString(R.string.Firmwareversion) + Build.DISPLAY); + } + + /****************************************************************** + * about DeviceStorage() + */ + private void InitStorage(){ + if (mStorageManager == null) { + mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + mStorageManager.registerListener(mStorageListener); + storageVolumes = mStorageManager.getVolumeList(); + if(storageVolumes.length >= 3){ + flash_path = storageVolumes[flash_pit].getPath(); + sdcard_path = storageVolumes[sdcard_pit].getPath(); + usb_path = storageVolumes[usb_pit].getPath(); + Log.d(TAG, " _____ " + flash_path + " " + sdcard_path + " " + usb_path); + }else{ + flash_path = getStoragePath(this, false); + sdcard_path = getStoragePath(this, true); + usb_path= "/mnt/usb_storage"; + + } + + /*flash_path = "/mnt/internal_sd"; + sdcard_path = "/mnt/external_sd"; + usb_path = "/mnt/usb_storage";*/ + } + } + private void updateMemoryStatus(String path) { + String status = mStorageManager.getVolumeState(path); + if (path.equals(flash_path)) { + status = mStorageManager.getVolumeState(flash_path); + } + String readOnly = ""; + if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { + status = Environment.MEDIA_MOUNTED; + readOnly = mRes.getString(R.string.read_only); + } + + if (status.equals(Environment.MEDIA_MOUNTED)) { + try { + //File path = Environment.getExternalStorageDirectory(); + StatFs stat = new StatFs(path); + long blockSize = stat.getBlockSize(); + long totalBlocks = stat.getBlockCount(); + long availableBlocks = stat.getAvailableBlocks(); + + if (path.equals(flash_path)) { + nandstorage.setText(mRes.getString(R.string.total_space) + " : " + formatSize(totalBlocks * blockSize)); + availablenandstorage.setText(mRes.getString(R.string.available_space) + " : " + formatSize(availableBlocks * blockSize) + readOnly); + } + } catch (IllegalArgumentException e) { + status = Environment.MEDIA_REMOVED; + } + } else { + if (path.equals(flash_path)) { + nandstorage.setText(mRes.getString(R.string.nand_unavailable)); + availablenandstorage.setText(mRes.getString(R.string.nand_unavailable)); + } + } + } + private String formatSize(long size) { + return Formatter.formatFileSize(this, size); + } + StorageEventListener mStorageListener = new StorageEventListener() { + @Override + public void onStorageStateChanged(String path, String oldState, String newState) { + Log.d(TAG, "--------------->>>>> Received storage state changed, path = " + + path + ", changed state from " + oldState + + " to " + newState); + if (path.equals(flash_path) + && !newState.equals(Environment.MEDIA_MOUNTED)) { + } else { + updateMemoryStatus(flash_path); + } + if(path.equals(sdcard_path)){ + if(testSdcard()){ + mSDcardTestView.setStatus(TEST_STATUS.SUCCEED); + }else{ + mSDcardTestView.setStatus(TEST_STATUS.FAILED); + } + }else if(path.equals(usb_path)){ + if(testUSBHost()){ + mUsbHostTestView.setStatus(TEST_STATUS.SUCCEED); + }else{ + mUsbHostTestView.setStatus(TEST_STATUS.FAILED); + } + } + } + }; + + + /****************************************************************** + * about WiFitest + */ + class WifiHandler extends Handler { + public void handleMessage(Message msg) { + switch(msg.what){ + case WIFI_MSG_SCAN: + removeMessages(WIFI_MSG_SCAN); + mWifiManager.startScan(); + break; + } + } + } + class MyBroadcastReceiver extends BroadcastReceiver { + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + Log.i("Jeffy", "action:" + action); + if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) { + int state = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, + WifiManager.WIFI_STATE_UNKNOWN); + if (state == WifiManager.WIFI_STATE_ENABLED) { + mWifiHandler.sendEmptyMessage(WIFI_MSG_SCAN); + } + } + + if (WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION.equals(action)) { + boolean connected = intent.getBooleanExtra( + WifiManager.EXTRA_SUPPLICANT_CONNECTED, false); + if (connected && mReadyToTest) { + Log.d("Jeffy===", "already connect to:" + mWifiManager.getConnectionInfo().getSSID()); +// mHandler.sendEmptyMessageDelayed(MSG_FINISH_TEST, 1000); + mWifiTestView.setStatus(TEST_STATUS.SUCCEED); + } + } + if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action)) { + List<ScanResult> resultList = mWifiManager.getScanResults(); + if ((resultList != null) && (!resultList.isEmpty())) { + mReadyToTest = true; + Log.d("Jeffy===", " ____________-------- resultList.size() = " + resultList.size()); + mWifiTestView.setStatus(TEST_STATUS.SUCCEED); + } + } + + } + } + + /****************************************************************** + * about SDcard + */ + private static final String TEST_STRING = "Rockchip UsbHostTest File"; + public boolean testSdcard() { + try { + String externalVolumeState = mStorageManager.getVolumeState(sdcard_path); + + Log.d(TAG, " __________----------- testSdcard(), externalVolumeState = " + externalVolumeState); + if (!externalVolumeState.equals(Environment.MEDIA_MOUNTED)) { + return false; + } + } catch (Exception rex) { + rex.printStackTrace(); + //test sdcard fail + return false; + } + Log.d(TAG, " __________----------- testSdcard() __ begin test read and write"); + return testReadAndWrite(sdcard_path + "/test"); + } + public boolean testReadAndWrite(String directoryName) { + return dotestReadAndWrite(directoryName); + } + private boolean dotestReadAndWrite(String directoryName) { + File directory = new File(directoryName); + Log.d(TAG, " _______-------- dotestReadAndWrite()0, directoryName = " + directoryName); + if (!directory.isDirectory()) { + if (!directory.mkdirs()) { + Log.d(TAG, " _______-------- dotestReadAndWrite()0 1, directoryName = " + directoryName); + return false; + } + } + File f = new File(directoryName, "storagetest.txt"); + try { + if (f.exists()) { + f.delete(); + } + if (!f.createNewFile()) { + return false; + } else { + doWriteFile(f.getAbsoluteFile().toString()); + if (!doReadFile(f.getAbsoluteFile().toString()).equals(TEST_STRING)) { + return false; + } + } + f.delete(); + return true; + } catch (IOException ex) { + Log.e(TAG, "isWritable : false (IOException)!"); + return false; + } + } + + public void doWriteFile(String filename) { + try { + OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(filename)); + osw.write(TEST_STRING, 0, TEST_STRING.length()); + osw.flush(); + osw.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + public String doReadFile(String filename) { + try { + BufferedReader br = new BufferedReader(new InputStreamReader + (new FileInputStream(filename))); + String data = null; + StringBuilder temp = new StringBuilder(); + while ((data = br.readLine()) != null) { + temp.append(data); + } + br.close(); + Log.e(TAG, "Readfile " + temp.toString()); + return temp.toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /****************************************************************** + * about USBHost + */ + public boolean testUSBHost() { + try { + String externalVolumeState = mStorageManager.getVolumeState(usb_path).toString(); + + Log.d(TAG, " __________----------- testUSBHost(), externalVolumeState = " + externalVolumeState); + if (!externalVolumeState.equals(Environment.MEDIA_MOUNTED) && !externalVolumeState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { + return false; + } + } catch (Exception rex) { + rex.printStackTrace(); + return false; + } + Log.d(TAG, " __________----------- testUSBHost() __ begin test read and write"); + return testReadAndWrite(usb_path + "/test"); + } + + /****************************************************************** + * about Camera + */ + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + Log.d(TAG, "---->>>>>>>>>> surfaceChanged()"); + if (holder.getSurface() == null) { + Log.d(TAG, "---- surfaceChanged(), holder.getSurface() == null"); + return; + } + mSurfaceHolder = holder; + try{ + hasCamera = true; + nocamera.setVisibility(View.GONE); + mCameraDevice = Camera.open(mCurrentCameraId); + }catch(Exception e){ + hasCamera = false; + nocamera.setVisibility(View.VISIBLE); + mSwitchBut.setVisibility(View.GONE); + Log.e(TAG, " ____________- camera error"); + return; + } + try{ + mCameraDevice.setPreviewDisplay(mSurfaceHolder); + }catch(IOException e){ + e.printStackTrace(); + } + mCameraDevice.startPreview(); + } + public void surfaceCreated(SurfaceHolder holder) { + } + public void surfaceDestroyed(SurfaceHolder holder) { + if(mCameraDevice != null){ + mCameraDevice.stopPreview(); + mCameraDevice.release(); + } + mSurfaceHolder = null; + } + OnClickListener mOnClickListener = new OnClickListener(){ + public void onClick(View arg0) { + switch(arg0.getId()){ + case R.id.camera_switch_btu: + mCameraDevice.stopPreview(); + mCameraDevice.release(); + mCameraDevice = null; + mCurrentCameraId = (mCurrentCameraId + 1) % mNumberOfCameras; + mCameraDevice = Camera.open(mCurrentCameraId); + mSurfaceHolder = null; + mSurfaceView.setVisibility(View.GONE); + mSurfaceView.setVisibility(View.VISIBLE); + break; + case R.id.brightnesstestbut: + if(isTestBrightness){ + mBrightnessHandler.removeMessages(0); + setBrightness(oldBrightness); + brightnessbut.setText(R.string.BrightnessTitle); + }else{ + mBrightnessHandler.sendEmptyMessage(0); + brightnessbut.setText(R.string.BrightnessTitleStop); + } + isTestBrightness = !isTestBrightness; + break; + case R.id.recordtestbutton: + mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, + mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0); + mSpeakerOn = mAudioManager.isSpeakerphoneOn(); + if (!mSpeakerOn) { + mAudioManager.setSpeakerphoneOn(true); + } + mRecordHandler.sendEmptyMessage(MSG_TEST_MIC_START); + recordtestbutton.setEnabled(false); + break; + case R.id.singletest: + Intent tmp = new Intent(FirstRun.this, DeviceTest.class); + FirstRun.this.startActivity(tmp); + break; + case R.id.closefirstrun: + FirstRun.this.finish(); + break; + default: + break; + } + } + }; + + /****************************************************************** + * about brightness + */ + int mBrightness = 30; + int oldBrightness = 200; + boolean increase = true; + private void setBrightness(int paramInt) { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + float brightness = (float) paramInt / MAXIMUM_BRIGHTNESS; + lp.screenBrightness = brightness; + getWindow().setAttributes(lp); + } + class BrightnessHandler extends Handler { + public void handleMessage(Message msg) { + super.handleMessage(msg); + int delay = 25; + if (increase) { + mBrightness += ONE_STAGE; + if (mBrightness >= MAXIMUM_BRIGHTNESS) { + mBrightness = MAXIMUM_BRIGHTNESS; + increase = false; + delay = 200; + } + } else { + mBrightness -= ONE_STAGE; + if (mBrightness <= MINIMUM_BRIGHTNESS) { + mBrightness = MINIMUM_BRIGHTNESS; + increase = true; + delay = 200; + } + } + progressBar.setProgress(mBrightness); + setBrightness(mBrightness); + sendEmptyMessageDelayed(0, delay); + } + } + + /****************************************************************** + * about mic + */ + int mTimes; + private static final int MSG_TEST_MIC_ING = 0; + private static final int MSG_TEST_MIC_OVER = 1; + private static final int MSG_TEST_MIC_START = 2; + class RecordHandler extends Handler { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + default: + case MSG_TEST_MIC_START: + removeMessages(MSG_TEST_MIC_START); + mTimes = RECORD_TIME; + recordtext.setText(" "+mTimes+" "); + mRecorder.startRecording(3, ".amr"); + sendEmptyMessageDelayed(MSG_TEST_MIC_ING, 1000L); + break; + case MSG_TEST_MIC_ING: + if (mTimes > 0) { + recordtext.setText(" "+mTimes+" "); + mTimes--; + Log.i(TAG, "mTimes=" + mTimes); + sendEmptyMessageDelayed(MSG_TEST_MIC_ING, 1000L); + } else { + removeMessages(MSG_TEST_MIC_ING); + sendEmptyMessage(MSG_TEST_MIC_OVER); + + } + break; + case MSG_TEST_MIC_OVER: + removeMessages(MSG_TEST_MIC_OVER); + mRecorder.stopRecording(); + if (mRecorder.sampleLength() > 0) { + recordtext.setText(R.string.HeadsetRecodrSuccess); + mRecorder.startPlayback(); + } else { + recordtext.setText(R.string.RecordError); + } + recordtestbutton.setEnabled(true); + break; + } + mVUMeter.invalidate(); + } + } + + /****************************************************************** + * about Power + */ + class PowerBroadcastReceiver extends BroadcastReceiver { + public void onReceive(Context paramContext, Intent intent) { + String action = intent.getAction(); + if (!Intent.ACTION_BATTERY_CHANGED.equals(action)) { + return; + } + int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0); + int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); + int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100); + int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0); + int voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0); + Log.e("Jeffy", "plugged:" + plugged); + int current = -1; + try { + String currentStr = SystemUtil.execScriptCmd("cat " + + CURRENT_PATH, DeviceTest.TEMP_FILE_PATH, true); + if (currentStr.length() > 0) { + current = Integer.parseInt(currentStr); + } + } catch (Exception e) { + e.printStackTrace(); + } + String statusString = ""; + switch (status) { + case BatteryManager.BATTERY_STATUS_UNKNOWN: + statusString = "Unknown"; + break; + case BatteryManager.BATTERY_STATUS_CHARGING: + statusString = "Charging"; + break; + case BatteryManager.BATTERY_STATUS_DISCHARGING: + statusString = "Discharging"; + break; + case BatteryManager.BATTERY_STATUS_NOT_CHARGING: + statusString = "Not Charging"; + break; + case BatteryManager.BATTERY_STATUS_FULL: + statusString = "Full"; + break; + } + mChargeStatus.setText(getString(R.string.ChargeState) + statusString); + mVoltage.setText(getString(R.string.Voltage) + voltage + "mV"); + if (current != -1) { + mCurrent.setText("Current:" + (current / 1000) + "mA"); + } else { + mCurrent.setVisibility(View.GONE); + } + mCapacity.setText(getString(R.string.Capacity) + (level * 100 / scale) + "%"); + boolean acPlugin = false; + String pluggedStr = ""; + switch (plugged) { + case BatteryManager.BATTERY_PLUGGED_AC: + acPlugin = true; + pluggedStr = "AC"; + break; + case BatteryManager.BATTERY_PLUGGED_USB: + pluggedStr = "USB"; + break; + default: + pluggedStr = "Unplugged"; + break; + } + mPlug.setText(getString(R.string.Plug) + pluggedStr); + } + } + + + /****************************************************************** + * about Key + */ + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + Log.d(TAG, " _____________---- dispatchKeyEvent(), " + event.getKeyCode()); + switch(event.getAction()){ + case KeyEvent.ACTION_DOWN: + mKeyTestView.setKeyDown(event.getKeyCode()); + break; + case KeyEvent.ACTION_UP: + mKeyTestView.setKeyUp(event.getKeyCode()); + mKeyTestView.requestFocus(); + mKeyTestView.requestFocusFromTouch(); + if(event.getKeyCode()== KeyEvent.KEYCODE_HOME){ + Log.d(TAG,getWindow().getAttributes().type+ " _____________---- onKeyEEEE(), " + event.getKeyCode()); + return true; + }else if(event.getKeyCode()== KeyEvent.KEYCODE_BACK){ + Log.d(TAG,getWindow().getAttributes().type+ " _____________---- onKeyEEEE(), " + event.getKeyCode()); + return true; + }else if(event.getKeyCode()== KeyEvent.KEYCODE_MENU){ + Log.d(TAG,getWindow().getAttributes().type+ " _____________---- onKeyEEEE(), " + event.getKeyCode()); + mKeyTestView.setFocusable(true); + mKeyTestView.setFocusableInTouchMode(true); + mKeyTestView.requestFocus(); + + return true; + } + break; + } + return super.dispatchKeyEvent(event); + + } + @Override + public void onAttachedToWindow() { + Log.d(TAG, "onAttachedToWindow"); + Log.d(TAG, "____________________________ ____________ onAttachedToWindow type: " + getWindow().getAttributes().type); +// getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); +//// getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); +// getWindow().addFlags(FLAG_KEEP_SCREEN_ON); + super.onAttachedToWindow(); + } + private void addWindow(){ + WindowManager.LayoutParams params = new WindowManager.LayoutParams(); + params.type = WindowManager.LayoutParams.TYPE_KEYGUARD; +// params.type = WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; +// params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL +// | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; +// params.flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN +// | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD; + params.width = 0;//WindowManager.LayoutParams.FILL_PARENT; + params.height = 0;//WindowManager.LayoutParams.FILL_PARENT; + params.format=PixelFormat.TRANSLUCENT; + params.gravity=Gravity.LEFT|Gravity.TOP; + //����Ļ���Ͻ�Ϊԭ�㣬����x��y��ʼֵ + params.x = 0; + params.y = 0; + + wm.addView(v, params); + v.requestFocus(); + v.setOnKeyListener(new OnKeyListener(){ + public boolean onKey(View v, int keyCode, KeyEvent event) { + switch(event.getAction()){ + case KeyEvent.ACTION_DOWN: + mKeyTestView.setKeyDown(event.getKeyCode()); + break; + case KeyEvent.ACTION_UP: + mKeyTestView.setKeyUp(event.getKeyCode()); + if(keyCode== KeyEvent.KEYCODE_HOME){ + Log.d(TAG,getWindow().getAttributes().type+ " _____________---- onKeyEEEE(), " + event.getKeyCode()); + return true; + } + + break; + + } + return false; + } + }); + } + private void removeWindow(){ + wm.removeView(v); + } + private static String getStoragePath(Context mContext, boolean is_removale) { + + StorageManager mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); + Class<?> storageVolumeClazz = null; + try { + storageVolumeClazz = Class.forName("android.os.storage.StorageVolume"); + Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList"); + Method getPath = storageVolumeClazz.getMethod("getPath"); + Method isRemovable = storageVolumeClazz.getMethod("isRemovable"); + Object result = getVolumeList.invoke(mStorageManager); + final int length = Array.getLength(result); + for (int i = 0; i < length; i++) { + Object storageVolumeElement = Array.get(result, i); + String path = (String) getPath.invoke(storageVolumeElement); + boolean removable = (Boolean) isRemovable.invoke(storageVolumeElement); + if (is_removale == removable) { + return path; + } + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsLocationTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsLocationTestActivity.java new file mode 100755 index 0000000..236da63 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsLocationTestActivity.java @@ -0,0 +1,255 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.util.Iterator; + +import com.DeviceTest.GpsTestActivity.MystatusListener; +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; + +import android.app.Activity; +import android.app.PendingIntent; +import android.app.PendingIntent.CanceledException; +import android.bluetooth.BluetoothAdapter; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.location.Criteria; +import android.location.GpsSatellite; +import android.location.GpsStatus; +import android.location.Location; +import android.location.LocationListener; +import android.location.LocationManager; +import android.net.Uri; +import android.net.wifi.WifiManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.SystemClock; +import android.provider.Settings; +import android.util.Log; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.Button; +import android.widget.TextView; + +public class GpsLocationTestActivity extends Activity { + private static final String TAG = GpsLocationTestActivity.class + .getSimpleName(); + LocationManager mLocatManager; + LocationListener mLocationListener = new LocationListener() { + public void onLocationChanged(Location location) { + // mLocatManager.getGpsStatus(gpsStatus); + // mResult.setText("Debug:get location data..."); + // Log.e("Jeffy", "!!!!!!!!!!!!!!!!Debug:get location data..."); + // if (gpsStatus != null && gpsStatus.getTimeToFirstFix() != 0) { + // mResult.setText("Debug:TTFF: " + gpsStatus.getTimeToFirstFix()); + // Log.e("Jeffy", "!!!!!!!!!!!!!!!!Debug:TTFF:" + + // gpsStatus.getTimeToFirstFix()); + // return; + // } + } + + public void onProviderDisabled(String provider) { + } + + public void onProviderEnabled(String provider) { + } + + public void onStatusChanged(String provider, int status, Bundle extras) { + } + }; + TextView mResult; + TextView mText; + TextView mTitle; + + private GpsStatus.Listener statusListener = new MystatusListener(); + private static final int step = 1000; // msecs + private static final int MSG_RUN = 0; + + boolean stop = false; + Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + removeMessages(MSG_RUN); + switch (msg.what) { + case MSG_RUN: + ((Runnable) msg.obj).run(); + break; + default: + break; + } + } + }; + Runnable mFailedRunnable = new Runnable() { + + public void run() { + if (stop) { + return; + } + findViewById(R.id.btn_Fail).performClick(); + } + }; + Runnable mSkipRunnable = new Runnable() { + + public void run() { + if (stop) { + return; + } + findViewById(R.id.btn_Skip).performClick(); + } + }; + + Runnable mPassRunnable = new Runnable() { + + public void run() { + if (stop) { + return; + } + findViewById(R.id.btn_Pass).performClick(); + } + }; + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.gpslocationtest); + + this.mResult = (TextView) findViewById(R.id.gpslocationresultText); + this.mResult.setVisibility(View.VISIBLE); + this.mResult.setGravity(Gravity.CENTER); + ControlButtonUtil.initControlButtonView(this); + this.mResult.setText("Wait for location data..."); + + //findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + + this.mLocatManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); + + // mLocatManager.getGpsStatus(gpsStatus); + // if(gpsStatus != null && gpsStatus.getTimeToFirstFix() != 0) { + // mResult.setText("TTFF already been set, please turn off & turn on GPS.."); + // + // mHandler.postDelayed(mSkipRunnable, 5000); + // return; + // } + + WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); + wifiManager.setWifiEnabled(false); + if(BluetoothAdapter.getDefaultAdapter() != null){ + BluetoothAdapter.getDefaultAdapter().disable(); + } + + /*Settings.Secure.setLocationProviderEnabled(getContentResolver(), + LocationManager.GPS_PROVIDER, true);*/ + + if (!mLocatManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { + this.mResult.setText("Gps off,gps location was not enabled!"); + //mHandler.postDelayed(mSkipRunnable, 5000); + //return; + }else{ + + TextView nmeaView = (TextView) findViewById(R.id.nmealocationresultText); + nmeaView.setText("Wait for NMEA information"); + + mLocatManager.addGpsStatusListener(this.statusListener); + mLocatManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, + step, 0, mLocationListener); + mLocatManager.addNmeaListener(nmeaListener); + stop = true; + mHandler.postDelayed(new Runnable() { + + public void run() { + SystemUtil.execRootCmd(DeviceTest.GPS_COLD_START_PATH); + SystemUtil.execRootCmd(DeviceTest.GPS_COLD_START_PATH); + } + }, 2000); + stop = false; + mHandler.postDelayed(mFailedRunnable, 120 * 1000); + } + } + public boolean onTouchEvent(MotionEvent paramMotionEvent) { + if (paramMotionEvent.getAction() == MotionEvent.ACTION_DOWN) { + if (!mLocatManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { + Intent intent = new Intent(); + intent .setAction("android.settings.LOCATION_SOURCE_SETTINGS"); + intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.Settings$LocationSettingsActivity")); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + } + return super.onTouchEvent(paramMotionEvent); + } + protected void onStop() { + super.onStop(); + this.mLocatManager.removeGpsStatusListener(this.statusListener); + this.mLocatManager.removeUpdates(this.mLocationListener); + stop = true; + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + GpsStatus gpsStatus; + + private void updateNmeaStatus(String nmea) { + TextView nmeaView = (TextView) findViewById(R.id.nmealocationresultText); + nmeaView.setText(nmea); + } + + private final GpsStatus.NmeaListener nmeaListener = new GpsStatus.NmeaListener() { + public void onNmeaReceived(long timestamp, String nmea) { + + updateNmeaStatus(nmea); + } + }; + + + class MystatusListener implements GpsStatus.Listener { + + public void onGpsStatusChanged(int event) { + gpsStatus = mLocatManager.getGpsStatus(null); + if(stop) { + return; + } + switch (event) { + case GpsStatus.GPS_EVENT_FIRST_FIX: + + Log.e("Jeffy", + "GPS_EVENT_FIRST_FIX:" + gpsStatus.getTimeToFirstFix()); + String ttff = ((int) (gpsStatus.getTimeToFirstFix() / 100)) / 10.0 + "s"; + mResult.setText("TTFF: " + + ttff); + ControlButtonUtil.setResult(DeviceTest.RESULT_INFO_HEAD + + ttff); + mHandler.removeMessages(MSG_RUN); + if(gpsStatus.getTimeToFirstFix() > 90 * 1000 ) { + mHandler.postDelayed(mFailedRunnable, 2 * 1000); + } else { + mHandler.postDelayed(mPassRunnable, 2 * 1000); + } + findViewById(R.id.btn_Pass).setVisibility(View.VISIBLE); + findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + break; + default: + break; + } + } + + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsTestActivity.java new file mode 100755 index 0000000..13f179b --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GpsTestActivity.java @@ -0,0 +1,347 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.helper.TestCase; +import com.DeviceTest.helper.TestCase.RESULT; + +import android.app.Activity; +import android.app.PendingIntent; +import android.app.PendingIntent.CanceledException; +import android.bluetooth.BluetoothAdapter; +import android.content.Context; +import android.content.Intent; +import android.location.Criteria; +import android.location.GpsSatellite; +import android.location.GpsStatus; +import android.location.Location; +import android.location.LocationListener; +import android.location.LocationManager; +import android.net.Uri; +import android.net.wifi.WifiManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.SystemClock; +import android.provider.Settings; +import android.util.Log; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.Window; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.AdapterView.OnItemSelectedListener; + +public class GpsTestActivity extends Activity { + private static final String TAG = GpsTestActivity.class.getSimpleName(); + LocationManager mLocatManager; + + private GpsStatus.Listener statusListener = new MystatusListener(); + HashMap<Integer, Integer> passSatellites = new HashMap<Integer, Integer>(); + HashMap<Integer, Integer> Satellites = new HashMap<Integer, Integer>(); + + TextView ttffView, cnView, timerView, satellitesView; + int ttff = 0; + static final int CN_PASS = 38; + static final int CN_PASS_NO = 4; + static final int TTFF_PASS = 90; + static final int TIMEOUT = 120 * 1000; + TestCase.RESULT ttffResult = TestCase.RESULT.UNDEF; + TestCase.RESULT cnResult = TestCase.RESULT.UNDEF; + boolean ttffPass = false; + boolean cnPass = false; + boolean stop = false; + Handler mHandler = new Handler(); + Runnable timerRunnable = new Runnable() { + int time = 0; + + public void run() { + if (stop) { + return; + } + time++; + timerView.setText("Time:" + time); + String ttffText = "Wait for TTFF"; + int count = time % 3; + switch (count) { + case 0: + ttffText += "."; + break; + case 1: + ttffText += ".."; + break; + case 2: + ttffText += "..."; + break; + default: + break; + } + if (!ttffPass) { + ttffView.setText(ttffText); + } + if (!ttffPass || !cnPass) + mHandler.postDelayed(this, 1000); + } + }; + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.gpstest); + + ControlButtonUtil.initControlButtonView(this); + + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + + this.mLocatManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); + + WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); + wifiManager.setWifiEnabled(false); + BluetoothAdapter.getDefaultAdapter().disable(); + try { + Settings.Secure.setLocationProviderEnabled(getContentResolver(), + LocationManager.GPS_PROVIDER, true); + } catch (Exception e) { + // TODO: handle exception + } + Criteria criteria = new Criteria(); + criteria.setAccuracy(Criteria.ACCURACY_FINE); // 高精度 + criteria.setAltitudeRequired(false); + criteria.setBearingRequired(false); + criteria.setCostAllowed(true); + criteria.setPowerRequirement(Criteria.POWER_LOW); // 低功耗 + + String provider = mLocatManager.getBestProvider(criteria, true); // 获取GPS信息 + Location location = mLocatManager.getLastKnownLocation(provider); // 通过GPS获取位置 + updateToNewLocation(location); + // 设置监听器,自动更新的最小时间为间隔N秒(1秒为1*1000,这样写主要为了方便)或最小位移变化超过N米 + mLocatManager.requestLocationUpdates(provider, 100 * 1000, 500, + locationListener); + mLocatManager.addGpsStatusListener(this.statusListener); + //mLocatManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, + // 1000, 0, locationListener); + + ttffView = (TextView) findViewById(R.id.gpsTTFF); + cnView = (TextView) findViewById(R.id.gpsCN); + timerView = (TextView) findViewById(R.id.gpsTimer); + satellitesView = (TextView) findViewById(R.id.gpsSatellite); + satellitesView.setText("Satellites:\n"); + cnView.setText("Passed Satellites:0"); + + stop = true; + mHandler.postDelayed(new Runnable() { + + public void run() { + SystemUtil.execRootCmd(DeviceTest.GPS_COLD_START_PATH); + + mHandler.postDelayed(new Runnable() { + public void run() { + if (stop) { + return; + } + Log.e("Jeffy", + "Test Timeout, ttffPass:" + ttffPass + + ", cnPass:" + cnPass + ", time:" + + timerView.getText()); + + cnPass = true; + ttffPass = true; + over(); + } + }, TIMEOUT); + mHandler.post(timerRunnable); + stop = false; + } + }, 2000); + + } +private void updateToNewLocation(Location location) { + + //TextView tv1; + // tv1 = (TextView) this.findViewById(R.id.tv1); + if (location != null) { + double latitude = location.getLatitude(); + double longitude= location.getLongitude(); + Log.e("----------","维度:" + latitude+ "\n经度" + longitude); + } else { + Log.e("----------","无法获取地理信息"); + } + +} + LocationListener locationListener = new LocationListener() { + + public void onStatusChanged(String provider, int status, Bundle extras) { + } + + public void onProviderEnabled(String provider) { + } + + public void onProviderDisabled(String provider) { + } + + public void onLocationChanged(Location location) { + } + + }; + + protected void onStop() { + + super.onStop(); + + this.mLocatManager.removeGpsStatusListener(this.statusListener); + mLocatManager.removeUpdates(locationListener); + stop = true; + } + + GpsStatus gpsStatus; + + class MystatusListener implements GpsStatus.Listener { + + public void onGpsStatusChanged(int event) { + if (stop) { + return; + } + gpsStatus = mLocatManager.getGpsStatus(null); + + switch (event) { + case GpsStatus.GPS_EVENT_SATELLITE_STATUS: + Iterable<GpsSatellite> allSatellites = gpsStatus + .getSatellites(); + Iterator<GpsSatellite> iterator = allSatellites.iterator(); + String msg = "Satellites:\n"; + + while (iterator.hasNext()) { + GpsSatellite gpsSatellite = iterator.next(); + int snr = (int) gpsSatellite.getSnr(); + int prn = gpsSatellite.getPrn(); + if (snr < 0) { + continue; + } + msg += "" + prn + "(" + snr + ")\n"; + Integer oldSnr = Satellites.get(prn); + if (oldSnr == null || snr > oldSnr) { + Satellites.put(prn, snr); + if (snr >= CN_PASS) { + passSatellites.put(prn, snr); + } + } + } + satellitesView.setText(msg); + + int passCount = passSatellites.size(); + msg = "Passed Satellites:" + passCount; + if (passCount >= CN_PASS_NO) { + Log.e("Jeffy", + "Get 4 CN > 38, ttffPass:" + ttffPass + ", cnPass:" + + cnPass + ", time:" + timerView.getText()); + msg += "(Pass)"; + cnPass = true; + over(); + } + cnView.setText(msg); + break; + case GpsStatus.GPS_EVENT_FIRST_FIX: + ttffPass = true; + ttff = gpsStatus.getTimeToFirstFix() / 1000; + msg = "TTFF:" + ttff; + + Log.e("Jeffy", "Get TTFF, ttffPass:" + ttffPass + ", cnPass:" + + cnPass + ", time:" + timerView.getText()); + + if (ttff <= TTFF_PASS) { + msg += "(Pass)"; + } else { + msg += "(Failed)"; + } + + over(); + ttffView.setText(msg); + break; + default: + break; + } + } + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + private String getCNs() { + if (Satellites.size() == 0) { + return ""; + } + String msg = ""; + for (int i = 0; i < 255; i++) { + if (Satellites.get(i) != null) { + msg += "" + i + "-" + Satellites.get(i) + ","; + } + } + return msg.substring(0, msg.length() - 1); + } + + public String getResult() { + String result = DeviceTest.RESULT_INFO_HEAD_JUST_INFO; + result += DeviceTest.formatResult("GPS C/No", cnResult, + DeviceTest.RESULT_INFO_HEAD + getCNs()) + "\n"; + result += DeviceTest.formatResult("GPS Location", ttffResult, + DeviceTest.RESULT_INFO_HEAD + ttff); + + return result; + } + + public void over() { + if (!cnPass || !ttffPass) { + return; + } + stop = true; + Log.e("Jeffy", "Test Over, ttffPass:" + ttffPass + ", cnPass:" + cnPass + + ", time:" + timerView.getText()); + + if (passSatellites.size() >= CN_PASS_NO) { + cnResult = TestCase.RESULT.OK; + } else { + cnResult = TestCase.RESULT.NG; + } + + if (ttff <= TTFF_PASS) { + ttffResult = TestCase.RESULT.OK; + } else { + ttffResult = TestCase.RESULT.NG; + } + ControlButtonUtil.setResult(getResult()); + mHandler.postDelayed(new Runnable() { + + public void run() { + if (cnResult == ttffResult && cnResult == TestCase.RESULT.OK) { + findViewById(R.id.btn_Pass).performClick(); + } else { + findViewById(R.id.btn_Fail).performClick(); + } + } + }, 3000); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GsensorTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GsensorTestActivity.java new file mode 100755 index 0000000..50468c8 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GsensorTestActivity.java @@ -0,0 +1,234 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.view.GsensorBall; + +import android.app.Activity; +import android.graphics.Color; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.TextView; +import android.widget.Toast; + +/** + * @author LanBinYuan + * @date 2011-06-11 + * + */ + +public class GsensorTestActivity extends Activity { + /** Called when the activity is first created. */ + private final static int MAX_NUM = 8; + private SensorManager sensorManager; + private SensorEventListener lsn = null; + boolean stop = false; + + private static enum TEST_AXIS { + X, Y, Z, D + }; + + private TEST_AXIS testAxis; + private GsensorBall mGsensorBall; + private Button save_btn; + private double x_offset=0; + private double y_offset=0; + private double z_offset=0; + + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + setContentView(R.layout.gsensortest); + stop = false; + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + ControlButtonUtil.initControlButtonView(this); + sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE); + //mGsensorBall = (GsensorBall)findViewById(R.id.gsensorball); + setTestAxis(TEST_AXIS.X); +// findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + save_btn = (Button) findViewById(R.id.save_calibration_button); + } + + TextView X_textView, Y_textView, Z_textView; + + + protected void onResume() { + super.onResume(); + + stop = false; + final TextView subTitle = (TextView) findViewById(R.id.Accelerometer); + subTitle.setTextColor(Color.rgb(255, 0, 0)); + + X_textView = (TextView) findViewById(R.id.gsensorTestX); + X_textView.setTextColor(android.graphics.Color.GREEN); + + Y_textView = (TextView) findViewById(R.id.gsensorTestY); + Y_textView.setTextColor(android.graphics.Color.GREEN); + + Z_textView = (TextView) findViewById(R.id.gsensorTestZ); + Z_textView.setTextColor(android.graphics.Color.GREEN); + + + lsn = new SensorEventListener() { + public void onAccuracyChanged(Sensor sensor, int accuracy) { + + } + + public void onSensorChanged(SensorEvent e) { + if(stop) { + return; + } + subTitle.setText("x:" + (double) e.values[0] + ", \ny:" + + (double) e.values[1] + ",\nz:" + (double) e.values[2]); + x_offset=e.values[0]-0; + y_offset=e.values[1]-0; + z_offset=e.values[2]-9.8; + doTest(e); + //mGsensorBall.setXYZ(e.values[0], e.values[1], e.values[2]); + } + + }; + + Sensor sensors = sensorManager + .getDefaultSensor(Sensor.TYPE_ACCELEROMETER); + + sensorManager.registerListener(lsn, sensors, + SensorManager.SENSOR_DELAY_NORMAL); + + save_btn.setOnClickListener(new OnClickListener() + { + + @Override + public void onClick(View v) + { + // TODO Auto-generated method stub + File savefile = new File("/cache/Gsensor.txt"); + if (savefile.exists()) { + savefile.delete(); + } + if (!savefile.exists()) + { + try + { + savefile.createNewFile(); + } catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + StringBuilder sb = new StringBuilder(); + sb.append("x_offset:" + x_offset).append("\n").append("y_offset:" + y_offset).append("\n").append("z_offset:" + x_offset); + String sbStirng = sb.toString(); + FileOutputStream fos = null; + try + { + fos = new FileOutputStream(savefile, false); + fos.write(sbStirng.getBytes()); + fos.close(); + } catch (FileNotFoundException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally + { + if (fos != null) + { + try + { + fos.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + } + Toast.makeText(getApplicationContext(), getString(R.string.save_isok), Toast.LENGTH_SHORT).show(); + } + }); + } + + private void doTest(SensorEvent e) { + switch (testAxis) { + case X: + if ((int) e.values[0] >= MAX_NUM && (int) e.values[1] == 0 + && (int) e.values[2] == 0) { + setTestAxis(TEST_AXIS.Y); + X_textView.setText(X_textView.getText() + ":Pass"); + } + break; + case Y: + if ((int) e.values[0] == 0 && (int) e.values[1] >= MAX_NUM + && (int) e.values[2] == 0) { + setTestAxis(TEST_AXIS.Z); + Y_textView.setText(Y_textView.getText() + ":Pass"); + } + break; + case Z: + if ((int) e.values[0] == 0 && (int) e.values[1] == 0 + && (int) e.values[2] >= MAX_NUM) { + setTestAxis(TEST_AXIS.D); + Z_textView.setText(Z_textView.getText() + ":Pass"); +// findViewById(R.id.btn_Pass).performClick(); + } + break; + default: + break; + } + } + + private void setTestAxis(TEST_AXIS testAxis) { + this.testAxis = testAxis; + switch (testAxis) { + case X: + findViewById(R.id.gsensorTestX).setVisibility(View.VISIBLE); + break; + case Y: + findViewById(R.id.gsensorTestY).setVisibility(View.VISIBLE); + break; + case Z: + findViewById(R.id.gsensorTestZ).setVisibility(View.VISIBLE); + break; + default: + break; + } + } + + // + + protected void onPause() { + super.onPause(); + sensorManager.unregisterListener(lsn); + stop = true; + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GyroscopeTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GyroscopeTestActivity.java new file mode 100755 index 0000000..e24c5fe --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/GyroscopeTestActivity.java @@ -0,0 +1,237 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.util.List; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.graphics.Color; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.util.Log; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import com.DeviceTest.view.*; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.Toast; +/** + * @author LanBinYuan + * @date 2011-06-11 + * + */ + +public class GyroscopeTestActivity extends Activity { + /** Called when the activity is first created. */ + private SensorManager sensorManager; + private SensorEventListener lsn = null; + private TouchSurfaceView mGLSurfaceView; + private Button save_btn; + private double x_offset=0; + private double y_offset=0; + private double z_offset=0; + + private float x; + private float y; + private float z = 0.0F; + int i = 0; + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.gyroscopetest); + ControlButtonUtil.initControlButtonView(this); + sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE); + this.mGLSurfaceView = new TouchSurfaceView(this); + //setContentView(this.mGLSurfaceView); + + // AdView localAdView = new AdView(this); + //localAdView.setVerticalGravity(80); + // localRelativeLayout.addView(localAdView, localLayoutParams); +// addContentView(localRelativeLayout, new WindowManager.LayoutParams(-1, -2)); + RelativeLayout layout2 = (RelativeLayout)findViewById(R.id.relativeLayout2); + RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + params2.addRule(RelativeLayout.CENTER_HORIZONTAL); + layout2.setGravity(Gravity.BOTTOM); + layout2.addView(mGLSurfaceView, params2); + // LayoutInflater.from(this).inflate(R.xml.control_buttons, get); + this.mGLSurfaceView.requestFocus(); + this.mGLSurfaceView.setFocusableInTouchMode(true); + save_btn = (Button) findViewById(R.id.save_calibration_button); + } + + + @Override + protected void onPause() { + // Ideally a game should implement onResume() and onPause() + // to take appropriate action when the activity looses focus + super.onPause(); + mGLSurfaceView.onPause(); + this.sensorManager.unregisterListener(lsn); + } + + + protected void onResume() { + super.onResume(); + + lsn = new SensorEventListener() { + public void onAccuracyChanged(Sensor sensor, int accuracy) { + // TODO Auto-generated method stub + + } + + public void onSensorChanged(SensorEvent e) { + TextView subTitle = (TextView) findViewById(R.id.Gyroscope); + subTitle.setTextColor(Color.rgb(255, 0, 0)); + + String info = " name:" + String.valueOf(e.sensor.getName()); + info += "\n"; + + info += " vendor:" + String.valueOf(e.sensor.getVendor()); + info += "\n"; + info += " version:" + String.valueOf(e.sensor.getVersion()); + info += "\n"; + info += " maxRange:" + + String.valueOf(e.sensor.getMaximumRange()); + info += "\n"; + info += " resolution:" + + String.valueOf(e.sensor.getResolution()); + info += "\n"; + info += " power:" + String.valueOf(e.sensor.getPower()); + + TextView infoView = (TextView) findViewById(R.id.magnetic_info); + infoView.setText(info); + // -------------- + + TextView text = (TextView) findViewById(R.id.magnetic_x); + text.setText(" x:" + + String.valueOf(e.values[SensorManager.DATA_X])); + text.setTextColor(android.graphics.Color.GREEN); + + TextView text2 = (TextView) findViewById(R.id.magnetic_y); + text2.setText(" y:" + + String.valueOf(e.values[SensorManager.DATA_Y])); + text2.setTextColor(android.graphics.Color.GREEN); + + TextView text3 = (TextView) findViewById(R.id.magnetic_z); + text3.setText(" z:" + + String.valueOf(e.values[SensorManager.DATA_Z])); + text3.setTextColor(android.graphics.Color.GREEN); + + x += e.values[0]; + y += e.values[1]; + z += e.values[2]; + mGLSurfaceView.updateGyro(x, y, z); + + int j = i; + i = (j + 1); + if (j % 50 != 0) + return; + Log.i("gyro", "x=" + e.values[0] + " y=" +e.values[1] + " z=" + e.values[2]); + x_offset=e.values[0]-0; + y_offset=e.values[1]-0; + z_offset=e.values[2]-0; + } + + }; + + Sensor sensors = sensorManager + .getDefaultSensor(Sensor.TYPE_GYROSCOPE); + + sensorManager.registerListener(lsn, sensors, + SensorManager.SENSOR_DELAY_NORMAL); + this.mGLSurfaceView.onResume(); +save_btn.setOnClickListener(new OnClickListener() + { + + @Override + public void onClick(View v) + { + // TODO Auto-generated method stub + File savefile = new File("/cache/Gyroscope.txt"); + if (savefile.exists()) { + savefile.delete(); + } + if (!savefile.exists()) + { + try + { + savefile.createNewFile(); + } catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + StringBuilder sb = new StringBuilder(); + sb.append("x_offset:" + x_offset).append("\n").append("y_offset:" + y_offset).append("\n").append("z_offset:" + x_offset); + String sbStirng = sb.toString(); + FileOutputStream fos = null; + try + { + fos = new FileOutputStream(savefile, false); + fos.write(sbStirng.getBytes()); + fos.close(); + } catch (FileNotFoundException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally + { + if (fos != null) + { + try + { + fos.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + } + Toast.makeText(getApplicationContext(), getString(R.string.save_isok), Toast.LENGTH_SHORT).show(); + } + }); + + } + + // + + protected void onStop() { + super.onStop(); + sensorManager.unregisterListener(lsn); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HardwareInfoTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HardwareInfoTestActivity.java new file mode 100755 index 0000000..5067ee8 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HardwareInfoTestActivity.java @@ -0,0 +1,170 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.Permission; +import java.util.ArrayList; +import java.util.Arrays; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.helper.TestCase.RESULT; +import com.rockchip.dmi.DmiUtil; + +import android.app.Activity; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PermissionInfo; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.Window; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; + +public class HardwareInfoTestActivity extends Activity implements + OnClickListener { + private TextView currentView = null; + private TextView cpuInfoTextView = null; + private TextView memInfoTextView = null; + private TextView dmiInfoTextView = null; + boolean stop = false; + + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.hardwareinfotest); + Button cpuInfoButton = (Button) findViewById(R.id.btn_cpu); + Button memInfoButton = (Button) findViewById(R.id.btn_mem); + Button dmiInfoButton = (Button) findViewById(R.id.btn_dmi); + + cpuInfoTextView = (TextView) findViewById(R.id.cpu_info); + memInfoTextView = (TextView) findViewById(R.id.mem_info); + dmiInfoTextView = (TextView) findViewById(R.id.dmi_info); + + String cpuInfo = SystemUtil.execShellCmd("cat /proc/cpuinfo"); + String dmiInfo = DmiUtil.getDmiInfo(this, false).toString(); + + cpuInfoTextView.setText("CPU INFO\n" + cpuInfo); + memInfoTextView.setText("MEM INFO\n" + + SystemUtil.execShellCmd("cat /proc/meminfo")); + dmiInfoTextView.setText("DMI INFO\n" + dmiInfo); + + cpuInfoButton.setTag(cpuInfoTextView); + memInfoButton.setTag(memInfoTextView); + dmiInfoButton.setTag(dmiInfoTextView); + + cpuInfoButton.setOnClickListener(this); + memInfoButton.setOnClickListener(this); + dmiInfoButton.setOnClickListener(this); + + currentView = cpuInfoTextView; + cpuInfoTextView.setVisibility(View.VISIBLE); + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + + boolean pass = true; + String infoText = ""; + if (!cpuInfo.contains("Processor\t: ARMv7 Processor rev 2 (v7l)")) { + infoText = "cpu - Processor;"; + pass = false; + } + if (!cpuInfo.contains("CPU architecture: 7")) { + infoText += "cpu - CPU architecture;"; + pass = false; + } + if (!cpuInfo.contains("CPU revision\t: 2")) { + infoText += "cpu - CPU revision;"; + pass = false; + } + + if (!cpuInfo.contains("Hardware\t: RK29board")) { + infoText += "cpu - Hardware;"; + pass = false; + } + + if (!dmiInfo.contains("Manufacture:TOSHIBA")) { + infoText += "dmi - Manufacture;"; + if (pass) { + dmiInfoButton.performClick(); + } + pass = false; + } + + if (pass) { + findViewById(R.id.btn_Pass).performClick(); + } else { + + TextView infoView = (TextView) findViewById(R.id.hwinfoText); + infoView.setText("Failed:\n" + infoText); + mHandler.postDelayed(mFailedRunnable, DeviceTest.TEST_FAILED_DELAY); + } + } + + Handler mHandler = new Handler(); + Runnable mFailedRunnable = new Runnable() { + + + public void run() { + if(stop) { + return; + } + mHandler.removeCallbacks(mFailedRunnable); + findViewById(R.id.btn_Fail).performClick(); + } + }; + + + public void onStop() { + super.onStop(); + stop = true; + mHandler.removeCallbacks(mFailedRunnable); + } + + // if (device != null && progressBar.isShown()) { + // progressBar.setVisibility(View.GONE); + // mResult.setText("Find equipment....\n Pass!"); + + + public void onClick(View v) { + TextView infoView = (TextView) v.getTag(); + if (currentView != null && currentView != infoView) { + currentView.setVisibility(View.GONE); + } + infoView.setVisibility(View.VISIBLE); + currentView = infoView; + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HdmiTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HdmiTestActivity.java new file mode 100755 index 0000000..3e6fcf7 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HdmiTestActivity.java @@ -0,0 +1,232 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.Timer; +import java.util.TimerTask; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +import android.os.CountDownTimer; +import android.os.Handler; +import android.os.SystemProperties; +import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.Window; +import android.widget.Button; +import android.widget.TextView; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.view.LcdTestView; +import android.os.UEventObserver; + +public class HdmiTestActivity extends Activity { + private final static String TAG = "HDMITEST"; + + private final static int CHANGE_COLOR = 1; + private final static int HDMI_SCAN = 2; + private int[] TestColor = {Color.RED, Color.GREEN, Color.BLUE }; + private LcdTestView mTestView; + private TextView mTitle; + private TextView mResult; + private TextView mShowTime; + private int mTestNo; + private boolean isStart = false; + private File HdmiFile = null; + private File HdmiState = null; + private File HdmiDisplayEnable=null; + private File HdmiDisplayMode=null; + private File HdmiDisplayConnect=null; + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + setContentView(R.layout.hdmitest); + + mTestView = (LcdTestView) findViewById(R.id.lcdtestview); + mResult = (TextView) findViewById(R.id.result); + mShowTime = (TextView) findViewById(R.id.TimeShow); + mTestNo = 0; + + HdmiFile = new File("/sys/class/hdmi/hdmi-0/enable"); + HdmiState = new File("/sys/devices/platform/display-subsystem/drm/card0/card0-HDMI-A-1/status"); + HdmiDisplayEnable=new File("/sys/class/display/HDMI/enable"); + //HdmiDisplayMode=new File("/sys/class/display/HDMI/mode"); + HdmiDisplayConnect=new File("sys/class/display/HDMI/connect"); + ControlButtonUtil.initControlButtonView(this); + ((Button) findViewById(R.id.btn_Pass)).setVisibility(View.INVISIBLE); + } + + @Override + public void onResume() { + super.onResume(); + mHandler.sendEmptyMessageDelayed(HDMI_SCAN, 500); + } + + @Override + public void onPause() { + super.onPause(); + mHandler.removeMessages(HDMI_SCAN); + mHandler.removeMessages(CHANGE_COLOR); + } + + private Handler mHandler = new Handler() { + public void handleMessage(android.os.Message msg) { + switch (msg.what) { + case CHANGE_COLOR: + if (mTestNo > TestColor.length - 1) { + finishHdmiTest(); + return; + } + ControlButtonUtil.Hide(); + mShowTime.setVisibility(View.VISIBLE); + mTestView.setVisibility(View.VISIBLE); + mResult.setText(R.string.HdmiStart); + mTestView.setBackgroundColor(TestColor[mTestNo++]); + sendEmptyMessageDelayed(CHANGE_COLOR, 1500); + break; + case HDMI_SCAN: + this.removeMessages(HDMI_SCAN); + if (startHdmiTest()) { + mResult.setText(R.string.HdmiPrepare); + //setHdmiConfig(HdmiFile, true); + mTestNo = 0; + sendEmptyMessageDelayed(CHANGE_COLOR, 4000); + }else{ + sendEmptyMessageDelayed(HDMI_SCAN, 500); + } + break; + default: + break; + } + } + }; + + public boolean startHdmiTest() { + if (!isStart && isHdmiConnected()) { + mResult.setText(R.string.HdmiPrepare); + setHdmiConfig(HdmiFile, true); + mTestNo = 0; + isStart = true; + return true; + } + mResult.setText(R.string.HdmiNoInsert); + Log.i(TAG, "Hdmi no insert"); + return false; + } + + public void finishHdmiTest() { + ((Button) findViewById(R.id.btn_Pass)).setVisibility(View.VISIBLE); + ControlButtonUtil.Show(); + isStart = false; + mShowTime.setVisibility(View.GONE); + mTestView.setVisibility(View.GONE); + mResult.setText(R.string.HdmiResult); +// setHdmiConfig(HdmiFile, false); + } + + protected boolean isHdmiConnected() { + File file = HdmiState; + boolean isConnected = false; + if (file.exists()) { + try { + FileReader fread = new FileReader(file); + BufferedReader buffer = new BufferedReader(fread); + String strPlug = "plug=1"; + String str = null; + + while ((str = buffer.readLine()) != null) { + int length = str.length(); + //if ((length == 6) && (str.equals(strPlug))) { + if(str.equals("connected")){ + isConnected = true; + break; + } else { + isConnected = false; + } + } + } catch (IOException e) { + Log.e(TAG, "IO Exception"); + } + } else { + Log.e(TAG, file + "isHdmiConnected : file no exist"); + } + return isConnected; + } + + protected void setHdmiConfig(File file, boolean enable) { + if (SystemProperties.get("ro.board.platform", "none").equals("rk29xx")){ + if (file.exists()) { + try { + String strDouble = "2"; + String strChecked = "1"; + String strUnChecked = "0"; + RandomAccessFile rdf = null; + rdf = new RandomAccessFile(file, "rw"); + + if (enable) { + rdf.writeBytes(strChecked); + } else { + rdf.writeBytes(strUnChecked); + + } + + } catch (IOException re) { + Log.e(TAG, "IO Exception"); + } + } else { + Log.i(TAG, "The File " + file + " is not exists"); + } + } else{ + if (file.exists()) { + try { + Log.d(TAG, "setHdmiConfig"); + String strChecked = "1"; + String strUnChecked = "0"; + + RandomAccessFile rdf = null; + rdf = new RandomAccessFile(file, "rw"); + if (enable) { + rdf.writeBytes(strChecked); + } else { + rdf.writeBytes(strUnChecked); + } + } catch (IOException re) { + Log.e(TAG, "IO Exception"); + re.printStackTrace(); + } + } else { + Log.i(TAG, "The File " + file + " is not exists"); + } + } + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + public boolean onTouchEvent(MotionEvent paramMotionEvent) { + if (paramMotionEvent.getAction() == MotionEvent.ACTION_DOWN && !isStart) { + mHandler.sendEmptyMessageDelayed(HDMI_SCAN, 500); + } + return super.onTouchEvent(paramMotionEvent); + } + + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HeadsetMicTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HeadsetMicTestActivity.java new file mode 100755 index 0000000..d969bb5 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/HeadsetMicTestActivity.java @@ -0,0 +1,270 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.File; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.media.AudioManager; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.Recorder; + +public class HeadsetMicTestActivity extends Activity { + + private static final String TAG = HeadsetMicTestActivity.class + .getSimpleName(); + + private final static String ERRMSG = "Record error"; + + private static final int MSG_TEST_MIC_ING = 8738; + private static final int MSG_TEST_MIC_OVER = 13107; + private static final int MSG_TEST_MIC_START = 4369; + boolean isSDcardTestOk = false; + boolean isTestStart = false; + AudioManager mAudioManager; + private Handler mHandler; + boolean mHeadSetOn = false; + private BroadcastReceiver mHeadsetReceiver; + boolean mIsTesting = false; + int mOldVolume; + Recorder mRecorder; + TextView mResult; + TextView mText; + int mTimes = 0; + TextView mTitle; + + public HeadsetMicTestActivity() { + + this.mHeadsetReceiver = new MBroadcastReceiver(); + + this.mHandler = new MyHandler(); + } + + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.headsetmictest); + + this.mResult = (TextView) findViewById(R.id.headsetresultText); + + this.mResult.setVisibility(View.VISIBLE); + this.mResult.setGravity(17); + ControlButtonUtil.initControlButtonView(this); + this.mRecorder = new Recorder(); + + this.mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + + } + + + protected void onResume() { + + super.onResume(); + this.isSDcardTestOk = false; + if (!Environment.getExternalStorageState().equals( + Environment.MEDIA_MOUNTED)) { + this.mResult.setText("Please insert sdcard"); + return; + } + + if (!isSDcardHasSpace()) { + + this.mResult.setText("sdcard has no space"); + stopMediaPlayBack(); + return; + + } + stopMediaPlayBack(); + this.isSDcardTestOk = true; + this.mOldVolume = this.mAudioManager + .getStreamVolume(AudioManager.STREAM_MUSIC); + int maxVolume = this.mAudioManager + .getStreamMaxVolume(AudioManager.STREAM_MUSIC); + this.mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, + maxVolume, 0); + + this.mHeadSetOn = this.mAudioManager.isWiredHeadsetOn(); + + if (!this.mHeadSetOn) { + this.mResult.setText("Please insert earphone!"); + return; + } + + IntentFilter localIntentFilter = new IntentFilter( + "android.intent.action.HEADSET_PLUG"); + + registerReceiver(this.mHeadsetReceiver, localIntentFilter); + + this.mIsTesting = true; + this.mHandler.sendEmptyMessage(MSG_TEST_MIC_START); + + } + + + protected void onPause() { + super.onPause(); + + + if (!mHeadSetOn) { + return; + + } + + + if (this.isSDcardTestOk) + { + + switch (this.mRecorder.state()) { + + case Recorder.IDLE_STATE: + this.mRecorder.delete(); + break; + case Recorder.PLAYING_STATE: + this.mRecorder.stop(); + this.mRecorder.delete(); + break; + case Recorder.RECORDING_STATE: + this.mRecorder.stop(); + this.mRecorder.clear(); + break; + } + + unregisterReceiver(mHeadsetReceiver); + mAudioManager.setStreamVolume(3, mOldVolume, 0); + } + + } + + public boolean isSDcardHasSpace() { + File pathFile = android.os.Environment.getExternalStorageDirectory(); + + StatFs statfs = new StatFs(pathFile.getPath()); + + if (statfs.getAvailableBlocks() > 1) { + + return true; + + } + + return false; + + } + + public void stopMediaPlayBack() { + Intent localIntent = new Intent("com.android.music.musicservicecommand"); + localIntent.putExtra("command", "pause"); + sendBroadcast(localIntent); + } + + class MyHandler extends Handler { + MyHandler() { + + } + + + public void handleMessage(Message msg) { + + super.handleMessage(msg); + + switch (msg.what) { + + case MSG_TEST_MIC_START: + isTestStart = true; + removeMessages(MSG_TEST_MIC_START); + mTimes = 10; + mResult.setText(" " + mTimes + " "); + mRecorder.startRecording(3, ".amr"); + sendEmptyMessageDelayed(MSG_TEST_MIC_ING, 1000L); + break; + case MSG_TEST_MIC_ING: + removeMessages(MSG_TEST_MIC_ING); + if (mTimes > 0) { + + mResult.setText(" " + mTimes + " "); + mTimes--; + + Log.i(TAG, "mTimes=" + mTimes); + + sendEmptyMessageDelayed(MSG_TEST_MIC_ING, 1000L); + } else { + sendEmptyMessage(MSG_TEST_MIC_OVER); + } + break; + case MSG_TEST_MIC_OVER: + removeMessages(MSG_TEST_MIC_OVER); + + mRecorder.stopRecording(); + + if (isTestStart) { + isTestStart = false; + if (mRecorder.sampleLength() > 0) { + mResult.setText("record successs!start Play back"); + mRecorder.startPlayback(); + } else { + mResult.setText(ERRMSG); + } + + } + + break; + } + + } + + } + + class MBroadcastReceiver extends BroadcastReceiver { + public void onReceive(Context paramContext, Intent paramIntent) { + + String action = paramIntent.getAction(); + Log.i(TAG, "action"); + if ("android.intent.action.HEADSET_PLUG".equals(action)) { + if (paramIntent.getIntExtra("state", 0) != 1) { + + Log.i(TAG, "HEADSET has bean removed"); + mIsTesting = false; + mHandler.sendEmptyMessage(MSG_TEST_MIC_OVER); + + return; + } + + if (!mIsTesting) { + Log.i(TAG, "HEADSET has bean inserted"); + mIsTesting = true; + mHandler.sendEmptyMessage(MSG_TEST_MIC_START); + } + } + + } + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/InfomationActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/InfomationActivity.java new file mode 100755 index 0000000..f291a22 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/InfomationActivity.java @@ -0,0 +1,259 @@ +package com.DeviceTest; +import java.io.File; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemInfoUtil; + +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.SystemProperties; +import android.os.storage.StorageEventListener; +import android.text.format.Formatter; +import android.util.Log; +import android.widget.Button; +import android.widget.TextView; +import java.io.FileReader; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; + +public class InfomationActivity extends Activity { + private final static String TAG = "InfomationActivity"; + + private TextView mCPUInfoTV; + private TextView mMemoryInfoTV; + //private TextView mNandFlashTotalTV; + //private TextView mNandFlashAvailTV; + private TextView mInternalAvailTV; + private TextView mInternalAvailSizeTV; + + public String flash_path = null; + public String sdcard_path = null; + public String usb_path = null; + private int flash_pit = 0; + private int sdcard_pit = 1; + private int usb_pit = 2; + private StorageVolume[] storageVolumes = null; + private StorageManager mStorageManager = null; + private final static int MSG_OK=0; + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.infomation); + InitStorage(); + initRes(); + ControlButtonUtil.initControlButtonView(this); + //Cancel automatically passing test. + //handler.sendEmptyMessageDelayed(MSG_OK, 2500); + } + + private Handler handler=new Handler(){ + @Override + public void handleMessage(Message msg) { + switch(msg.what){ + case MSG_OK: + ((Button) findViewById(R.id.btn_Pass)).performClick(); + } + } + }; + + @Override + protected void onResume() { + super.onResume(); + updateView(); + } + + private void initRes() { + mCPUInfoTV = (TextView) findViewById(R.id.cpuinfo_tv); + mMemoryInfoTV = (TextView) findViewById(R.id.meminfo_tv); + //mNandFlashTotalTV = (TextView) findViewById(R.id.nand_total_tv); + //mNandFlashAvailTV = (TextView) findViewById(R.id.nand_avail_tv); + mInternalAvailTV = (TextView) findViewById(R.id.internal_avail_tv); + mInternalAvailSizeTV = (TextView) findViewById(R.id.internal_avail_size_tv); + } + + private String getCpuInfoString() { + StringBuilder cpuInfoSB = new StringBuilder(); + /*cpuInfoSB.append("processor : ");*/ + /*cpuInfoSB.append(SystemInfoUtil.getCpuName()).append(" ").append("\n");*/ + cpuInfoSB.append(SystemInfoUtil.getNumCores()+"").append("").append(" * ").append(""+SystemInfoUtil.getMaxCpuFreq()+" Hz"); + return cpuInfoSB.toString(); + } + + private long getEMMC() { + try { + + int blockNum = 0; + for(int i=0;i<5;i++) { + String path=String.format("/sys/block/mmcblk%dboot0", i); + if(new File(path).exists()) { + blockNum = i; + } + } + + File targetFile = null; + + if ( blockNum == 0 ) { + File File0 = new File("/sys/block/mmcblk0/size"); + if(File0.exists()) { + targetFile = File0; + } + } + + + if ( blockNum == 1 ) { + File File1 = new File("/sys/block/mmcblk1/size"); + if(File1.exists()){ + targetFile = File1; + } + + } + + if ( blockNum == 2) { + File File2 = new File("/sys/block/mmcblk2/size"); + if(File2.exists()){ + targetFile = File2; + } + } + + //Log.d(TAG, "tanzh------" + targetFile.getPath()); + + + FileReader fr = new FileReader(targetFile.getPath()); + BufferedReader br = new BufferedReader(fr); + String text = br.readLine(); + long result = Long.valueOf(text) / 2000000; + int temp = 0; + if (result > 54 && result < 66) { + temp = 64; + } else if (result > 24 && result < 34) { + temp = 32; + } else if (result > 12 && result < 18) { + temp = 16; + } else if (result > 6 && result < 10) { + temp = 8; + } + return temp; + } catch(FileNotFoundException e){ + e.printStackTrace(); + } catch(IOException e){ + e.printStackTrace(); + } + return -1; + } + + + private void updateView() { + mCPUInfoTV.setText(getCpuInfoString()); + mMemoryInfoTV.setText(SystemInfoUtil.GetMemInfo1(this)); + //updateMemoryStatus(flash_path); + File dataPath = Environment.getDataDirectory(); + StatFs stat = new StatFs(dataPath.getPath()); + long blockSize = stat.getBlockSize(); + long blockCount = stat.getBlockCount(); + + + + // long availableBlocks = stat.getAvailableBlocks(); + //mInternalAvailSizeTV.setText(formatSize(blockCount * blockSize)); + mInternalAvailSizeTV.setText(getEMMC() + "GB"); + + //Log.d(TAG,"formatSize(availableBlocks * blockSize)="+formatSize(availableBlocks * blockSize)); + } + + + private void updateMemoryStatus(String path) { + String status = SystemProperties.get("EXTERNAL_STORAGE_STATE","unmounted"); + if (flash_path!=null&&path.equals(flash_path)) { + status = mStorageManager.getVolumeState(path); + } + String readOnly = ""; + if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { + status = Environment.MEDIA_MOUNTED; + readOnly = getString(R.string.read_only); + } + + if (status.equals(Environment.MEDIA_MOUNTED)) { + try { + //File path = Environment.getExternalStorageDirectory(); + StatFs stat = new StatFs(path); + long blockSize = stat.getBlockSize(); + long totalBlocks = stat.getBlockCount(); + long availableBlocks = stat.getAvailableBlocks(); + + /*if (path.equals(flash_path)){ + mNandFlashTotalTV.setText(getString(R.string.total_space)+":"+formatSize(totalBlocks * blockSize)); + mNandFlashAvailTV.setText(getString(R.string.available_space)+":"+formatSize(availableBlocks * blockSize) + readOnly); + }*/ + } catch (IllegalArgumentException e) { + // this can occur if the SD card is removed, but we haven't received the + // ACTION_MEDIA_REMOVED Intent yet. + status = Environment.MEDIA_REMOVED; + } + + } else { + if (flash_path!=null&&path.equals(flash_path)){ + /*mNandFlashTotalTV.setText(getString(R.string.nand_unavailable)); + mNandFlashAvailTV.setText(getString(R.string.nand_unavailable));*/ + if (status.equals(Environment.MEDIA_UNMOUNTED) || + status.equals(Environment.MEDIA_NOFS) || + status.equals(Environment.MEDIA_UNMOUNTABLE) ) { + } + } + } + + File dataPath = Environment.getDataDirectory(); + StatFs stat = new StatFs(dataPath.getPath()); + long blockSize = stat.getBlockSize(); + long availableBlocks = stat.getAvailableBlocks(); + mInternalAvailTV.setText(getString(R.string.available_space)+":"+formatSize(availableBlocks * blockSize)); + Log.d(TAG,"formatSize(availableBlocks * blockSize)="+formatSize(availableBlocks * blockSize)); + } + + private String formatSize(long size) { + return Formatter.formatFileSize(this, size); + } + + public void onCancel(DialogInterface dialog) { + finish(); + } + + private void InitStorage(){ + if (mStorageManager == null) { + mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + mStorageManager.registerListener(mStorageListener); + storageVolumes = mStorageManager.getVolumeList(); + Log.e(TAG,"storageVolumes.length:"+storageVolumes.length); + if(storageVolumes.length >= 3){ + flash_path = storageVolumes[flash_pit].getPath(); + sdcard_path = storageVolumes[sdcard_pit].getPath(); + usb_path = storageVolumes[usb_pit].getPath(); + Log.d(TAG, " _____ " + flash_path + " " + sdcard_path + " " + usb_path); + } + } + } + + StorageEventListener mStorageListener = new StorageEventListener() { + + @Override + public void onStorageStateChanged(String path, String oldState, String newState) { + Log.d(TAG, "Received storage state changed notification that " + + path + " changed state from " + oldState + + " to " + newState); + if (path.equals(sdcard_path) && !newState.equals(Environment.MEDIA_MOUNTED)) { + } else { + updateMemoryStatus(flash_path); + } + } + }; + + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/IrdaTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/IrdaTestActivity.java new file mode 100755 index 0000000..6d2fadb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/IrdaTestActivity.java @@ -0,0 +1,267 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.Permission; +import java.util.ArrayList; +import java.util.Arrays; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.rockchip.dmi.DmiInfo; +import com.rockchip.dmi.DmiUtil; + +import android.app.Activity; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PermissionInfo; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Handler.Callback; +import android.os.Looper; +import android.os.Message; +import android.os.Process; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.Window; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; + +public class IrdaTestActivity extends Activity implements OnClickListener { + private Button sirSend = null; + private Button sirReceive = null; + private Button firSend = null; + private Button firReceive = null; + private ProgressBar progressBar = null; + + Handler handler, myHandler; + private static final int TEST_SIR_SEND = 0; + private static final int TEST_SIR_RECEIVE = 1; + private static final int TEST_FIR_SEND = 2; + private static final int TEST_FIR_RECEIVE = 3; + boolean sirSendPass = false; + boolean sirReceivePass = false; + boolean firSendPass = false; + boolean firReceivePass = false; + + private final static String TEST_IRDA_PATH = DeviceTest.DATA_PATH + + "irda_test"; + File testIrdaFile = new File(TEST_IRDA_PATH); + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.irdatest); + + sirSend = (Button) findViewById(R.id.sir_send); + sirReceive = (Button) findViewById(R.id.sir_receive); + firSend = (Button) findViewById(R.id.fir_send); + firReceive = (Button) findViewById(R.id.fir_receive); + + sirSend.setTag(sirSend.getText()); + sirReceive.setTag(sirReceive.getText()); + firSend.setTag(firSend.getText()); + firReceive.setTag(firReceive.getText()); + + sirSend.setOnClickListener(this); + sirReceive.setOnClickListener(this); + firSend.setOnClickListener(this); + firReceive.setOnClickListener(this); + + progressBar = (ProgressBar) findViewById(R.id.irda_progress); + + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + + + InputStream is = null; + OutputStream os = null; + try { + is = getAssets().open("irda_test"); + os = new FileOutputStream(testIrdaFile); + int data = 0; + while (true) { + data = is.read(); + if (data < 0) { + break; + } + os.write(data); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (is != null) { + is.close(); + } + if (os != null) { + os.close(); + } + if (testIrdaFile.exists()) { + SystemUtil.execRootCmd("chmod 777 " + testIrdaFile); + } + } catch (Exception e) { + } + } + + + + myHandler = new Handler(); + + new Thread(new Runnable() { + + public void run() { + Looper.prepare(); + handler = new Handler() { + + public void handleMessage(Message msg) { + myHandler.post(new Runnable() { + + public void run() { + sirSend.setEnabled(false); + sirReceive.setEnabled(false); + firSend.setEnabled(false); + firReceive.setEnabled(false); + } + }); + + final boolean result; + final TextView resultView; + switch (msg.arg1) { + case TEST_SIR_SEND: + result = SystemUtil.execShellCmdForStatue(TEST_IRDA_PATH + " --sir-send") == 0; + resultView = sirSend; + if (result) { + sirSendPass = true; + } + break; + case TEST_SIR_RECEIVE: + result = SystemUtil.execShellCmdForStatue(TEST_IRDA_PATH + " --sir-receive") == 0; + resultView = sirReceive; + if (result) { + sirReceivePass = true; + } + break; + case TEST_FIR_SEND: + result = SystemUtil.execShellCmdForStatue(TEST_IRDA_PATH + " --fir-send") == 0; + resultView = firSend; + if (result) { + firSendPass = true; + } + break; + case TEST_FIR_RECEIVE: + result = SystemUtil.execShellCmdForStatue(TEST_IRDA_PATH + " --fir-receive") == 0; + resultView = firReceive; + if (result) { + firReceivePass = true; + } + break; + + default: + result = false; + resultView = null; + break; + } + + myHandler.post(new Runnable() { + + public void run() { + + sirSend.setEnabled(true); + sirReceive.setEnabled(true); + firSend.setEnabled(true); + firReceive.setEnabled(true); + + progressBar.setVisibility(View.INVISIBLE); + resultView.setText(resultView.getTag() + .toString() + + ":" + + (result ? "Success" : "Failed")); + if (sirSendPass && sirReceivePass + && firSendPass && firReceivePass) { + findViewById(R.id.btn_Pass).performClick(); + } + } + }); + } + }; + + Looper.loop(); + } + }).start(); + + + + } + + protected void onStop() { + super.onStop(); + + SystemUtil.killProcessByPath(TEST_IRDA_PATH); + + if (testIrdaFile.exists()) { + testIrdaFile.delete(); + } + } + + protected void onResume() { + super.onResume(); + } + + public void onPause() { + super.onPause(); + } + + public void onClick(View v) { + progressBar.setVisibility(View.VISIBLE); + + Message message = handler.obtainMessage(); + if (v == sirSend || v == sirReceive) { + if (v == sirSend) { + message.arg1 = TEST_SIR_SEND; + } else { + message.arg1 = TEST_SIR_RECEIVE; + } + } else { + if (v == firSend) { + message.arg1 = TEST_FIR_SEND; + } else { + message.arg1 = TEST_FIR_RECEIVE; + } + } + ((TextView) v).setText(v.getTag().toString() + ":Testing"); + + handler.sendMessage(message); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/KeyboardTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/KeyboardTestActivity.java new file mode 100755 index 0000000..a264596 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/KeyboardTestActivity.java @@ -0,0 +1,237 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; +import android.app.Activity; +import android.app.KeyguardManager; +import android.app.KeyguardManager.KeyguardLock; +import android.content.Context; +import android.graphics.Color; +import android.graphics.PixelFormat; +import android.os.Build; +import android.os.Bundle; +import android.os.RemoteException; +//import android.view.IWindowManager; +//import android.view.IWindowManager.Stub; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.view.View.OnKeyListener; +import android.widget.TextView; +import java.util.HashMap; + +import com.DeviceTest.helper.ConfigUtil; +import com.DeviceTest.helper.ControlButtonUtil; + +import android.util.Log; + +public class KeyboardTestActivity extends Activity { + static final int Key_Status_Down = 1; + static final int Key_Status_Null = 0; + static final int Key_Status_Up = 2; + + static final String TAG = "KeyboardTestActivity"; + + private int[] mButtonIds; + private HashMap<Integer, Integer> mButtonMaps = new HashMap(); + private HashMap<Integer, Integer> mButtonStatus = new HashMap(); + private int[] mKeyCodes; + private View v = null; + private WindowManager wm = null; + KeyguardLock kl = null; + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + setContentView(R.layout.keyboadtest); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); + //(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + ControlButtonUtil.initControlButtonView(this); + initButtonsMaps(); + + v = new View(KeyboardTestActivity.this); + wm = (WindowManager)KeyboardTestActivity.this.getSystemService(WINDOW_SERVICE); + KeyguardManager km= (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); + if (Build.VERSION.SDK_INT < ConfigUtil.ANDROID_SDK_VERSION_P) { + kl = km.newKeyguardLock("unLock"); + } +// findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + } + + public boolean onKeyDown(int keyCode, KeyEvent event) { + Log.d(TAG, "=============onKeyDown=========="); + return super.onKeyDown(keyCode, event); + } + + protected void onResume() { + super.onResume(); + + if (Build.VERSION.SDK_INT < ConfigUtil.ANDROID_SDK_VERSION_P) { + kl.disableKeyguard(); + } + //addWindow(); + } + @Override + protected void onPause() { + super.onPause(); + //removeWindow(); + if (Build.VERSION.SDK_INT < ConfigUtil.ANDROID_SDK_VERSION_P) { + kl.reenableKeyguard(); + } + } + private void initButtonsMaps() { + Log.d(TAG, "===========initButtonsMaps======"); + int[] resId = { R.id.bt_sounddown, R.id.bt_soundup, R.id.bt_home, + R.id.bt_menu, R.id.bt_back }; + mButtonIds = resId; + int[] keycode = { 25, 24, 3, 82, 4 }; + mKeyCodes = keycode; + + int i = 0; + int j = mButtonIds.length; + + Log.d(TAG, "I=" + i + " j = " + j); + + for (i = 0; i < j; i++) { + Integer key = Integer.valueOf(mKeyCodes[i]); + Integer value = Integer.valueOf(mButtonIds[i]); + mButtonMaps.put(key, value); + } + resetButtonBackground(); + } + + private boolean isTestKey(int keycode) { + int j = mKeyCodes.length; + int i = 0; + while (i < j) { + if (keycode == mKeyCodes[i]) { + return true; + } else { + i++; + } + } + return false; + } + + private void resetButtonBackground() { + Log.d(TAG, "resetButtonBackground()... ..."); + int i = mButtonIds.length; + int j = 0; + while (true) { + if (j >= i) + return; + int k = mButtonIds[j]; + findViewById(k).setBackgroundColor(Color.rgb(255, 255, 255)); + ((TextView)findViewById(k)).setTextColor(Color.BLACK); + j += 1; + } + } + + private void setButtonBackgroundDown(int resId) { + Log.d(TAG, "=====613========setButtonBackgroundDown"); + findViewById(resId).setBackgroundColor(Color.BLUE); + } + + private void setButtonBackgroundUp(int resId) { + Log.d(TAG, "======setButtonBackgroundUp"); + findViewById(resId).setBackgroundColor(Color.GREEN); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + int keyCode = event.getKeyCode(); + int actionCode = event.getAction(); + Log.d(TAG, "KeyCode = " + keyCode); + Log.d(TAG, "actionCode = " + actionCode); + if (!isTestKey(keyCode)) + return super.dispatchKeyEvent(event); + int value = 0; + Integer key = Integer.valueOf(keyCode); + value = mButtonMaps.get(key).intValue(); + Log.d(TAG, "================== value = " + value); + switch (actionCode) { + + case 0: + setButtonBackgroundDown(value); + mButtonStatus.put(key, Integer.valueOf(1)); + break; + + case 1: + setButtonBackgroundUp(value); + mButtonStatus.put(key, Integer.valueOf(1)); + if(event.getKeyCode()== KeyEvent.KEYCODE_HOME){ + Log.d(TAG,getWindow().getAttributes().type+ " _____________---- onKeyEEEE(), " + event.getKeyCode()); + return true; + }else if(event.getKeyCode()== KeyEvent.KEYCODE_BACK){ + Log.d(TAG,getWindow().getAttributes().type+ " _____________---- onKeyEEEE(), " + event.getKeyCode()); + return true; + } + break; + + default: + break; + } + +// if (mButtonStatus.size() == mButtonIds.length) { +// findViewById(R.id.btn_Pass).performClick(); +// } + return true; + } + + private void addWindow(){ + WindowManager.LayoutParams params = new WindowManager.LayoutParams(); + params.type = WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; +// params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; +// params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL +// | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; +// params.flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN +// | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; + params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; + params.width = 1;//WindowManager.LayoutParams.FILL_PARENT; + params.height = 1;//WindowManager.LayoutParams.FILL_PARENT; + params.format=PixelFormat.TRANSLUCENT; + params.gravity=Gravity.LEFT|Gravity.TOP; + //����Ļ���Ͻ�Ϊԭ�㣬����x��y��ʼֵ + params.x = 0; + params.y = 0; + wm.addView(v, params); + v.requestFocus(); + v.setOnKeyListener(new OnKeyListener(){ + public boolean onKey(View v, int keyCodee, KeyEvent event) { + Log.d(TAG, " _____________---- onKey(), " + event.getKeyCode()); + int keyCode = event.getKeyCode(); + int actionCode = event.getAction(); + Log.d(TAG, "KeyCode = " + keyCode); + Log.d(TAG, "actionCode = " + actionCode); + if (!isTestKey(keyCode)) + return false; + int value = 0; + Integer key = Integer.valueOf(keyCode); + value = mButtonMaps.get(key).intValue(); + Log.d(TAG, "================== value = " + value); + switch (actionCode) { + case 0: + setButtonBackgroundDown(value); + mButtonStatus.put(key, Integer.valueOf(1)); + break; + + case 1: + setButtonBackgroundUp(value); + mButtonStatus.put(key, Integer.valueOf(1)); + break; + default: + break; + } + return true; + + } + }); + } + private void removeWindow(){ + wm.removeView(v); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LcdTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LcdTestActivity.java new file mode 100755 index 0000000..340304e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LcdTestActivity.java @@ -0,0 +1,159 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.view.LcdTestView; + +import android.R.color; +import android.app.Activity; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.BitmapDrawable; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; +import android.util.Log; + +public class LcdTestActivity extends Activity { + public static final int MSG_LCD_TESTING = 2; + public static final int MSG_LCD_TEST_START = 1; + public static final int MSG_LCD_TES_END = 3; + + LcdTestView mLcdView; + boolean mTestOn; + TextView mText; + TextView mTitle; + int mTestCount = 0; + private static final int TEST_COLOR_COUNT = 5; + private static final int TEST_COLORS[] = new int[TEST_COLOR_COUNT]; + + private Canvas mCanvas = new Canvas(); + private Paint mPaint = new Paint(); + + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + TEST_COLORS[0] = Color.WHITE; + TEST_COLORS[1] = Color.BLACK; + TEST_COLORS[2] = Color.RED; + TEST_COLORS[3] = Color.GREEN; + TEST_COLORS[4] = Color.BLUE; + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + //getWindow().getDecorView().setSystemUiVisibility(4); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); + + setContentView(R.layout.lcdtest); + mTitle = (TextView) findViewById(R.id.lcdtextTitle); + mText = (TextView) findViewById(R.id.lcdtestresult); + mLcdView = (LcdTestView)findViewById(R.id.lcdtestview); + ControlButtonUtil.initControlButtonView(this); + ControlButtonUtil.Hide(); + } + + + protected void onPause() { + super.onPause(); + } + + + protected void onResume() { + super.onResume(); + } + + + public boolean onTouchEvent(MotionEvent paramMotionEvent) { + if (paramMotionEvent.getAction() == MotionEvent.ACTION_DOWN) { + mTestCount++; + + if(mTestCount >= 1 && mTestCount <= TEST_COLOR_COUNT) { + mLcdView.setBackgroundColor(TEST_COLORS[mTestCount - 1]); + } + + switch (mTestCount) { + case 1: + mTitle.setVisibility(View.GONE); + mText.setVisibility(View.GONE); + ControlButtonUtil.Hide(); + mLcdView.setVisibility(View.VISIBLE); + break; + case TEST_COLOR_COUNT +1: + mLcdView.grayScale(true); + mLcdView.paneBorder(false); + mLcdView.postInvalidate(); + break; + case TEST_COLOR_COUNT +2: + mLcdView.paneBorder(true); + mLcdView.grayScale(false); + mLcdView.postInvalidate(); + break; + case TEST_COLOR_COUNT + 3: + mLcdView.paneBorder(false); + mLcdView.grayScale(false); + mTestCount = 0; + mLcdView.setVisibility(View.GONE); + mTitle.setVisibility(View.VISIBLE); + ControlButtonUtil.Show(); + break; + default: + break; + } + } + return super.onTouchEvent(paramMotionEvent); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + }else if(event.getAction() == KeyEvent.ACTION_DOWN&&( event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP ||event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN)){ + mTestCount++; + + if(mTestCount >= 1 && mTestCount <= TEST_COLOR_COUNT) { + mLcdView.setBackgroundColor(TEST_COLORS[mTestCount - 1]); + } + switch (mTestCount) { + case 1: + mTitle.setVisibility(View.GONE); + mText.setVisibility(View.GONE); + ControlButtonUtil.Hide(); + mLcdView.setVisibility(View.VISIBLE); + break; + case TEST_COLOR_COUNT +1: + mLcdView.grayScale(true); + mLcdView.paneBorder(false); + mLcdView.postInvalidate(); + break; + case TEST_COLOR_COUNT +2: + mLcdView.paneBorder(true); + mLcdView.grayScale(false); + mLcdView.postInvalidate(); + break; + case TEST_COLOR_COUNT + 3: + mLcdView.paneBorder(false); + mLcdView.grayScale(false); + mTestCount = 0; + mLcdView.setVisibility(View.GONE); + mTitle.setVisibility(View.VISIBLE); + ControlButtonUtil.Show(); + break; + default: + break; + } + } + return super.dispatchKeyEvent(event); + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LedTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LedTestActivity.java new file mode 100755 index 0000000..dc63b82 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LedTestActivity.java @@ -0,0 +1,158 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.Permission; +import java.util.ArrayList; +import java.util.Arrays; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.rockchip.newton.UserModeManager; + +import android.app.Activity; +import android.app.Notification; +import android.app.NotificationManager; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PermissionInfo; +import android.graphics.Color; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.PowerManager; +import android.os.SystemClock; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; + +public class LedTestActivity extends Activity implements OnClickListener { + NotificationManager notificationManager; + private static final int NOTIFY_ID = 1000; +// +// private static final String POWER_LED_PATH = "/sys/class/leds/power_led/"; +// private static final String POWER_LED_BRIGHT = POWER_LED_PATH +// + "brightness"; +// // private static final String POWER_LED_FREQ = POWER_LED_PATH + "freq"; +// private static final String POWER_LED_PERIOD = POWER_LED_PATH + "period"; + + + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_FULLSCREEN); + setContentView(R.layout.ledtest); + + notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + + Button redButton = (Button) findViewById(R.id.red_btn); + Button yellowButton = (Button) findViewById(R.id.green_btn); + Button blueButton = (Button) findViewById(R.id.blue_btn); +// final Button powerButton = (Button) findViewById(R.id.power_btn); +// +// powerButton.setText("PowerLed"); +// powerButton.setOnClickListener(new OnClickListener() { +// +// +// public void onClick(View v) { +// String cmd = "echo 255 > " + POWER_LED_BRIGHT + "\necho 255 > " +// + POWER_LED_PERIOD; +// SystemUtil.execScriptCmd(cmd, +// DeviceTest.TEMP_FILE_PATH, true); +// powerButton.setEnabled(false); +// } +// }); + + redButton.setOnClickListener(this); + yellowButton.setOnClickListener(this); + blueButton.setOnClickListener(this); + + ControlButtonUtil.initControlButtonView(this); + + Notification notification; + + notification = new Notification(); + notification.flags |= Notification.FLAG_SHOW_LIGHTS; + notification.ledARGB = Color.RED; + notification.ledOffMS = 0; + notification.ledOnMS = 1; + redButton.setTag(notification); + + notification = new Notification(); + notification.flags |= Notification.FLAG_SHOW_LIGHTS; + notification.ledARGB = Color.GREEN; + notification.ledOffMS = 0; + notification.ledOnMS = 1; + yellowButton.setTag(notification); + + notification = new Notification(); + notification.flags |= Notification.FLAG_SHOW_LIGHTS; + notification.ledARGB = Color.BLUE; + notification.ledOffMS = 0; + notification.ledOnMS = 1; + blueButton.setTag(notification); + + } + + + protected void onStop() { + super.onStop(); + notificationManager.cancel(NOTIFY_ID); +// SystemUtil.execScriptCmd("echo 0 > " + POWER_LED_PERIOD, +// DeviceTest.TEMP_FILE_PATH, true); + } + + + protected void onResume() { + super.onResume(); + } + + + public void onPause() { + super.onPause(); + } + + + public void onClick(View v) { + notificationManager.notify(NOTIFY_ID, (Notification) v.getTag()); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LevelTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LevelTestActivity.java new file mode 100755 index 0000000..da69f62 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LevelTestActivity.java @@ -0,0 +1,75 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.view.LevelView; + +import android.R.color; +import android.app.Activity; +import android.content.Context; +import android.graphics.Color; +import android.hardware.SensorListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; +import android.util.Log; + +public class LevelTestActivity extends Activity { + + private LevelView levelView; + + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.leveltest); + levelView = (LevelView) findViewById(R.id.leveltestview); + + SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); + + sensorManager.registerListener(new SensorListener() { + + + public void onSensorChanged(int sensor, float[] values) { + levelView.update(values[0], values[1]); + } + + + public void onAccuracyChanged(int sensor, int accuracy) { + } + }, SensorManager.SENSOR_ACCELEROMETER); + ControlButtonUtil.initControlButtonView(this); + } + + + protected void onPause() { + super.onPause(); + } + + + protected void onResume() { + super.onResume(); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LightsensorTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LightsensorTestActivity.java new file mode 100755 index 0000000..e8a8019 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/LightsensorTestActivity.java @@ -0,0 +1,119 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.util.List; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; +import android.widget.TextView; + +/** + * @author LanBinYuan + * @date 2011-06-11 + * + */ + +public class LightsensorTestActivity extends Activity + implements SensorEventListener { + private static final String TAG = "LightsensorTestActivity"; + + private TextView txt_Light; + private TextView txt_sensor_info; + private TextView txt_sensor_event; + + /** Called when the activity is first created. */ + private SensorManager sensorManager; + + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.lightsensortest); + initView(); + ControlButtonUtil.initControlButtonView(this); + sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE); + + } + + private void initView() { + txt_Light = (TextView) findViewById(R.id.Light); + txt_Light.setTextColor(android.graphics.Color.RED); + txt_sensor_info = (TextView) findViewById(R.id.txt_sensor_info); + txt_sensor_event = (TextView) findViewById(R.id.txt_sensor_event); + txt_sensor_event.setTextColor(android.graphics.Color.GREEN); + } + + protected void onResume() { + super.onResume(); + + List<Sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_LIGHT); + if (null != sensors) { + for (Sensor s : sensors) { + Log.v(TAG, "registerListener " + s.getName()); + //updateSensorInfoText(s); + sensorManager.registerListener(this, s, + SensorManager.SENSOR_DELAY_NORMAL); + break; + } + } + } + + // + + protected void onStop() { + super.onStop(); + Log.v(TAG, "unregisterListener"); + sensorManager.unregisterListener(this); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + private void updateSensorInfoText(Sensor sensor) { + StringBuilder sb = new StringBuilder(); + sb.append("name:" + sensor.getName() + "\n"); + sb.append("vendor:" + sensor.getVendor() + "\n"); + sb.append("version:" + sensor.getVersion() + "\n"); + sb.append("maxRange:" + sensor.getMaximumRange() + "\n"); + sb.append("resolution:" + sensor.getResolution() + "\n"); + sb.append("power:" + sensor.getPower() + "\n"); + txt_sensor_info.setText(sb.toString()); + } + + @Override + public void onSensorChanged(SensorEvent e) { + Sensor sensor = e.sensor; + switch (sensor.getType()) { + case Sensor.TYPE_LIGHT: { + updateSensorInfoText(sensor); + String event = "Light:" + e.values[SensorManager.DATA_X]; + //Log.v(TAG, "onSensorChanged" + event); + txt_sensor_event.setText(event); + } + default: + break; + } + } + + @Override + public void onAccuracyChanged(Sensor sensor, int i) { + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MobileNetTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MobileNetTestActivity.java new file mode 100755 index 0000000..c289177 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MobileNetTestActivity.java @@ -0,0 +1,114 @@ +package com.DeviceTest; +import java.io.File; +import java.io.FilenameFilter; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemInfoUtil; +import android.view.View; +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.SystemProperties; +import android.os.storage.StorageEventListener; +import android.text.format.Formatter; +import android.util.Log; +import android.widget.Button; +import android.widget.TextView; +import android.view.KeyEvent; +import android.telephony.TelephonyManager; + +public class MobileNetTestActivity extends Activity { + private final static String TAG = "MobileNetTestActivity"; + private final static int MSG_OK=0; + private final static int MSG_FAIL=1; + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + setContentView(R.layout.mobilenettest); + int simTestResult = 0; + int moduleTestResult = 0; + + TextView simView = (TextView) findViewById(R.id.simView); + TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imsi = mTelephonyMgr.getSubscriberId(); + + if (imsi == null) { + simView.setText("Cann't get IMSI!"); + + } else { + simView.setText("IMSI:" + imsi); + simTestResult = 1; + } + + TextView moduleView = (TextView) findViewById(R.id.moduleView); + + String directoryPath = "/dev"; + File directory = new File(directoryPath); + File[] ttyUSBFiles = directory.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.startsWith("ttyUSB"); + } + }); + + if (ttyUSBFiles != null) { + int count = ttyUSBFiles.length; + if (count < 2){ + moduleView.setText("4G Module check fail"); + }else { + moduleView.setText("4G Module check OK"); + moduleTestResult = 1; + } + } else { + moduleView.setText("4G Module check fail"); + } + + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + //if (simTestResult == 1 && moduleTestResult == 1) { + // only check 4G module + if (moduleTestResult == 1) { + handler.sendEmptyMessageDelayed(MSG_OK, 2000); + } else { + handler.sendEmptyMessageDelayed(MSG_FAIL, 2000); + } + } + + private Handler handler=new Handler(){ + @Override + public void handleMessage(Message msg) { + switch(msg.what){ + case MSG_OK: + ((Button) findViewById(R.id.btn_Pass)).performClick(); + + case MSG_FAIL: + ((Button) findViewById(R.id.btn_Fail)).performClick(); + } + } + }; + + @Override + protected void onResume() { + super.onResume(); + } + + public void onCancel(DialogInterface dialog) { + finish(); + } + + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MrioUSBTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MrioUSBTestActivity.java new file mode 100755 index 0000000..361a995 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MrioUSBTestActivity.java @@ -0,0 +1,100 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.BatteryManager; +import android.os.Bundle; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; +import android.os.Environment; +//import android.hardware.Usb; +import android.util.Log; + +public class MrioUSBTestActivity extends Activity { + private static final String TAG = "USBConnectPCTestActivity"; + private BroadcastReceiver mUsbStateReceiver; + TextView mUsbPluginText; + TextView mUsbUnplugText; + boolean pluginPass = false; + boolean unplugPass = false; + boolean stop = false; + + + protected void onCreate(Bundle savedInstanceState) { + Log.d(TAG, "=========onCreate============"); + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.mriousbtest); + ControlButtonUtil.initControlButtonView(this); + + mUsbStateReceiver = new UsbConnectedBroadcastReceiver(); + + mUsbPluginText = (TextView) findViewById(R.id.pluginTest); + + mUsbUnplugText = (TextView) findViewById(R.id.unplugTest); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + } + + + protected void onResume() { + super.onResume(); + stop = false; + IntentFilter intentFilter = new IntentFilter( + Intent.ACTION_UMS_CONNECTED); + intentFilter.addAction(Intent.ACTION_UMS_DISCONNECTED); + registerReceiver(mUsbStateReceiver, intentFilter); + } + + + public void onPause() { + super.onPause(); + stop = true; + unregisterReceiver(mUsbStateReceiver); + } + + class UsbConnectedBroadcastReceiver extends BroadcastReceiver { + + public void onReceive(Context context, Intent intent) { + if(stop) { + return; + } + if (intent.getAction().equals(Intent.ACTION_UMS_CONNECTED)) { + if(!pluginPass) { + pluginPass = true; + mUsbPluginText.setText(mUsbPluginText.getText() + "Pass"); + } + } else if (intent.getAction() + .equals(Intent.ACTION_UMS_DISCONNECTED)) { + if(!unplugPass) { + unplugPass = true; + mUsbUnplugText.setText(mUsbUnplugText.getText() + "Pass"); + } + } + if (pluginPass && unplugPass) { + findViewById(R.id.btn_Pass).performClick(); + } + } + }; + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MsensorTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MsensorTestActivity.java new file mode 100755 index 0000000..6b232c3 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/MsensorTestActivity.java @@ -0,0 +1,120 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.util.List; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.graphics.Color; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; +import android.widget.TextView; + +/** + * @author LanBinYuan + * @date 2011-06-11 + * + */ + +public class MsensorTestActivity extends Activity { + /** Called when the activity is first created. */ + private SensorManager sensorManager; + private SensorEventListener lsn = null; + + + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.msensortest); + ControlButtonUtil.initControlButtonView(this); + sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE); + + } + + + protected void onResume() { + super.onResume(); + + lsn = new SensorEventListener() { + public void onAccuracyChanged(Sensor sensor, int accuracy) { + // TODO Auto-generated method stub + + } + + public void onSensorChanged(SensorEvent e) { + TextView subTitle = (TextView) findViewById(R.id.Magnetic); + subTitle.setTextColor(Color.rgb(255, 0, 0)); + + String info = " name:" + String.valueOf(e.sensor.getName()); + info += "\n"; + + info += " vendor:" + String.valueOf(e.sensor.getVendor()); + info += "\n"; + info += " version:" + String.valueOf(e.sensor.getVersion()); + info += "\n"; + info += " maxRange:" + + String.valueOf(e.sensor.getMaximumRange()); + info += "\n"; + info += " resolution:" + + String.valueOf(e.sensor.getResolution()); + info += "\n"; + info += " power:" + String.valueOf(e.sensor.getPower()); + + TextView infoView = (TextView) findViewById(R.id.magnetic_info); + infoView.setText(info); + // -------------- + + TextView x = (TextView) findViewById(R.id.magnetic_x); + x.setText(" x:" + + String.valueOf(e.values[SensorManager.DATA_X])); + x.setTextColor(android.graphics.Color.GREEN); + + TextView y = (TextView) findViewById(R.id.magnetic_y); + y.setText(" y:" + + String.valueOf(e.values[SensorManager.DATA_Y])); + y.setTextColor(android.graphics.Color.GREEN); + + TextView z = (TextView) findViewById(R.id.magnetic_z); + z.setText(" z:" + + String.valueOf(e.values[SensorManager.DATA_Z])); + z.setTextColor(android.graphics.Color.GREEN); + + } + + }; + + Sensor sensors = sensorManager + .getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); + + sensorManager.registerListener(lsn, sensors, + SensorManager.SENSOR_DELAY_NORMAL); + } + + // + + protected void onStop() { + super.onStop(); + sensorManager.unregisterListener(lsn); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PCIETestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PCIETestActivity.java new file mode 100755 index 0000000..843c5ba --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PCIETestActivity.java @@ -0,0 +1,171 @@ +package com.DeviceTest; + +import android.os.Message; +import android.os.SystemService; +import android.util.Log; +import android.view.View; + +import com.DeviceTest.helper.PCIEInfo; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class PCIETestActivity extends UsbHostTestActivity { + private static final String TAG = "PCIETestActivity"; + private static final int MSG_CHECK_PCIE_INFO_FILE = 11; + + private boolean mStop; + private String mPCIEInfoPath; + private String mStrStorageResult; + + @Override + protected void preData() { + mStorageType = STORAGE_TYPE.PCIE; + } + + @Override + protected void dealMessage(Message msg) { + if (mStop) { + return; + } + switch (msg.what) { + case MSG_CHECK_PCIE_INFO_FILE: + testPcieInfo(); + break; + default: + break; + } + } + + private void testPcieInfo() { + String staFlag = "LnkSta:"; + List<String> list = readPcieInfoTxt(mPCIEInfoPath, new String[]{staFlag}, "\t"); + if (list.size() < 1 /*|| list.size() % 2 == 1*/) { + appendResultText("pcieInfo file txt err"); + mHandler.sendEmptyMessageDelayed(R_PASS, BACK_TIME); + return; + } + StringBuilder sb = new StringBuilder(); + for (String temp : list) { + sb.append(temp + "\n"); + } + Log.v(TAG, sb.toString()); + appendResultText(sb.toString()); + + List<PCIEInfo> lnkModelList = fillPcieInfoTxt(list, staFlag); + if (lnkModelList.size() < 1/* || lnkModelList.size() % 2 == 1*/) { + sb.append("\npcieInfo lnk txt err"); + appendResultText(sb.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, BACK_TIME); + return; + } + + sb = new StringBuilder(); + for (PCIEInfo lnk : lnkModelList) { + sb.append("\n"); + sb.append(lnk.toString()); + } + appendResultText(sb.toString()); + findViewById(R.id.btn_Pass).setVisibility(View.VISIBLE); + findViewById(R.id.btn_Pass).setClickable(true); + findViewById(R.id.btn_Fail).setVisibility(View.VISIBLE); + findViewById(R.id.btn_Fail).setClickable(true); + } + + private List<String> readPcieInfoTxt(String path, String[] containWords, String replace) { + List<String> list = new ArrayList<String>(); + BufferedReader br = null; + FileReader fr = null; + try { + File file = new File(path); + if (!file.exists()) { + Log.e(TAG, path + " not exists"); + return list; + } + fr = new FileReader(file); + br = new BufferedReader(fr); + String lineText; + while ((lineText = br.readLine()) != null) { + lineText = lineText.replaceAll("\t", ""); + for (String containWord : containWords) { + if (lineText.contains(containWord)) { + list.add(lineText); + } + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + if (null != fr) { + try { + fr.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return list; + } + + private List<PCIEInfo> fillPcieInfoTxt(List<String> vvInfoList, String staFlag) { + List<PCIEInfo> lnks = new ArrayList<PCIEInfo>(); + for (String vvInfo : vvInfoList) { + if (vvInfo.startsWith(staFlag)) { + PCIEInfo tempLnk = new PCIEInfo(); + String[] temps = vvInfo.replace(staFlag, "").split(", "); + for (String temp : temps) { + if (temp.startsWith("Speed ")) { + tempLnk.setStaSpeed(temp.replace("Speed ", "")); + } else if (temp.startsWith("Width ")) { + tempLnk.setStaWidth(temp.replace("Width ", "")); + } + } + lnks.add(tempLnk); + } + } + return lnks; + } + + private void appendResultText(String ss) { + mResult.setText(mStrStorageResult + "\n\n" + ss); + } + + @Override + protected void childTest() { + Log.v(TAG, "test PCIE info"); + if (null != mResult.getText() && null != mResult.getText().toString()) { + mStrStorageResult = mResult.getText().toString(); + } + appendResultText("waiting PCIE info test..."); + mPCIEInfoPath = "/mnt/sdcard/pcieInfo.tmp"; + File file = new File(mPCIEInfoPath); + if (null != file && file.exists()) { + file.delete(); + } + try { + SystemService.start("read_pcie_info"); + mHandler.sendEmptyMessageDelayed(MSG_CHECK_PCIE_INFO_FILE, 2000); + } catch (Exception e) { + appendResultText("err " + e.getMessage()); + mHandler.sendEmptyMessageDelayed(R_FAIL, BACK_TIME); + } + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mStop = true; + mHandler.removeMessages(MSG_CHECK_PCIE_INFO_FILE); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PhoneMicTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PhoneMicTestActivity.java new file mode 100755 index 0000000..5d8e509 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PhoneMicTestActivity.java @@ -0,0 +1,241 @@ +package com.DeviceTest; + +import java.io.File; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.media.AudioManager; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.TextView; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.Recorder; +import com.DeviceTest.helper.VUMeter; + +public class PhoneMicTestActivity extends Activity implements OnClickListener{ + private static final String TAG = PhoneMicTestActivity.class + .getSimpleName(); + + private final static String ERRMSG = "Record error"; + private final static int RECORD_TIME = 3; + private static final int MSG_TEST_MIC_ING = 8738; + private static final int MSG_TEST_MIC_OVER = 13107; + private static final int MSG_TEST_MIC_START = 4369; + private boolean isSDcardTestOk = false; + private AudioManager mAudioManager; + private Handler mHandler; + private int mOldVolume; + private Recorder mRecorder; + private TextView mResult; + boolean mSpeakerOn = false; + private TextView mText; + int mTimes; + TextView mTitle; + private Button mBtnRetest; + private VUMeter mVUMeter; + + public PhoneMicTestActivity() { + this.mHandler = new MyHandler(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + requestWindowFeature(Window.FEATURE_NO_TITLE); + + getWindow().addFlags(1152); + setContentView(R.layout.phonemictest); + + mVUMeter = (VUMeter) findViewById(R.id.uvMeter); + this.mResult = (TextView) findViewById(R.id.phoneresultText); + this.mResult.setVisibility(View.VISIBLE); + this.mResult.setGravity(17); + ControlButtonUtil.initControlButtonView(this); + mBtnRetest = (Button)findViewById(R.id.btn_retest); + mBtnRetest.setOnClickListener(this); + mBtnRetest.setEnabled(false); + this.mRecorder = new Recorder(); + this.mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + mVUMeter.setRecorder(mRecorder); + } + + @Override + protected void onResume() { + + super.onResume(); + + this.isSDcardTestOk = false; + if (!Environment.getExternalStorageState().equals( + Environment.MEDIA_MOUNTED)) { + this.mResult.setText(R.string.InsertSdCard); + return; + } + + if (!isSDcardHasSpace()) { + this.mResult.setText(R.string.SdCardNospace); + stopMediaPlayBack(); + return; + } + stopMediaPlayBack(); + this.isSDcardTestOk = true; + + this.mOldVolume = this.mAudioManager + .getStreamVolume(AudioManager.STREAM_MUSIC); + int maxVolume = this.mAudioManager + .getStreamMaxVolume(AudioManager.STREAM_MUSIC); + this.mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, + maxVolume, 0); + + this.mSpeakerOn = mAudioManager.isSpeakerphoneOn(); + + if (!this.mSpeakerOn) { + this.mAudioManager.setSpeakerphoneOn(true); + } + this.mHandler.sendEmptyMessage(MSG_TEST_MIC_START); + + } + + @Override + protected void onPause() { + + super.onPause(); + + if (this.isSDcardTestOk) { + + switch (this.mRecorder.state()) { + + case Recorder.IDLE_STATE: + this.mRecorder.delete(); + break; + case Recorder.PLAYING_STATE: + this.mRecorder.stop(); + this.mRecorder.delete(); + break; + case Recorder.RECORDING_STATE: + this.mRecorder.stop(); + this.mRecorder.clear(); + break; + } + + + mAudioManager.setStreamVolume(3, mOldVolume, 0); + + if (mSpeakerOn) { + mAudioManager.setSpeakerphoneOn(false); + + } + } + + } + + public void stopMediaPlayBack() { + Intent localIntent = new Intent("com.android.music.musicservicecommand"); + localIntent.putExtra("command", "pause"); + sendBroadcast(localIntent); + } + + public boolean isSDcardHasSpace() { + File pathFile = android.os.Environment.getExternalStorageDirectory(); + + StatFs statfs = new StatFs(pathFile.getPath()); + + if (statfs.getAvailableBlocks() > 1) { + + return true; + + } + + return false; + + } + + class MyHandler extends Handler { + MyHandler() { + } + + @Override + public void handleMessage(Message msg) { + + + switch (msg.what) { + default: + case MSG_TEST_MIC_START: + + removeMessages(MSG_TEST_MIC_START); + mTimes = RECORD_TIME; + + mResult.setText(" "+mTimes+" "); + mRecorder.startRecording(3, ".amr"); + sendEmptyMessageDelayed(MSG_TEST_MIC_ING, 1000L); + break; + case MSG_TEST_MIC_ING: + + + + if (mTimes > 0) { + + mResult.setText(" "+mTimes+" "); + mTimes--; + Log.i(TAG, "mTimes=" + mTimes); + sendEmptyMessageDelayed(MSG_TEST_MIC_ING, 1000L); + } else { + removeMessages(MSG_TEST_MIC_ING); + sendEmptyMessage(MSG_TEST_MIC_OVER); + + } + + break; + case MSG_TEST_MIC_OVER: + removeMessages(MSG_TEST_MIC_OVER); + mRecorder.stopRecording(); + if (mRecorder.sampleLength() > 0) { + mResult.setText(R.string.HeadsetRecodrSuccess); + mRecorder.startPlayback(); + } else { + mResult.setText(R.string.RecordError); + } + mBtnRetest.setEnabled(true); + break; + } + + mVUMeter.invalidate(); + } + + } + + public void onClick(View v) { + switch (this.mRecorder.state()) { + + case Recorder.IDLE_STATE: + this.mRecorder.delete(); + break; + case Recorder.PLAYING_STATE: + this.mRecorder.stop(); + this.mRecorder.delete(); + break; + } + mRecorder.stopPlayback(); + mBtnRetest.setEnabled(false); + this.mHandler.sendEmptyMessage(MSG_TEST_MIC_START); + + } + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PowerTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PowerTestActivity.java new file mode 100755 index 0000000..3e73cbb --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/PowerTestActivity.java @@ -0,0 +1,226 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.OutputStreamWriter; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.rockchip.newton.UserModeManager; + +import android.R.integer; +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.BatteryManager; +import android.os.Bundle; +import android.os.PowerManager; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; + +public class PowerTestActivity extends Activity { + TextView mBattery; + private BroadcastReceiver mBatteryInfoReceiver; + TextView mChargeStatus; + TextView mVoltage; + TextView mCurrent; + TextView mCapacity; + TextView mPlug; + private static final String CURRENT_PATH = "/sys/class/power_supply/*battery/current_now"; + + boolean stop = false; + + int mLastVoltage = -1; + + TextView pluginView; + TextView unplugView; + boolean pluginPass = false; + boolean unplugPass = false; + + public PowerTestActivity() { + + this.mBatteryInfoReceiver = new MyBroadcastReceiver(); + + } + + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.powertest); + ControlButtonUtil.initControlButtonView(this); + + this.mChargeStatus = (TextView) findViewById(R.id.chargeStatusText); + this.mVoltage = (TextView) findViewById(R.id.voltageText); + this.mCurrent = (TextView) findViewById(R.id.currentText); + this.mCapacity = (TextView) findViewById(R.id.capacityText); + this.mPlug = (TextView) findViewById(R.id.plugText); + +// findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + pluginView = (TextView) findViewById(R.id.pluginTest); + unplugView = (TextView) findViewById(R.id.unplugTest); + } + + + protected void onResume() { + super.onResume(); + stop = false; + IntentFilter localIntentFilter = new IntentFilter( + Intent.ACTION_BATTERY_CHANGED); + registerReceiver(this.mBatteryInfoReceiver, localIntentFilter); + } + + + public void onPause() { + super.onPause(); + stop = true; + BroadcastReceiver localBroadcastReceiver = this.mBatteryInfoReceiver; + unregisterReceiver(localBroadcastReceiver); + + } + + class MyBroadcastReceiver extends BroadcastReceiver { + public void onReceive(Context paramContext, Intent intent) { + if (stop) { + return; + } + String action = intent.getAction(); + + if (!Intent.ACTION_BATTERY_CHANGED.equals(action)) { + return; + + } + + int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0); + + int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); + int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100); + + int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0); + int voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0); + Log.e("Jeffy", "plugged:" + plugged); + // int current = -1; + // try { + // DataInputStream dis = new DataInputStream(new FileInputStream( + // CURRENT_PATH)); + // current = Integer.parseInt(dis.readLine()); + // dis.close(); + // } catch (FileNotFoundException e) { + // e.printStackTrace(); + // } catch (IOException e) { + // e.printStackTrace(); + // } + int current = -1; + try { + String currentStr = SystemUtil.execScriptCmd("cat " + + CURRENT_PATH, DeviceTest.TEMP_FILE_PATH, true); + if (currentStr.length() > 0) { + current = Integer.parseInt(currentStr); + } + } catch (Exception e) { + e.printStackTrace(); + } + + String statusString = ""; + + switch (status) { + case BatteryManager.BATTERY_STATUS_UNKNOWN: + statusString = "Unknown"; + break; + case BatteryManager.BATTERY_STATUS_CHARGING: + statusString = "Charging"; + + break; + case BatteryManager.BATTERY_STATUS_DISCHARGING: + statusString = "Discharging"; + break; + case BatteryManager.BATTERY_STATUS_NOT_CHARGING: + statusString = "Not Charging"; + break; + case BatteryManager.BATTERY_STATUS_FULL: + statusString = "Full"; + break; + } + mChargeStatus.setText(getString(R.string.ChargeState) + statusString); + + mVoltage.setText(getString(R.string.Voltage) + voltage + "mV"); + + if (current != -1) { + mCurrent.setText("Current:" + (current / 1000) + "mA"); + } else { + mCurrent.setVisibility(View.GONE); + } + + mCapacity.setText(getString(R.string.Capacity) + (level * 100 / scale) + "%"); + + boolean acPlugin = false; + String pluggedStr = ""; + switch (plugged) { + case BatteryManager.BATTERY_PLUGGED_AC: + acPlugin = true; + pluggedStr = "AC"; + break; + case BatteryManager.BATTERY_PLUGGED_USB: + pluggedStr = "USB"; + break; + + default: + pluggedStr = "Unplugged"; + break; + } + mPlug.setText(getString(R.string.Plug) + pluggedStr); + +// if (mLastVoltage > 0) { +// if (acPlugin) { +// if (voltage > mLastVoltage) { +// if (!pluginPass) { +// pluginPass = true; +// pluginView.setText(pluginView.getText() + "Pass"); +// } +// } +// } else { +// if (voltage < mLastVoltage) { +// if (!unplugPass) { +// unplugPass = true; +// unplugView.setText(unplugView.getText() + "Pass"); +// } +// } +// } +// } +// +// if (pluginPass && unplugPass) { +// findViewById(R.id.btn_Pass).performClick(); +// } + +// mLastVoltage = voltage; + } + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RTCTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RTCTestActivity.java new file mode 100755 index 0000000..c250c7d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RTCTestActivity.java @@ -0,0 +1,139 @@ +package com.DeviceTest; +import java.io.File; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemInfoUtil; +import android.view.View; +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.SystemProperties; +import android.os.storage.StorageEventListener; +import android.text.format.Formatter; +import android.util.Log; +import android.widget.Button; +import android.widget.TextView; +import android.view.KeyEvent; + +import java.io.File; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemInfoUtil; + +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.SystemProperties; +import android.os.storage.StorageEventListener; +import android.text.format.Formatter; +import android.util.Log; +import android.widget.Button; +import android.widget.TextView; +import android.hardware.usb.UsbDevice; +import android.hardware.usb.UsbManager; +import java.util.Iterator; +import java.util.HashMap; +import java.io.FileReader; + + + +public class RTCTestActivity extends Activity { + private final static String TAG = "RTCTestActivity"; + private final static int MSG_OK=0; + private final static int MSG_FAIL=1; + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + setContentView(R.layout.rtctest); + + int count = 0; + String str = null; + File rtcFile = new File("/sys/class/rtc/"); + File[] list = rtcFile.listFiles(); + + String rtcStr = ""; + + + for (File f: list){ + count ++; + Log.d("RRRRRRR", "rtc file:" + f.getName()); + char[] buffer = new char[32]; + try { + FileReader mReader = new FileReader(new File(f.getPath() + "/name")); + mReader.read(buffer, 0, 32); + mReader.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + str = new String(buffer).trim(); + if (str.equals("aml_vrtc")){ + //skip + } else if (str.equals("rk808-rtc rk808-rtc")){ + //skip + //((TextView) findViewById(R.id.RTCResult)).setText("检测到内部RTC: " + str + "\n" + "请务必确认板子是否有外置RTC芯片!!"); + rtcStr += f.getName() + " :" + str + "\n"; + } else { + // count++; + // if (count > 0) { + // ((TextView) findViewById(R.id.RTCResult)).setText("RTC设备数: " + count + ", RTC型号:" + str); + // // handler.sendEmptyMessageDelayed(MSG_OK, 1000); + // } else { + // ((TextView) findViewById(R.id.RTCResult)).setText("没有找到RTC设备."); + // // handler.sendEmptyMessageDelayed(MSG_FAIL, 1000); + //} + rtcStr += f.getName() + " :" + str + "\n"; + } + } + rtcStr = "RTC 设备数量:" + count + "\n" + rtcStr; + ((TextView) findViewById(R.id.RTCResult)).setText(rtcStr); + + ControlButtonUtil.initControlButtonView(this); + // findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); //屏蔽确认按键 + } + + private Handler handler=new Handler(){ + @Override + public void handleMessage(Message msg) { + switch(msg.what){ + case MSG_OK: + ((Button) findViewById(R.id.btn_Pass)).performClick(); + case MSG_FAIL: + ((Button) findViewById(R.id.btn_Fail)).performClick(); + } + } + }; + + + @Override + protected void onResume() { + super.onResume(); + } + + public void onCancel(DialogInterface dialog) { + finish(); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} + diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RockVideoPlayer.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RockVideoPlayer.java new file mode 100755 index 0000000..adab2c9 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RockVideoPlayer.java @@ -0,0 +1,398 @@ +/* + * Copyright (C) 2009 The Rockchip Android MID 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.DeviceTest; + + +import java.io.File; + +import android.app.Dialog; +import android.app.ListActivity; +import android.app.ProgressDialog; +import android.content.AsyncQueryHandler; +import android.content.BroadcastReceiver; +import android.content.ContentResolver; +import android.content.ContentUris; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.provider.MediaStore; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.widget.Button; +import android.widget.ListView; +import android.widget.Toast; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.VideoListAdapter; +import com.DeviceTest.helper.TestCase.RESULT; + +public class RockVideoPlayer extends ListActivity + implements View.OnCreateContextMenuListener{ + private static final String TAG = "RockVideoPlayer"; + private static final boolean DEBUG = true; + public static void LOG(String msg) + { + if(DEBUG) + { + Log.d(TAG,msg); + } + } + //private ArrayList<VideoItem> VideoSet; + private String[] mCols = new String[] { + MediaStore.Video.Media._ID, + MediaStore.Video.Media.TITLE, + MediaStore.Video.Media.DISPLAY_NAME, + MediaStore.Video.Media.DURATION, + MediaStore.Video.Media.MIME_TYPE, + MediaStore.Video.Media.SIZE, + MediaStore.Video.Media.BOOKMARK, + MediaStore.Video.Media.DATA + }; + /*���Ե�cursor,�������������� */ + public Cursor mVideoCursor; + private String mSortOrder; + private VideoListAdapter mVideoListAdapter; + private Uri mCurrentVideoUri; + private String mCurrentVideoFilename; + private View MainView; + private View sNoFileView; + static final int DIALOG_DELETE_CHOICE = 1; + static final int DIALOG_DELETE_CONFIRM = 2; + private static final int PlayDone = 1; + private int mLastPosition = 0; + int timeoutmode; + int screenOn; + int mOldBrightness; + boolean mForbidenClick = false; + private Dialog mMediaScanningDialog; + private ProgressDialog pd; + private BroadcastReceiver mReceiver; + private ListView mVideoList; + private Uri mUri; + public RockVideoPlayer(){ + } + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + setContentView(R.layout.main_display_land); + MainView = findViewById(R.id.main_layout); + sNoFileView = findViewById(R.id.novideofile); + ControlButtonUtil.initControlButtonView(this); + } + public void VideoDisplayVisible() + { + LOG("Begin to setListAdapter"); + VideoDisplay(); + mForbidenClick = false; + //RockVideoPlayer.this.getListView().setSelection(mLastPosition); + } + public void VideoDisplayVInVisible() + { + sNoFileView.setVisibility(View.VISIBLE); + } + + @Override + public void onResume() { + LOG("Enter onResume()"); + super.onResume(); + String Dilog_tile = getResources().getString(R.string.load_title); + String Dilog_wait = getResources().getString(R.string.wait); + pd = ProgressDialog.show(this, Dilog_tile,Dilog_wait, true, false); + IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED); + intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); + intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED); + intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); + intentFilter.addAction(Intent.ACTION_MEDIA_EJECT); + intentFilter.addDataScheme("file"); + mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + + String action = intent.getAction(); + LOG("action = " + action); + if (action.equals(Intent.ACTION_MEDIA_MOUNTED)) { + } else if (action.equals(Intent.ACTION_MEDIA_EJECT) + ||action.equals(Intent.ACTION_MEDIA_UNMOUNTED)){ + finish(); + return; + } else if (action.equals(Intent.ACTION_MEDIA_SCANNER_STARTED) + ||action.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) { + mReScanHandler.sendEmptyMessage(0); + } + } + }; + registerReceiver(mReceiver, new IntentFilter(intentFilter)); + VideoDisplayVisible(); + } + public void updataAdapter() + { + LOG("Enter updataAdapter()"); + LOG("mVideoListAdapter = " + mVideoListAdapter); + setListAdapter(mVideoListAdapter); + setVideoDisplayViewBackground(); + + } + public void setVideoDisplayViewBackground() + { + LOG("Enter setVideoDisplayViewBackground() "); + + if (mVideoListAdapter == null) + //MainView.setBackgroundResource(R.drawable.novideofile); + sNoFileView.setVisibility(View.VISIBLE); + else{ + if(mVideoCursor == null){ + //MainView.setBackgroundResource(R.drawable.novideofile); + sNoFileView.setVisibility(View.VISIBLE); + }else if(mVideoCursor.moveToFirst() == false){ + //MainView.setBackgroundResource(R.drawable.novideofile); + sNoFileView.setVisibility(View.VISIBLE); + } + else if( mVideoCursor.moveToFirst() != false && mVideoCursor.getCount()!= 0){ + //MainView.setBackgroundColor(R.color.black); + { + sNoFileView.setVisibility(View.GONE); + // RockVideoPlayer.this.getListView().setSelection(mLastPosition); + } + }else{ + sNoFileView.setVisibility(View.VISIBLE); + } + } + } + @Override + public void onRestart() + { + LOG("Enter onRestart()"); + super.onRestart(); + //RockVideoPlayer.this.getListView().setSelection(mLastPosition); + } + @Override + public void onPause() { + LOG("Enter onPause()"); + super.onPause(); + Uri uri = mUri; + mReScanHandler.removeCallbacksAndMessages(null); + unregisterReceiverSafe(mReceiver); + System.gc(); + } + @Override + public void onDestroy() { + LOG("Enter onDestroy()"); + unregisterReceiverSafe(mReceiver); + super.onDestroy(); + } + private void unregisterReceiverSafe(BroadcastReceiver receiver) { + try { + unregisterReceiver(receiver); + } catch (IllegalArgumentException e) { + // ignore + } + } + public void VideoDisplay() + { + LOG("Enter VideoDisplay()"); + mVideoList = getListView(); + if (mVideoListAdapter == null){ + mVideoListAdapter = new VideoListAdapter( + RockVideoPlayer.this, // need to use application context to avoid leaks + this, + R.layout.video_item_land, + null, // cursor + new String[] {}, + new int[] {} + ); + LOG("mVideoListAdapter = " + mVideoListAdapter); + mVideoListAdapter.setActivity(this); + setListAdapter(mVideoListAdapter); + getVideoCursor(mVideoListAdapter.getQueryHandler()); + + }else{ + mVideoListAdapter.setActivity(this); + mVideoCursor = mVideoListAdapter.getCursor(); + LOG("mVideoCursor = " + mVideoCursor); + if (mVideoCursor != null) { + initVideoCursor(mVideoCursor); + } else { + getVideoCursor(mVideoListAdapter.getQueryHandler()); + } + LOG("mVideoCursor2 = " + mVideoCursor); + setListAdapter(mVideoListAdapter); + setVideoDisplayViewBackground(); + } + } + @Override + protected void onListItemClick(ListView l, View v, int position, long id) + { + LOG("onListItemClick:mForbidenClick = " + mForbidenClick); + + mLastPosition = position; + String videoid = Long.valueOf(id).toString(); + Uri uri = Uri.withAppendedPath(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, + videoid); + if(uri == null){ + return; + } + Cursor cur = getCurrentCursor(this,uri); + if(cur == null) + return; + String tepMimetype = cur.getString(cur.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE)); + if(checkVideoAvailable(this, cur)){ + /* Intent intent = new Intent(Intent.ACTION_VIEW, uri); + intent.putExtra(name, value); + intent.setClass(this, VideoPlayActivity.class); + intent.putExtra("mediaTypes", tepMimetype); + startActivityForResult(intent,PlayDone);*/ + // Intent intent = new Intent("com.rk.app.mediafloat.CUSTOM_ACTION"); + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(uri, tepMimetype); + + // intent.putExtra("URI", uri.toString()); + //intent.putExtra("POSITION", 0); + startActivity(intent); + // ControlButtonUtil. setIntent("com.rk.app.mediafloat.CUSTOM_ACTION"); + mForbidenClick = true; + } + + } + public Cursor getCurrentCursor(Context context,Uri currenturi) + { + Uri uri = MediaStore.Video.Media.getContentUri("external"); + Cursor cur = getContentResolver().query(uri, mCols, null, null, null); + if(cur != null) + { + if(cur.moveToFirst()) + { + while(!cur.isAfterLast()) + { + if(currenturi.equals(ContentUris.withAppendedId(uri,cur.getInt(cur.getColumnIndexOrThrow(MediaStore.Video.Media._ID))))) + return cur; + else + cur.moveToNext(); + } + } + } + return null; + } + public static boolean checkVideoAvailable(Context context,Cursor cur){ + String videofile = cur.getString(cur.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); + File file = new File(videofile); + if (file.exists()){ + return true; + }else + return false; + } + Handler mHandler = new Handler(); + public Cursor query(Uri uri, String[] projection, + String selection, String[] selectionArgs, String sortOrder) { + LOG("Enter query()"); + try { + ContentResolver resolver = getContentResolver(); + if (resolver == null) { + return null; + } + return resolver.query(uri, projection, selection, selectionArgs, sortOrder); + } catch (UnsupportedOperationException ex) { + return null; + } + } + public Cursor getVideoCursor(AsyncQueryHandler async){ + LOG("Enter getVideoCursor()"); + Cursor ret = null; + mSortOrder = MediaStore.Video.Media._ID; + StringBuilder where = new StringBuilder(); + where.append(MediaStore.Video.Media._ID + " != ''"); + if (async != null) { + LOG("getVideoCursor:startQuery()"); + async.startQuery(0, null, + MediaStore.Video.Media.EXTERNAL_CONTENT_URI, + mCols, + where.toString(), null, mSortOrder); + } else { + ret = query( + MediaStore.Video.Media.EXTERNAL_CONTENT_URI, mCols, + where.toString(), null,mSortOrder); + } + LOG("ret/async = " + ret + "/" + async); + if (ret != null && async != null) { + LOG("getVideoCursor:initVideoCursor()"); + initVideoCursor(ret); + } + return ret; + } + public void initVideoCursor(Cursor newCursor){ + LOG("Enter initVideoCursor() and newCursor = " + newCursor); + mVideoListAdapter.changeCursor(newCursor); + LOG("mVideoCursor = " + mVideoCursor + "newCursor = " + newCursor); + if (mVideoCursor == null){ + pd.dismiss(); + VideoDisplayVInVisible(); + mReScanHandler.sendEmptyMessageDelayed(0, 1000);//1000); + return; + } + LOG("mVideoCursor.moveToFirst() = and mVideoCursor.getCount() = " + + mVideoCursor.moveToFirst() + mVideoCursor.getCount()); + if(mVideoCursor.moveToFirst() == false || mVideoCursor.getCount() == 0){ + if(pd != null) + pd.dismiss(); + VideoDisplayVInVisible(); + HintNoVideo(); + }else if (mVideoCursor.getCount() != 0){ + if(pd != null) + pd.dismiss(); + //MainView.setBackgroundResource(R.drawable.textlistbak); + sNoFileView.setVisibility(View.GONE); + //RockVideoPlayer.this.getListView().setSelection(mLastPosition); + } + pd.dismiss(); + } + public void HintNoVideo() + { + Toast.makeText(this, R.string.no_mediafiles, 1500).show(); + } + private Handler mReScanHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + LOG("mReScanHandler mTrackCursor / mVideoListAdapter = " + mVideoCursor + " / " + mVideoListAdapter); + getVideoCursor(mVideoListAdapter.getQueryHandler()); + } + }; + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if ((resultCode == RESULT_OK) + && (data != null)) { + mUri = data.getData(); + LOG("onActivityResult:mUri = " + mUri); + } + /*int result = DBUtils.FindPosition(this,mUri); + if(result >= 0) + mLastPosition = result;*/ + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RuninTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RuninTestActivity.java new file mode 100755 index 0000000..108814c --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/RuninTestActivity.java @@ -0,0 +1,599 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Date; + +import android.R.integer; +import android.app.Activity; +import android.app.ActivityManager; +import android.app.AlarmManager; +import android.app.KeyguardManager; +import android.app.PendingIntent; +import android.app.KeyguardManager.KeyguardLock; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.ActivityInfo; +import android.content.res.Configuration; +import android.database.DataSetObserver; +import android.media.MediaPlayer; +import android.media.MediaPlayer.OnCompletionListener; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; +import android.os.SystemClock; +import android.util.Log; +import android.view.KeyEvent; +import android.view.Surface; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemSelectedListener; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.MediaController; +import android.widget.ProgressBar; +import android.widget.Spinner; +import android.widget.SpinnerAdapter; +import android.widget.TextView; +import android.widget.Toast; +import android.widget.VideoView; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.helper.TestCase.RESULT; + +public class RuninTestActivity extends Activity { + + private static final String BATTERY_TEMP_PATH = "/sys/class/power_supply/*battery/temp"; + private static final String VIDEO_PATH = DeviceTest.EXTRA_PATH + + "Earth.mp4"; + + private static final int MSG_DO_TEST = 0; + private static final int MSG_TEST_FAILED = 1; + private static final int MSG_TEST_PASS = 2; + private static final int MSG_STOP = 3; + private static final int MSG_SLEEP_WAKE = 5; + + private static final int SLEEP_WAKE_COUNT = 10; + private static final long VIDEO_TEST_TIME = 0; + private static final int MEM_TEST_SIZE = 200; + + private static final int SLEEP_WAKE_DIST = 5 * 1000; + + private String sleepWakeCountString; + private String videoTimeString; + private String memSizeString; + + int sleepWakeCount = 0; + long videoTime = 0; + + VideoView videoView; + long videoStart = 0; + + private enum TEST_STEP { + SLEEP_WAKE_TEST, MEM_TEST, VIDEO_TEST, BATTERY_TEMP_TEST + } + + String memTestResult; + private int mTestStep = 0; + float batteryTemp = 0; + + private RESULT[] mTestResult; + TextView[] mTextViews; + + Spinner sleepWakeCountSpinner, videoTimeSpinner, memSizeSpinner; + String[] sleepWakeCountVal = { "Def(10)", "0", "1", "2", "5", "10", "20", }; + String[] memSizeVal = { "Def(200M)", "0", "1", "10", "100", "200", "250", }; + String[] videoTimeVal = { "Def(--m)", "0", "1", "10", "30", "60", "90", + "120", "--" }; + + PowerManager powerManager; + + ProgressBar progressBar; + KeyguardManager keyguardManager; + KeyguardLock keyguardLock; + Button stopVideo; + + final String SLEEP_WAKE = "Sleep:"; + + boolean videoStoped = false; + protected WakeLock wakeLock; + final String ACTION = "sleep_wake_action"; + AlarmManager alarmManager; + PendingIntent pendingIntent; + BroadcastReceiver receiver; + + public RuninTestActivity() { + mTestResult = new RESULT[] { RESULT.UNDEF, RESULT.UNDEF, RESULT.UNDEF, + RESULT.UNDEF, }; + mTextViews = new TextView[mTestResult.length]; + } + + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + + ")"); + requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.runintest); + mTextViews[0] = (TextView) findViewById(R.id.SleepWakeText); + mTextViews[0].setText(SLEEP_WAKE); + mTextViews[1] = (TextView) findViewById(R.id.MemText); + mTextViews[1].setText("Mem:"); + mTextViews[2] = (TextView) findViewById(R.id.VideoText); + mTextViews[2].setText("Video:"); + mTextViews[3] = (TextView) findViewById(R.id.BatteryTempText); + mTextViews[3].setText("Temp:"); + + progressBar = (ProgressBar) findViewById(R.id.progress); + stopVideo = (Button) findViewById(R.id.StopVideo); + stopVideo.setText("stop"); + + videoView = (VideoView) findViewById(R.id.VideoView); + videoView.setVideoPath(VIDEO_PATH); + // videoView.setMediaController(new MediaController(this)); + videoView.setOnCompletionListener(new OnCompletionListener() { + + public void onCompletion(MediaPlayer mp) { + videoView.setVideoPath(VIDEO_PATH); + videoView.start(); + } + }); + + sleepWakeCountSpinner = (Spinner) findViewById(R.id.SleepWakeTimesSpinner); + memSizeSpinner = (Spinner) findViewById(R.id.MemSizeSpinner); + videoTimeSpinner = (Spinner) findViewById(R.id.VideoLengthSpinner); + + sleepWakeCountSpinner.setAdapter(new ArrayAdapter<String>(this, + android.R.layout.simple_spinner_dropdown_item, + sleepWakeCountVal)); + memSizeSpinner.setAdapter(new ArrayAdapter<String>(this, + android.R.layout.simple_spinner_dropdown_item, memSizeVal)); + videoTimeSpinner.setAdapter(new ArrayAdapter<String>(this, + android.R.layout.simple_spinner_dropdown_item, videoTimeVal)); + + sleepWakeCountSpinner + .setOnItemSelectedListener(new OnItemSelectedListener() { + + public void onItemSelected(AdapterView<?> parent, + View view, int position, long id) { + sleepWakeCountString = parent.getItemAtPosition( + position).toString(); + } + + public void onNothingSelected(AdapterView<?> parent) { + + } + }); + videoTimeSpinner + .setOnItemSelectedListener(new OnItemSelectedListener() { + + public void onItemSelected(AdapterView<?> parent, + View view, int position, long id) { + videoTimeString = parent.getItemAtPosition(position) + .toString(); + } + + public void onNothingSelected(AdapterView<?> parent) { + + } + }); + memSizeSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { + + public void onItemSelected(AdapterView<?> parent, View view, + int position, long id) { + memSizeString = parent.getItemAtPosition(position).toString(); + } + + public void onNothingSelected(AdapterView<?> parent) { + + } + }); + final Button startButton = (Button) findViewById(R.id.TestStart); + startButton.setText("Start Test"); + startButton.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + if (startButton.getVisibility() != View.VISIBLE) { + return; + } + mHandler.sendEmptyMessage(MSG_DO_TEST); + startButton.setVisibility(View.GONE); + sleepWakeCountSpinner.setEnabled(false); + videoTimeSpinner.setEnabled(false); + memSizeSpinner.setEnabled(false); + } + }); + + stopVideo.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + if (stopVideo.getVisibility() == View.INVISIBLE) { + return; + } + stopVideo.setVisibility(View.INVISIBLE); + videoStoped = true; + videoTime = SystemClock.uptimeMillis() - videoStart; + mHandler.sendEmptyMessage(MSG_STOP); + } + }); + + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + saveResult(); + + powerManager = (PowerManager) getSystemService(POWER_SERVICE); + wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK + | PowerManager.ACQUIRE_CAUSES_WAKEUP + | PowerManager.ON_AFTER_RELEASE, "jeffy_sleep_lock"); + + keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE); + keyguardLock = keyguardManager.newKeyguardLock(""); + keyguardLock.disableKeyguard(); + + alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); + pendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION), + PendingIntent.FLAG_CANCEL_CURRENT); + + receiver = new BroadcastReceiver() { + boolean sleep = false; + int count = 0; + + @Override + public void onReceive(Context context, Intent intent) { + if (!sleep) { + // goto Sleep + + Log.i("Jeffy", "Sleep"); + if (wakeLock.isHeld()) { + wakeLock.release(); + } + powerManager.goToSleep(SystemClock.uptimeMillis()); + } else { + // wake up + + count++; + Log.i("Jeffy", "wake"); + if (!wakeLock.isHeld()) { + wakeLock.acquire(); + } else { + Log.e("Jeffy", "Run in, wake lock statue error"); + mTextViews[TEST_STEP.SLEEP_WAKE_TEST.ordinal()] + .setText(SLEEP_WAKE); + mHandler.sendEmptyMessage(MSG_TEST_FAILED); + } + if (sleepWakeCount > count) { + mTextViews[TEST_STEP.SLEEP_WAKE_TEST.ordinal()] + .setText(SLEEP_WAKE + count); + } else { + mTextViews[TEST_STEP.SLEEP_WAKE_TEST.ordinal()] + .setText(SLEEP_WAKE); + mHandler.sendEmptyMessage(MSG_TEST_PASS); + return; + } + } + sleep = !sleep; + + alarmManager.set(AlarmManager.RTC_WAKEUP, + System.currentTimeMillis() + SLEEP_WAKE_DIST, + pendingIntent); + } + }; + + registerReceiver(receiver, new IntentFilter(ACTION)); + } + + Handler mHandler = new Handler() { + + public void handleMessage(Message msg) { + mHandler.removeMessages(msg.what); + boolean pass = false; + + switch (msg.what) { + case MSG_DO_TEST: + saveResult(); + if (mTestStep < TEST_STEP.values().length) { + doTest(); + } else { + endAllTest(); + } + break; + case MSG_STOP: + stopTest(); + break; + case MSG_TEST_PASS: + case MSG_TEST_FAILED: + if (mTestStep >= TEST_STEP.values().length) { + return; + } + pass = msg.what == MSG_TEST_PASS; + mTestResult[mTestStep] = pass ? RESULT.OK : RESULT.NG; + String result = (pass ? "Pass" : "Failed"); + if (msg.obj != null) { + result += "(" + msg.obj.toString() + ")"; + } + mTextViews[mTestStep].setText(mTextViews[mTestStep].getText() + + result); + if (!isFinishing()) { + mTestStep++; + sendEmptyMessage(MSG_DO_TEST); + } + break; + + case MSG_SLEEP_WAKE: + Runnable runnable = (Runnable) msg.obj; + runnable.run(); + break; + default: + break; + } + } + }; + + private void doTest() { + TEST_STEP step = TEST_STEP.values()[mTestStep]; + switch (step) { + case SLEEP_WAKE_TEST: + doSleepWakeTest(); + // mHandler.sendEmptyMessage(MSG_TEST_FAILED); + break; + case MEM_TEST: + doMemTest(); + // mHandler.sendEmptyMessage(MSG_TEST_PASS); + break; + case VIDEO_TEST: + doVideoTest(); + // mHandler.sendEmptyMessage(MSG_TEST_FAILED); + break; + case BATTERY_TEMP_TEST: + doBatteryTempTest(); + default: + break; + } + } + + private void doBatteryTempTest() { + String temp = SystemUtil.execScriptCmd("cat " + BATTERY_TEMP_PATH, + DeviceTest.TEMP_FILE_PATH, true); + + batteryTemp = Integer.parseInt(temp); + batteryTemp /= 10; + mHandler.sendMessage(mHandler.obtainMessage( + batteryTemp < 40 ? MSG_TEST_PASS : MSG_TEST_FAILED, batteryTemp + + "C")); + } + + private void doSleepWakeTest() { + sleepWakeCount = SLEEP_WAKE_COUNT; + if (sleepWakeCountString != null) { + try { + sleepWakeCount = Integer.parseInt(sleepWakeCountString); + } catch (Exception e) { + } + } + + if (sleepWakeCount == 0) { + mHandler.sendEmptyMessage(MSG_TEST_PASS); + return; + } + alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), + pendingIntent); + } + + private void doVideoTest() { + videoTime = VIDEO_TEST_TIME; + if (this.videoTimeString != null) { + try { + videoTime = Integer.parseInt(this.videoTimeString) * 60 * 1000; + if (videoTime == 0) { + mHandler.sendEmptyMessage(MSG_TEST_PASS); + return; + } + } catch (Exception e) { + } + } + + File file = new File(VIDEO_PATH); + if (!file.exists() || !file.canRead()) { + mHandler.sendEmptyMessage(MSG_TEST_FAILED); + return; + } + + ControlButtonUtil.Hide(); + stopVideo.setVisibility(View.VISIBLE); + videoView.setVisibility(View.VISIBLE); + videoView.bringToFront(); + videoView.start(); + videoStart = SystemClock.uptimeMillis(); + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + + if (videoTimeString.indexOf("--") < 0) { + mHandler.sendEmptyMessageDelayed(MSG_STOP, videoTime); + } + } + + protected void endAllTest() { + boolean pass = true; + for (RESULT result : mTestResult) { + if (result == RESULT.NG) { + pass = false; + break; + } + } + // saveResult(); + if (pass) { + // findViewById(R.id.btn_Pass).setVisibility(View.VISIBLE); + findViewById(R.id.btn_Pass).performClick(); + // } else { + // // findViewById(R.id.btn_Fail).performClick(); + // } else { + // mHandler.postDelayed(new Runnable() { + // + // public void run() { + // if (!isFinishing()) { + // findViewById(R.id.btn_Fail).performClick(); + // } + // } + // }, DeviceTest.TEST_FAILED_DELAY); + } + } + + private void doMemTest() { + if (! new File(DeviceTest.MEMTESTER_PATH).exists()) { + mHandler.sendEmptyMessage(MSG_TEST_FAILED); + return; + } + progressBar.setVisibility(View.VISIBLE); + new Thread(new Runnable() { + + public void run() { + String result = null; + int memSize = MEM_TEST_SIZE; + + if (RuninTestActivity.this.memSizeString != null) { + try { + memSize = Integer + .parseInt(RuninTestActivity.this.memSizeString); + } catch (Exception e) { + } + } + + if (memSize == 0) { + mHandler.post(new Runnable() { + public void run() { + progressBar.setVisibility(View.GONE); + } + }); + mHandler.sendEmptyMessage(MSG_TEST_PASS); + return; + } + try { + result = SystemUtil.execRootCmd(DeviceTest.MEMTESTER_PATH + " " + + memSize + "M 1"); + mHandler.post(new Runnable() { + + public void run() { + progressBar.setVisibility(View.GONE); + } + }); + result = "---------------------------\n" + + result.substring(result.indexOf("want")); + + memTestResult = result; + boolean pass = memTestResult.endsWith("Pass."); + if (pass) { + mHandler.sendEmptyMessage(MSG_TEST_PASS); + } else { + mHandler.sendEmptyMessage(MSG_TEST_FAILED); + } + } catch (Exception e) { + mHandler.sendMessage(mHandler.obtainMessage( + MSG_TEST_FAILED, e.getMessage())); + } + } + }).start(); + } + + protected void stopTest() { + if (mTestStep >= TEST_STEP.values().length) { + return; + } + mTestResult[mTestStep] = RESULT.NG; + TEST_STEP step = TEST_STEP.values()[mTestStep]; + switch (step) { + case SLEEP_WAKE_TEST: + stopSleepWakeTest(); + break; + case MEM_TEST: + stopMemTest(); + break; + case VIDEO_TEST: + stopVideoTest(); + break; + + default: + break; + } + } + + private void stopSleepWakeTest() { + mHandler.removeMessages(MSG_SLEEP_WAKE); + mHandler.sendEmptyMessage(MSG_TEST_FAILED); + + alarmManager.cancel(pendingIntent); + } + + private void stopVideoTest() { + videoView.stopPlayback(); + ControlButtonUtil.Show(); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + stopVideo.setVisibility(View.GONE); + videoView.setVisibility(View.GONE); + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + boolean pass = (SystemClock.uptimeMillis() - videoStart) >= this.videoTime; + + mHandler.sendEmptyMessage(pass ? MSG_TEST_PASS : MSG_TEST_FAILED); + } + + // + // public void onConfigurationChanged(Configuration newConfig) { + // super.onConfigurationChanged(newConfig); + // } + + private void stopMemTest() { + SystemUtil.killProcessByPath(DeviceTest.MEMTESTER_PATH); + } + + protected void onStop() { + super.onStop(); + stopTest(); + keyguardLock.reenableKeyguard(); + unregisterReceiver(receiver); + } + + public String getResult() { + + String result = DeviceTest.RESULT_INFO_HEAD_JUST_INFO; + result += DeviceTest.formatResult("SleepWakeTest", mTestResult[0], + DeviceTest.RESULT_INFO_HEAD + sleepWakeCount) + "\n"; + result += DeviceTest.formatResult("MemTest", mTestResult[1], null) + + "\n"; + result += DeviceTest.formatResult("VideoTest", mTestResult[2], + DeviceTest.RESULT_INFO_HEAD + (videoTime / 1000 / 60) + "Min") + + "\n"; + result += DeviceTest.formatResult("BatteryTemp", mTestResult[3], + DeviceTest.RESULT_INFO_HEAD + batteryTemp + "C") + "\n"; + + return result; + } + + private void saveResult() { + ControlButtonUtil.setResult(getResult()); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SATATestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SATATestActivity.java new file mode 100755 index 0000000..5872741 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SATATestActivity.java @@ -0,0 +1,9 @@ +package com.DeviceTest; + +public class SATATestActivity extends UsbHostTestActivity { + + @Override + protected void preData() { + mStorageType = STORAGE_TYPE.SATA; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SdCardTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SdCardTestActivity.java new file mode 100755 index 0000000..bf4a1f7 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SdCardTestActivity.java @@ -0,0 +1,462 @@ +package com.DeviceTest; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.math.BigInteger; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.ServiceManager; +import android.os.StatFs; +import android.view.View; +import android.view.Window; +import android.widget.Button; +import android.widget.TextView; +import android.os.SystemProperties; +import android.text.format.Formatter; +import android.util.Log; +//import android.os.storage.IMountService; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.storage.StorageEventListener; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import android.os.storage.VolumeInfo; +import java.util.Collections; +import android.os.storage.DiskInfo; +import java.util.List; + + +public class SdCardTestActivity extends Activity { + private static final String TAG = "SdCardTestActivity"; + private static final String TEST_STRING = "Rockchip UsbHostTest File"; + private static String SDCARD_PATH ; +// private static final String SDCARD_PATH = "/mnt/external_sd"; +// private final static String SDCARD_PATH = "/storage/sdcard1"; + private static final int BACK_TIME = 2000; + private static final int SEND_REND_WRITE_SD = 3; + private static final int R_PASS = 1; + private static final int R_FAIL = 2; + private String sdcard_path = null; + private StringBuilder sBuilder; + // private SdcardReceiver sdcardReceiver = null; + public String SUCCESS; + public String FAIL; + private boolean isFindSd = false; + private static StorageManager mStorageManager = null; + private static boolean is_Usb=false; + TextView mResult; + private static boolean isSDFirstTest =true; + public static String flash_dir = Environment.getExternalStorageDirectory().getPath(); + private static String sdcard_dir; + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + // requestWindowFeature(Window.FEATURE_NO_TITLE); + // getWindow().addFlags(1152); + setContentView(R.layout.sdcardtest); + isSDFirstTest =true; + if (mStorageManager == null) { + mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + } + this.mResult = (TextView) findViewById(R.id.sdresultText); + this.mResult.setVisibility(View.VISIBLE); + this.mResult.setGravity(17); + + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + SUCCESS = getString(R.string.success); + FAIL = getString(R.string.fail); + + } + + @Override + protected void onResume() { + super.onResume(); + init_StoragePath(this); + // mStorageManager.registerListener(mStorageListener); + StorageVolume[] storageVolumes = mStorageManager.getVolumeList(); + Log.d(TAG, " storageVolumes.length= " + storageVolumes.length); + for(int i=0;i< storageVolumes.length;i++) + { + Log.d(TAG, " storageVolumes["+i+"].getPath()=" +storageVolumes[i].getPath()); + } + /*if(storageVolumes.length >= 2){ + sdcard_path = storageVolumes[1].getPath();*/ + + //SDCARD_PATH=sdcard_path; + //Log.d(TAG, " storageVolumes[1].getPath()= " + SDCARD_PATH + " "+","+ Environment.getExternalStorageDirectory()); + //Log.d(TAG, " storageVolumes[0].getPath()= " + storageVolumes[0].getPath()); + //} + sBuilder = new StringBuilder(); + //String sdState = getSdCardState(); + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { + isFindSd=true; + + mResult.setText(getString(R.string.resume_findSD)); + mHandler.sendEmptyMessageDelayed(SEND_REND_WRITE_SD, 1000); + } + } + + @Override + protected void onPause() { + super.onPause(); + if (mStorageManager != null) { + // mStorageManager.unregisterListener(mStorageListener); + } + } + + + public void testSdcard() { + try { + if (SDCARD_PATH==null) + { + sBuilder.append(getString(R.string.SdCardFail)).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + // String externalVolumeState = mStorageManager.getVolumeState(SDCARD_PATH); + //if (!externalVolumeState.equals(Environment.MEDIA_MOUNTED)) { + // sBuilder.append(getString(R.string.SdCardFail)).append("\n"); + //mResult.setText(sBuilder.toString()); + //mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + //isFindSd = false; + //return; + // } + } catch (Exception rex) { + + rex.printStackTrace(); + isFindSd = false; + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + return; + } + + File pathFile = new File(SDCARD_PATH); + Log.d(TAG, "pathFile = " + pathFile.toString()); + if (!pathFile.exists()) { + sBuilder.append(getString(R.string.SdCardFail)).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + StatFs stat = new StatFs(pathFile.getPath()); + Log.d(TAG, "StatFs "); + long blockSize = stat.getBlockSize(); + long totalBlocks = stat.getBlockCount(); + String totalSize = Formatter.formatFileSize(this, totalBlocks + * blockSize); + if ("0.00 B".equals(totalSize)) { + sBuilder.append(getString(R.string.SdCardFail)).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + String prix = getString(R.string.SdCardFind); + sBuilder.append(prix + totalSize).append("\n"); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Log.d(TAG, "testReadAndWrite " + isFindSd); + testReadAndWrite(); + + } + + public void testReadAndWrite() { + if (isFindSd && dotestReadAndWrite()) { + sBuilder.append(getString(R.string.SdCardTitle) + SUCCESS); + ((Button)findViewById(R.id.btn_Skip)).setClickable(false); + //((Button)findViewById(R.id.btn_Pass)).setClickable(false); + ((Button)findViewById(R.id.btn_Fail)).setClickable(false); + mHandler.sendEmptyMessageDelayed(R_PASS, BACK_TIME); + } else { + sBuilder.append(getString(R.string.SdCardTitle) + FAIL); + ((Button)findViewById(R.id.btn_Skip)).setClickable(false); + ((Button)findViewById(R.id.btn_Pass)).setClickable(false); + //((Button)findViewById(R.id.btn_Fail)).setClickable(false); + mHandler.sendEmptyMessageDelayed(R_FAIL, BACK_TIME); + } + + mResult.setText(sBuilder.toString()); + } + + private boolean dotestReadAndWrite() { + // String directoryName = Environment.getExternalStorageDirectory().toString()+ "/test"; + String directoryName = SDCARD_PATH+ "/test"; + Log.d(TAG, "dotestReadAndWrite: " + directoryName); + File directory = new File(directoryName); + if (!directory.isDirectory()) { + if (!directory.mkdirs()) { + sBuilder.append(getString(R.string.MakeDir) + FAIL).append("\n"); + return false; + } else { + sBuilder.append(getString(R.string.MakeDir) + SUCCESS).append( + "\n"); + } + } + File f = new File(directoryName, "SDCard.txt"); + try { + // Remove stale file if any + if (f.exists()) { + f.delete(); + } + if (!f.createNewFile()) { + sBuilder.append(getString(R.string.CreateFile) + FAIL).append( + "\n"); + return false; + } else { + sBuilder.append(getString(R.string.CreateFile) + SUCCESS).append( + "\n"); + + doWriteFile(f.getAbsoluteFile().toString()); + + if (doReadFile(f.getAbsoluteFile().toString()).equals( + TEST_STRING)) { + sBuilder.append(getString(R.string.Compare)).append(SUCCESS).append( + "\n"); + } else { + sBuilder.append(getString(R.string.Compare)).append(FAIL).append( + "\n"); + return false; + } + } + + sBuilder.append(getString(R.string.FileDel)).append( + (f.delete() ? SUCCESS : FAIL)).append("\n"); + sBuilder.append(getString(R.string.DirDel)).append( + (directory.delete() ? SUCCESS : FAIL)).append("\n"); + return true; + } catch (IOException ex) { + Log.e(TAG, "isWritable : false (IOException)!"); + return false; + } + } + + public void doWriteFile(String filename) { + try { + sBuilder.append(getString(R.string.WriteData)).append("\n"); + OutputStreamWriter osw = new OutputStreamWriter( + new FileOutputStream( + filename)); + osw.write(TEST_STRING, 0, TEST_STRING.length()); + osw.flush(); + osw.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public String doReadFile(String filename) { + try { + BufferedReader br = new BufferedReader(new InputStreamReader + (new FileInputStream(filename))); + String data = null; + StringBuilder temp = new StringBuilder(); + sBuilder.append(getString(R.string.ReadData)).append("\n"); + while ((data = br.readLine()) != null) { + temp.append(data); + } + br.close(); + Log.e(TAG, "Readfile " + temp.toString()); + return temp.toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /* + public class SdcardReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + Log.e(TAG, "onReveive ..... " + intent.getAction()); + if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) { + Log.e(TAG, "239 ..... " + intent.getAction()); + testSdcard(); + testReadAndWrite(); + } + } + } + */ +/*StorageEventListener mStorageListener = new StorageEventListener() { + @Override + public void onStorageStateChanged(String path, String oldState, String newState) { + Log.d("xxxxxxxxxxxxxxxxxxxxxxxxxxxx","yyyyyyyyyyyyyyyyyyyyyyyyyyyy"); + if (path.equals(SDCARD_PATH) && newState.equals(Environment.MEDIA_MOUNTED)) { + isFindSd=true; + + mResult.setText(getString(R.string.resume_findSD)); + mHandler.sendEmptyMessageDelayed(SEND_REND_WRITE_SD, 100); + testReadAndWrite(); + } + } + };*/ + + public void TestResult(int result) { + if (result == R_PASS) { + if(isSDFirstTest){ + isSDFirstTest=false; + ((Button) findViewById(R.id.btn_Pass)).performClick(); + isFindSd = false; + } + + } else if (result == R_FAIL) { + if(isSDFirstTest){ + isSDFirstTest=false; + ((Button) findViewById(R.id.btn_Fail)).performClick(); + isFindSd = false; + } + } + } + + Handler mHandler = new Handler() { + public void handleMessage(android.os.Message msg) { + switch (msg.what) { + case R_PASS: + TestResult(R_PASS); + break; + case R_FAIL: + TestResult(R_FAIL); + break; + + case SEND_REND_WRITE_SD: + + testSdcard(); + break; + + } + }; + }; + /* + public static String getSdCardState() { + try { + IMountService mMntSvc = null; + if (mMntSvc == null) { + mMntSvc = IMountService.Stub.asInterface(ServiceManager + .getService("mount")); + } + return mMntSvc.getVolumeState(SDCARD_PATH); + } catch (Exception rex) { + return Environment.MEDIA_REMOVED; + } + + }*/ + //获取外置sd卡路径 + private static String getStoragePath(Context mContext, boolean is_removale) { + + mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); + Class<?> storageVolumeClazz = null; + try { + storageVolumeClazz = Class.forName("android.os.storage.StorageVolume"); + Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList"); + Method getPath = storageVolumeClazz.getMethod("getPath"); + Method isRemovable = storageVolumeClazz.getMethod("isRemovable"); + Object result = getVolumeList.invoke(mStorageManager); + final int length = Array.getLength(result); + for (int i = 0; i < length; i++) { + Object storageVolumeElement = Array.get(result, i); + String path = (String) getPath.invoke(storageVolumeElement); + boolean removable = (Boolean) isRemovable.invoke(storageVolumeElement); + if (is_removale == removable) { + return path; + } + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + public void init_StoragePath(Context context) { + // flash dir + + mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); + flash_dir = Environment.getExternalStorageDirectory().getPath(); + final List<VolumeInfo> volumes = mStorageManager.getVolumes(); + Collections.sort(volumes, VolumeInfo.getDescriptionComparator()); + for (VolumeInfo vol : volumes) { + if (vol.getType() == VolumeInfo.TYPE_PUBLIC) { + Log.d(TAG, "Volume path:" + vol.getPath()); + DiskInfo disk = vol.getDisk(); + if (disk != null) { + if (disk.isSd()) { + // sdcard dir + StorageVolume sv = vol.buildStorageVolume(context, + context.getUserId(), false); + sdcard_dir = sv.getPath(); + } else if (disk.isUsb()) { + // usb dir + } + } + } + } + + SDCARD_PATH = sdcard_dir; + Log.d(TAG, "sdcard_dir: " + sdcard_dir); + } +//判断sd卡是否挂载 +private boolean isSDMounted() { + boolean isMounted = false; + StorageManager sm = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + + try { + Method getVolumList = StorageManager.class.getMethod("getVolumeList", null); + getVolumList.setAccessible(true); + Object[] results = (Object[])getVolumList.invoke(sm, null); + if (results != null) { + for (Object result : results) { + Method mRemoveable = result.getClass().getMethod("isRemovable", null); + Boolean isRemovable = (Boolean) mRemoveable.invoke(result, null); + if (isRemovable) { + Method getPath = result.getClass().getMethod("getPath", null); + String path = (String) mRemoveable.invoke(result, null); + Method getState = sm.getClass().getMethod("getVolumeState", String.class); + String state = (String)getState.invoke(sm, path); + if (state.equals(Environment.MEDIA_MOUNTED)) { + isMounted = true; + break; + } + } + } + } + } catch (NoSuchMethodException e){ + e.printStackTrace(); + } catch (IllegalAccessException e){ + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + + return isMounted; + } + + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SimCardTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SimCardTestActivity.java new file mode 100755 index 0000000..2e9e743 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SimCardTestActivity.java @@ -0,0 +1,68 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.File; +import java.math.BigInteger; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.os.Environment; +import android.os.StatFs; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.widget.TextView; + +import android.telephony.TelephonyManager; +import android.util.Log; + +public class SimCardTestActivity extends Activity { + private static final String TAG = "SdCardTestActivity"; + + TextView mResult; + + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.simcardtest); + + this.mResult = (TextView) findViewById(R.id.text); + this.mResult.setVisibility(View.VISIBLE); + this.mResult.setGravity(17); + + ControlButtonUtil.initControlButtonView(this); + } + + + protected void onResume() { + super.onResume(); + TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); + String imsi = mTelephonyMgr.getSubscriberId(); + + if (imsi == null) { + mResult.setText("Cann't get IMSI!"); + } else { + mResult.setText("IMSI:" + imsi); + } + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SpeakerTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SpeakerTestActivity.java new file mode 100755 index 0000000..58aed4e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/SpeakerTestActivity.java @@ -0,0 +1,156 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.FileDescriptor; +import java.io.IOException; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.content.Intent; +import android.content.res.AssetFileDescriptor; +import android.media.AudioManager; +import android.media.MediaPlayer; +import android.media.MediaRecorder; +import android.os.Bundle; +import android.os.Handler; +import android.os.Vibrator; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.TextView; + +public class SpeakerTestActivity extends Activity { + private AudioManager mAudioManager; + private MediaPlayer mPlayer; + private int mOldVolume; + private boolean mSpeakerOn; + + private Button leftButton; + private Button rightButton; + + private boolean leftEnable = true; + private boolean rightEnable = true; + + + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.speakertest); + TextView txtTitle = (TextView) findViewById(R.id.txtTitle); + TextView txtContent = (TextView) findViewById(R.id.txtContent); + txtTitle.setText(R.string.SpeakerTitle); + txtContent.setText(getString(R.string.SpeakerTip)); + + mAudioManager = (AudioManager) getSystemService("audio"); + mPlayer = new MediaPlayer(); + try { + // mPlayer.setDataSource("/system/media/audio/ringtones/CrazyDream.ogg"); + AssetFileDescriptor fd = getAssets().openFd("test_music.mp3"); + mPlayer.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), + fd.getDeclaredLength()); + + mPlayer.prepare(); + mPlayer.setLooping(true); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + leftButton = (Button) findViewById(R.id.spk_btn_left); + leftButton.setOnClickListener(new OnClickListener() { + + + public void onClick(View v) { + leftEnable = !leftEnable; + updateButtons(); + } + }); + + rightButton = (Button) findViewById(R.id.spk_btn_right); + rightButton.setOnClickListener(new OnClickListener() { + + + public void onClick(View v) { + rightEnable = !rightEnable; + updateButtons(); + } + }); + updateButtons(); + + ControlButtonUtil.initControlButtonView(this); + + } + + protected void updateButtons() { + leftButton.setText("left " + (leftEnable ? "enabled" : "disabled")); + rightButton.setText("right " + (rightEnable ? "enabled" : "disabled")); + + mPlayer.setVolume(leftEnable ? 1 : 0, rightEnable ? 1 : 0); + } + + protected void onDestroy() { + super.onDestroy(); + mPlayer.stop(); + if (this.mPlayer == null) { + return; + } + this.mPlayer.release(); + this.mPlayer = null; + } + + protected void onPause() { + super.onPause(); + this.mAudioManager.setStreamSolo(AudioManager.STREAM_MUSIC, false); + this.mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, + this.mOldVolume, 0); + if (this.mSpeakerOn) + return; + this.mAudioManager.setSpeakerphoneOn(false); + + } + + protected void onResume() { + super.onResume(); + stopMediaPlayBack(); + this.mAudioManager.setStreamSolo(AudioManager.STREAM_MUSIC, true); + int i = this.mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); + mOldVolume = i; + int j = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); + mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, j, 0); + this.mSpeakerOn = this.mAudioManager.isSpeakerphoneOn(); + if (!this.mSpeakerOn) { + this.mAudioManager.setSpeakerphoneOn(true); + } + this.mPlayer.start(); + + } + + private void stopMediaPlayBack() { + Intent i = new Intent("com.android.music.musicservicecommand"); + i.putExtra("command", "pause"); + sendBroadcast(i); + + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageActivity.java new file mode 100755 index 0000000..e74ebc0 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageActivity.java @@ -0,0 +1,235 @@ +/* + * 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.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; +import android.app.Activity; +import android.app.ActivityManager; +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.DialogInterface.OnCancelListener; +import android.content.pm.ApplicationInfo; +import android.content.res.Resources; +import android.os.Bundle; +import android.os.IBinder; +import android.os.RemoteException; +import android.os.Environment; +import android.os.ServiceManager; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageEventListener; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceGroup; +import android.preference.PreferenceScreen; +import android.text.format.Formatter; +import android.util.Log; +import android.view.KeyEvent; +import android.widget.TextView; +import android.widget.Toast; +import android.os.SystemProperties; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import com.DeviceTest.helper.ControlButtonUtil; + +import java.io.File; +import java.util.List; + +public class StorageActivity extends Activity implements OnCancelListener { + private static final String TAG = "Memory"; + private static final boolean localLOGV = false; + + private Resources mRes; + + private TextView mNandSize; + private TextView mNandAvail; + private TextView mDataAvail; + + boolean mSdMountToggleAdded = true; + boolean mNandMountToggleAdded = true; + + private StorageManager mStorageManager = null; + + @Override + protected void onCreate(Bundle icicle) { + super.onCreate(icicle); + + if (mStorageManager == null) { + mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + mStorageManager.registerListener(mStorageListener); + } + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.storageactivitytest); + + mRes = getResources(); + mNandSize = (TextView)findViewById(R.id.nand_total_space); + mNandAvail = (TextView)findViewById(R.id.nand_available_space); + mDataAvail = (TextView)findViewById(R.id.data_available_space); + + ControlButtonUtil.initControlButtonView(this); + } + + @Override + protected void onResume() { + super.onResume(); + + IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_SCANNER_STARTED); + intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED); + intentFilter.addDataScheme("file"); + registerReceiver(mReceiver, intentFilter); + if (getStoragePath(this,false)==null) { + finish(); + } + updateMemoryStatus(getStoragePath(this,false)); + } + + StorageEventListener mStorageListener = new StorageEventListener() { + + @Override + public void onStorageStateChanged(String path, String oldState, String newState) { + Log.d(TAG, "Received storage state changed notification that " + + path + " changed state from " + oldState + + " to " + newState); + if (path.equals(FirstRun.sdcard_path) && !newState.equals(Environment.MEDIA_MOUNTED)) { + } else { + updateMemoryStatus(getStoragePath(getApplication(),false)); + } + } + }; + + @Override + protected void onPause() { + super.onPause(); + unregisterReceiver(mReceiver); + } + + @Override + protected void onDestroy() { + if (mStorageManager != null && mStorageListener != null) { + mStorageManager.unregisterListener(mStorageListener); + } + super.onDestroy(); + } + + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + updateMemoryStatus(getStoragePath(getApplication(),false)); + //updateMemoryStatus(Environment.getExternalStorageDirectory().getPath()); + } + }; + + private void updateMemoryStatus(String path) { + String status = SystemProperties.get("EXTERNAL_STORAGE_STATE","unmounted"); + if (path.equals(getStoragePath(this,false))) { + status = mStorageManager.getVolumeState(path); + } + String readOnly = ""; + if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { + status = Environment.MEDIA_MOUNTED; + readOnly = mRes.getString(R.string.read_only); + } + + if (status.equals(Environment.MEDIA_MOUNTED)) { + try { + //File path = Environment.getExternalStorageDirectory(); + StatFs stat = new StatFs(path); + long blockSize = stat.getBlockSize(); + long totalBlocks = stat.getBlockCount(); + long availableBlocks = stat.getAvailableBlocks(); + + if (path.equals(getStoragePath(this,false))){ + mNandSize.setText(formatSize(totalBlocks * blockSize)); + mNandAvail.setText(formatSize(availableBlocks * blockSize) + readOnly); + } + } catch (IllegalArgumentException e) { + // this can occur if the SD card is removed, but we haven't received the + // ACTION_MEDIA_REMOVED Intent yet. + status = Environment.MEDIA_REMOVED; + } + + } else { + if (path.equals(getStoragePath(this,false))){ + mNandSize.setText(mRes.getString(R.string.nand_unavailable)); + mNandAvail.setText(mRes.getString(R.string.nand_unavailable)); + if (status.equals(Environment.MEDIA_UNMOUNTED) || + status.equals(Environment.MEDIA_NOFS) || + status.equals(Environment.MEDIA_UNMOUNTABLE) ) { + } + } + } + + File dataPath = Environment.getDataDirectory(); + StatFs stat = new StatFs(dataPath.getPath()); + long blockSize = stat.getBlockSize(); + long availableBlocks = stat.getAvailableBlocks(); + mDataAvail.setText(formatSize(availableBlocks * blockSize)); + } + + private String formatSize(long size) { + return Formatter.formatFileSize(this, size); + } + + public void onCancel(DialogInterface dialog) { + finish(); + } + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +private static String getStoragePath(Context mContext, boolean is_removale) { + + StorageManager mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); + Class<?> storageVolumeClazz = null; + try { + storageVolumeClazz = Class.forName("android.os.storage.StorageVolume"); + Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList"); + Method getPath = storageVolumeClazz.getMethod("getPath"); + Method isRemovable = storageVolumeClazz.getMethod("isRemovable"); + Object result = getVolumeList.invoke(mStorageManager); + final int length = Array.getLength(result); + for (int i = 0; i < length; i++) { + Object storageVolumeElement = Array.get(result, i); + String path = (String) getPath.invoke(storageVolumeElement); + boolean removable = (Boolean) isRemovable.invoke(storageVolumeElement); + if (is_removale == removable) { + return path; + } + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageTestActivity.java new file mode 100755 index 0000000..1f3ccce --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/StorageTestActivity.java @@ -0,0 +1,178 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.Permission; +import java.util.ArrayList; +import java.util.Arrays; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; +import com.DeviceTest.helper.TestCase.RESULT; + +import android.app.Activity; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothDevice; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PermissionInfo; +import android.net.Uri; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.os.Environment; + +public class StorageTestActivity extends Activity { + private final static String TAG = "StorageTest"; + private TextView mResult; + + boolean stop = false; + private static final String TEST_FILE_PATH = "/system/bin/logcat"; + private static final String TEMP_FILE_PATH = DeviceTest.TEMP_FILE_PATH + + "_test"; + + + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.storagetest); + + boolean pass = true; + + mResult = (TextView) findViewById(R.id.resultText); + String result = ""; +// String sdPath = System.getenv("EXTERNAL_STORAGE"); + String sdPath = Environment.getExternalStorageDirectory().toString(); + Log.e(TAG, "EXTERNAL_STORAGE path :"+sdPath); + if (sdPath == null) { + result += getString(R.string.StorageSDNoFind); + pass = false; + } else { + if (!testCopy(sdPath)) { + pass = false; + result += getString(R.string.StorageSDCopyF); + } else { + result += getString(R.string.StorageSDCopyS); + } + } + + String usbPath = System.getenv("EXTERNAL_HOST_USB"); + if (null == usbPath) { + result += getString(R.string.StorageUsbNoFind); + pass = false; + } else { + if (!testCopy(usbPath)) { + pass = false; + result += getString(R.string.StorageUsbCopyF); + } else { + result += getString(R.string.StorageUsbCopyS); + } + } + + result += pass ? "Pass!" : "Failed"; + mResult.setText(result); + ControlButtonUtil.initControlButtonView(this); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + if (pass) { + findViewById(R.id.btn_Pass).performClick(); + } else { + mHandler.postDelayed(mFailedRunnable, DeviceTest.TEST_FAILED_DELAY); + } + } + + Handler mHandler = new Handler(); + Runnable mFailedRunnable = new Runnable() { + + + public void run() { + if (stop) { + return; + } + mHandler.removeCallbacks(mFailedRunnable); + findViewById(R.id.btn_Fail).performClick(); + } + }; + + private boolean testCopy(String dstPath) { + SystemUtil.execScriptCmd("cat " + TEST_FILE_PATH + " > " + + dstPath + "/test", DeviceTest.TEMP_FILE_PATH, true); + SystemUtil.execScriptCmd("cat " + dstPath + "/test" + + " > " + TEMP_FILE_PATH + "\nrm " + dstPath + "/test", + DeviceTest.TEMP_FILE_PATH, true); + + byte[] buffer1 = new byte[1024]; + byte[] buffer2 = new byte[1024]; + int length = 0; + try { + BufferedInputStream bisSrc = new BufferedInputStream( + new FileInputStream(TEST_FILE_PATH)); + BufferedInputStream bisDst = new BufferedInputStream( + new FileInputStream(TEMP_FILE_PATH)); + Arrays.fill(buffer1, (byte) 0); + Arrays.fill(buffer2, (byte) 0); + while ((length = bisSrc.read(buffer1)) > 0) { + if (length != bisDst.read(buffer2)) { + Log.e(TAG, "length not equals : failed"); + return false; + } + if (!Arrays.equals(buffer1, buffer2)) { + Log.e(TAG, "data not equals : failed"); + return false; + } + } + bisSrc.close(); + bisDst.close(); + } catch (IOException e) { + e.printStackTrace(); + return false; + } finally { + File file = new File(TEMP_FILE_PATH); + if (file.exists()) { + file.delete(); + } + } + return true; + } + + + + public void onStop() { + super.onStop(); + mHandler.removeCallbacks(mFailedRunnable); + stop = true; + } + + // if (device != null && progressBar.isShown()) { + // progressBar.setVisibility(View.GONE); + // mResult.setText("Find equipment....\n Pass!"); + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/TouchTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/TouchTestActivity.java new file mode 100755 index 0000000..c71ddb5 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/TouchTestActivity.java @@ -0,0 +1,70 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.*; + +import java.io.File; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.view.PointerLocationView; +import com.DeviceTest.view.PointerLocationView.OnPointCountChangeListener; + +import android.app.Activity; +import android.graphics.Color; +import android.os.Bundle; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.View.OnTouchListener; +import android.view.Window; +import android.widget.Button; +import android.widget.TextView; +import android.util.Log; + +public class TouchTestActivity extends Activity { + TextView mText; + TextView mTitle; + PointerLocationView mPointerView; + private Button passButton; + + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.touchtest); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); + + mPointerView = (PointerLocationView) findViewById(R.id.pointerview); + mPointerView.setBackgroundColor(Color.TRANSPARENT); + + mPointerView + .setOnPointCountChangeListener(new OnPointCountChangeListener() { + + + public void onPointCountChange(int newPointCount) { + Log.i("Jeffy", "Count:" + newPointCount); + if (newPointCount >= 20) { +// passButton.setVisibility(View.VISIBLE); + passButton.performClick(); + } + } + }); + + ControlButtonUtil.initControlButtonView(this); +// passButton = (Button) findViewById(R.id.btn_Pass); +// passButton.setVisibility(View.INVISIBLE); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/USBDeviceTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/USBDeviceTestActivity.java new file mode 100755 index 0000000..f13cc6c --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/USBDeviceTestActivity.java @@ -0,0 +1,186 @@ +package com.DeviceTest; +import java.io.File; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemInfoUtil; + +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.SystemProperties; +import android.os.storage.StorageEventListener; +import android.text.format.Formatter; +import android.util.Log; +import android.widget.Button; +import android.widget.TextView; +import android.view.KeyEvent; +import android.view.View; +import android.hardware.input.InputManager; +import android.view.MotionEvent; +import android.view.InputDevice; +import java.io.File; +import android.content.ComponentName; +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemInfoUtil; +import android.os.Build; +import android.app.Activity; +import android.content.Context; +import android.content.DialogInterface; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.SystemProperties; +import android.os.storage.StorageEventListener; +import android.text.format.Formatter; +import android.util.Log; +import android.widget.Button; +import android.widget.TextView; +import android.hardware.usb.UsbDevice; +import android.hardware.usb.UsbManager; +import java.util.Iterator; +import java.util.HashMap; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.widget.Toast; + +public class USBDeviceTestActivity extends Activity { + private final static String TAG = "USBDeviceTestActivity"; + private final static int MSG_OK=0; + + // 创建定时器循环 + public Handler USBhandler; + + public void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + setContentView(R.layout.usbdevicetest); + + System.out.println("rpdzkj usb test"); + + // 创建定时器循环 + USBhandler=new Handler(); + USBhandler.postDelayed(runnable, 500); + + + ControlButtonUtil.initControlButtonView(this); + // 自动通过测试 + //handler.sendEmptyMessageDelayed(MSG_OK, 2500); + } + + private Handler handler=new Handler(){ + @Override + public void handleMessage(Message msg) { + switch(msg.what){ + case MSG_OK: + ((Button) findViewById(R.id.btn_Pass)).performClick(); + } + } + }; + + // 定时器循环代码 + Runnable runnable=new Runnable(){ + public void run() { + TextView usbHostView = (TextView) findViewById(R.id.USBNum); + usbHostView.setText("USB设备数量 : " + USBhostDeviceCheck()); + USBhandler.postDelayed(this, 1000);// 每1000毫秒循环一次 + } + }; + + + // 获取当前USB设备数量 + public int USBhostDeviceCheck(){ + int usbNum = 0; + UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); + HashMap<String, UsbDevice> devs; + devs = usbManager.getDeviceList(); + StringBuilder sb = new StringBuilder(); + if(!devs.isEmpty()){ + Iterator<UsbDevice> usbs = devs.values().iterator(); + while(usbs.hasNext()){ + UsbDevice dev = usbs.next(); + int vid = dev.getVendorId(); + int pid = dev.getProductId(); + if (vid == 1507 && pid == 1544) { + // skip usb hub gl850g + } else if (vid == 3034 && pid == 46880) { + // skip usb wifi rtl + } else if (vid == 4292 && pid == 60000) { + // skip usb wifi rtl + } else if (vid == 11388 && pid == 293) { + // skip EC20 + } else if (vid == 11388 && pid == 24578) { + // skip EC200s + } else if (vid == 0x2c7c && pid == 0x0801) { + // RM520N + } else if (vid == 0x2c7c && pid == 0x0800) { + // RM500Q + } else if (vid == 0x2c7c && pid == 0x0900) { + // RM500U + } else { + usbNum++; + } + String name = dev.getDeviceName(); + sb.append("-----------------------------------"+"\n"); + sb.append("vid = "+Integer.toHexString(vid)+ " ,pid = "+ Integer.toHexString(pid) + "\n"); + sb.append("name = "+name+"\n"); + android.util.Log.d("RRRRRRRR", sb.toString()); + } + } + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) return usbNum; + + InputManager inputManager = (InputManager) getSystemService(Context.INPUT_SERVICE); + int[] deviceIds = inputManager.getInputDeviceIds(); + for (int deviceId : deviceIds) { + InputDevice device = inputManager.getInputDevice(deviceId); + if (device != null) { + int srcid = device.getSources(); + if ((srcid & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { + usbNum ++; + } + } + } + + + return usbNum; + } + + public void onGoOtgModeSetBtnClick(View view) { + goOTGModeSetting(); + } + + public void goOTGModeSetting() { + Intent intent = new Intent(); + intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.Settings$UsbHostDeviceSettingsActivity")); + if (intent.resolveActivityInfo(getPackageManager(), PackageManager.MATCH_DEFAULT_ONLY) != null) { + startActivity(intent); + } + } + + @Override + protected void onResume() { + super.onResume(); + } + + public void onCancel(DialogInterface dialog) { + finish(); + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/UsbHostTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/UsbHostTestActivity.java new file mode 100755 index 0000000..c722599 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/UsbHostTestActivity.java @@ -0,0 +1,584 @@ +package com.DeviceTest; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.math.BigInteger; + +import com.DeviceTest.helper.ConfigUtil; +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.StorageInfo; +import com.DeviceTest.helper.SystemInfoUtil; +import com.DeviceTest.helper.SystemUtil; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.os.ServiceManager; +import android.os.StatFs; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.TextView; +import android.os.SystemProperties; +import android.text.format.Formatter; +import android.util.Log; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; +import android.os.storage.StorageEventListener; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import android.os.storage.VolumeInfo; +import java.util.Collections; +import android.os.storage.DiskInfo; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class UsbHostTestActivity extends Activity { + private static final String TAG = "UsbHostTestActivity"; + private static final String TEST_STRING = "Rockchip UsbHostTest File"; +// private static final String SDCARD_PATH = "/mnt/external_sd"; +// private final static String SDCARD_PATH = "/storage/sdcard1"; + protected static final int BACK_TIME = 2000; + private static final int SEND_REND_WRITE_SD = 3; + protected static final int R_PASS = 1; + protected static final int R_FAIL = 2; + private String sdcard_path = null; + private StringBuilder sBuilder; + // private SdcardReceiver sdcardReceiver = null; + public String SUCCESS; + public String FAIL; + private boolean isFindSd = false; + private static StorageManager mStorageManager = null; + private static boolean is_Usb=false; + TextView mResult; + private static boolean isSDFirstTest =true; + public static String flash_dir = Environment.getExternalStorageDirectory().getPath(); + private static StatFs stat=null; + private StorageInfo mTestStorage; + protected STORAGE_TYPE mStorageType = STORAGE_TYPE.USB_HOST; + + public enum STORAGE_TYPE { + USB_HOST, + PCIE, + SATA, + } + + protected void preData() { + + } + + protected void childTest(){} + protected void dealMessage(Message msg) {} + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + + // requestWindowFeature(Window.FEATURE_NO_TITLE); + // getWindow().addFlags(1152); + setContentView(R.layout.usbhosttest); + preData(); + isSDFirstTest =true; + if (mStorageManager == null) { + mStorageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + } + this.mResult = (TextView) findViewById(R.id.sdresultText); + this.mResult.setVisibility(View.VISIBLE); + this.mResult.setGravity(17); + TextView textTitle = (TextView) findViewById(R.id.textTitle); + textTitle.setText(getTestTitle()); + + ControlButtonUtil.initControlButtonView(this); + SUCCESS = getString(R.string.success); + FAIL = getString(R.string.fail); + + } + + @Override + protected void onResume() { + super.onResume(); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + findViewById(R.id.btn_Fail).setVisibility(View.INVISIBLE); + init_StoragePath(this); + // mStorageManager.registerListener(mStorageListener); + StorageVolume[] storageVolumes = mStorageManager.getVolumeList(); + Log.d(TAG, " storageVolumes.length= " + storageVolumes.length); + for(int i=0;i< storageVolumes.length;i++) + { + Log.d(TAG, " storageVolumes["+i+"].getPath()=" +storageVolumes[i].getPath()); + } + /*if(storageVolumes.length >= 2){ + sdcard_path = storageVolumes[1].getPath();*/ + + //SDCARD_PATH=sdcard_path; + //Log.d(TAG, " storageVolumes[1].getPath()= " + SDCARD_PATH + " "+","+ Environment.getExternalStorageDirectory()); + //Log.d(TAG, " storageVolumes[0].getPath()= " + storageVolumes[0].getPath()); + //} + sBuilder = new StringBuilder(); + //String sdState = getSdCardState(); + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { + isFindSd=true; + + mResult.setText(getString(R.string.resume_findSD)); + mHandler.sendEmptyMessageDelayed(SEND_REND_WRITE_SD, 1000); + } + } + + @Override + protected void onPause() { + super.onPause(); + if (mStorageManager != null) { + // mStorageManager.unregisterListener(mStorageListener); + } + } + + + public void testSdcard() { + try { + if (null == mTestStorage || null == mTestStorage.getPath()) { + sBuilder.append(getNotStoragePathFailTxt()).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + // String externalVolumeState = mStorageManager.getVolumeState(SDCARD_PATH); + //if (!externalVolumeState.equals(Environment.MEDIA_MOUNTED)) { + // sBuilder.append(getString(R.string.SdCardFail)).append("\n"); + //mResult.setText(sBuilder.toString()); + //mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + //isFindSd = false; + //return; + // } + } catch (Exception rex) { + + rex.printStackTrace(); + isFindSd = false; + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + return; + } + + File pathFile = new File(mTestStorage.getPath()); + Log.d(TAG, "pathFile = " + pathFile.toString()); + if (!pathFile.exists()) { + sBuilder.append(getNotStoragePathFailTxt()).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + try { + stat = new StatFs(pathFile.getPath()); + } catch (Exception e) { + e.printStackTrace(); + sBuilder.append(getNotStoragePathFailTxt()).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + + long blockSize = stat.getBlockSize(); + long totalBlocks = stat.getBlockCount(); + String totalSize = Formatter.formatFileSize(this, totalBlocks + * blockSize); + if ("0.00 B".equals(totalSize)) { + sBuilder.append(getNotStoragePathFailTxt()).append("\n"); + mResult.setText(sBuilder.toString()); + mHandler.sendEmptyMessageDelayed(R_FAIL, 3000); + isFindSd = false; + return; + } + String prix = ""; + if (STORAGE_TYPE.PCIE == mStorageType) { + prix = getString(R.string.PCIEFind); + } else if (STORAGE_TYPE.SATA == mStorageType) { + prix = getString(R.string.SATAFind); + } else if (STORAGE_TYPE.USB_HOST == mStorageType) { + prix = getString(R.string.UsbFind); + } + sBuilder.append(prix + totalSize).append("\n"); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + testReadAndWrite(); + + } + + private String getTestTitle() { + if (STORAGE_TYPE.PCIE == mStorageType) { + return getString(R.string.PCIETestTitle); + } else if (STORAGE_TYPE.SATA == mStorageType) { + return getString(R.string.SATATestTitle); + } else if (STORAGE_TYPE.USB_HOST == mStorageType) { + return getString(R.string.UsbHostTestTitle); + } + return ""; + } + + private String getNotStoragePathFailTxt() { + if (STORAGE_TYPE.PCIE == mStorageType) { + return getString(R.string.PCIETestFail); + } else if (STORAGE_TYPE.SATA == mStorageType) { + return getString(R.string.SATATestFail); + } else if (STORAGE_TYPE.USB_HOST == mStorageType) { + return getString(R.string.UsbHostTestFail); + } + return ""; + } + + public void testReadAndWrite() { + if (isFindSd && dotestReadAndWrite()) { + sBuilder.append(getTestTitle() + SUCCESS); + mResult.setText(sBuilder.toString()); + ((Button)findViewById(R.id.btn_Skip)).setClickable(false); + //((Button)findViewById(R.id.btn_Pass)).setClickable(false); + ((Button)findViewById(R.id.btn_Fail)).setClickable(false); + if (STORAGE_TYPE.PCIE == mStorageType) { + childTest(); + } else if (STORAGE_TYPE.USB_HOST == mStorageType + && Build.VERSION.SDK_INT == ConfigUtil.ANDROID_SDK_VERSION_R) { + dotestHostSpeed(mTestStorage.getSysPath()); + } else { + mHandler.sendEmptyMessageDelayed(R_PASS, BACK_TIME); + } + } else { + sBuilder.append(getTestTitle() + FAIL); + mResult.setText(sBuilder.toString()); + ((Button)findViewById(R.id.btn_Skip)).setClickable(false); + ((Button)findViewById(R.id.btn_Pass)).setClickable(false); + //((Button)findViewById(R.id.btn_Fail)).setClickable(false); + mHandler.sendEmptyMessageDelayed(R_FAIL, BACK_TIME); + } + } + + private void dotestHostSpeed(String sysPath) { + //String test = "/sys//devices/platform/usbhost/fd000000.dwc3/xhci-hcd.0.auto/usb60/6-1/6-1:1.0/host1/target1:0:0/1:0:0:0/block/sda'}"; + Pattern pattern = Pattern.compile(".*/(usb)(\\d+)/\\d-\\d/"); + Matcher matcher = pattern.matcher(sysPath); + String lastStorageResult = ""; + if (null != mResult.getText() && null != mResult.getText().toString()) { + lastStorageResult = mResult.getText().toString(); + } + if (matcher.find()) { + String strSpeed = SystemUtil.execShellCmd( + "cat " + matcher.group() + "speed"); + if ("5000".equals(strSpeed)) { + mResult.setText(lastStorageResult + "\n\nusb3.0"); + } else if("480".equals(strSpeed)) { + mResult.setText(lastStorageResult + "\n\nusb2.0"); + } else if ("12".equals(strSpeed)) { + mResult.setText(lastStorageResult + "\n\nusb1.1"); + } else { + mResult.setText(lastStorageResult + "\n\n" + strSpeed + ", unknown usb type"); + } + findViewById(R.id.btn_Pass).setVisibility(View.VISIBLE); + findViewById(R.id.btn_Pass).setClickable(true); + findViewById(R.id.btn_Fail).setVisibility(View.VISIBLE); + findViewById(R.id.btn_Fail).setClickable(true); + } else { + mResult.setText(lastStorageResult + "\n\n" + sysPath); + mHandler.sendEmptyMessageDelayed(R_FAIL, BACK_TIME); + } + } + + private boolean dotestReadAndWrite() { + // String directoryName = Environment.getExternalStorageDirectory().toString()+ "/test"; + String directoryName = mTestStorage.getPath() + "/test"; + File directory = new File(directoryName); + if (!directory.isDirectory()) { + if (!directory.mkdirs()) { + sBuilder.append(getString(R.string.MakeDir) + FAIL).append("\n"); + return false; + } else { + sBuilder.append(getString(R.string.MakeDir) + SUCCESS).append( + "\n"); + } + } + File f = new File(directoryName, "SDCard.txt"); + try { + // Remove stale file if any + if (f.exists()) { + f.delete(); + } + if (!f.createNewFile()) { + sBuilder.append(getString(R.string.CreateFile) + FAIL).append( + "\n"); + return false; + } else { + sBuilder.append(getString(R.string.CreateFile) + SUCCESS).append( + "\n"); + + doWriteFile(f.getAbsoluteFile().toString()); + + if (doReadFile(f.getAbsoluteFile().toString()).equals( + TEST_STRING)) { + sBuilder.append(getString(R.string.Compare)).append(SUCCESS).append( + "\n"); + } else { + sBuilder.append(getString(R.string.Compare)).append(FAIL).append( + "\n"); + return false; + } + } + + sBuilder.append(getString(R.string.FileDel)).append( + (f.delete() ? SUCCESS : FAIL)).append("\n"); + sBuilder.append(getString(R.string.DirDel)).append( + (directory.delete() ? SUCCESS : FAIL)).append("\n"); + return true; + } catch (IOException ex) { + Log.e(TAG, "isWritable : false (IOException)!"); + return false; + } + } + + public void doWriteFile(String filename) { + try { + sBuilder.append(getString(R.string.WriteData)).append("\n"); + OutputStreamWriter osw = new OutputStreamWriter( + new FileOutputStream( + filename)); + osw.write(TEST_STRING, 0, TEST_STRING.length()); + osw.flush(); + osw.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public String doReadFile(String filename) { + try { + BufferedReader br = new BufferedReader(new InputStreamReader + (new FileInputStream(filename))); + String data = null; + StringBuilder temp = new StringBuilder(); + sBuilder.append(getString(R.string.ReadData)).append("\n"); + while ((data = br.readLine()) != null) { + temp.append(data); + } + br.close(); + Log.e(TAG, "Readfile " + temp.toString()); + return temp.toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /* + public class SdcardReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + Log.e(TAG, "onReveive ..... " + intent.getAction()); + if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) { + Log.e(TAG, "239 ..... " + intent.getAction()); + testSdcard(); + testReadAndWrite(); + } + } + } + */ +/*StorageEventListener mStorageListener = new StorageEventListener() { + @Override + public void onStorageStateChanged(String path, String oldState, String newState) { + Log.d("xxxxxxxxxxxxxxxxxxxxxxxxxxxx","yyyyyyyyyyyyyyyyyyyyyyyyyyyy"); + if (path.equals(SDCARD_PATH) && newState.equals(Environment.MEDIA_MOUNTED)) { + isFindSd=true; + + mResult.setText(getString(R.string.resume_findSD)); + mHandler.sendEmptyMessageDelayed(SEND_REND_WRITE_SD, 100); + testReadAndWrite(); + } + } + };*/ + + public void TestResult(int result) { + if (result == R_PASS) { + if(isSDFirstTest){ + isSDFirstTest=false; + ((Button) findViewById(R.id.btn_Pass)).performClick(); + isFindSd = false; + } + + } else if (result == R_FAIL) { + if(isSDFirstTest){ + isSDFirstTest=false; + ((Button) findViewById(R.id.btn_Fail)).performClick(); + isFindSd = false; + } + } + } + + Handler mHandler = new Handler() { + public void handleMessage(android.os.Message msg) { + switch (msg.what) { + case R_PASS: + TestResult(R_PASS); + break; + case R_FAIL: + TestResult(R_FAIL); + break; + + case SEND_REND_WRITE_SD: + + testSdcard(); + break; + default: + dealMessage(msg); + break; + } + }; + }; + /* + public static String getSdCardState() { + try { + IMountService mMntSvc = null; + if (mMntSvc == null) { + mMntSvc = IMountService.Stub.asInterface(ServiceManager + .getService("mount")); + } + return mMntSvc.getVolumeState(USB_PATH); + } catch (Exception rex) { + return Environment.MEDIA_REMOVED; + } + + } + */ + //获取外置sd卡路径 + private static String getStoragePath(Context mContext, boolean is_removale) { + + mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); + Class<?> storageVolumeClazz = null; + try { + storageVolumeClazz = Class.forName("android.os.storage.StorageVolume"); + Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList"); + Method getPath = storageVolumeClazz.getMethod("getPath"); + Method isRemovable = storageVolumeClazz.getMethod("isRemovable"); + Object result = getVolumeList.invoke(mStorageManager); + final int length = Array.getLength(result); + for (int i = 0; i < length; i++) { + Object storageVolumeElement = Array.get(result, i); + String path = (String) getPath.invoke(storageVolumeElement); + boolean removable = (Boolean) isRemovable.invoke(storageVolumeElement); + if (is_removale == removable) { + return path; + } + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + + public void init_StoragePath(Context context) { + mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); + flash_dir = Environment.getExternalStorageDirectory().getPath(); + final List<VolumeInfo> volumes = mStorageManager.getVolumes(); + Collections.sort(volumes, VolumeInfo.getDescriptionComparator()); + for (VolumeInfo vol : volumes) { + if (vol.getType() != VolumeInfo.TYPE_PUBLIC) { + continue; + } + Log.d(TAG, "Volume path:" + vol.getPath()); + DiskInfo disk = vol.getDisk(); + if (null == disk) { + continue; + } + if (STORAGE_TYPE.PCIE == mStorageType) { + if (null != disk.sysPath && disk.sysPath.contains(".pcie/")) { + StorageVolume sv = vol.buildStorageVolume(context, + context.getUserId(), false); + mTestStorage = new StorageInfo(sv.getPath(), disk.sysPath); + break; + } + } else if (STORAGE_TYPE.SATA == mStorageType) { + if (null != disk.sysPath && disk.sysPath.contains(".sata/")) { + StorageVolume sv = vol.buildStorageVolume(context, + context.getUserId(), false); + mTestStorage = new StorageInfo(sv.getPath(), disk.sysPath); + break; + } + } else if (STORAGE_TYPE.USB_HOST == mStorageType) { + if (disk.isUsb() && null != disk.sysPath + && !disk.sysPath.contains(".pcie/") + && !disk.sysPath.contains(".sata/")) { + StorageVolume sv = vol.buildStorageVolume(context, + context.getUserId(), false); + mTestStorage = new StorageInfo(sv.getPath(), disk.sysPath); + break; + } + } else if (disk.isSd()) { + + } + } + Log.d(TAG, "mTestStorageInfo: " + mTestStorage); + } +//判断sd卡是否挂载 +private boolean isSDMounted() { + boolean isMounted = false; + StorageManager sm = (StorageManager) getSystemService(Context.STORAGE_SERVICE); + + try { + Method getVolumList = StorageManager.class.getMethod("getVolumeList", null); + getVolumList.setAccessible(true); + Object[] results = (Object[])getVolumList.invoke(sm, null); + if (results != null) { + for (Object result : results) { + Method mRemoveable = result.getClass().getMethod("isRemovable", null); + Boolean isRemovable = (Boolean) mRemoveable.invoke(result, null); + if (isRemovable) { + Method getPath = result.getClass().getMethod("getPath", null); + String path = (String) mRemoveable.invoke(result, null); + Method getState = sm.getClass().getMethod("getVolumeState", String.class); + String state = (String)getState.invoke(sm, path); + if (state.equals(Environment.MEDIA_MOUNTED)) { + isMounted = true; + break; + } + } + } + } + } catch (NoSuchMethodException e){ + e.printStackTrace(); + } catch (IllegalAccessException e){ + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + + return isMounted; + } + + @Override + protected void onDestroy() { + super.onDestroy(); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VersionTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VersionTestActivity.java new file mode 100755 index 0000000..db78c2d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VersionTestActivity.java @@ -0,0 +1,127 @@ +package com.DeviceTest; + +import android.app.Activity; +import android.content.Context; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.os.StatFs; +import android.os.SystemProperties; +import android.view.KeyEvent; +import android.widget.TextView; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.DeviceTest.helper.ControlButtonUtil; + +public class VersionTestActivity extends Activity +{ + private String getFormattedKernelVersion() { + String procVersionStr; + + try { + BufferedReader reader = new BufferedReader(new FileReader("/proc/version"), 256); + try { + procVersionStr = reader.readLine(); + } finally { + reader.close(); + } + + final String PROC_VERSION_REGEX = + "\\w+\\s+" + /* ignore: Linux */ + "\\w+\\s+" + /* ignore: version */ + "([^\\s]+)\\s+" + /* group 1: 2.6.22-omap1 */ + "\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+" + /* group 2: (xxxxxx@xxxxx.constant) */ + "\\((?:[^(]*\\([^)]*\\))?[^)]*\\)\\s+" + /* ignore: (gcc ..) */ + "([^\\s]+)\\s+" + /* group 3: #26 */ + "(?:PREEMPT\\s+)?" + /* ignore: PREEMPT (optional) */ + "(.+)"; /* group 4: date */ + + Pattern p = Pattern.compile(PROC_VERSION_REGEX); + Matcher m = p.matcher(procVersionStr); + + if (!m.matches()) { + + return "Unavailable"; + } else if (m.groupCount() < 4) { + + return "Unavailable"; + } else { + return (new StringBuilder(m.group(1)).append("\n").append( + m.group(2)).append(" ").append(m.group(3)).append("\n") + .append(m.group(4))).toString(); + } + } catch (IOException e) { + + + return "Unavailable"; + } + } + @Override + protected void onCreate(Bundle paramBundle) + { + super.onCreate(paramBundle); + + + setContentView(R.layout.versiontest); + + + + TextView firmwareTextView = (TextView)findViewById(R.id.TextFirmwareversion); + firmwareTextView.setText(Build.VERSION.RELEASE); + + TextView kernelTextView = (TextView)findViewById(R.id.TextKernelversion); + kernelTextView.setText(getFormattedKernelVersion()); + + + + TextView buildTextView = (TextView)findViewById(R.id.TextBuildversion); + buildTextView.setText(Build.DISPLAY); + + TextView localTextView5 = (TextView)findViewById(R.id.TextBasebandversion); + String str4 = SystemProperties.get("gsm.version.baseband", "Unavailable"); + localTextView5.setText(str4); + +// checkFlashSize(); + + ControlButtonUtil.initControlButtonView(this); + } + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } + + +/* Flash test Used for mid + * + public void checkFlashSize() { + TextView flashsizeView = (TextView)findViewById(R.id.FlashSize); + + String path = getDirectory("FLASH_STORAGE", "/flash").getPath(); + StatFs stat = new StatFs(path); + long blockSize = stat.getBlockSize(); + long availableBlocks = stat.getAvailableBlocks(); + long availableSize = (availableBlocks * blockSize)/(1024 * 1024); //MBtye + long freeBlocks = stat.getFreeBlocks(); + long freeSize = (freeBlocks * blockSize)/(1024 * 1024); //MBtye + + flashsizeView.setText(String.valueOf(availableSize)+" MB"); + } + + static File getDirectory(String variableName, String defaultPath) { + String path = System.getenv(variableName); + return path == null ? new File(defaultPath) : new File(path); + } + + */ + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VibrationTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VibrationTestActivity.java new file mode 100755 index 0000000..33a776d --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/VibrationTestActivity.java @@ -0,0 +1,57 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import com.DeviceTest.helper.ControlButtonUtil; + +import android.app.Activity; +import android.os.Bundle; +import android.os.Vibrator; +import android.view.KeyEvent; +import android.widget.TextView; + +public class VibrationTestActivity extends Activity { + + private Vibrator mVibrator; + + + protected void onCreate(Bundle paramBundle) { + super.onCreate(paramBundle); + + + setTitle(getTitle() + "----(" + + getIntent().getStringExtra(DeviceTest.EXTRA_TEST_PROGRESS) + ")"); + //requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + + setContentView(R.layout.vibrationtest); + + TextView txtTitle = (TextView) findViewById(R.id.txtTitle); + TextView txtContent = (TextView) findViewById(R.id.txtContent); + txtTitle.setText(R.string.VibrationTitle); + txtContent.setText(R.string.VibrationContent); + this.mVibrator = (Vibrator) getSystemService("vibrator"); + ControlButtonUtil.initControlButtonView(this); + + } + + protected void onPause() { + super.onPause(); + this.mVibrator.cancel(); + } + + protected void onResume() { + super.onResume(); + long pattern[] = { 500L, 500L }; + this.mVibrator.vibrate(pattern, 0); + + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/WifiTestActivity.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/WifiTestActivity.java new file mode 100755 index 0000000..f7735b2 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/WifiTestActivity.java @@ -0,0 +1,458 @@ +package com.DeviceTest; + +import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.apache.http.HttpClientConnection; +import org.apache.http.HttpConnection; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; + +import com.DeviceTest.helper.ControlButtonUtil; +import com.DeviceTest.helper.SystemUtil; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.Uri; +import android.net.wifi.ScanResult; +import android.net.wifi.WifiConfiguration; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.os.Parcelable; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.view.Window; +//import android.webkit.WebView; +import android.widget.ProgressBar; +import android.widget.RemoteViews; +import android.widget.TextView; + +public class WifiTestActivity extends Activity { + + private static final String TAG = WifiTestActivity.class.getSimpleName(); + private static final String HTTP_TEST_URL = "http://172.16.9.1/"; + private static final String PING_TEST_ADDR = "172.16.9.1"; + private static final int TEST_FAILED_DELAY = 5000; + private static final int MSG_ERROR = 1; + private static final int MSG_HTTP_TEST = 2; + private static final int MSG_SCAN = 3; + private static final int MSG_HTTP_TEST_PASS = 4; + private static final int MSG_HTTP_TEST_FAILED = 5; + private static final int MSG_FAIL = 6; + private static final int MSG_PING_TEST_PASS = 7; + private static final int MSG_PING_TEST_FAILED = 8; + private static final int MSG_PING_TEST = 9; + private static final int MSG_FINISH_TEST = 10; + private Handler mHandler; + private BroadcastReceiver mReceiver; + TextView mResult; + TextView mInfoText; + boolean stop = false; + private boolean mReadyToTest = false; + TextView mText; + TextView mTitle; + ProgressBar wifiProgressBar; + + private List<String> mWifiList; + private WifiManager mWifiManager; + + private final static String ERRMSG = "Wifi test failed!"; + + NetworkInfo mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_WIFI, 0, "WIFI", ""); + + public WifiTestActivity() { + + this.mWifiList = new ArrayList<String>(); + + this.mReceiver = new MyBroadcastReceiver(); + + mHandler = new MyHandler(); + } + + // + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + // requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(FLAG_FULLSCREEN | FLAG_KEEP_SCREEN_ON); + setContentView(R.layout.wifitest); + + this.mResult = (TextView) findViewById(R.id.wifiresultText); + this.mResult.setVisibility(View.VISIBLE); + // this.mResult.setGravity(17); + mInfoText = (TextView) findViewById(R.id.wifiInfoText); + + wifiProgressBar = (ProgressBar) findViewById(R.id.wifiprogress); + wifiProgressBar.setVisibility(View.VISIBLE); + ControlButtonUtil.initControlButtonView(this); + + this.mWifiManager = (WifiManager) getSystemService("wifi"); + findViewById(R.id.btn_Pass).setVisibility(View.INVISIBLE); + } + + protected void onResume() { + super.onResume(); + IntentFilter localIntentFilter = new IntentFilter(); + localIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); + localIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); + localIntentFilter + .addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION); + localIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); + registerReceiver(mReceiver, localIntentFilter); + this.mWifiList.clear(); + + stop = false; + Log.i("Jeffy", "try to enable wifi"); + mWifiManager.setWifiEnabled(true); + mHandler.sendEmptyMessage(MSG_SCAN); + + Log.i("Jeffy", "start test"); + } + + public void onPause() { + stop = true; + super.onPause(); + if (this.mWifiManager == null) { + return; + } + + Log.i("Jeffy", "end test"); + this.mHandler.removeMessages(MSG_SCAN); + this.mHandler.removeMessages(MSG_ERROR); + + unregisterReceiver(mReceiver); + // mWifiManager.setWifiEnabled(false); + mHandler.removeMessages(MSG_FAIL); + } + + class MyHandler extends Handler { + + public void handleMessage(Message msg) { + if (stop) { + return; + } + switch (msg.what) { + + case MSG_SCAN: + Log.i(TAG, "try to scan"); + removeMessages(MSG_SCAN); + mWifiManager.startScan(); + break; + + case MSG_HTTP_TEST: + removeMessages(MSG_HTTP_TEST); + if (mReadyToTest) { + Log.i("Jeffy", "do http test:" + HTTP_TEST_URL); + mInfoText.setText(mInfoText.getText() + "\ntesting " + + HTTP_TEST_URL); + new Thread(new Runnable() { + + public void run() { + + mHandler.sendEmptyMessage(httpClientTest() ? MSG_HTTP_TEST_PASS + : MSG_HTTP_TEST_FAILED); + } + }).start(); + } + break; + + case MSG_PING_TEST: + removeMessages(MSG_PING_TEST); + if (mReadyToTest) { + Log.i("Jeffy", "do ping test:" + PING_TEST_ADDR); + mInfoText.setText(mInfoText.getText() + "\ntesting " + + PING_TEST_ADDR); + new Thread(new Runnable() { + + public void run() { + + mHandler.sendEmptyMessage(pingTest() ? MSG_PING_TEST_PASS + : MSG_PING_TEST_FAILED); + } + }).start(); + } + break; + case MSG_PING_TEST_PASS: { + mInfoText.setText(mInfoText.getText() + "\n" + getString(R.string.WifiPing)+getString(R.string.btnPassText)); + wifiProgressBar.setVisibility(View.GONE); + mHandler.sendEmptyMessageDelayed(MSG_FINISH_TEST, 2000); + findViewById(R.id.btn_Pass).performClick(); + break; + } + case MSG_PING_TEST_FAILED: { + mInfoText.setText(mInfoText.getText() + "\n" + getString(R.string.WifiPing)+getString(R.string.btnFailText)); + wifiProgressBar.setVisibility(View.GONE); + mHandler.sendEmptyMessageDelayed(MSG_FAIL, + TEST_FAILED_DELAY); + break; + } + case MSG_HTTP_TEST_PASS: { + mInfoText.setText(mInfoText.getText() + "\n" + getString(R.string.WifiHttp)+getString(R.string.btnPassText)); + wifiProgressBar.setVisibility(View.GONE); + findViewById(R.id.btn_Pass).performClick(); + break; + } + + case MSG_HTTP_TEST_FAILED: { + mInfoText.setText(getString(R.string.WifiHttp)+getString(R.string.btnFailText)); + wifiProgressBar.setVisibility(View.GONE); + mHandler.sendEmptyMessageDelayed(MSG_FAIL, + TEST_FAILED_DELAY); + break; + } + + case MSG_ERROR: + + removeMessages(MSG_ERROR); + wifiProgressBar.setVisibility(View.GONE); + mResult.setText(getString(R.string.WifiError)); + mHandler.sendEmptyMessageDelayed(MSG_FAIL, + TEST_FAILED_DELAY); + break; + case MSG_FAIL: + removeMessages(MSG_FAIL); + wifiProgressBar.setVisibility(View.GONE); + findViewById(R.id.btn_Fail).performClick(); + break; + case MSG_FINISH_TEST: + wifiProgressBar.setVisibility(View.GONE); + findViewById(R.id.btn_Pass).performClick(); + break; + } + } + } + + class MyBroadcastReceiver extends BroadcastReceiver { + + public void onReceive(Context context, Intent intent) { + if (stop) { + return; + } + String action = intent.getAction(); + + Log.i("Jeffy", "action:" + action); + + if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) { + int state = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, + WifiManager.WIFI_STATE_UNKNOWN); + if (state == WifiManager.WIFI_STATE_ENABLED) { + mHandler.sendEmptyMessage(MSG_SCAN); + } + } + + if (WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION.equals(action)) { + boolean connected = intent.getBooleanExtra( + WifiManager.EXTRA_SUPPLICANT_CONNECTED, false); + if (connected && mReadyToTest) { + Log.i("Jeffy", "already connect to:" + + mWifiManager.getConnectionInfo().getSSID()); + mInfoText.setText("connect to " + + mWifiManager.getConnectionInfo().getSSID()); +// mHandler.sendEmptyMessage(MSG_PING_TEST); //change no pingtest + mHandler.sendEmptyMessageDelayed(MSG_FINISH_TEST, 3000); + } + } + + if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) { + mNetworkInfo = (NetworkInfo) intent.getParcelableExtra( + WifiManager.EXTRA_NETWORK_INFO); + // reset & clear notification on a network connect & disconnect + switch(mNetworkInfo.getDetailedState()) { + case CONNECTED: + Log.i("Jeffy", "connect to:" + + mWifiManager.getConnectionInfo().getSSID()); + mInfoText.setText("Connected to " + + mWifiManager.getConnectionInfo().getSSID()); + mHandler.sendEmptyMessageDelayed(MSG_FINISH_TEST, 3000); + break; + } + } + + if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action)) { + List<ScanResult> resultList = mWifiManager.getScanResults(); + Collections.sort(resultList, new Comparator<ScanResult>() { + + public int compare(ScanResult s1, ScanResult s2) { + return s2.level - s1.level; + } + }); + + if ((resultList != null) && (!resultList.isEmpty())) { + + String str3 = getString(R.string.wififindtest); + StringBuilder sb = new StringBuilder().append(str3).append( + "\n"); + ScanResult selectAp = null; + for (ScanResult scanResult : resultList) { + sb.append( + scanResult.SSID + + "\t- " + + scanResult.capabilities + + "\t- level:" + + WifiManager.calculateSignalLevel( + scanResult.level, 4)).append( + "\n"); + if (scanResult.capabilities.length() < 6) { + if (null == selectAp + || selectAp.level < scanResult.level) { + selectAp = scanResult; + } + } + } + mResult.setText(sb.toString()); + + mReadyToTest = true; + + if (mWifiManager.getConnectionInfo().getIpAddress() != 0) { + Log.i("Jeffy", "--already connect to:" + + mWifiManager.getConnectionInfo().getSSID()); + mInfoText.setText(getString(R.string.WifiConnect) + + mWifiManager.getConnectionInfo().getSSID()); +// mHandler.sendEmptyMessage(MSG_PING_TEST); //change no pingtest + mHandler.sendEmptyMessageDelayed(MSG_FINISH_TEST, 3000); + return; + } + Log.i("Jeffy", "--selected ap:" + selectAp); + if (null == selectAp) { + mInfoText.setText(getString(R.string.WifiConnectErr)); + wifiProgressBar.setVisibility(View.GONE); + //mHandler.sendEmptyMessageDelayed(MSG_FAIL, + // TEST_FAILED_DELAY); + + mHandler.sendEmptyMessageDelayed(MSG_PING_TEST_PASS, 500); + return; + } + + int networkId = getNetworkId(selectAp.BSSID, selectAp.SSID); + mInfoText.setText(getString(R.string.WifiTry) + " " + selectAp.SSID); + Log.i("Jeffy", "--try connect to ap:" + selectAp.SSID); + mWifiManager.enableNetwork(networkId, true); + + // + // wifiProgressBar.setVisibility(View.GONE); + // isTestFinish = true; + // mResult.setText("Find wifi network...\n Pass!"); + + mHandler.sendEmptyMessageDelayed(MSG_PING_TEST_PASS, 500); + } + } + + } + } + + private int getNetworkId(String BSSID, String SSID) { + for (WifiConfiguration wifiConfiguration : mWifiManager + .getConfiguredNetworks()) { + if (BSSID.equals(wifiConfiguration.BSSID)) { + Log.i("Jeffy", "--get existed config:" + wifiConfiguration.SSID); + return wifiConfiguration.networkId; + } + } + + WifiConfiguration wc = new WifiConfiguration(); + wc.BSSID = BSSID; + wc.SSID = "\"" + SSID + "\""; + wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); + wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); + wc.status = WifiConfiguration.Status.ENABLED; + wc.networkId = mWifiManager.addNetwork(wc); + Log.i("Jeffy", "--new config:" + wc.SSID); + return wc.networkId; + } + + private boolean httpClientTest() { + HttpClient client = new DefaultHttpClient(); + try { + // TODO: Hardcoded for now, make it UI configurable + HttpGet request = new HttpGet(HTTP_TEST_URL); + HttpResponse response = client.execute(request); + Log.i("Jeffy", "http result code:" + + response.getStatusLine().getStatusCode()); + if (response.getStatusLine().getStatusCode() == 401) { + request.abort(); + return true; + } else { + request.abort(); + return false; + } + } catch (IOException e) { + Log.i("Jeffy", "http exception"); + e.printStackTrace(); + return false; + } finally { + } + } + + private boolean pingTest() { +// int status = SystemUtil.execShellCmdForStatue("ping -c 1 -w 5 " +// + PING_TEST_ADDR); +// return (status == 0); + boolean ret = false; + URL serverURL; + try { + serverURL = new URL("http://www.baidu.com"); + Log.d(TAG, " __________________-------- serverURL = " + serverURL.toString()); + // connect to server + URLConnection uc2 = serverURL.openConnection(); + HttpURLConnection conn = (HttpURLConnection) uc2; + Log.d(TAG, " __________________--------00 serverURL = " + serverURL.toString()); + uc2.setAllowUserInteraction(true); + uc2.setConnectTimeout(55000); + uc2.setDoInput(true); + uc2.setDoOutput(true); +// conn.setConnectTimeout(1000); + conn.setReadTimeout(1000); + int numBytesRead = 0; + int allBytesRead = 0; + Log.d(TAG, " __________________--------11 conn.getContentLength() = " + conn.getContentLength()); + InputStream in = conn.getInputStream(); + byte[] buffer = new byte[4096]; + do { + numBytesRead = in.read(buffer); + allBytesRead = allBytesRead + numBytesRead; + } while (numBytesRead > 0); + Log.d(TAG, " __________________-------- allBytesRead = " + allBytesRead + " " + conn.getContentLength()); + if(allBytesRead > 10) + ret = true; + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return ret; + } + + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { + return false; + } + return super.dispatchKeyEvent(event); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ConfigUtil.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ConfigUtil.java new file mode 100755 index 0000000..07267b9 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ConfigUtil.java @@ -0,0 +1,26 @@ +package com.DeviceTest.helper; + +import android.os.SystemProperties; +import android.text.TextUtils; + +public class ConfigUtil { + public static int ANDROID_SDK_VERSION_P = 28; + public static int ANDROID_SDK_VERSION_R = 30; + public static int ANDROID_SDK_VERSION_S = 31; + + private static String mProductModel; + + public static boolean isSpecialEvb() { + String platform = SystemProperties.get("ro.board.platform"); + if ("rk356x".equals(platform)) { + if (TextUtils.isEmpty(mProductModel)) { + mProductModel = SystemUtil.execShellCmd( + "cat /sys/firmware/devicetree/base/model"); + } + if (null != mProductModel) { + return mProductModel.contains("EVB"); + } + } + return false; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ControlButtonUtil.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ControlButtonUtil.java new file mode 100755 index 0000000..546192b --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/ControlButtonUtil.java @@ -0,0 +1,130 @@ +package com.DeviceTest.helper; + +import com.DeviceTest.DeviceTest; +import com.DeviceTest.R; +import com.DeviceTest.R.id; +import com.DeviceTest.helper.TestCase.RESULT; + +import android.app.Activity; +import android.app.NotificationManager; +import android.content.Intent; + +import android.util.Log; +import android.view.View; + +import android.widget.Button; + +public class ControlButtonUtil { + static Activity mActivity; + static ControlButtonUtil mControlButtonView; + static NotificationManager mNotificationManager; + static Intent resultIntent = new Intent(); + private static String mAction; + public ControlButtonUtil(Activity paramActivity) { + resultIntent.removeExtra(DeviceTest.EXTRA_TEST_RESULT_INFO); + mActivity = paramActivity; + + Button returnButton = (Button) mActivity.findViewById(R.id.btn_return); + + returnButton.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + ControlButtonUtil.mActivity.setResult(mActivity.RESULT_OK, + resultIntent); + if (ControlButtonUtil.mNotificationManager != null) + ControlButtonUtil.mNotificationManager.cancelAll(); + stopService(); + ControlButtonUtil.mActivity.finish(); + } + }); + + Button passButton = (Button) mActivity.findViewById(R.id.btn_Pass); + + passButton.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + ControlButtonUtil.mActivity.setResult(RESULT.OK.ordinal(), + resultIntent); + if (ControlButtonUtil.mNotificationManager != null) + ControlButtonUtil.mNotificationManager.cancelAll(); + stopService(); + ControlButtonUtil.mActivity.finish(); + } + }); + + Button failedButton = (Button) mActivity.findViewById(R.id.btn_Fail); + + failedButton.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + ControlButtonUtil.mActivity.setResult(RESULT.NG.ordinal(), + resultIntent); + if (ControlButtonUtil.mNotificationManager != null) + ControlButtonUtil.mNotificationManager.cancelAll(); + stopService(); + ControlButtonUtil.mActivity.finish(); + + } + }); + + Button skipButton = (Button) mActivity.findViewById(R.id.btn_Skip); + + skipButton.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { +// ControlButtonUtil.mActivity.setResult(RESULT.SKIP.ordinal(), +// resultIntent); +// if (ControlButtonUtil.mNotificationManager != null) +// ControlButtonUtil.mNotificationManager.cancelAll(); +// ControlButtonUtil.mActivity.finish(); + + ControlButtonUtil.mActivity.setResult(RESULT.UNDEF.ordinal(), + resultIntent); + if (ControlButtonUtil.mNotificationManager != null) + ControlButtonUtil.mNotificationManager.cancelAll(); + stopService(); + ControlButtonUtil.mActivity.finish(); + } + }); + + } +// +// public static void back() { +// } + private void stopService(){ + if(mAction != null){ + Intent intent = new Intent(mAction); + ControlButtonUtil.mActivity.stopService(intent); + } + } + public static void setIntent(String result) { + mAction = result; + + } + public static void setResult(String result) { + resultIntent.putExtra(DeviceTest.EXTRA_TEST_RESULT_INFO, result); + } + + public static void Hide() { + mActivity.findViewById(R.id.btn_Pass).setVisibility(View.GONE); + mActivity.findViewById(R.id.btn_Fail).setVisibility(View.GONE); + mActivity.findViewById(R.id.btn_Skip).setVisibility(View.GONE); + mActivity.findViewById(R.id.btn_return).setVisibility(View.GONE); + } + + public static void Show() { + mActivity.findViewById(R.id.btn_Pass).setVisibility(View.VISIBLE); + mActivity.findViewById(R.id.btn_Pass).requestFocus(); + mActivity.findViewById(R.id.btn_Fail).setVisibility(View.VISIBLE); + mActivity.findViewById(R.id.btn_Fail).requestFocus(); + mActivity.findViewById(R.id.btn_Skip).setVisibility(View.VISIBLE); + mActivity.findViewById(R.id.btn_Skip).requestFocus(); + + mActivity.findViewById(R.id.btn_return).setVisibility(View.VISIBLE); + mActivity.findViewById(R.id.btn_return).requestFocus(); + } + + public static void initControlButtonView(Activity paramActivity) { + mControlButtonView = new ControlButtonUtil(paramActivity); + } + + static void setNotification(NotificationManager paramNotificationManager) { + mNotificationManager = paramNotificationManager; + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/PCIEInfo.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/PCIEInfo.java new file mode 100755 index 0000000..dbe5362 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/PCIEInfo.java @@ -0,0 +1,44 @@ +package com.DeviceTest.helper; + +public class PCIEInfo { + private String staSpeed; + private String staWidth; + + public String getStaSpeed() { + return staSpeed; + } + + public void setStaSpeed(String staSpeed) { + this.staSpeed = staSpeed; + } + + public String getStaWidth() { + return staWidth; + } + + public void setStaWidth(String staWidth) { + this.staWidth = staWidth; + } + + @Override + public String toString() { + String gen = staSpeed; + if ("2.5GT/s".equals(staSpeed)) { + gen = "gen1"; + } else if ("5GT/s".equals(staSpeed)) { + gen = "gen2"; + } else if ("8GT/s".equals(staSpeed)) { + gen = "gen3"; + } + String lane = staWidth; + if ("x1".equals(staWidth)) { + lane = "1Lane"; + } else if ("x2".equals(staWidth)) { + lane = "2Lanes"; + } else if ("x4".equals(staWidth)) { + lane = "4Lanes"; + } + return "gen='" + gen + '\'' + + ", lane='" + lane + '\''; + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/Recorder.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/Recorder.java new file mode 100755 index 0000000..f8f85a0 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/Recorder.java @@ -0,0 +1,215 @@ +package com.DeviceTest.helper; + +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileInputStream; + +import com.DeviceTest.DeviceTest; + +import android.media.MediaPlayer; +import android.media.MediaRecorder; +import android.os.Bundle; +import android.os.Environment; +import android.util.Log; + +public class Recorder implements MediaPlayer.OnCompletionListener, + MediaPlayer.OnErrorListener { + public static final int IDLE_STATE = 0; + public static final int INTERNAL_ERROR = 2; + public static final int NO_ERROR = 0; + public static final int PLAYING_STATE = 2; + public static final int RECORDING_STATE = 1; + static final String SAMPLE_LENGTH_KEY = "sample_length"; + static final String SAMPLE_PATH_KEY = "sample_path"; + static final String SAMPLE_PREFIX = "recording"; + private static final String TEST_FILE_PATH = DeviceTest.DATA_PATH + "test"; + public static final int SDCARD_ACCESS_ERROR = 1; + OnStateChangedListener mOnStateChangedListener = null; + MediaPlayer mPlayer = null; + MediaRecorder mRecorder = null; + File mSampleFile = null; + int mSampleLength; + long mSampleStart = 0L; + int mState; + + private void setError(int paramInt) { + if (this.mOnStateChangedListener == null) { + return; + } + + this.mOnStateChangedListener.onError(paramInt); + } + + private void setState(int state) { + if (this.state() == state) { + return; + + } + + this.mState = state; + + signalStateChanged(this.mState); + + } + + private void signalStateChanged(int paramInt) { + if (this.mOnStateChangedListener == null) + return; + this.mOnStateChangedListener.onStateChanged(paramInt); + } + + public void clear() { + stop(); + this.mSampleLength = 0; + signalStateChanged(0); + } + + public void delete() { + int i = 0; + stop(); + if (this.mSampleFile != null) + this.mSampleFile.delete(); + this.mSampleFile = null; + this.mSampleLength = i; + signalStateChanged(i); + } + + + public int getMaxAmplitude() + { + if (this.mState == Recorder.RECORDING_STATE) { + return this.mRecorder.getMaxAmplitude(); + } + return 0; + } + + public void onCompletion(MediaPlayer paramMediaPlayer) { + stop(); + } + + public boolean onError(MediaPlayer paramMediaPlayer, int paramInt1, + int paramInt2) { + stop(); + setError(1); + return true; + } + + public int progress() { + if (this.state() != Recorder.PLAYING_STATE) { + return 0; + } + long currentTime = System.currentTimeMillis(); + + return (int) ((currentTime - this.mSampleStart) / 1000L); + + } + + public File sampleFile() { + return this.mSampleFile; + } + + public int sampleLength() { + return this.mSampleLength; + } + + public void setOnStateChangedListener( + OnStateChangedListener paramOnStateChangedListener) { + this.mOnStateChangedListener = paramOnStateChangedListener; + } + + public void startPlayback() { + + stop(); + + this.mPlayer = new MediaPlayer(); + try { + FileInputStream fis = new FileInputStream(mSampleFile); + this.mPlayer.setDataSource(fis.getFD()); + this.mPlayer.setOnCompletionListener(this); + this.mPlayer.setOnErrorListener(this); + this.mPlayer.prepare(); + this.mPlayer.start(); + + this.mSampleStart = System.currentTimeMillis(); + setState(Recorder.PLAYING_STATE); + + } catch (Exception e) { + setError(Recorder.PLAYING_STATE); + setState(Recorder.IDLE_STATE); + + } + } + + public void startRecording(int paramInt, String paramString) { + + stop(); + try { + Log.i("Jeffy","Create new file:" + TEST_FILE_PATH); + this.mSampleFile = new File(TEST_FILE_PATH); + this.mSampleFile.createNewFile(); + Log.i("Jeffy","new file created,now create recorder"); + this.mRecorder = new MediaRecorder(); + this.mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); + this.mRecorder.setOutputFormat(paramInt); + this.mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); + + String str = this.mSampleFile.getAbsolutePath(); + mRecorder.setOutputFile(str); + Log.i("Jeffy","start to record"); + + this.mRecorder.prepare(); + this.mRecorder.start(); + + this.mSampleStart = System.currentTimeMillis(); + setState(Recorder.RECORDING_STATE); + } catch (Exception e) { + e.printStackTrace(); + setError(Recorder.IDLE_STATE); + if(mRecorder != null) { + this.mRecorder.reset(); + this.mRecorder.release(); + this.mRecorder = null; + } + + } + + } + + public int state() { + return this.mState; + } + + public void stop() { + stopRecording(); + stopPlayback(); + } + + public void stopPlayback() { + if (this.mPlayer == null) { + return; + } + this.mPlayer.stop(); + this.mPlayer.release(); + this.mPlayer = null; + setState(Recorder.IDLE_STATE); + + } + + public void stopRecording() { + if (this.mRecorder == null) { + return; + } + this.mRecorder.stop(); + this.mRecorder.release(); + this.mRecorder = null; + + this.mSampleLength = (int) ((System.currentTimeMillis() - mSampleStart) / 1000L); + setState(Recorder.IDLE_STATE); + } +} + +abstract interface OnStateChangedListener { + public abstract void onError(int paramInt); + + public abstract void onStateChanged(int paramInt); +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/StorageInfo.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/StorageInfo.java new file mode 100755 index 0000000..bef48db --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/StorageInfo.java @@ -0,0 +1,35 @@ +package com.DeviceTest.helper; + +public class StorageInfo { + private String path; + private String sysPath; + + public StorageInfo(String path, String sysPath) { + this.path = path; + this.sysPath = sysPath; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getSysPath() { + return sysPath; + } + + public void setSysPath(String sysPath) { + this.sysPath = sysPath; + } + + @Override + public String toString() { + return "StorageInfo{" + + "path='" + path + '\'' + + ", sysPath='" + sysPath + '\'' + + '}'; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemInfoUtil.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemInfoUtil.java new file mode 100755 index 0000000..a2f4031 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemInfoUtil.java @@ -0,0 +1,578 @@ +package com.DeviceTest.helper; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileFilter; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.security.auth.PrivateCredentialPermission; + +import android.R.integer; +import android.R.string; +import android.app.ActivityManager; +import android.bluetooth.BluetoothAdapter; +import android.content.Context; +import android.graphics.Camera; +import android.hardware.Camera.CameraInfo; +import android.hardware.Camera.Parameters; +import android.hardware.Camera.Size; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; +import android.os.Build; +import android.os.Environment; +import android.os.RemoteException; +import android.os.StatFs; +//import android.os.IECService; +import android.os.ServiceManager; +import android.os.SystemProperties; +import android.text.format.Formatter; +import android.util.Log; + +/* + * TODO:获取系统相关信息 + * + * Data:2013-04-24 + */ + +public class SystemInfoUtil { + private static final String TAG = "SystemInfoUtil"; + + // 获取sdcard 的大小 + private static void getSdcardStorageSize() { + String state = Environment.getExternalStorageState(); + if (Environment.MEDIA_MOUNTED.equals(state)) { + File sdcardDir = Environment.getExternalStorageDirectory(); + StatFs sf = new StatFs(sdcardDir.getPath()); + long blockSize = sf.getBlockSize(); + long blockCount = sf.getBlockCount(); + long availCount = sf.getAvailableBlocks(); + Log.d("cghs", "block大小:" + blockSize + ",block数目:" + blockCount + + ",总大小:" + blockSize * blockCount / 1024 + "KB"); + Log.d("cghs", "可用的block数目::" + availCount + ",剩余空间:" + availCount + * blockSize / 1024 + "KB"); + } + } + + // 获取系统分区的大小 + private static void getSystemStorageSize() { + File root = Environment.getRootDirectory(); + StatFs sf = new StatFs(root.getPath()); + long blockSize = sf.getBlockSize(); + long blockCount = sf.getBlockCount(); + long availCount = sf.getAvailableBlocks(); + Log.d("cghs", "block大小:" + blockSize + ",block数目:" + blockCount + + ",总大小:" + blockSize * blockCount / 1024 + "KB"); + Log.d("cghs", "可用的block数目::" + availCount + ",可用大小:" + availCount + * blockSize / 1024 + "KB"); + } + + // 获得内存信息 方法1 + public static String GetMemInfo1(Context mContext) { + long MEM_UNUSED; + long MEM_TOTAL; + // 得到ActivityManager + ActivityManager am = (ActivityManager) mContext + .getSystemService(Context.ACTIVITY_SERVICE); + // 创建ActivityManager.MemoryInfo对象 + ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); + am.getMemoryInfo(mi); + + // 取得剩余的内存空间 + MEM_UNUSED = mi.availMem / (1024*1024); + MEM_TOTAL = mi.totalMem / (1024*1024); + Log.d("cghs", "MEN_UNUSER: " + MEM_UNUSED + " MEM_TOTAL:" + MEM_TOTAL); + String memStr = MEM_TOTAL + " MB"; + return memStr; + + } + + // 获得内存信息 方法2 + public static void GetMemInfo2() { + List<String> contents = new ArrayList<String>(); + long mTotal; + // /proc/meminfo读出的内核信息进行解释 + String path = "/proc/meminfo"; + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(path), 8); + String line; + if ((line = br.readLine()) != null) { + contents.add(line); + } + + if ((line = br.readLine()) != null) { + contents.add(line); + } + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + String total = contents.get(0); + String rest = contents.get(1); + // beginIndex + int begin = total.indexOf(':'); + // endIndex + int end = total.indexOf('k'); + // 截取字符串信息 + + total = total.substring(begin + 1, end).trim(); + mTotal = Integer.parseInt(total); + Log.d("cghs", "mTotal: " + mTotal); + Log.d("cghs", "" + rest); + } + + // -------------------------CPU INFO------------------------- + + // 获取CPU名字 + public static String getCpuName() { + try { + FileReader fr = new FileReader("/proc/cpuinfo"); + BufferedReader br = new BufferedReader(fr); + String text = br.readLine(); + String[] array = text.split(":\\s+", 2); + for (int i = 0; i < array.length; i++) { + } + return array[1]; + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + public static String getCpuNameByProp() { + String name = null; + name = SystemProperties.get("ro.rk.cpu", "rk3188"); + return name; + } + + // 获取CPU最大频率(单位KHZ) + // "/system/bin/cat" 命令行 + // "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" 存储最大频率的文件的路径 + public static String getMaxCpuFreq() { + String result = "N/A"; + try { + FileReader fr = new FileReader( + "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"); + BufferedReader br = new BufferedReader(fr); + String text = br.readLine(); + result = text.trim(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + // 获取CPU最小频率(单位KHZ) + public static String getMinCpuFreq() { + String result = ""; + ProcessBuilder cmd; + try { + String[] args = { "/system/bin/cat", + "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq" }; + cmd = new ProcessBuilder(args); + Process process = cmd.start(); + InputStream in = process.getInputStream(); + byte[] re = new byte[24]; + while (in.read(re) != -1) { + result = result + new String(re); + } + in.close(); + } catch (IOException ex) { + ex.printStackTrace(); + result = "N/A"; + } + return result.trim(); + } + + // 实时获取CPU当前频率(单位KHZ) + public static String getCurCpuFreq() { + String result = "N/A"; + try { + FileReader fr = new FileReader( + "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"); + BufferedReader br = new BufferedReader(fr); + String text = br.readLine(); + result = text.trim(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + // 获取 cpu 核数 + public static int getNumCores() { + // Private Class to display only CPU devices in the directory listing + class CpuFilter implements FileFilter { + @Override + public boolean accept(File pathname) { + // Check if filename is "cpu", followed by a single digit number + if (Pattern.matches("cpu[0-9]", pathname.getName())) { + return true; + } + return false; + } + } + + try { + // Get directory containing CPU info + File dir = new File("/sys/devices/system/cpu/"); + // Filter to only list the devices we care about + File[] files = dir.listFiles(new CpuFilter()); + // Return the number of cores (virtual CPU devices) + return files.length; + } catch (Exception e) { + e.printStackTrace(); + // Default to return 1 core + return 1; + } + } + + /** + * 获取 HDD 大小 + * + */ + /* + public static String getHDDSize(Context context) { + int trytime = 0; + String flash_path = "/mnt/sdcard"; + while(!getSdCardState(flash_path).equals(Environment.MEDIA_MOUNTED)) { + try { + Thread.sleep(500); + } catch (Exception e) { + + } + trytime ++; + if (trytime >= 8) { + Log.e(TAG, "getHDDSize(): flash unmount"); + return "err!"; + } + } + + + StatFs stat = new StatFs(flash_path); + long blockSize = stat.getBlockSize(); + long totalBlocks = stat.getBlockCount(); + long availableBlocks = stat.getAvailableBlocks(); + float size = (blockSize * totalBlocks)/(1024*1024); + float sizeInGB = size / 1024; + if (sizeInGB > 11.00f && sizeInGB < 20.00f) { + return "16.00 GB"; + } else if (sizeInGB > 20.00f) { + return "32.00 GB"; + } + return Formatter.formatFileSize(context, blockSize * totalBlocks); + + } + */ + + /** + * 获取当前路径下硬盘是否挂载。 + */ + /*public static String getSdCardState(String path) { + try { + IMountService mMntSvc = null; + if (mMntSvc == null) { + mMntSvc = IMountService.Stub.asInterface(ServiceManager + .getService("mount")); + } + return mMntSvc.getVolumeState(path); + } catch (Exception rex) { + return Environment.MEDIA_REMOVED; + } + + } +*/ + /* + * 获取wifi MAC need permission: <uses-permission + * android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission + * android:name="android.permission.INTERNET"/> + */ + public static String getLocalMacAddress(Context context) { + WifiManager wifi = (WifiManager) context + .getSystemService(Context.WIFI_SERVICE); + if (!wifi.isWifiEnabled()) { + // wifi.setWifiEnabled(true); + } + WifiInfo info = wifi.getConnectionInfo(); + String mac = info.getMacAddress(); + wifi.setWifiEnabled(false); + return mac; + + } + + public static String getAndroidVersion() { + return Build.VERSION.RELEASE; + } + + /** + * 获取kernel 版本 + */ + public static String getFormattedKernelVersion() { + String procVersionStr; + + try { + BufferedReader reader = new BufferedReader(new FileReader( + "/proc/version"), 256); + try { + procVersionStr = reader.readLine(); + } finally { + reader.close(); + } + + final String PROC_VERSION_REGEX = "\\w+\\s+" + /* ignore: Linux */ + "\\w+\\s+" + /* ignore: version */ + "([^\\s]+)\\s+" + /* group 1: 2.6.22-omap1 */ + "\\(([^\\s@]+(?:@[^\\s.]+)?)[^)]*\\)\\s+" + /* + * group 2: + * (xxxxxx@xxxxx + * .constant) + */ + "\\((?:[^(]*\\([^)]*\\))?[^)]*\\)\\s+" + /* ignore: (gcc ..) */ + "([^\\s]+)\\s+" + /* group 3: #26 */ + "(?:PREEMPT\\s+)?" + /* ignore: PREEMPT (optional) */ + "(.+)"; /* group 4: date */ + + Pattern p = Pattern.compile(PROC_VERSION_REGEX); + Matcher m = p.matcher(procVersionStr); + + if (!m.matches()) { + + return "Unavailable"; + } else if (m.groupCount() < 4) { + + return "Unavailable"; + } else { + return (new StringBuilder(m.group(1)).append("\n") + .append(m.group(2)).append(" ").append(m.group(3)) + .append("\n").append(m.group(4))).toString(); + } + } catch (IOException e) { + + return "Unavailable"; + } + } + + /** + * 获取product 名字 + */ + public static String getProductName() { + return Build.PRODUCT; + } + +/* public static String getFormattedECVersion() { + IECService ecService; + byte[] vv = new byte[2]; + int ecVersion; + try { + ecService = IECService.Stub.asInterface(ServiceManager + .getService("ECServiceinfo")); + if (ecService == null) { + Log.e(TAG, "Unable to create the ECService instance!"); + return "Unavailable"; + } + + ecVersion = ecService.getVersion(); + + vv[0] = (byte) (ecVersion & 0x000000FF); + vv[1] = (byte) ((ecVersion >> 8) & 0x000000FF); + + return String.format("%02x %02x", vv[1], vv[0]); + + } catch (RemoteException e) { + // TODO Auto-generated catch block + Log.e(TAG, + "IO Exception when getting ec version for Device Info screen", + e); + return "Unavailable"; + } + } +*/ + public static String getCameraId() { + String pidcmd = "/system/bin/cat /sys/bus/usb/devices/3-1/idProduct"; + String vidcmd = "/system/bin/cat /sys/bus/usb/devices/3-1/idVendor"; + String pid = runCmd(pidcmd); + String vid = runCmd(vidcmd); + return pid+"&"+vid; + + } + + public static String getWlanId(Context c) { + int trytime = 0; + WifiManager mWifiManager = (WifiManager) c.getSystemService(Context.WIFI_SERVICE); + /* mWifiManager.setWifiEnabled(true); + while (!mWifiManager.isWifiEnabled()) { + try { + Thread.sleep(500); + trytime ++; + if (trytime >= 8) { + Log.e(TAG, "getWlanId(): open wifi timeout!"); + mWifiManager.setWifiEnabled(false); + return "err!"; + } + } catch (Exception e) { + } + }*/ +// String id = runCmd("/system/bin/iwpriv wlan0 read 1,fc"); +//// mWifiManager.setWifiEnabled(false); +// if (id == null) return "err!"; +// String[] ids = id.split(":"); +// if (ids.length > 1) { +// return ids[1]; +// } +// return "err!"; + WifiInfo info = mWifiManager.getConnectionInfo(); + return info.getMacAddress(); + + } + +/* public static String getTouchpadId(){ + String touchpadId=null; + try { + IECService ecService; + ecService=IECService.Stub.asInterface(ServiceManager.getService("ECServiceinfo")); + if(ecService==null){ + Log.e(TAG,"Unable to create the ECService instance!"); + return "Unavailable"; + } + int padid=ecService.DeviceCtrl(16,0); + if(padid==0)touchpadId="Elan"; + else{ + if(padid==1)touchpadId="Synaptics"; + else touchpadId="Unknow"; + } + }catch (RemoteException e) { + // TODO Auto-generated catch block + Log.e(TAG,"IO Exception when getting touchpadId ",e); + return "Unavailable"; + } + return touchpadId; + } + + public static String getBatteryCell(){ + String batteryCell=null; + try { + IECService ecService; + ecService=IECService.Stub.asInterface(ServiceManager.getService("ECServiceinfo")); + if(ecService==null){ + Log.e(TAG,"Unable to create the ECService instance!"); + return "Unavailable"; + } + int batid=ecService.DeviceCtrl(17,0); + if(batid==0)batteryCell="Other"; + else{ + if(batid==1)batteryCell="Simplo"; + else batteryCell="Unknow"; + } + }catch (RemoteException e) { + // TODO Auto-generated catch block + Log.e(TAG,"IO Exception when getting batteryCell ",e); + return "Unavailable"; + } + return batteryCell; + } + + public static String getTouchpanelId(){ + String touchpanelId=null; + try { + IECService ecService; + ecService=IECService.Stub.asInterface(ServiceManager.getService("ECServiceinfo")); + if(ecService==null){ + Log.e(TAG,"Unable to create the ECService instance!"); + return "Unavailable"; + } + int padid=ecService.DeviceCtrl(18,0); + if(padid==0)touchpanelId="Ofilm"; + else{ + if(padid==1)touchpanelId="Mutto"; + else touchpanelId="Unknow"; + } + } catch (RemoteException e) { + // TODO Auto-generated catch block + Log.e(TAG,"IO Exception when getting Touchpanel id ",e); + return "Unavailable"; + } + return touchpanelId; + } +*/ + public static String runCmd(String cmd) { + Process process = null; + InputStreamReader mISR; + StringBuilder sBuilder = new StringBuilder(); + String temp; + try { + process = Runtime.getRuntime().exec(cmd); + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); +// while ((temp = reader.readLine()) != null) { +// Log.e("cghs", "temp:"+temp); +// } + temp = reader.readLine(); + process.destroy(); + reader.close(); + return temp; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + + public static String getBuildNumber() { + + String mBuildNum=null; + String aa=null; + String Build_number=null; + mBuildNum=Build.DISPLAY; + + int key=mBuildNum.indexOf("A10_S"); + if(key>0){ + aa=mBuildNum.substring(key); + if(aa!=null&&aa.length()>=15) + Build_number=mBuildNum.substring(key, key+15); + } + return Build_number; + } + + //get BTMAC by mw + public static String getBTMAC() { + BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter(); + // mAdapter.enable(); + return mAdapter.getAddress(); + } + + //get EMMC by mw + public static String getEMMC(Context c) { + File dataPath = Environment.getDataDirectory(); + StatFs stat = new StatFs(dataPath.getPath()); + long blockSize = stat.getBlockSize(); + long availableBlocks = stat.getAvailableBlocks(); + return Formatter.formatFileSize(c, availableBlocks * blockSize); + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemUtil.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemUtil.java new file mode 100755 index 0000000..0988284 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/SystemUtil.java @@ -0,0 +1,139 @@ +package com.DeviceTest.helper; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; + +import com.rockchip.newton.UserModeManager; + +import android.content.pm.PackageManager; +import android.graphics.Picture; +import android.util.Log; + +public class SystemUtil { + private static final String TAG = "SystemUtil"; + public static int execShellCmdForStatue(String command) { + int status = -1; + try { + Process p = Runtime.getRuntime().exec(command); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream())); + String s = ""; + while((s = bufferedReader.readLine()) != null){ + Log.d(TAG, " >>>> " + s); + } + status = p.waitFor(); + Log.d(TAG, " ________________----------- command: " + command + " status = " + status); + } catch (Exception e) { + e.printStackTrace(); + } + return status; + + } + + public static String execShellCmd(String command) { + String result = ""; + Log.i("execShellCmd", command); + try { + Process process = Runtime.getRuntime().exec(command + "\n"); + DataOutputStream stdin = new DataOutputStream( + process.getOutputStream()); + DataInputStream stdout = new DataInputStream( + process.getInputStream()); + DataInputStream stderr = new DataInputStream( + process.getErrorStream()); + String line; + while ((line = stdout.readLine()) != null) { + result += line + "\n"; + } + if (result.length() > 0) { + result = result.substring(0, result.length() - 1); + } + while ((line = stderr.readLine()) != null) { + Log.e("EXEC", line); + } + process.waitFor(); + } catch (Exception e) { + e.getMessage(); + } + return result; + } + + public static String execRootCmd(String command) { + int userMode = UserModeManager.getCurrentUserMode(); + UserModeManager.switchToUserMode(UserModeManager.SUPER_USER_MODE); + + String result = execShellCmd("su root " + command + "\n"); + + UserModeManager.switchToUserMode(userMode); + + return result; + } + + public static String execScriptCmd(String command, String path, boolean root) { + int userMode = UserModeManager.getCurrentUserMode(); + UserModeManager.switchToUserMode(UserModeManager.SUPER_USER_MODE); + File tempFile = null; + String result = ""; + Log.i("execScriptCmd", command); + try { + tempFile = new File(path); + tempFile.deleteOnExit(); + BufferedWriter br = new BufferedWriter(new OutputStreamWriter( + new FileOutputStream(tempFile))); + br.write("#!/system/bin/sh\n"); + br.write(command); + br.close(); + SystemUtil.execShellCmd("su root chmod 777 " + + tempFile.getAbsolutePath()); + result = SystemUtil.execShellCmd((root ? "su root " : "") + + tempFile.getAbsolutePath()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (tempFile != null && tempFile.exists()) { + tempFile.delete(); + } + } + UserModeManager.switchToUserMode(userMode); + return result; + } + + public static boolean killProcessByPath(String exePath) { + File dir = new File("/proc/"); + String[] files = dir.list(); + int pid = -1; + for (String path : files) { + File file = new File("/proc/" + path + "/cmdline"); + if (file.exists()) { + String cmdline = execShellCmd("cat " + file.getAbsolutePath()); + if (cmdline.startsWith(exePath)) { + try { + pid = Integer.parseInt(path); + break; + } catch (Exception e) { + break; + } + } + } + } + + if (pid >= 0) { + int userMode = UserModeManager.getCurrentUserMode(); + UserModeManager.switchToUserMode(UserModeManager.SUPER_USER_MODE); + execShellCmd("su root kill " + pid); + UserModeManager.switchToUserMode(userMode); + return true; + } + return false; + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/TestCase.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/TestCase.java new file mode 100755 index 0000000..4198850 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/TestCase.java @@ -0,0 +1,88 @@ +package com.DeviceTest.helper; + +import java.io.IOException; +import java.io.Serializable; + +public class TestCase implements Serializable { + public static enum RESULT { + NG, OK, SKIP, UNDEF, + } + + private int testNo; + private boolean needtest; + private String testName; + private String className; + private RESULT result = RESULT.UNDEF; + private String detail; + private boolean showResult; + + public boolean isShowResult() { + return showResult; + } + + public void setShowResult(boolean showResult) { + this.showResult = showResult; + } + + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public TestCase(int testNo, String testName, String className) { + this.testNo = testNo; + this.testName = testName; + this.className = className; + this.needtest = true; + showResult = true; + } + public boolean getneedtest(){ + return this.needtest; + } + public void setneedtest(boolean tmp){ + this.needtest = tmp; + } + public String getClassName() { + return className; + } + + public RESULT getResult() { + return result; + } + + public String getTestName() { + return testName; + } + + public int getTestNo() { + return testNo; + } + + public void setResult(RESULT result) { + this.result = result; + } + + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + out.writeObject(className); + out.writeInt(result.ordinal()); + out.writeObject(detail); + out.writeBoolean(showResult); + } + + private void readObject(java.io.ObjectInputStream in) throws IOException, + ClassNotFoundException { + Object object = in.readObject(); + if (null != object) { + className = object.toString(); + } + result = RESULT.values()[in.readInt()]; + object = in.readObject(); + if (null != object) { + detail = object.toString(); + } + showResult = in.readBoolean(); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VUMeter.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VUMeter.java new file mode 100755 index 0000000..17bcda1 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VUMeter.java @@ -0,0 +1,90 @@ +package com.DeviceTest.helper; + +import java.util.Map; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.View; + +public class VUMeter extends View { + static final float PIVOT_RADIUS = 3.5f; + static final float PIVOT_Y_OFFSET = 10f; + static final float SHADOW_OFFSET = 2.0f; + static final float DROPOFF_STEP = 0.18f; + static final float SURGE_STEP = 0.35f; + static final long ANIMATION_INTERVAL = 70; + + Paint mPaint, mShadow; + float mCurrentAngle; + + Recorder mRecorder; + + public VUMeter(Context context) { + super(context); + init(context); + } + + public VUMeter(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + + void init(Context context) { +// Drawable background = getResources().getDrawable(R.drawable.vumeter); +// setBackgroundDrawable(background); + + mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + mPaint.setColor(Color.WHITE); + mShadow = new Paint(Paint.ANTI_ALIAS_FLAG); + mShadow.setColor(Color.argb(60, 0, 0, 0)); + + mRecorder = null; + + mCurrentAngle = 0; + } + + public void setRecorder(Recorder recorder) { + mRecorder = recorder; + invalidate(); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + final float minAngle = (float)Math.PI/8; + final float maxAngle = (float)Math.PI*7/8; + + float angle = minAngle; + if (mRecorder != null) + angle += (float)(maxAngle - minAngle)*mRecorder.getMaxAmplitude()/32768; + + if (angle > mCurrentAngle) + mCurrentAngle = angle; + else + mCurrentAngle = Math.max(angle, mCurrentAngle - DROPOFF_STEP); + + mCurrentAngle = Math.min(maxAngle, mCurrentAngle); + + float w = getWidth(); + float h = getHeight(); + float pivotX = w/2; + float pivotY = h - PIVOT_RADIUS - PIVOT_Y_OFFSET; + float l = h*4/5; + float sin = (float) Math.sin(mCurrentAngle); + float cos = (float) Math.cos(mCurrentAngle); + float x0 = pivotX - l*cos; + float y0 = pivotY - l*sin; + canvas.drawLine(x0 + SHADOW_OFFSET, y0 + SHADOW_OFFSET, pivotX + SHADOW_OFFSET, pivotY + SHADOW_OFFSET, mShadow); + canvas.drawCircle(pivotX + SHADOW_OFFSET, pivotY + SHADOW_OFFSET, PIVOT_RADIUS, mShadow); + canvas.drawLine(x0, y0, pivotX, pivotY, mPaint); + canvas.drawCircle(pivotX, pivotY, PIVOT_RADIUS, mPaint); + + if (mRecorder != null && mRecorder.state() == Recorder.RECORDING_STATE) + postInvalidateDelayed(ANIMATION_INTERVAL); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VideoListAdapter.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VideoListAdapter.java new file mode 100755 index 0000000..be56dca --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/VideoListAdapter.java @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2009 The Rockchip Android MID 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.DeviceTest.helper; + +import java.util.Formatter; +import java.util.List; +import java.util.Locale; + +import android.content.AsyncQueryHandler; +import android.content.ContentResolver; +import android.content.ContentUris; +import android.content.Context; +import android.database.CharArrayBuffer; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.provider.MediaStore; +import android.media.MediaMetadataRetriever; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AlphabetIndexer; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.SectionIndexer; +import android.widget.SimpleCursorAdapter; +import android.widget.TextView; + +import com.DeviceTest.R; +import com.DeviceTest.RockVideoPlayer; + + +class VideoItem { + Drawable bitmap; + Uri uri; + int Totaltime; + int Lasttime; + int Currenttime; + String videoname; + String mimetype; + String size; + String videopath; +} +/* +class Item implements Comparable<Item>{ + private static final String TAG = "Item"; + //private static final boolean DEBUG = true; + private static final boolean DEBUG = false; + public void LOG(String msg) + { + if(DEBUG) + { + Log.d(TAG,msg); + } + } + + public int compareTo(Item another) { + // TODO Auto-generated method stub + return 0; + } + +} +*/ +public class VideoListAdapter extends SimpleCursorAdapter +implements SectionIndexer { + int resource; + //private final LayoutInflater mInflater; + private static final String TAG = "VideoListAdapter"; + private static final boolean DEBUG = true; + //private static final boolean DEBUG = false; + private RockVideoPlayer mActivity = null; + /** @see AlphabetIndexer. */ + private AlphabetIndexer mIndexer; + /** ����Э��ʵ�ֶ� ContentResolver �첽�� query ������ helper ���ʵ��. */ + private AsyncQueryHandler mQueryHandler; + int nameIdx; + Uri uriIdx; + int idIdx; + int mimetypeIdx; + int bookmarkIdx; + int durationIdx; + int sizeIdx; + int pahtIdx; + private String mConstraint = null; + private boolean mConstraintIsValid = false; + public void LOG(String msg) + { + if(DEBUG) + { + Log.d(TAG,msg); + } + } + + public VideoListAdapter(Context context, + RockVideoPlayer currentactivity, + int layout, + Cursor cursor, + String[] from, + int[] to) { + super(context, layout, cursor, from, to); + mActivity = currentactivity; + getColumnIndices(cursor); + mQueryHandler = new QueryHandler(context.getContentResolver()); /* ����ת��. */ + LOG("Built mQueryHandler = " + mQueryHandler); + } + + public void setActivity(RockVideoPlayer newactivity) { + mActivity = newactivity; + } + class ViewHolder { + // ��u21069 list item view �� ��u26469 ��u31034 ��u24212 data item(��u-28212 ��iju20010 ��u23450 ��u27468 ��u30340 ��u24687 ) ��column "TITLE" ��value ��TextView ��u24341 �� + ImageView video_icon; + TextView video_name; + TextView video_time; + TextView video_type; + TextView video_size; + TextView video_path; + CharArrayBuffer buffer1; + // ��u26469 ��u23384 "ARTIST" ��u20018 . + char [] buffer2; + } + /** + * ���Ƶ� AsyncQueryHandler ����. + * @see AsyncQueryHandler. + * */ + class QueryHandler extends AsyncQueryHandler { + /** Ctor. */ + QueryHandler(ContentResolver res) { + super(res); + } + @Override + protected void onQueryComplete(int token, Object cookie, Cursor cursor) { + //LOG("@@@ query complete: " + cursor.getCount() + " "); + /* ��ʼ�� ��ǰ activity. */ + mActivity.initVideoCursor(cursor); + } + } + public AsyncQueryHandler getQueryHandler() { + return mQueryHandler; + } + /** + * ��ȡָͬ�� Cursor ʵ����ص� �ض��� column �� index, �������� "this"(��ǰ����ʵ��) ��. + * �������� �����и�. + */ + private void getColumnIndices(Cursor cur) { + + LOG("Enter getColumnIndices() and cur = " + cur); + Uri uri = MediaStore.Video.Media.getContentUri("external"); + if (cur!= null) { + cur.moveToFirst(); + nameIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME); + LOG("nameIdx= " + nameIdx); + uriIdx = ContentUris.withAppendedId(uri,cur.getColumnIndexOrThrow(MediaStore.Video.Media._ID)); + LOG("uriIdx= " + uriIdx); + idIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media._ID); + mimetypeIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE); + LOG("mimetypeIdx= " + mimetypeIdx); + bookmarkIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media.BOOKMARK); + LOG("bookmarkIdx= " + bookmarkIdx); + durationIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media.DURATION); + LOG("durationIdx= " + durationIdx); + sizeIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media.SIZE); + LOG("sizeIdx= " + sizeIdx); + pahtIdx = cur.getColumnIndexOrThrow(MediaStore.Video.Media.DATA); + LOG("pahtIdx= " + pahtIdx); + } + } + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) { + View v = super.newView(context, cursor, parent); + + ViewHolder vh = new ViewHolder(); + vh.video_icon = (ImageView)v.findViewById(R.id.video_image); + vh.video_name = (TextView)v.findViewById(R.id.video_name); + vh.video_time = (TextView)v.findViewById(R.id.time_info); + vh.video_type = (TextView)v.findViewById(R.id.type_info); + vh.video_size = (TextView)v.findViewById(R.id.size_info); + //vh.video_path = (TextView)v.findViewById(R.id.path_info); + vh.buffer1 = new CharArrayBuffer(100); + vh.buffer2 = new char[200]; + v.setTag(vh); + return v; + } + @Override + public void bindView(View view, Context context, Cursor cursor) { + ViewHolder vh = (ViewHolder) view.getTag(); /* ����ض��� list item view, �������� newView() ֮����. ����� ����ת�͵���ȷ��, "����" �ɳ���Ա��֤. */ + cursor.copyStringToBuffer(nameIdx, vh.buffer1); + vh.video_name.setText(vh.buffer1.data, 0, vh.buffer1.sizeCopied); + mFormatBuilder = new StringBuilder(); + mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); + vh.video_time.setText(makeTimeString(cursor.getInt(bookmarkIdx),cursor.getInt(durationIdx))); + vh.video_type.setText(cursor.getString(mimetypeIdx)); + vh.video_size.setText(makeSizeString(cursor.getInt(sizeIdx))); + //vh.video_path.setText(cursor.getString(pahtIdx)); + ImageView iv = vh.video_icon; + iv.setImageResource(R.drawable.video_icon); + //iv.setImageBitmap(getVideoCover(cursor.getString(pahtIdx))); + } + @Override + public void changeCursor(Cursor cursor) { + //LOG("Enter changeCursor() get "+ cursor.getCount() + "and cursor = " + cursor); + + if(cursor != null) + cursor.moveToFirst(); + if (cursor != mActivity.mVideoCursor) { + super.changeCursor(cursor); + mActivity.mVideoCursor = cursor; + getColumnIndices(cursor); /* ��Ϊ "cursor" ʵ��仯, �������е� column ID Ҳ���ܱ仯. �ʸ���֮. */ + } + } + @Override + public Cursor runQueryOnBackgroundThread(CharSequence constraint) { + String s = constraint.toString(); + if (mConstraintIsValid + && ( (s == null && mConstraint == null) + || (s != null && s.equals(mConstraint)))) { + return getCursor(); + } + Cursor c = mActivity.getVideoCursor(null); + mConstraint = s; + mConstraintIsValid = true; + return c; + } + + StringBuilder mFormatBuilder; + Formatter mFormatter; + + public String stringForTime(int timeMs) + { + int totalSeconds = timeMs / 1000; + + int seconds = totalSeconds % 60; + int minutes = (totalSeconds / 60) % 60; + int hours = totalSeconds / 3600; + + mFormatBuilder.setLength(0); + + if(hours > 0) + return mFormatter.format("%02d:%02d:%02d", hours, minutes, seconds).toString(); + else + return mFormatter.format("%02d:%02d", minutes, seconds).toString(); + } + + public String makeTimeString(int time1,int time2) + { + StringBuilder time = new StringBuilder(); + time.append(stringForTime(time1)+'/'+stringForTime(time2)); + return time.toString(); + } + + public String makeSizeString(int size){ + StringBuilder sizeBuilder = new StringBuilder(); + if (size <= 0){ + sizeBuilder.append("0 K"); + return sizeBuilder.toString(); + } + int sizeK = size/1000; + int sizeM = sizeK/1000; + if(0 < sizeK && sizeK < 1024){ + sizeBuilder.append(sizeK); + sizeBuilder.append(" K"); + return sizeBuilder.toString(); + }else{ + sizeBuilder.append(sizeM); + sizeBuilder.append(" M"); + return sizeBuilder.toString(); + } + } + public int getSectionForPosition(int position) { + return 0; + } + + public int getPositionForSection(int section) { + int pos = mIndexer.getPositionForSection(section); + return pos; + } + + public Object[] getSections() { + if (mIndexer != null) { + return mIndexer.getSections(); + } else { + return null; + } + } + + +} + diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java new file mode 100755 index 0000000..2347e17 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java @@ -0,0 +1,168 @@ +package com.DeviceTest.helper; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import android.hardware.Camera; +import android.hardware.Camera.CameraInfo; +import android.content.res.XmlResourceParser; +import android.os.SystemClock; +import android.util.Log; +import android.util.Xml; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import org.xmlpull.v1.XmlSerializer; + +import com.DeviceTest.DeviceTest; +import android.content.res.Resources; +public class XmlDeal { + + private static final String TAG = "XmlDeal"; + /**/ + private static final String XML_ROOT_TAG = "TestCaseList"; + private static final String XML_NODE_TAG = "TestCase"; + + private static final String CLASS_NAME_TAG = "class_name"; + private static final String TEST_NAME_TAG = "test_name"; + private static final String RESULT_TAG = "result"; + private static final String TEST_GROUP_TAG = "test_group"; + private static final String TEST_FIRST = "first_test"; + + public List<TestCase> mTestCases = null; + public Map<String, List<TestCase>> mCaseGroups = null; + + public XmlDeal(InputStream is) { + mTestCases = new ArrayList<TestCase>(); + mCaseGroups = new HashMap<String, List<TestCase>>(); + if (!ParseXml(is)) { + throw new RuntimeException(); + } + } + + private boolean ParseXml(InputStream is) { + + DocumentBuilderFactory docBuilderFactory = null; + DocumentBuilder docBuilder = null; + Document doc = null; + try { + docBuilderFactory = DocumentBuilderFactory.newInstance(); + docBuilder = docBuilderFactory.newDocumentBuilder(); + + doc = docBuilder.parse(is); + NodeList nodeList = doc.getElementsByTagName(XML_ROOT_TAG); + + int length = nodeList.getLength(); + List<TestCase> caseGroup = null; + for (int i = 0; i < length; i++) { + Node item = nodeList.item(i); + + int testNo = 0; + caseGroup = null; + for (Node node = item.getFirstChild(); node != null; node = node + .getNextSibling()) { + if (node.getNodeType() == Node.ELEMENT_NODE) { + + String testName = null; + String className = null; + boolean isfirsttest = false; + for (int j = 0; j < node.getAttributes().getLength(); j++) { + String attrValue = node.getAttributes().item(j) + .getNodeValue(); + String attrName = node.getAttributes().item(j) + .getNodeName(); + if (attrName.equals(CLASS_NAME_TAG)) { + className = attrValue; + } else if (attrName.equals(TEST_GROUP_TAG)) { + caseGroup = mCaseGroups.get(attrValue); + if (caseGroup == null) { + caseGroup = new ArrayList<TestCase>(); + mCaseGroups.put(attrValue, caseGroup); + } + }else if(attrName.equals(TEST_FIRST)){ + isfirsttest = true; + } + } + + + testName = node.getFirstChild().getNodeValue(); + Log.i(TAG, "-----getTestItemName:" + testName + " isfirsttest = " + isfirsttest); + + + if (hasBackFacingCamera()&&hasFrontFacingCamera()){ + if (testName.equals("CameraOnly")||testName.equals("单摄像头")) { + continue; + } + }else { + if (testName.equals("Camera")||testName.equals("摄像头")) { + continue; + } + + } + TestCase testCase = new TestCase(testNo, testName, + className); + //testCase.setneedtest(isfirsttes); + mTestCases.add(testCase); + if(caseGroup != null) { + caseGroup.add(testCase); + } + testNo++; + + } + } + } + + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + return false; + } finally { + doc = null; + docBuilder = null; + docBuilderFactory = null; + } + + if (mTestCases.size() == 0) { + return false; + } + + Log.i(TAG, "The cases count is :" + mTestCases.size()); + return true; + } +private static boolean checkCameraFacing(final int facing) { + + final int cameraCount = Camera.getNumberOfCameras(); + CameraInfo info = new CameraInfo(); + for (int i = 0; i < cameraCount; i++) { + Camera.getCameraInfo(i, info); + if (facing == info.facing) { + return true; + } + } + return false; + } + public static boolean hasBackFacingCamera() { + final int CAMERA_FACING_BACK = 0; + return checkCameraFacing(CAMERA_FACING_BACK); + } + public static boolean hasFrontFacingCamera() { + final int CAMERA_FACING_BACK = 1; + return checkCameraFacing(CAMERA_FACING_BACK); + } + public static int getSdkVersion() { + return android.os.Build.VERSION.SDK_INT; + } + + + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java.bak b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java.bak new file mode 100755 index 0000000..ae229e6 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/helper/XmlDeal.java.bak @@ -0,0 +1,196 @@ +package com.DeviceTest.helper; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import android.content.res.XmlResourceParser; +import android.os.SystemClock; +import android.util.Log; +import android.util.Xml; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import org.xmlpull.v1.XmlSerializer; + +import com.DeviceTest.DeviceTest; + +public class XmlDeal { + + private static final String TAG = "XmlDeal"; + /**/ + private static final String XML_ROOT_TAG = "TestCaseList"; + private static final String XML_NODE_TAG = "TestCase"; + + private static final String CLASS_NAME_TAG = "class_name"; + private static final String TEST_NAME_TAG = "test_name"; + private static final String RESULT_TAG = "result"; + private static final String TEST_GROUP_TAG = "test_group"; + private static final String TEST_FIRST = "first_test"; + + public List<TestCase> mTestCases = null; + public Map<String, List<TestCase>> mCaseGroups = null; + + public XmlDeal(InputStream is) { + mTestCases = new ArrayList<TestCase>(); + mCaseGroups = new HashMap<String, List<TestCase>>(); + if (!ParseXml(is)) { + throw new RuntimeException(); + } + } + + private boolean ParseXml(InputStream is) { + + DocumentBuilderFactory docBuilderFactory = null; + DocumentBuilder docBuilder = null; + Document doc = null; + try { + docBuilderFactory = DocumentBuilderFactory.newInstance(); + docBuilder = docBuilderFactory.newDocumentBuilder(); + + doc = docBuilder.parse(is); + NodeList nodeList = doc.getElementsByTagName(XML_ROOT_TAG); + + int length = nodeList.getLength(); + List<TestCase> caseGroup = null; + for (int i = 0; i < length; i++) { + Node item = nodeList.item(i); + + int testNo = 0; + caseGroup = null; + for (Node node = item.getFirstChild(); node != null; node = node + .getNextSibling()) { + if (node.getNodeType() == Node.ELEMENT_NODE) { + + String testName = null; + String className = null; + boolean isfirsttest = false; + for (int j = 0; j < node.getAttributes().getLength(); j++) { + String attrValue = node.getAttributes().item(j) + .getNodeValue(); + String attrName = node.getAttributes().item(j) + .getNodeName(); + if (attrName.equals(CLASS_NAME_TAG)) { + className = attrValue; + } else if (attrName.equals(TEST_GROUP_TAG)) { + caseGroup = mCaseGroups.get(attrValue); + if (caseGroup == null) { + caseGroup = new ArrayList<TestCase>(); + mCaseGroups.put(attrValue, caseGroup); + } + }else if(attrName.equals(TEST_FIRST)){ + isfirsttest = true; + } + } + testName = node.getFirstChild().getNodeValue(); + Log.i(TAG, "-----getTestItemName:" + testName + " isfirsttest = " + isfirsttest); + + if(getResources().getConfiguration().locale.getCountry().equals("CN")) + { + if(testName.equals("Version")) + { + testName = "��"; + } + else if(testName.equals("LCD")) + { + testName = ; + } + else if(testName.equals("Touch")) + { + testName = ; + } + else if(testName.equals("Camera")) + { + testName = ; + } + else if(testName.equals("Speaker")) + { + testName = ; + } + else if(testName.equals("Gsensor")) + { + testName = ; + } + + else if(testName.equals("Bluetooth")) + { + testName = ; + } + else if(testName.equals("Wifi")) + { + testName = ; + } + else if(testName.equals("MIC")) + { + testName = ; + }else if(testName.equals("Battery")) + { + testName = ; + } + else if(testName.equals("SD Card")) + { + testName = ; + } + else if(testName.equals("Keyboard")) + { + testName = ; + } + else if(testName.equals("Brightness")) + { + testName = ; + }else if(testName.equals("UsbHost")) + { + //testName = "u" + } + else if(testName.equals("HDMI")) + { + //testName = "�汾" + } + else if(testName.equals("Storage")) + { + testName = ; + } + + } + + TestCase testCase = new TestCase(testNo, testName, + className); + testCase.setneedtest(isfirsttes); + mTestCases.add(testCase); + if(caseGroup != null) { + caseGroup.add(testCase); + } + testNo++; + } + } + } + + } catch (Exception e) { + Log.e(TAG, e.getMessage()); + return false; + } finally { + doc = null; + docBuilder = null; + docBuilderFactory = null; + } + + if (mTestCases.size() == 0) { + return false; + } + + Log.i(TAG, "The cases count is :" + mTestCases.size()); + return true; + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/CompassView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/CompassView.java new file mode 100755 index 0000000..86fb03e --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/CompassView.java @@ -0,0 +1,61 @@ +package com.DeviceTest.view; + +import com.DeviceTest.R; +import com.DeviceTest.R.drawable; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.View; + +public class CompassView extends View { + + private float yaw = 0; + private Paint paint; + private Drawable compass; + + public CompassView(Context context) { + this(context, null); + } + + public CompassView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public CompassView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + paint = new Paint(); + paint.setColor(Color.RED); + // paint.setStyle(Style.FILL_AND_STROKE); + paint.setStrokeWidth(2); + + compass = getResources().getDrawable(R.drawable.compass); + + this.setBackgroundColor(Color.WHITE); + } + + public void update(float yaw) { + if (Math.abs(this.yaw - yaw) > 1) { + this.yaw = yaw; + postInvalidate(); + } + } + + protected void onDraw(Canvas canvas) { + int height = getHeight(); + int width = getWidth(); + int midX = width / 2; + int midY = height / 2; + int size = (height > width ? width : height) * 3 / 8; + compass.setBounds(midX - size, midY - size, midX + size, midY + size); + canvas.save(); + canvas.rotate(-yaw, midX, midY); + compass.draw(canvas); + canvas.restore(); + paint.setTextSize(size / 3); + canvas.drawText((int) yaw + "\260", 0, size / 3, paint); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/Cube.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/Cube.java new file mode 100755 index 0000000..5f7fa76 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/Cube.java @@ -0,0 +1,100 @@ +/* + * 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 com.DeviceTest.view; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; + +import javax.microedition.khronos.opengles.GL10; + +/** + * A vertex shaded cube. + */ +class Cube +{ + public Cube() + { + int one = 0x10000; + int vertices[] = { + -one, -one, -one, + one, -one, -one, + one, one, -one, + -one, one, -one, + -one, -one, one, + one, -one, one, + one, one, one, + -one, one, one, + }; + + int colors[] = { + 0, 0, 0, one, + one, 0, 0, one, + one, one, 0, one, + 0, one, 0, one, + 0, 0, one, one, + one, 0, one, one, + one, one, one, one, + 0, one, one, one, + }; + + byte indices[] = { + 0, 4, 5, 0, 5, 1, + 1, 5, 6, 1, 6, 2, + 2, 6, 7, 2, 7, 3, + 3, 7, 4, 3, 4, 0, + 4, 7, 6, 4, 6, 5, + 3, 0, 1, 3, 1, 2 + }; + + // Buffers to be passed to gl*Pointer() functions + // must be direct, i.e., they must be placed on the + // native heap where the garbage collector cannot + // move them. + // + // Buffers with multi-byte datatypes (e.g., short, int, float) + // must have their byte order set to native order + + ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4); + vbb.order(ByteOrder.nativeOrder()); + mVertexBuffer = vbb.asIntBuffer(); + mVertexBuffer.put(vertices); + mVertexBuffer.position(0); + + ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4); + cbb.order(ByteOrder.nativeOrder()); + mColorBuffer = cbb.asIntBuffer(); + mColorBuffer.put(colors); + mColorBuffer.position(0); + + mIndexBuffer = ByteBuffer.allocateDirect(indices.length); + mIndexBuffer.put(indices); + mIndexBuffer.position(0); + } + + public void draw(GL10 gl) + { + gl.glFrontFace(GL10.GL_CW); + gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer); + gl.glColorPointer(4, GL10.GL_FIXED, 0, mColorBuffer); + gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer); + } + + private IntBuffer mVertexBuffer; + private IntBuffer mColorBuffer; + private ByteBuffer mIndexBuffer; +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/DrawClock.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/DrawClock.java new file mode 100755 index 0000000..7cc1cdd --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/DrawClock.java @@ -0,0 +1,167 @@ + +package com.DeviceTest.view; + +import java.util.Calendar; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Path; +import android.view.View; + +public class DrawClock extends View { + + public DrawClock(Context context) { + super(context); + } + + public void onDraw(Canvas canvas) { + + canvas.drawColor(Color.BLACK); + Paint paint = new Paint(); + paint.setAntiAlias(true); + paint.setColor(Color.RED); + paint.setStyle(Paint.Style.STROKE); + paint.setStrokeWidth(2); + paint.setTextSize(16); + drawClockPandle(canvas, paint); // 画制时钟的底盘 + + drawClockPointer(canvas, paint); // 画制时钟的指针 + } + + // ------时钟底盘画制函数-------------- + void drawClockPandle(Canvas canvas, Paint paint) + { + int px = getMeasuredWidth(); + int py = getMeasuredWidth(); + + canvas.drawCircle(px / 2, py / 2, py / 2 - 1, paint); + canvas.drawCircle(px / 2, py / 2, py / 40, paint); + + Path path = new Path(); + path.moveTo(1, py / 2); + path.lineTo(py / 16, py / 2); + canvas.drawPath(path, paint); + canvas.drawText("11", py / 16, py / 2, paint); + + path.moveTo(px / 2, 1); + path.lineTo(px / 2, py / 16); + canvas.drawPath(path, paint); + canvas.drawText("12", px / 2,py / 16, paint); + + path.moveTo(px - 1, py / 2); + path.lineTo(px - px / 16, py / 2); + canvas.drawPath(path, paint); + canvas.drawText("3",px - px / 16, py / 2, paint); + + path.moveTo(px / 2, py - 1); + path.lineTo(px / 2, py - py / 16); + canvas.drawPath(path, paint); + canvas.drawText("6", px / 2, py - py / 16, paint); + + canvas.save(); + canvas.rotate(30, px / 2, py / 2); + Path path8 = new Path(); + path8.moveTo(1, py / 2); + path8.lineTo(px / 30, py / 2); + canvas.drawPath(path8, paint); + canvas.drawText("10",px / 30, py / 2, paint); + + path8.moveTo(px / 2, 1); + path8.lineTo(px / 2, py / 30); + canvas.drawPath(path8, paint); + canvas.drawText("1",px / 2, py / 30, paint); + + path8.moveTo(px - 1, py / 2); + path8.lineTo(px - px / 30, py / 2); + canvas.drawPath(path8, paint); + canvas.drawText("4", px - px / 30, py / 2, paint); + + path8.moveTo(px / 2, py - 1); + path8.lineTo(px / 2, py - py / 30); + canvas.drawPath(path8, paint); + canvas.drawText("7", px / 2, py - py / 30, paint); + canvas.restore(); + + canvas.save(); + canvas.rotate(60, px / 2, py / 2); + Path path9 = new Path(); + path9.moveTo(1, py / 2); + path9.lineTo(px / 30, py / 2); + canvas.drawPath(path9, paint); + canvas.drawText("11", px / 30, py / 2, paint); + + path9.moveTo(px / 2, 1); + path9.lineTo(px / 2, py / 30); + canvas.drawPath(path9, paint); + canvas.drawText("2",px / 2, py / 30, paint); + + path9.moveTo(px - 1, py / 2); + path9.lineTo(px - px / 30, py / 2); + canvas.drawPath(path9, paint); + canvas.drawText("5", px - px / 30, py / 2, paint); + + path9.moveTo(px / 2, py - 1); + path9.lineTo(px / 2, py - py / 30); + canvas.drawPath(path9, paint); + canvas.drawText("8",px / 2,py - py / 30, paint); + canvas.restore(); + + } + + // ---------时钟指针画制函数--------------------- + void drawClockPointer(Canvas canvas, Paint paint) + { + int px = getMeasuredWidth(); + int py = getMeasuredWidth(); + + /*-------------------------获得当前时间小时和分钟数---------------------*/ + int mHour; + int mMinutes; + int mSeconds; + long time = System.currentTimeMillis(); + final Calendar mCalendar = Calendar.getInstance(); + mCalendar.setTimeInMillis(time); + mHour = mCalendar.get(Calendar.HOUR); + mMinutes = mCalendar.get(Calendar.MINUTE); + mSeconds = mCalendar.get(Calendar.SECOND); + /*-------------------------获得当前时间---------------------*/ + + float hDegree = ((mHour + (float) mMinutes / 60) / 12) * 360; + float mDegree = ((mMinutes + (float) mSeconds / 60) / 60) * 360; + float sDegree = ((float) mSeconds / 60) * 360; + + // 分针----------- + paint.setColor(Color.GREEN); + canvas.save(); + canvas.rotate(mDegree, px / 2, py / 2); + Path path1 = new Path(); + path1.moveTo(px / 2, py / 2); + path1.lineTo(px / 2, py / 4); + canvas.drawPath(path1, paint); + canvas.restore(); + + // 时针------------------ + paint.setColor(Color.WHITE); + canvas.save(); + canvas.rotate(hDegree, px / 2, py / 2); + Path path2 = new Path(); + path2.moveTo(px / 2, py / 2); + path2.lineTo(px / 2, py / 3); + canvas.drawPath(path2, paint); + canvas.restore(); + + // 秒针--------------------- + paint.setColor(Color.YELLOW); + canvas.save(); + canvas.rotate(sDegree, px / 2, py / 2); + Path path3 = new Path(); + path3.moveTo(px / 2, py / 2); + path3.lineTo(px / 2, py / 8); + canvas.drawPath(path3, paint); + canvas.restore(); + + } + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/GsensorBall.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/GsensorBall.java new file mode 100755 index 0000000..7aedb46 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/GsensorBall.java @@ -0,0 +1,76 @@ +package com.DeviceTest.view; + +import android.R.color; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Style; +import android.graphics.Rect; +import android.util.AttributeSet; +import android.util.Log; +import android.view.View; + +public class GsensorBall extends View { + private final static String TAG = "GsensorBall"; + private Paint mPaint = new Paint(); + private Rect mRect = new Rect(); + + private float center_point_x = 0; + private float center_point_y = 0; + private float draw_center_point_x = 0; + private float draw_center_point_y = 0; + private float ball_radius = 0; + private final static float SCALE = 14.0f; + private static float MOVESCALE = 12.0f; + private int currentcolor = Color.RED; + public GsensorBall(Context context) { + this(context, null, 0); + } + + public GsensorBall(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public GsensorBall(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, + int bottom) { + super.onLayout(changed, left, top, right, bottom); + center_point_x = this.getWidth()/2.0f; + center_point_y = this.getHeight()/2.0f; + MOVESCALE = this.getWidth() > this.getHeight() ? this.getHeight()/18.0f : this.getWidth()/18.0f; + if(draw_center_point_x == 0){ + draw_center_point_x = center_point_x; + draw_center_point_y = center_point_y; + } + ball_radius = this.getWidth() > this.getHeight() ? this.getHeight()/SCALE : this.getWidth()/SCALE; + + mPaint.setColor(Color.RED); + mPaint.setStyle(Style.FILL); + } + + public void setXYZ(float x, float y, float z){ + draw_center_point_x = center_point_x + y * MOVESCALE; + draw_center_point_y = center_point_y + x * MOVESCALE; + if(draw_center_point_x != 0 || draw_center_point_y != 0){ + currentcolor = Color.GREEN; + } +// Log.d(TAG, "__________________-------- setXYZ(), draw_center_point_x = " + draw_center_point_x + +// " draw_center_point_y = " + draw_center_point_y); + this.invalidate(); + } + + public void onDraw(Canvas canvas) { + super.onDraw(canvas); + //Log.d(TAG, ball_radius+"__________________-------- onDraw(), draw_center_point_x = " + draw_center_point_x + + // " draw_center_point_y = " + draw_center_point_y); + mPaint.setColor(Color.RED); + canvas.drawCircle(center_point_x, center_point_y, ball_radius / 2, mPaint); + mPaint.setColor(currentcolor); + canvas.drawCircle(draw_center_point_x, draw_center_point_y, ball_radius, mPaint); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/KeyTestView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/KeyTestView.java new file mode 100755 index 0000000..4d3affa --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/KeyTestView.java @@ -0,0 +1,123 @@ +package com.DeviceTest.view; + +import java.util.ArrayList; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Style; +import android.util.AttributeSet; +import android.view.View; + +public class KeyTestView extends View{ + private final static String TAG = "KeyTestView"; + + private int COLOR_NOR = Color.GRAY; + private int COLOR_DOWN = Color.YELLOW; + private int COLOR_PASS = Color.GREEN; + private Paint mPaint = null; + private Paint mWordPaint = null; + private final static int ROW = 3; + private final static int LINE = 2; + private final static int PER_GAP = 3; + private int per_width = 0; + private int per_height = 0; + ArrayList<KeyStruct> mKeyArray = new ArrayList<KeyStruct>(); + public KeyTestView(Context context, AttributeSet attrs) { + super(context, attrs); + mPaint = new Paint(); + mPaint.setColor(COLOR_NOR); + mPaint.setStyle(Style.FILL); + mWordPaint = new Paint(); + mWordPaint.setColor(Color.WHITE); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + per_width = (this.getWidth() - PER_GAP * (ROW + 1)) / ROW; + per_height = (this.getHeight() - PER_GAP * (LINE + 1))/ LINE; + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + int current_x = PER_GAP; + int current_y = PER_GAP; + int i = 0; + while(i < mKeyArray.size()){ + int color = COLOR_NOR; + if(mKeyArray.get(i).getIsPass()){ + color = COLOR_PASS; + } + if(mKeyArray.get(i).getIsDown()){ + color = COLOR_DOWN; + } + mPaint.setColor(color); + + canvas.drawRect(current_x, current_y, current_x + per_width, current_y + per_height, mPaint); + canvas.drawText(mKeyArray.get(i).getKeyName(), current_x, current_y + per_height / 2+5, mWordPaint); + i ++; + if(i % ROW == 0){ + current_x = PER_GAP; + current_y += (per_height + PER_GAP); + }else{ + current_x += (per_width + PER_GAP); + } + } + } + + public void addKey(String name, int code){ + KeyStruct mkey = new KeyStruct(name, code); + mKeyArray.add(mkey); + } + public void setKeyDown(int code){ + for(KeyStruct key : mKeyArray){ + if(key.getKeyCode() == code){ + key.setIsDown(true); + break; + } + } + invalidate(); + } + public void setKeyUp(int code){ + for(KeyStruct key : mKeyArray){ + if(key.getKeyCode() == code){ + key.setIsDown(false); + break; + } + } + invalidate(); + } + + private class KeyStruct{ + private String keyname; + private int keycode; + private boolean isdown; + private boolean pass; + public KeyStruct(String name, int code){ + this.keyname = name; + this.keycode = code; + this.isdown = false; + this.pass = false; + } + public void setIsDown(boolean tmp){ + this.isdown = tmp; + if(tmp) + this.pass = true; + } + public boolean getIsDown(){ + return this.isdown; + } + public boolean getIsPass(){ + return this.pass; + } + public String getKeyName(){ + return this.keyname; + } + public int getKeyCode(){ + return this.keycode; + } + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LcdTestView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LcdTestView.java new file mode 100755 index 0000000..9ae9577 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LcdTestView.java @@ -0,0 +1,72 @@ +package com.DeviceTest.view; + +import android.R.color; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Style; +import android.graphics.Rect; +import android.util.AttributeSet; +import android.view.View; + +public class LcdTestView extends View { + + private boolean grayScale = false; + private boolean paneBorder = false; + private Paint mPaint = new Paint(); + private Rect mRect = new Rect(); + + public LcdTestView(Context context) { + this(context, null, 0); + } + + public LcdTestView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public LcdTestView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + public void grayScale(boolean enable) { + grayScale = enable; + } + + public void paneBorder(boolean enable) { + paneBorder = enable; + } + + + public void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (grayScale) { + mPaint.setStyle(Style.FILL); + getDrawingRect(mRect); + final int width = getWidth(); + final int scale = 16; + final int scaleWidth = width / scale; + final int left = 0; + + for (int i = 0; i < scale; i++) { + int gray = i * 16; + gray = gray > 255 ? 255 : gray; + mPaint.setColor(Color.rgb(gray, gray, gray)); + mRect.left = left + i * scaleWidth; + mRect.right = left + (i + 1) * scaleWidth; + canvas.drawRect(mRect, mPaint); + } + + canvas.drawRect(mRect, mPaint); + } + if (paneBorder) { + canvas.drawColor(Color.BLACK); + mPaint.setColor(Color.WHITE); + mPaint.setStyle(Style.STROKE); + mPaint.setStrokeWidth(5); + getDrawingRect(mRect); + canvas.drawRect(mRect, mPaint); + } + + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LevelView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LevelView.java new file mode 100755 index 0000000..84c0872 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/LevelView.java @@ -0,0 +1,88 @@ +package com.DeviceTest.view; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Style; +import android.graphics.Rect; +import android.graphics.RectF; +import android.util.AttributeSet; +import android.view.View; + +public class LevelView extends View { + + private float x = 0; + private float y = 0; + private Paint paint = new Paint(); + private RectF rectF = new RectF(); + + public LevelView(Context context) { + this(context, null); + } + + public LevelView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public LevelView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + this.setBackgroundColor(Color.WHITE); + } + + public void update(float values, float values2) { + this.x = values; + this.y = values2; + postInvalidate(); + } + + protected void onDraw(Canvas canvas) { + int height = getHeight(); + int width = getWidth(); + int size = (height > width ? width : height) * 3 / 8; + int midX = width / 2; + int midY = height / 2; + int radius = size / 6; + float scaler = (size - radius) / 10F; + + paint.reset(); + paint.setAlpha(150); + + paint.setColor(Color.RED); + paint.setStyle(Style.FILL); + + canvas.drawCircle(midX - x * scaler, midY + y * scaler, radius, paint); + canvas.drawCircle(midX - x * scaler, midY + size + radius, radius, + paint); + canvas.drawCircle(midX - size - radius, midY + y * scaler, radius, + paint); + + paint.setTextSize(2 * radius); + canvas.drawText("x=" + ((int) (-x * 100) / 100F) + ",y=" + + ((int) (-y * 100) / 100F), 0, 2 * radius, paint); + + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(2); + paint.setColor(Color.BLACK); + + canvas.drawCircle(midX, midY, size, paint); + canvas.drawCircle(midX, midY, radius + 1, paint); + rectF.set(midX - size - 2 * radius, midY - size, midX - size, midY + + size); + canvas.drawRoundRect(rectF, radius, radius, paint); + rectF.set(midX - size, midY + size, midX + size, midY + size + 2 + * radius); + canvas.drawRoundRect(rectF, radius, radius, paint); + + canvas.drawLine(midX - radius, midY + size, midX - radius, midY + size + + 2 * radius, paint); + canvas.drawLine(midX + radius, midY + size, midX + radius, midY + size + + 2 * radius, paint); + + canvas.drawLine(midX - size - 2 * radius, midY - radius, midX - size, + midY - radius, paint); + canvas.drawLine(midX - size - 2 * radius, midY + radius, midX - size, + midY + radius, paint); + + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyGridView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyGridView.java new file mode 100755 index 0000000..1c3f173 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyGridView.java @@ -0,0 +1,100 @@ +package com.DeviceTest.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.util.Log; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; +import android.widget.AdapterView.OnItemClickListener; +import android.widget.AdapterView; +import android.widget.FrameLayout; +import android.widget.FrameLayout.LayoutParams; + +public class MyGridView extends FrameLayout implements View.OnClickListener { + private String TAG = "MyGridView"; + private int mColumn = 1; + private OnItemClickListener onItemClickListener; + + public MyGridView(Context context) { + this(context, null, 0); + } + + public MyGridView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public MyGridView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + public void setColumnCount(int column) { + this.mColumn = column; + } + + + protected void onLayout(boolean changed, int left, int top, int right, + int bottom) { + final int childCount = getChildCount(); + if (0 == childCount) { + super.onLayout(changed, left, top, right, bottom); + return; + } + final int width = right - left; + final int height = bottom - top; + final int column = mColumn; + final int row = (childCount - 1) / column + 1; + final int childHeight = height / row; + final int childWidth = width / column; + + int childLeft = left; + int childTop = top; + for (int i = 0; i < childCount; i++) { + View child = getChildAt(i); + child.layout(childLeft, childTop, childLeft + childWidth, childTop + + childHeight); + childLeft += childWidth; + if (((i + 1) % column) == 0) { + childLeft = left; + childTop += childHeight; + } + } + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } + + public void addView(View child, int index, ViewGroup.LayoutParams params) { + super.addView(child, index, params); + child.setOnClickListener(this); + } + + public interface OnItemClickListener { + void onItemClick(ViewParent parent, View view, int position); + } + + + public void onClick(View v) { + if (null == onItemClickListener) { + return; + } + final int childCount = getChildCount(); + int istouchchildcount = 0; + int touchid = -1; + for (int i = 0; i < childCount; i++) { + if (v == getChildAt(i)) { + Log.d(TAG, "__________-----------onClick(), i = " + i); + touchid = i; + } + if(((MyItemView)getChildAt(i)).getIsTouch()){ + istouchchildcount ++; + } + } + Log.d(TAG, "__________-----------onClick(), touchid = " + touchid + " istouchchildcount = " + istouchchildcount); + if(touchid >= 0 && istouchchildcount == 0) + onItemClickListener.onItemClick(this, v, touchid); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyItemView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyItemView.java new file mode 100755 index 0000000..33f2ad4 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MyItemView.java @@ -0,0 +1,169 @@ +package com.DeviceTest.view; + +import com.DeviceTest.helper.TestCase.RESULT; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Style; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.util.Log; +import android.view.Display; +import android.view.MotionEvent; +import android.view.WindowManager; +import android.widget.TextView; +import com.DeviceTest.R; +public class MyItemView extends TextView { + private static final String TAG = "MyItemView"; + + public static final int PASS_COLOR = Color.rgb(0, 255, 0); + public static final int FAILED_COLOR = Color.rgb(255, 0, 0); + public static final int SKIP_COLOR = Color.rgb(0, 0, 255); + public static final int CLICK_COLOR = Color.rgb(0, 255, 255); + + private RESULT mResult = RESULT.UNDEF; + private int current_color = 0x00000000; + private Paint mPaint = new Paint(); + private Rect mRect = new Rect(); + private Bitmap checkedbitmap = null; + private Bitmap uncheckedbitmap = null; + private int checkicon_left = 0; + private int checkicon_top = 0; + private final static int PADDINGLEN = 5; + private boolean ischeck = true; + private float scale; + public MyItemView(Context context) { + this(context, null, 0); + } + + public MyItemView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public MyItemView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + WindowManager windowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + + Display display = windowManager.getDefaultDisplay(); + int densityDpi = getResources().getDisplayMetrics().densityDpi; + scale = densityDpi/120; + mPaint.setColor(Color.WHITE); + mPaint.setStrokeWidth(2); + mPaint.setStyle(Style.STROKE); +// Drawable tmp = context.getResources().getDrawable(R.drawable.devicetest_icon); + checkedbitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.btn_check_on); + uncheckedbitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.btn_check_on_disable); + setTextColor(Color.WHITE); + setResult(RESULT.UNDEF); + setBackgroundResource(R.drawable.itemclickbk); + } + + + protected void onLayout(boolean changed, int left, int top, int right, + int bottom) { + super.onLayout(changed, left, top, right, bottom); + setTextSize((bottom - top) * 2 / 4/scale); + checkicon_left = this.getWidth() - checkedbitmap.getWidth() - PADDINGLEN * 2; + checkicon_top = (this.getHeight() - checkedbitmap.getHeight()) / 2; + } + + public void setResult(RESULT result) { + int color; + switch (result) { + case OK: + color = PASS_COLOR; + break; + case NG: + color = FAILED_COLOR; + break; + case SKIP: + color = SKIP_COLOR; + break; + case UNDEF: + color = 0xff101010; + break; + default: + return; + } + + mResult = result; + current_color = color; + this.setBackgroundColor(color); + } + + public RESULT getResult() { + return mResult; + } + public void setCheck(boolean check){ + this.ischeck = check; + this.invalidate(); + } + public boolean getTemcheckclick(){ + return tmpcheckclick; + } + public boolean setCheckClick(){ + if(tmpcheckclick){ + if(ischeck) + ischeck = false; + else + ischeck = true; + } + this.invalidate(); + return tmpcheckclick; + } + public boolean getischeck(){ + return ischeck; + } + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + getDrawingRect(mRect); + canvas.drawRect(mRect, mPaint); + if(ischeck) + canvas.drawBitmap(checkedbitmap, checkicon_left, checkicon_top, null); + else + canvas.drawBitmap(uncheckedbitmap, checkicon_left, checkicon_top, null); + } + + private boolean tmpcheckclick = false; + private boolean istouch = false; + @Override + public boolean onTouchEvent(MotionEvent event) { +// Log.d(TAG, " ________ action = " + event.getAction() + " " + event.getX() + ", " + event.getY() + " w = " + this.getWidth()); +// Log.d(TAG, "_____________________ onTouchEvent(), " + event.getPointerCount()); + boolean ret = false; + switch(event.getAction()){ + case MotionEvent.ACTION_DOWN: + tmpcheckclick = false; + this.setBackgroundColor(CLICK_COLOR); + if(event.getX() > checkicon_left){ + tmpcheckclick = true; + } + istouch = true; + break; + case MotionEvent.ACTION_MOVE: + if(event.getX()>0 && event.getX() < this.getWidth() && event.getY() > 0 && event.getY() < this.getHeight()){ + this.setBackgroundColor(CLICK_COLOR); + if(tmpcheckclick && event.getX() < checkicon_left){ + tmpcheckclick = false; + } + }else{ + tmpcheckclick = false; + this.setBackgroundColor(current_color); + } + break; + case MotionEvent.ACTION_UP: + this.setBackgroundColor(current_color); + istouch = false; + break; + } + return super.onTouchEvent(event); + } + public boolean getIsTouch(){ + return istouch; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MySpinnerView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MySpinnerView.java new file mode 100755 index 0000000..ac2cb29 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/MySpinnerView.java @@ -0,0 +1,20 @@ +package com.DeviceTest.view; + +import android.content.Context; +import android.widget.TextView; + +public class MySpinnerView extends TextView { + + public MySpinnerView(Context context) { + super(context); + } + + + protected void onLayout(boolean changed, int left, int top, int right, + int bottom) { + super.onLayout(changed, left, top, right, bottom); + setTextSize((bottom - top) * 3 / 4); + } + + +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/PointerLocationView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/PointerLocationView.java new file mode 100755 index 0000000..723cc09 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/PointerLocationView.java @@ -0,0 +1,368 @@ +/* + * Copyright (C) 2010 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.DeviceTest.view; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Paint.Align; +import android.graphics.Paint.FontMetricsInt; +import android.util.AttributeSet; +import android.util.Log; +import android.view.*; +import android.view.View.OnTouchListener; +import android.widget.RelativeLayout; + +import java.util.ArrayList; + +public class PointerLocationView extends View implements OnTouchListener { + public static class PointerState { + private final ArrayList<Float> mXs = new ArrayList<Float>(); + private final ArrayList<Float> mYs = new ArrayList<Float>(); + private boolean mCurDown; + private int mCurX; + private int mCurY; + private float mCurPressure; + private float mCurSize; + private int mCurWidth; + private VelocityTracker mVelocity; + } + + // private final ViewConfiguration mVC; + private int NP = 0; + private final Paint mTextPaint; + // private final Paint mTextBackgroundPaint; + // private final Paint mTextLevelPaint; + private final Paint mPaint; + private final Paint mTargetPaint; + private final Paint mPathPaint; + // private final FontMetricsInt mTextMetrics = new FontMetricsInt(); + // private int mHeaderBottom; + private boolean mCurDown; + private int mCurNumPointers; + private int mMaxNumPointers; + private final ArrayList<PointerState> mPointers = new ArrayList<PointerState>(); + + private boolean mPrintCoords = true; + + public PointerLocationView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public PointerLocationView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + setFocusable(true); + // mVC = ViewConfiguration.get(context); + mTextPaint = new Paint(); + mTextPaint.setAntiAlias(true); + mTextPaint.setTextSize(50 * getResources().getDisplayMetrics().density); + mTextPaint.setARGB(255, 255, 0, 0); + mTextPaint.setTextAlign(Align.RIGHT); + /* + * mTextBackgroundPaint = new Paint(); + * mTextBackgroundPaint.setAntiAlias(false); + * mTextBackgroundPaint.setARGB(128, 255, 255, 255); mTextLevelPaint = + * new Paint(); mTextLevelPaint.setAntiAlias(false); + * mTextLevelPaint.setARGB(192, 255, 0, 0); + */ + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mPaint.setARGB(255, 255, 255, 255); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setStrokeWidth(2); + mTargetPaint = new Paint(); + mTargetPaint.setAntiAlias(false); + mTargetPaint.setARGB(255, 0, 0, 192); + mPathPaint = new Paint(); + mPathPaint.setAntiAlias(false); + mPathPaint.setARGB(255, 0, 96, 255); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setStrokeWidth(1); + + PointerState ps = new PointerState(); + ps.mVelocity = VelocityTracker.obtain(); + mPointers.add(ps); + } + + public void setPrintCoords(boolean state) { + mPrintCoords = state; + } + + + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + /* + * mTextPaint.getFontMetricsInt(mTextMetrics); mHeaderBottom = + * -mTextMetrics.ascent+mTextMetrics.descent+2; + */ + ((ViewGroup)getParent()).setOnTouchListener(this); + } + + + protected void onDraw(Canvas canvas) { + synchronized (mPointers) { + NP = mPointers.size(); + + /* + * final int w = getWidth(); final int itemW = w/7; final int base = + * -mTextMetrics.ascent+1; final int bottom = mHeaderBottom; + * + * + * if (NP > 0) { final PointerState ps = mPointers.get(0); + * canvas.drawRect(0, 0, itemW-1, bottom,mTextBackgroundPaint); + * canvas.drawText("P: " + mCurNumPointers + " / " + + * mMaxNumPointers, 1, base, mTextPaint); + * + * final int N = ps.mXs.size(); if ((mCurDown && ps.mCurDown) || N + * == 0) { canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom, + * mTextBackgroundPaint); canvas.drawText("X: " + ps.mCurX, 1 + + * itemW, base, mTextPaint); canvas.drawRect(itemW * 2, 0, (itemW * + * 3) - 1, bottom, mTextBackgroundPaint); canvas.drawText("Y: " + + * ps.mCurY, 1 + itemW * 2, base, mTextPaint); } else { float dx = + * ps.mXs.get(N-1) - ps.mXs.get(0); float dy = ps.mYs.get(N-1) - + * ps.mYs.get(0); canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom, + * Math.abs(dx) < mVC.getScaledTouchSlop() ? mTextBackgroundPaint : + * mTextLevelPaint); canvas.drawText("dX: " + String.format("%.1f", + * dx), 1 + itemW, base, mTextPaint); canvas.drawRect(itemW * 2, 0, + * (itemW * 3) - 1, bottom, Math.abs(dy) < mVC.getScaledTouchSlop() + * ? mTextBackgroundPaint : mTextLevelPaint); canvas.drawText("dY: " + * + String.format("%.1f", dy), 1 + itemW * 2, base, mTextPaint); } + * + * canvas.drawRect(itemW * 3, 0, (itemW * 4) - 1, bottom, + * mTextBackgroundPaint); int velocity = ps.mVelocity == null ? 0 : + * (int) (ps.mVelocity.getXVelocity() * 1000); + * canvas.drawText("Xv: " + velocity, 1 + itemW * 3, base, + * mTextPaint); + * + * canvas.drawRect(itemW * 4, 0, (itemW * 5) - 1, bottom, + * mTextBackgroundPaint); velocity = ps.mVelocity == null ? 0 : + * (int) (ps.mVelocity.getYVelocity() * 1000); + * canvas.drawText("Yv: " + velocity, 1 + itemW * 4, base, + * mTextPaint); + * + * canvas.drawRect(itemW * 5, 0, (itemW * 6) - 1, bottom, + * mTextBackgroundPaint); canvas.drawRect(itemW * 5, 0, (itemW * 5) + * + (ps.mCurPressure * itemW) - 1, bottom, mTextLevelPaint); + * canvas.drawText("Prs: " + String.format("%.2f", ps.mCurPressure), + * 1 + itemW * 5, base, mTextPaint); + * + * canvas.drawRect(itemW * 6, 0, w, bottom, mTextBackgroundPaint); + * canvas.drawRect(itemW * 6, 0, (itemW * 6) + (ps.mCurSize * itemW) + * - 1, bottom, mTextLevelPaint); canvas.drawText("Size: " + + * String.format("%.2f", ps.mCurSize), 1 + itemW * 6, base, + * mTextPaint); } + */ + + if (onPointCountChangeListener != null) { + onPointCountChangeListener.onPointCountChange(mPointers.size()); + } + canvas.drawText("Current Point:" + mCurNumPointers, getWidth() / 2, getHeight() / 2, + mTextPaint); + + for (int p = 0; p < NP; p++) { + final PointerState ps = mPointers.get(p); + + if (mCurDown && ps.mCurDown) { + canvas.drawLine(0, (int) ps.mCurY, getWidth(), + (int) ps.mCurY, mTargetPaint); + canvas.drawLine((int) ps.mCurX, 0, (int) ps.mCurX, + getHeight(), mTargetPaint); + int pressureLevel = (int) (ps.mCurPressure * 255); + mPaint.setARGB(255, pressureLevel, 128, 255 - pressureLevel); + canvas.drawPoint(ps.mCurX, ps.mCurY, mPaint); + canvas.drawCircle(ps.mCurX, ps.mCurY, ps.mCurWidth, mPaint); + } + } + + for (int p = 0; p < NP; p++) { + final PointerState ps = mPointers.get(p); + + final int N = ps.mXs.size(); + float lastX = 0, lastY = 0; + boolean haveLast = false; + boolean drawn = false; + mPaint.setARGB(255, 128, 255, 255); + for (int i = 0; i < N; i++) { + float x = ps.mXs.get(i); + float y = ps.mYs.get(i); + if (Float.isNaN(x)) { + haveLast = false; + continue; + } + if (haveLast) { + canvas.drawLine(lastX, lastY, x, y, mPathPaint); + canvas.drawPoint(lastX, lastY, mPaint); + drawn = true; + } + lastX = x; + lastY = y; + haveLast = true; + } + + if (drawn) { + if (ps.mVelocity != null) { + mPaint.setARGB(255, 255, 64, 128); + float xVel = ps.mVelocity.getXVelocity() * (1000 / 60); + float yVel = ps.mVelocity.getYVelocity() * (1000 / 60); + canvas.drawLine(lastX, lastY, lastX + xVel, lastY + + yVel, mPaint); + } else { + canvas.drawPoint(lastX, lastY, mPaint); + } + } + } + } + } + + public void addTouchEvent(MotionEvent event) { + synchronized (mPointers) { + int action = event.getAction(); + + NP = mPointers.size(); + + if (action == MotionEvent.ACTION_DOWN) { + for (int p = 0; p < NP; p++) { + final PointerState ps = mPointers.get(p); + ps.mXs.clear(); + ps.mYs.clear(); + ps.mVelocity = VelocityTracker.obtain(); + ps.mCurDown = false; + } + mPointers.get(0).mCurDown = true; + mMaxNumPointers = 0; + if (mPrintCoords) { + Log.i("Pointer", "Pointer 1: DOWN"); + } + } + + if ((action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN) { + + Log.i("Pointer", "action down"); + final int index = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; + final int id = event.getPointerId(index); + while (NP <= id) { + PointerState ps = new PointerState(); + ps.mVelocity = VelocityTracker.obtain(); + mPointers.add(ps); + NP++; + } + final PointerState ps = mPointers.get(id); + ps.mVelocity = VelocityTracker.obtain(); + ps.mCurDown = true; + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (id + 1) + ": DOWN"); + } + } + + final int NI = event.getPointerCount(); + + mCurDown = action != MotionEvent.ACTION_UP + && action != MotionEvent.ACTION_CANCEL; + mCurNumPointers = mCurDown ? NI : 0; + if (mMaxNumPointers < mCurNumPointers) { + mMaxNumPointers = mCurNumPointers; + } + + for (int i = 0; i < NI; i++) { + final int id = event.getPointerId(i); + final PointerState ps = mPointers.get(id); + ps.mVelocity.addMovement(event); + ps.mVelocity.computeCurrentVelocity(1); + final int N = event.getHistorySize(); + for (int j = 0; j < N; j++) { + if (mPrintCoords) { + Log.i("Pointer", + "Pointer " + (id + 1) + ": (" + + event.getHistoricalX(i, j) + ", " + + event.getHistoricalY(i, j) + ")" + + " Prs=" + + event.getHistoricalPressure(i, j) + + " Size=" + + event.getHistoricalSize(i, j)); + } + ps.mXs.add(event.getHistoricalX(i, j)); + ps.mYs.add(event.getHistoricalY(i, j)); + } + if (mPrintCoords) { + Log.i("Pointer", + "Pointer " + (id + 1) + ": (" + event.getX(i) + + ", " + event.getY(i) + ")" + " Prs=" + + event.getPressure(i) + " Size=" + + event.getSize(i)); + } + ps.mXs.add(event.getX(i)); + ps.mYs.add(event.getY(i)); + ps.mCurX = (int) event.getX(i); + ps.mCurY = (int) event.getY(i); + // Log.i("Pointer", "Pointer #" + p + ": (" + ps.mCurX + // + "," + ps.mCurY + ")"); + ps.mCurPressure = event.getPressure(i); + ps.mCurSize = event.getSize(i); + ps.mCurWidth = (int) (ps.mCurSize * (getWidth() / 3)); + } + + if ((action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP) { + + Log.i("Pointer", "action up"); + final int index = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; + final int id = event.getPointerId(index); + final PointerState ps = mPointers.get(id); + ps.mXs.add(Float.NaN); + ps.mYs.add(Float.NaN); + ps.mCurDown = false; + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (id + 1) + ": UP"); + } + } + + if (action == MotionEvent.ACTION_UP) { + for (int i = 0; i < NI; i++) { + final int id = event.getPointerId(i); + final PointerState ps = mPointers.get(id); + if (ps.mCurDown) { + ps.mCurDown = false; + if (mPrintCoords) { + Log.i("Pointer", "Pointer " + (id + 1) + ": UP"); + } + } + } + } + + postInvalidate(); + } + } + + + public interface OnPointCountChangeListener { + public void onPointCountChange(int newPointCount); + } + + private OnPointCountChangeListener onPointCountChangeListener; + + public void setOnPointCountChangeListener( + OnPointCountChangeListener onPointCountChangeListener) { + this.onPointCountChangeListener = onPointCountChangeListener; + } + + + public boolean onTouch(View v, MotionEvent event) { + addTouchEvent(event); + + return true; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TestView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TestView.java new file mode 100755 index 0000000..1033e9f --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TestView.java @@ -0,0 +1,65 @@ +package com.DeviceTest.view; + +import com.DeviceTest.FirstRun.TEST_STATUS; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Style; +import android.util.AttributeSet; +import android.widget.TextView; + +public class TestView extends TextView{ + private final static String TAG = "TestView"; + public static final int SUCC_COLOR = Color.GREEN; + public static final int FAIL_COLOR = Color.RED; + public static final int TEST_COLOR = Color.YELLOW; + public static final int WAIT_COLOR = Color.GRAY; + + private float center_x = 0; + private float center_y = 0; + private float ball_radius = 0; + private final static float SCALE = 2.0f; + + private TEST_STATUS currentstatus = TEST_STATUS.WAITING; + private Paint mPaint = new Paint(); + public TestView(Context context, AttributeSet attrs) { + super(context, attrs); + mPaint.setStyle(Style.FILL); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + center_x = this.getWidth()/2.0f; + center_y = this.getHeight()/2.0f; + ball_radius = this.getWidth() > this.getHeight() ? this.getHeight()/SCALE : this.getWidth()/SCALE; + } + + @Override + public void draw(Canvas canvas) { + int color = WAIT_COLOR; + switch(currentstatus){ + case WAITING: + color = WAIT_COLOR; + break; + case TESTING: + color = TEST_COLOR; + break; + case FAILED: + color = FAIL_COLOR; + break; + case SUCCEED: + color = SUCC_COLOR; + break; + } + mPaint.setColor(color); + canvas.drawCircle(center_x, center_y, ball_radius / 2, mPaint); + + super.draw(canvas); + } + public void setStatus(TEST_STATUS tmp){ + this.currentstatus = tmp; + this.invalidate(); + } +} \ No newline at end of file diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TouchSurfaceView.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TouchSurfaceView.java new file mode 100755 index 0000000..6d841ea --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/DeviceTest/view/TouchSurfaceView.java @@ -0,0 +1,127 @@ +package com.DeviceTest.view; + +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.opengl.GLSurfaceView.Renderer; +import android.view.KeyEvent; +import android.view.MotionEvent; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +public class TouchSurfaceView extends GLSurfaceView +{ + private final float TOUCH_SCALE_FACTOR = 0.5625F; + private float mPreviousX; + private float mPreviousY; + private float mPreviousZ; + private CubeRenderer mRenderer = new CubeRenderer(); + + public TouchSurfaceView(Context paramContext) + { + super(paramContext); + setRenderer(this.mRenderer); + setRenderMode(0); + } + + public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) + { + if (paramInt == 82) + { + this.mRenderer.mAngleZ = 0.0F; + mRenderer.mAngleY = 0.0F; + mRenderer.mAngleX = 0.0F; + } + return super.onKeyDown(paramInt, paramKeyEvent); + } + + public boolean onTouchEvent(MotionEvent paramMotionEvent) + { + this.mRenderer.mAngleZ = 0.0F; + mRenderer.mAngleY = 0.0F; + mRenderer.mAngleX = 0.0F; + return true; + } + + public void updateGyro(float paramFloat1, float paramFloat2, float paramFloat3) + { + float f1 = paramFloat1 - this.mPreviousX; + float f2 = paramFloat2 - this.mPreviousY; + float f3 = paramFloat3 - this.mPreviousZ; + CubeRenderer localCubeRenderer1 = this.mRenderer; + localCubeRenderer1.mAngleX += f1 * 0.5625F; + CubeRenderer localCubeRenderer2 = this.mRenderer; + localCubeRenderer2.mAngleY += f2 * 0.5625F; + CubeRenderer localCubeRenderer3 = this.mRenderer; + localCubeRenderer3.mAngleZ += f3 * 0.5625F; + requestRender(); + this.mPreviousX = paramFloat1; + this.mPreviousY = paramFloat2; + this.mPreviousZ = paramFloat3; + } + + private class CubeRenderer + implements GLSurfaceView.Renderer + { + public float mAngleX; + public float mAngleY; + public float mAngleZ; + private Cube mCube = new Cube(); + + public CubeRenderer() + { + } + + public void onDrawFrame(GL10 gl) + { + gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); + gl.glMatrixMode(GL10.GL_MODELVIEW); + gl.glLoadIdentity(); + gl.glTranslatef(0.0F, 0.0F, -6.0F); + gl.glRotatef(this.mAngleY, 1.0F, 0.0F, 0.0F); + gl.glRotatef(this.mAngleX, 0.0F, 1.0F, 0.0F); + gl.glRotatef(this.mAngleZ, 0.0F, 0.0F, 1.0F); + gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); + gl.glEnableClientState(GL10.GL_COLOR_ARRAY); + this.mCube.draw(gl); + } + + public void onSurfaceChanged(GL10 gl, int width, int height) + { + gl.glViewport(0, 0, width, height); + + /* + * Set our projection matrix. This doesn't have to be done + * each time we draw, but usually a new projection needs to + * be set when the viewport is resized. + */ + + float ratio = (float) width / height; + gl.glMatrixMode(GL10.GL_PROJECTION); + gl.glLoadIdentity(); + gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10); + } + + public void onSurfaceCreated(GL10 gl, EGLConfig paramEGLConfig) + { + /* + * By default, OpenGL enables features that improve quality + * but reduce performance. One might want to tweak that + * especially on software renderer. + */ + gl.glDisable(GL10.GL_DITHER); + + /* + * Some one-time OpenGL initialization can be made here + * probably based on features of this particular context + */ + gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, + GL10.GL_FASTEST); + + + gl.glClearColor(1,1,1,1); + gl.glEnable(GL10.GL_CULL_FACE); + gl.glShadeModel(GL10.GL_SMOOTH); + gl.glEnable(GL10.GL_DEPTH_TEST); + } + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiInfo.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiInfo.java new file mode 100755 index 0000000..d0248b8 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiInfo.java @@ -0,0 +1,89 @@ +package com.rockchip.dmi; + +public class DmiInfo { + private String manufacture; + private String productName; + private String version; + private String serialNumber; + private byte[] UUID; + private String OEM_Strings; + private String terminalID; + + private static DmiInfo instance; + + private DmiInfo(Object[] dmiInfo) { + + manufacture = (String) dmiInfo[0]; + productName = (String) dmiInfo[1]; + version = (String) dmiInfo[2]; + serialNumber = (String) dmiInfo[3]; + + UUID = (byte[]) dmiInfo[4]; + + OEM_Strings = (String) dmiInfo[5]; + terminalID = (String) dmiInfo[6]; + } + + public String toString() { + String str = ""; + str += "Manufacture:" + manufacture + "\n"; + str += "ProductName:" + productName + "\n"; + str += "Version:" + version + "\n"; + str += "SerialNumber:" + serialNumber + "\n"; + + str += "UUID:"; + for (int i = 0; i < UUID.length; i++) { + str += String.format("%02X", UUID[i]); + } + str += "\n"; + + str += "OEM_Strings:" + OEM_Strings + "\n"; + str += "TerminalID:" + terminalID + "\n"; + return str; + } + + protected static DmiInfo getInstance() { + return instance; + } + + protected static DmiInfo getInstance(Object[] dmiInfo) { + if (dmiInfo == null) { + instance = null; + } else { + try { + instance = new DmiInfo(dmiInfo); + } catch (Exception e) { + instance = null; + } + } + return instance; + } + + public String getManufacture() { + return manufacture; + } + + public String getProductName() { + return productName; + } + + public String getVersion() { + return version; + } + + public String getSerialNumber() { + return serialNumber; + } + + public byte[] getUUID() { + return UUID; + } + + public String getOEM_Strings() { + return OEM_Strings; + } + + public String getTerminalID() { + return terminalID; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiUtil.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiUtil.java new file mode 100755 index 0000000..2d10f81 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/dmi/DmiUtil.java @@ -0,0 +1,42 @@ +package com.rockchip.dmi; + +import android.content.Context; +import android.net.wifi.WifiManager; +import android.os.SystemClock; + +public class DmiUtil { + + static { + System.loadLibrary("getdmi"); + } + + private static native Object[] getdmi(); + + public static DmiInfo getDmiInfo(Context context, boolean regain) { + DmiInfo dmiInfo = null; + + // use the cached infos. + if (!regain) { + dmiInfo = DmiInfo.getInstance(); + } + + // try to get infos. + if (null == dmiInfo) { + // enable wifi to get the mac addr. + WifiManager wifiManager = (WifiManager) context + .getSystemService(Context.WIFI_SERVICE); + boolean wifiEnabled = wifiManager.isWifiEnabled(); + if (!wifiEnabled) { + wifiManager.setWifiEnabled(true); + } + + SystemClock.sleep(500); + dmiInfo = DmiInfo.getInstance(getdmi()); + + if (!wifiEnabled) { + wifiManager.setWifiEnabled(false); + } + } + return dmiInfo; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/irda/IrdaTestUtil.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/irda/IrdaTestUtil.java new file mode 100755 index 0000000..1d80aa2 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/com/rockchip/irda/IrdaTestUtil.java @@ -0,0 +1,24 @@ +package com.rockchip.irda; + +public class IrdaTestUtil { + static { + System.loadLibrary("IrdaTest"); + } + private static native boolean native_testSirReceive(); + private static native boolean native_testSirSend(); + private static native boolean native_testFirReceive(); + private static native boolean native_testFirSend(); + + public static boolean testSirReceive() { + return native_testSirReceive(); + } + public static boolean testSirSend() { + return native_testSirSend(); + } + public static boolean testFirReceive() { + return native_testFirReceive(); + } + public static boolean testFirSend() { + return native_testFirSend(); + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/ntt/east/hardware/IrRemoteController.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/ntt/east/hardware/IrRemoteController.java new file mode 100755 index 0000000..bf49379 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/ntt/east/hardware/IrRemoteController.java @@ -0,0 +1,156 @@ + +package jp.co.ntt.east.hardware; + +import java.io.IOException; +import java.util.Timer; +import java.util.TimerTask; + +import android.view.KeyEvent; + +public class IrRemoteController { + + static { + System.loadLibrary("rk29_cir"); + } + + private static final int SEND_WAIT_TIME = 250; + private static IrRemoteController instance; + private volatile boolean isRunning; + private IrRemoteController.Data[] data; + private int timeout; + private int count; + private Timer timer; + + public static synchronized IrRemoteController getInstance() { + if (instance == null) { + instance = new IrRemoteController(); + } + return instance; + } + + public void send(IrRemoteController.Data[] data, int timeout) throws IOException { + send(data, timeout, -1); + } + + public void send(IrRemoteController.Data[] data, int timeout, int count) throws IOException { + if (isRunning) { + throw new IllegalStateException("IrRemote is running."); + } + this.data = data; + this.timeout = timeout; + this.count = count; + + isRunning = true; + new SendThread().start(); + timer.schedule(new TimerThread(), (long)timeout * 1000L); + } + + public void stop() throws IOException { + isRunning = false; + native_hal_stop(); + timer.cancel(); + } + + private IrRemoteController() { + timer = new Timer(); + } + + private static native int native_hal_init(); + private static native int native_hal_deinit(); + private static native int native_hal_send(); + private static native int native_hal_stop(); + private static native int native_hal_set_formate(int high, int low, byte[] data, + int length, int duration, int startHigh, int startLow, int stopHigh, + int data0Pattern, int data0High, int data0Low, int data1Pattern, + int data1High, int data1Low, int count); + + public static class Data { + public static final int HIGH_LOW = 1; + public static final int INFINITE = 0; + public static final int LOW_HIGH = 2; + + int carry_high; + int carry_low; + int data0Pattern; + int data0High; + int data0Low; + int data1Pattern; + int data1High; + int data1Low; + int startHigh; + int startLow; + int stopHigh; + byte[] data; + int length; + int count; + int duration; + + public void setCarrier(int high, int low) { + this.carry_high = (int)(high / 10.0); + this.carry_low = (int)(low / 10.0); + } + + public void setPulse(int data0Pattern, int data0High, int data0Low, + int data1Pattern, int data1High, int data1Low) { + this.data0Pattern = (data0Pattern == HIGH_LOW) ? 0 : 1; + this.data0High = data0High; + this.data0Low = data0Low; + this.data1Pattern = (data1Pattern == HIGH_LOW) ? 0 : 1; + this.data1High = data1High; + this.data1Low = data1Low; + } + + public void setParameter(int startHigh, int startLow, int stopHigh) { + this.startHigh = startHigh; + this.startLow = startLow; + this.stopHigh = stopHigh; + } + + public void setData(byte[] data, int length) { + this.data = data; + this.length = length; + } + + public void setRepeatCount(int count) { + this.count = (count == INFINITE) ? -1 : count; + } + + public void setDuration(int duration) { + this.duration = duration; + } + } + + private class SendThread extends Thread { + + public void run() { + native_hal_init(); + for (int i = 0; i < data.length && isRunning; i++) { + Data d = data[i]; + native_hal_set_formate(d.carry_high, d.carry_low, d.data, d.length, d.duration, + d.startHigh, d.startLow, d.stopHigh, d.data0Pattern, d.data0High, + d.data0Low, d.data1Pattern, d.data1High, d.data1Low, d.count); + native_hal_send(); + } + + try { + Thread.sleep(SEND_WAIT_TIME); + } + catch (InterruptedException e) { + ; + } + isRunning = false; + timer.cancel(); + native_hal_deinit(); + } + } + + private class TimerThread extends TimerTask { + + public void run() { + if (isRunning) { + isRunning = false; + native_hal_stop(); + } + } + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/toshiba/newtion/cir/RemoteControl.java b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/toshiba/newtion/cir/RemoteControl.java new file mode 100755 index 0000000..5678213 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/src/jp/co/toshiba/newtion/cir/RemoteControl.java @@ -0,0 +1,112 @@ +package jp.co.toshiba.newtion.cir; + +import java.io.IOException; + +import jp.co.ntt.east.hardware.IrRemoteController; +import jp.co.ntt.east.hardware.IrRemoteController.Data; +import android.util.Log; + +public class RemoteControl { + private static final String TAG = "NewtonTest"; + + private static final int SEND_TIMEOUT = 1; + + private static final int CARRIER_HIGH_TIME = 130; + + private static final int CARRIER_LOW_TIME = 130; + + private static final int PULSE_0_HIGH_TIME = 560; + + private static final int PULSE_0_LOW_TIME = 560; + + private static final int PULSE_1_HIGH_TIME = 1690; + + private static final int PULSE_1_LOW_TIME = 560; + + private static final int START_HIGH_TIME = 9000; + + private static final int START_LOW_TIME = 4500; + + private static final int STOP_HIGH_TIME = 560; + + private static final int REPEAT_HIGH_TIME = 9000; + + private static final int REPEAT_LOW_TIME = 2250; + + private static final int DURATION_TIME = 1080; + + private static final int REPEAT_COUNT = 1; + + private static final byte CUSTOM_CODE = (byte) 0x40; + + public static final byte COMMAND_POWER = (byte) 0x12; + + public static final byte COMMAND_CHANNEL_BASE = (byte) 0x01; + + public static final byte COMMAND_CHANNEL_UP = (byte) 0x1b; + + public static final byte COMMAND_CHANNEL_DOWN = (byte) 0x1f; + + public static final byte COMMAND_VOLUME_UP = (byte) 0x1a; + + public static final byte COMMAND_VOLUME_DOWN = (byte) 0x1e; + + public static final byte COMMAND_MUTE = (byte) 0x10; + + public static final byte COMMAND_INPUT_SWITCH = (byte) 0x0f; + + public static final int CHANNEL_MIN = 1; + + public static final int CHANNEL_MAX = 12; + + public static boolean sendCommand(byte command) { + boolean returnValue = false; + byte sendData[] = new byte[4]; + + sendData[0] = (byte) (CUSTOM_CODE); + sendData[1] = (byte) (~CUSTOM_CODE); + + sendData[2] = (byte) command; + sendData[3] = (byte) (~command); + + IrRemoteController.Data irData1 = new IrRemoteController.Data(); + irData1.setCarrier(CARRIER_HIGH_TIME, CARRIER_LOW_TIME); + irData1.setPulse(IrRemoteController.Data.HIGH_LOW, PULSE_0_HIGH_TIME, + PULSE_0_LOW_TIME, IrRemoteController.Data.HIGH_LOW, + PULSE_1_HIGH_TIME, PULSE_1_LOW_TIME); + irData1.setParameter(START_HIGH_TIME, START_LOW_TIME, STOP_HIGH_TIME); + irData1.setData(sendData, sendData.length * 8); + irData1.setDuration(DURATION_TIME); + irData1.setRepeatCount(REPEAT_COUNT); + + IrRemoteController irController = IrRemoteController.getInstance(); + IrRemoteController.Data irDatas[] = { irData1 }; + + returnValue = true; + try { + irController.send(irDatas, SEND_TIMEOUT); + } catch (IllegalStateException e) { + } + + catch (IOException ex) { + returnValue = false; + Log.e(TAG, ex.getMessage()); + } + + return returnValue; + } + + public static boolean sendChannelCommand(int channel) { + boolean returnValue = false; + + if (CHANNEL_MIN <= channel && channel <= CHANNEL_MAX) { + byte commandValue = (byte) (channel - CHANNEL_MIN + COMMAND_CHANNEL_BASE); + boolean bResult = sendCommand(commandValue); + if (bResult) { + returnValue = true; + } + } + + return returnValue; + } +} diff --git a/android/vendor/aw/public/package/apk/DeviceTest_V1/user_mode.jar b/android/vendor/aw/public/package/apk/DeviceTest_V1/user_mode.jar new file mode 100755 index 0000000..1b8b205 --- /dev/null +++ b/android/vendor/aw/public/package/apk/DeviceTest_V1/user_mode.jar Binary files differ -- Gitblit v1.6.2