进入相应页面
要求去掉ItemTest中的GPSTest选项
Adb logcat | grep “START u0”命令,查看启动的activity的log
在ItemTestActivity中点击GPSTest选项就会进入GPS Test的页面
Code/packages/apps/validationtools中查看ListItemTestActivity的相关代码
ListItemTestActivity 继承自activity,图中的显示由ListView实现
ListView中的内容由适配器提供
代码中
mListViewItem.setAdapter(mItemListViewAdapter);//为ListView设置adapter
/** Adapter的初始化 */
private void initAdapter() {
TestItem item = null;
EngSqlite engSqlite = EngSqlite.getInstance(ListItemTestActivity.this);
if (engSqlite == null) {
return;
}
mItemsListView = Const.getSupportList(true, this); // 对ListView对象的赋值
for (int i = 0; i < mItemsListView.size(); i++) {
item = mItemsListView.get(i);
item.setResult(engSqlite.getTestListItemStatus(mItemsListView.get(i)
.getTestname()));
}
mItemListViewAdapter = new ItemListViewAdapter(this, mItemsListView);
}
Adapter中的数据由ListView的属性决定,查看ListView具体的创建过程
mItemsListView = Const.getSupportList(true, this);
通过循环的嵌套,创建不同层级中的各个Item,查看定义的常量集合
public static final int[] ALL_TEST_ITEM_STRID = {
R.string.otg_test,
R.string.version_test,
R.string.rf_cali_test,
R.string.rtc_test,
R.string.backlight_test,
R.string.lcd_test,
R.string.touchpoint_test,
R.string.muti_touchpoint_test,
R.string.vibrator_test,
R.string.phone_loopback_test,
R.string.phone_call_test,
R.string.gravity_sensor_test,
R.string.oritention_sensor_test,
R.string.proximity_sensor_test,
R.string.front_camera_title_text,
R.string.back_camera_title_text,
R.string.key_test,
R.string.battery_title_text,
R.string.headset_test,
R.string.fm_test,
// R.string.status_indicator_red,
// R.string.status_indicator_green,
// R.string.status_indicator_blue,
R.string.bt_test,
R.string.wifi_test,
R.string.gps_test,
R.string.sdcard_test,
R.string.sim_test,
R.string.TestResultTitleString,
};
public static final String[] ALL_TEST_ITEM_NAME = {
"OTG test",
"Version",
"RF CALI",
"RTC test",
"Backlight test",
"Lcd test",
"TP test",
"Multi-TP test",
"Melody test",
"Phone loopback test",
"PhoneCall test",
"Gsensor test",
"Msensor test",
"Proximity test",
"FrontCamera test",
"Camera test",
"Key test",
"Charger test",
"Headset test",
"FM test",
// "RedLed test",
// "GreenLed test",
// "BlueLed test",
"Bluetooth test",
"Wifi test",
"Gps test",
"SDcard test",
"SIMcard test",
RESULT_TEST_NAME
};
public static final Class[] ALL_TEST_ITEM = {
OTGTest.class,
SystemVersionTest.class,
RFCALITest.class,
RTCTest.class,
BackLightTest.class,
ScreenColorTest.class,
SingleTouchPointTest.class,
MutiTouchTest.class,
MelodyTest.class,
PhoneLoopBackTest.class,
PhoneCallTestActivity.class,
GsensorTestActivity.class,
CompassTestActivity.class,
PsensorTestActivity.class,
FrontCameraTestActivity.class,
CameraTestActivity.class,
KeyTestActivity.class,
ChargerTest.class,
HeadSetTest.class,
FMTest.class,
// RedLightTest.class,
// GreenLightTest.class,
// BlueLightTest.class,
BluetoothTestActivity.class,
WifiTestActivity.class,
GpsTestActivity.class,
SDCardTest.class,
SIMCardTestActivity.class,
TestResultActivity.class
};
public static final Class[] DEFAULT_UNIT_TEST_ITEMS = {
OTGTest.class,
SystemVersionTest.class,
RFCALITest.class,
RTCTest.class,
BackLightTest.class,
ScreenColorTest.class,
SingleTouchPointTest.class,
MutiTouchTest.class,
MelodyTest.class,
PhoneLoopBackTest.class,
PhoneCallTestActivity.class,
GsensorTestActivity.class,
CompassTestActivity.class,
PsensorTestActivity.class,
FrontCameraTestActivity.class,
CameraTestActivity.class,
KeyTestActivity.class,
ChargerTest.class,
HeadSetTest.class,
FMTest.class,
// RedLightTest.class,
// GreenLightTest.class,
// BlueLightTest.class,
BluetoothTestActivity.class,
WifiTestActivity.class,
GpsTestActivity.class,
SDCardTest.class,
SIMCardTestActivity.class,
TestResultActivity.class
};
public static final Class[] DEFAULT_AUTO_TEST_ITEMS = {
BackLightTest.class,
ScreenColorTest.class,
SingleTouchPointTest.class,
MutiTouchTest.class,
PhoneLoopBackTest.class,
MelodyTest.class,
GsensorTestActivity.class,
CompassTestActivity.class,
PsensorTestActivity.class,
FrontCameraTestActivity.class,
CameraTestActivity.class,
KeyTestActivity.class,
ChargerTest.class,
HeadSetTest.class,
FMTest.class,
// RedLightTest.class,
// GreenLightTest.class,
// BlueLightTest.class,
//PhoneCallTestActivity.class,
// TestResultActivity.class
};
public static final Class[] DEFAULT_SYSTEM_TEST_ITEMS = {
BackLightTest.class,
ScreenColorTest.class,
SingleTouchPointTest.class,
MutiTouchTest.class,
PhoneLoopBackTest.class,
MelodyTest.class,
GsensorTestActivity.class,
CompassTestActivity.class,
PsensorTestActivity.class,
FrontCameraTestActivity.class,
CameraTestActivity.class,
KeyTestActivity.class,
ChargerTest.class,
HeadSetTest.class,
FMTest.class,
// PhoneCallTestActivity.class,
BluetoothTestActivity.class,
WifiTestActivity.class,
GpsTestActivity.class,
SDCardTest.class,
SIMCardTestActivity.class,
};
将各常量中关于GPS的代码注释掉push apk 重启即可。