1. 程式人生 > >Android 5.0 CTS 程式碼修改日記

Android 5.0 CTS 程式碼修改日記

 1.android.os.cts.BuildVersionTest#testReleaseVersion
 CTS Log
 04-24 19:08:43.460 11050 11065 I TestRunner: failed: testReleaseVersion(android.os.cts.BuildVersionTest)
04-24 19:08:43.460 11050 11065 I TestRunner: ----- begin exception -----
04-24 19:08:43.461 11050 11065 I TestRunner: junit.framework.AssertionFailedError: For: BUILD.VERSION.RELEASE, the value: 5.1.1, should be one of: [5.1]
04-24 19:08:43.461 11050 11065 I TestRunner:     at junit.framework.Assert.fail(Assert.java:50)
04-24 19:08:43.461 11050 11065 I TestRunner:     at android.os.cts.BuildVersionTest.assertAnyOf(BuildVersionTest.java:90)
04-24 19:08:43.461 11050 11065 I TestRunner:     at android.os.cts.BuildVersionTest.testReleaseVersion(BuildVersionTest.java:40)

CTS路徑執行的程式碼
./cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java

      private static final Set<String> EXPECTED_RELEASES =
              new HashSet<String>(Arrays.asList("5.0.1", "5.0.2"));
      @SuppressWarnings("deprecation")
      public void testReleaseVersion() {                                                                                                                                                                   
          // Applications may rely on the exact release version
          assertAnyOf("BUILD.VERSION.RELEASE", Build.VERSION.RELEASE, EXPECTED_RELEASES);
          assertEquals("Build.VERSION.SDK", "" + EXPECTED_SDK, Build.VERSION.SDK);
          assertEquals("Build.VERSION.SDK_INT", EXPECTED_SDK, Build.VERSION.SDK_INT);
      }
      
      錯誤的原因是CTS的版本路徑不一樣
     
 
 2.com.android.cts.browser.BrowserBenchTest --- testOctane
設定一個預設的瀏覽器即可
設定方法:
a.可以設定android 原生的瀏覽器: Browser
方法: 用簡訊的方式,發一個link到手機上,點選link 就可以設定一下預設瀏覽器
b. 需要設定google 的搜尋引擎,
方法: 進入原生Browser -> setting -> Advanced -> Set search engine ->選擇google

煩請按上述方法設定後再測試

 3.android.app.cts.SystemFeaturesTest#testSensorFeatures
 一般碰到這類問題比較好解決
 根據CTS的log分析
 junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.compass) returns true but SensorManager#getSensorList(2) shows sensors [] expected:<true> but was:<false>
at junit.framework.Assert.fail(Assert.java:50)
是由於預設指南針(compass) Sensor功能是開啟的,但是在system/etc/permissions/路徑下面缺少android.hardware.sensor.compass.xml

解決方法:
如果指南針功能不支援,我們關閉對於的巨集即可
如果指南針功能支援,在指令碼中新增拷貝android.hardware.sensor.compass.xml 到system/etc/permissions/的程式碼

5.android.bionic.sys_resource#smoke
修改方法:usr版本即可pass

出現錯誤的原因是測試用的不是usr版本測試的



6.android.security.cts.ServicePermissionsTest        
-- testDumpProtected    ------- 可申請Waiver,不需要修改

7.android.security.cts.ListeningPortsTest        
-- testNoListeningLoopbackTcp6Ports    fail    
android.security.cts.ListeningPortsTest$ListeningPortsAssertionError:
Found port listening on addr=127.0.0.1, port=47269, UID=10085 [com.google.android.youtube] in /proc/net/tcp6 

------------------可以申請Waiver