run cts -m CtsCameraTestCases -t android.hardware.cts.CameraTest#testMultipleCamerasテストfail


試験項目:run cts-m CtsCameraTestCases-t android.hardware.cts.CameraTest#testMultipleCameras
エラーログ:junit.framework.AssertionFailedError: getCameraInfo should not accept bad cameraId (2)
エラーの原因:このテスト項目はテストcameraです.id_List以外のcamera idはget_cam_infoとopenは、これまでこの項目は二重撮影だったためctsパッケージ名に補助撮影は露出していなかったが、このテスト時にget_caminfoとopenなのでfailをテストします
fixメソッド:framework/base/core/java/android/hardware/Cameraを変更します.JAva,ctsパケット名がcamera idリスト以外のcamera idをget_caminfoまたはopen操作の場合、強制的にcamera idを-1に変更するとget_caminfoとopenが間違っています.
コード修正://begin addedコメント囲み部分が新規コード1.
public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) {
    //begin added on 20190902, fixed cts#testMultipleCameras.
    boolean exposeAuxCamera = false;
    String packageName = ActivityThread.currentOpPackageName();
    /* Force to expose only two cameras
     * if the package name does not falls in this bucket
     */
    String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
    if (packageList.length() > 0) {
        TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
        splitter.setString(packageList);
        for (String str : splitter) {
            if (packageName.equals(str)) {
                exposeAuxCamera = true;
                break;
            }
        }
    }
    if (exposeAuxCamera == false && (cameraId > 1)) {
        cameraId = -1;
    }
    //end added on 20190902, fixed cts#testMultipleCameras.
    _getCameraInfo(cameraId, cameraInfo);
    IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
    IAudioService audioService = IAudioService.Stub.asInterface(b);
    try {
        if (audioService.isCameraSoundForced()) {
            // Only set this when sound is forced; otherwise let native code
            // decide.
            cameraInfo.canDisableShutterSound = false;
        }
    } catch (RemoteException e) {
        Log.e(TAG, "Audio service is unavailable for queries");
    }
}

  • public static Camera open(int cameraId) {
    
        //begin added on 20190902, fixed cts#testMultipleCameras.
        boolean exposeAuxCamera = false;
        String packageName = ActivityThread.currentOpPackageName();
        /* Force to expose only two cameras
         * if the package name does not falls in this bucket
         */
        String packageList = SystemProperties.get("vendor.camera.aux.packagelist");
        if (packageList.length() > 0) {
            TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
            splitter.setString(packageList);
            for (String str : splitter) {
                if (packageName.equals(str)) {
                    exposeAuxCamera = true;
                    break;
                }
            }
        }
    
        if (exposeAuxCamera == false && (cameraId > 1)) {
            cameraId = -1;
        }
        //end added on 20190902, fixed cts#testMultipleCameras.
    
        return new Camera(cameraId);
    }