工模测试相机拍摄退出闪屏一下,整机测试中断

文章描述了在设备上相机测试时遇到的拍照闪退问题,问题源于相机布局默认为横屏。为解决此问题,通过修改AndroidManifest.xml中相机活动的屏幕方向为竖屏,并调整camera.xml布局为垂直布局,从而避免了闪退。同时提到了设备的虚拟键设置和系统配置对交互模式的影响。
摘要由CSDN通过智能技术生成

/frameworks/base/core/res/res/values/config.xml

<!-- Controls the navigation bar interaction mode:
         0: 3 button mode (back, home, overview buttons)
         1: 2 button mode (back, home buttons + swipe up for overview)
         2: gestures only for back, home and overview -->

默认2:
   <integer name="config_navBarInteractionMode">2</integer>

/device/mediatek/system/common/system.prop

 # temporary enables NAV bar (soft keys) 虚拟键宏开关  0:开启  1:关闭
qemu.hw.mainkeys=1

主要问题:相机测试项拍照闪退将导致整机测试到此了

主要办法:修改布局:相机布局默认横屏,也就是横屏导致闪退了一下,需改为竖屏

/vendor/freeme/packages/apps/FreemeFactoryTest/AndroidManifest.xml

 <activity
            android:name=".camera.CameraTest"
            android:clearTaskOnLaunch="true"
            android:label="@string/Camera"
            android:screenOrientation="portrait"
            android:taskAffinity="android.task.camera" />
        <activity
            android:name=".camera.BackViceCamera"
            android:clearTaskOnLaunch="true"
            android:label="@string/Camera"
            android:screenOrientation="portrait"
            android:taskAffinity="android.task.camera" />
        <activity
            android:name=".camera.BackVice2Camera"
            android:clearTaskOnLaunch="true"
            android:label="@string/Camera"
            android:screenOrientation="portrait"
            android:taskAffinity="android.task.camera" />
        <activity
            android:name=".camera.SubCamera"
            android:clearTaskOnLaunch="true"
            android:label="@string/Camera"
            android:screenOrientation="portrait"
            android:stateNotNeeded="true"
            android:taskAffinity="android.task.camera" />

2./vendor/freeme/packages/apps/FreemeFactoryTest/res/layout/camera.xml

android:orientation="vertical"采用垂直布局:

<?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="fill_parent"
    android:background="@drawable/main_background"
    android:orientation="vertical"
    android:baselineAligned="false" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <TextureView
            android:id="@+id/camera_view"
            android:layout_width="fill_parent"
            android:layout_height="400dp" />

        <LinearLayout
            android:layout_width="@dimen/dual_camera_view_width"
            android:layout_height="@dimen/dual_camera_view_heigth">

            <TextureView
                android:id="@+id/dual_camera_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone"/>
        </LinearLayout>
    </RelativeLayout>
    
     <CheckBox
          android:id="@+id/camera_check_strobe"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:button="@drawable/btn_camera_check_strobe" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

            <Button
                android:id="@+id/camera_take"
                android:layout_width="wrap_content"
                android:layout_height="100.0dip"
                android:layout_marginLeft="10.0dip"

                android:background="@drawable/btn_default"
                android:text="@string/Camera_takepic"
                android:textColor="@color/Blue"
                android:textSize="18sp" />

            <Button
                android:id="@+id/ResultOK"
                android:layout_width="wrap_content"
                android:layout_height="100.0dip"
                android:layout_marginLeft="20.0dip"

                android:background="@drawable/btn_fcm_sucess"
                android:text="@string/Success"
                android:textColor="@color/gray"
                android:textSize="18sp" />

            <Button
                android:id="@+id/ResultFail"
                android:layout_width="wrap_content"
                android:layout_height="100.0dip"
                android:layout_marginLeft="20.0dip"

                android:background="@drawable/btn_fcm_fail"
                android:text="@string/Failed"
                android:textColor="@color/gray"
                android:textSize="18sp" />

    </LinearLayout>
</LinearLayout>

其他布局需要自主微调了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值