第18讲 camera java framework aidl概述 -凯发k8旗舰厅

本讲是android camera native framework专题的第18讲,我们介绍camera java framework aidl概述。

更多资源:

资源 描述
在线课程
知识星球 星球名称:深入浅出android camera 星球id: 17296815
wechat 极客笔记圈

camera java framework aidl文件路径

路径:/frameworks/av/camera/aidl/android/hardware/

camera java framework aidl文件路径

android 13 icameraservice.aidl代码如下:

/*
 * 凯发k8旗舰厅 copyright (c) 2013 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 android.hardware;
import android.hardware.icamera;
import android.hardware.icameraclient;
import android.hardware.camera2.icameradeviceuser;
import android.hardware.camera2.icameradevicecallbacks;
import android.hardware.camera2.icamerainjectioncallback;
import android.hardware.camera2.icamerainjectionsession;
import android.hardware.camera2.params.vendortagdescriptor;
import android.hardware.camera2.params.vendortagdescriptorcache;
import android.hardware.camera2.utils.concurrentcameraidcombination;
import android.hardware.camera2.utils.cameraidandsessionconfiguration;
import android.hardware.camera2.impl.camerametadatanative;
import android.hardware.icameraservicelistener;
import android.hardware.camerainfo;
import android.hardware.camerastatus;
/**
 * binder interface for the native camera service running in mediaserver.
 *
 * @hide
 */
interface icameraservice
{
    /**
     * all camera service and device binder calls may return a
     * servicespecificexception with the following error codes
     */
    const int error_permission_denied = 1;
    const int error_already_exists = 2;
    const int error_illegal_argument = 3;
    const int error_disconnected = 4;
    const int error_timed_out = 5;
    const int error_disabled = 6;
    const int error_camera_in_use = 7;
    const int error_max_cameras_in_use = 8;
    const int error_deprecated_hal = 9;
    const int error_invalid_operation = 10;
    /**
     * types for getnumberofcameras
     */
    const int camera_type_backward_compatible = 0;
    const int camera_type_all = 1;
    /**
     * return the number of camera devices available in the system
     */
    int getnumberofcameras(int type);
    /**
     * fetch basic camera information for a camera device
     */
    camerainfo getcamerainfo(int cameraid);
    /**
     * default uid/pid values for non-privileged callers of
     * connect() and connectdevice()
     */
    const int use_calling_uid = -1;
    const int use_calling_pid = -1;
    /**
     * open a camera device through the old camera api
     */
    icamera connect(icameraclient client,
            int cameraid,
            string oppackagename,
            int clientuid, int clientpid,
            int targetsdkversion);
    /**
     * open a camera device through the new camera api
     * only supported for device hal versions >= 3.2
     */
    icameradeviceuser connectdevice(icameradevicecallbacks callbacks,
            string cameraid,
            string oppackagename,
            @nullable string featureid,
            int clientuid, int oomscoreoffset,
            int targetsdkversion);
    /**
     * add listener for changes to camera device and flashlight state.
     *
     * also returns the set of currently-known camera ids and state of each device.
     * adding a listener will trigger the torch status listener to fire for all
     * devices that have a flash unit.
     */
    camerastatus[] addlistener(icameraservicelistener listener);
    /**
     * get a list of combinations of camera ids which support concurrent streaming.
     *
     */
    concurrentcameraidcombination[] getconcurrentcameraids();
    /**
      * check whether a particular set of session configurations are concurrently supported by the
      * corresponding camera ids.
      *
      * @param sessions the set of camera id and session configuration pairs to be queried.
      * @param targetsdkversion the target sdk level of the application calling this function.
      * @return true  - the set of concurrent camera id and stream combinations is supported.
      *         false - the set of concurrent camera id and stream combinations is not supported
      *                 or the method was called with a set of camera ids not returned by
      *                 getconcurrentcameraids().
      */
    boolean isconcurrentsessionconfigurationsupported(
            in cameraidandsessionconfiguration[] sessions,
            int targetsdkversion);
    /**
     * remove listener for changes to camera device and flashlight state.
     */
    void removelistener(icameraservicelistener listener);
    /**
     * read the static camera metadata for a camera device.
     * only supported for device hal versions >= 3.2
     */
    camerametadatanative getcameracharacteristics(string cameraid, int targetsdkversion);
    /**
     * read in the vendor tag descriptors from the camera module hal.
     * intended to be used by the native code of camerametadatanative to correctly
     * interpret camera metadata with vendor tags.
     */
    vendortagdescriptor getcameravendortagdescriptor();
    /**
     * retrieve the vendor tag descriptor cache which can have multiple vendor
     * providers.
     * intended to be used by the native code of camerametadatanative to correctly
     * interpret camera metadata with vendor tags.
     */
    vendortagdescriptorcache getcameravendortagcache();
    /**
     * read the legacy camera1 parameters into a string
     */
    string getlegacyparameters(int cameraid);
    /**
     * apiversion constants for supportscameraapi
     */
    const int api_version_1 = 1;
    const int api_version_2 = 2;
    // determines if a particular api version is supported directly for a cameraid.
    boolean supportscameraapi(string cameraid, int apiversion);
    // determines if a cameraid is a hidden physical camera of a logical multi-camera.
    boolean ishiddenphysicalcamera(string cameraid);
    // inject the external camera to replace the internal camera session.
    icamerainjectionsession injectcamera(string packagename, string internalcamid,
            string externalcamid, in icamerainjectioncallback camerainjectioncallback);
    void settorchmode(string cameraid, boolean enabled, ibinder clientbinder);
    // change the brightness level of the flash unit associated with cameraid to strengthlevel.
    // if the torch is in off state and strengthlevel > 0 then the torch will also be turned on.
    void turnontorchwithstrengthlevel(string cameraid, int strengthlevel, ibinder clientbinder);
    // get the brightness level of the flash unit associated with cameraid.
    int gettorchstrengthlevel(string cameraid);
    /**
     * notify the camera service of a system event.  should only be called from system_server.
     *
     * callers require the android.permission.camera_send_system_events permission.
     */
    const int event_none = 0;
    const int event_user_switched = 1; // the argument is the set of new foreground user ids.
    const int event_usb_device_attached = 2; // the argument is the deviceid and vendorid
    const int event_usb_device_detached = 3; // the argument is the deviceid and vendorid
    oneway void notifysystemevent(int eventid, in int[] args);
    /**
     * notify the camera service of a display configuration change.
     *
     * callers require the android.permission.camera_send_system_events permission.
     */
    oneway void notifydisplayconfigurationchange();
    /**
     * notify the camera service of a device physical status change. may only be called from
     * a privileged process.
     *
     * newstate is a bitfield consisting of device_state_* values combined together. valid state
     * combinations are device-specific. at device startup, the camera service will assume the device
     * state is normal until otherwise notified.
     *
     * callers require the android.permission.camera_send_system_events permission.
     */
    oneway void notifydevicestatechange(long newstate);
    // bitfield constants for notifydevicestatechange
    // all bits >= 32 are for custom vendor states
    // written as ints since aidl does not support long constants.
    const int device_state_normal = 0;
    const int device_state_back_covered = 1;
    const int device_state_front_covered = 2;
    const int device_state_folded = 4;
    const int device_state_last_framework_bit = 0x80000000; // 1 << 31;
}

camera java framework aidl产生的库/文件

camera java framework aidl产生的库/文件

aidl产生的java源文件:

  • out\soong\.intermediates\frameworks\base\framework-minus-apex\android_common\gen\aidl\ aidl36.srcjar

aidl产生的c 源文件:

  • out\soong\.intermediates\frameworks\av\camera\libcamera_client\android_arm64_armv8-a_cortex-a55_shared_cfi\gen\aidl\android\hardware

camera java framework aidl核心类

class description
icameraservice.aidl cameraserver进程对外提供的入口接口
icameraservicelistener.aidl icameraservice的回调类,通知cameraservice相关状态
icameradeviceuser.aidl 用于操作某一颗camera device
icameradevicecallbacks.aidl camera device的回调类

camera java framework aidl核心类之间的调用关系如下图所示:

camera java framework aidl核心类

camera课程

python教程

java教程

web教程

数据库教程

图形图像教程

办公软件教程

linux教程

计算机教程

大数据教程

开发工具教程

网站地图