mirror of
https://github.com/openharmony/multimedia_ringtone_library.git
synced 2026-07-01 03:23:19 -04:00
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
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.
|
||||
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||
All configurations in this file will be merged to OAT-Default.xml, if you have any questions or concerns, please create issue in OpenHarmony/tools_oat and @jalenchen or chenyaxun.
|
||||
|
||||
licensefile:
|
||||
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||
|
||||
policylist:
|
||||
1. policy: If the OAT-Default.xml policies do not meet your requirements, please add policies here.
|
||||
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||
3. policyitem type:
|
||||
"compatibility" is used to check license compatibility in the specified path;
|
||||
"license" is used to check source license header in the specified path;
|
||||
"copyright" is used to check source copyright header in the specified path;
|
||||
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||
"filename" is used to check whether the specified file exists in the specified path(projectroot means the root dir of the project), supported file names: LICENSE, README, README.OpenSource
|
||||
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||
7. policyitem desc: Used to describe the reason of this policy item, committers will check this while merging the code.
|
||||
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||
|
||||
Note:If the text contains special characters, please escape them according to the following rules:
|
||||
" == "
|
||||
& == &
|
||||
' == '
|
||||
< == <
|
||||
> == >
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile></licensefile>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<!--policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/-->
|
||||
<policyitem type="license" name="LGPL" path=".*" desc="Dynamically linked by module X"/>
|
||||
<!--policyitem type="copyright" name="xxx" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed by X Company"/-->
|
||||
</policy>
|
||||
</policylist>
|
||||
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
<filteritem type="filename" name="*.iml|*.json|*.txt" desc="desc files"/>
|
||||
<filteritem type="filepath" name="target/.*" desc="Compile output files"/>
|
||||
<filteritem type="filepath" name="out/.*" desc="Compile output files"/>
|
||||
<filteritem type="filepath" name="log/.*" desc="log files"/>
|
||||
<filteritem type="filepath" name=".idea/.*" desc="IDE temp files"/>
|
||||
<filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/>
|
||||
<filteritem type="filepath" name="src/test/.*" desc="Test files"/>
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||
<filteritem type="filepath" name="src/main/java/ohos/oat/analysis/headermatcher/.*"
|
||||
desc="License matcher rules, not license header"/>
|
||||
</filefilter>
|
||||
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
|
||||
</filefilter>
|
||||
<filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
|
||||
</filefilter>
|
||||
<filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
|
||||
</filefilter>
|
||||
<filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filename" name="*.png" desc="png格式图片文件,用于展示示例"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
@@ -1,36 +0,0 @@
|
||||
# multimedia_ringtone_library
|
||||
|
||||
#### Description
|
||||
铃音库功能实现
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
@@ -1,37 +1,37 @@
|
||||
# multimedia_ringtone_library
|
||||
# RingtoneLibrary
|
||||
|
||||
#### 介绍
|
||||
铃音库功能实现
|
||||
- [Introduction](#section1158716411637)
|
||||
- [Directory Structure](#section161941989596)
|
||||
- [Repositories Involved](#section1533973044317)
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
## Introduction<a name="section1158716411637"></a>
|
||||
**Figures 1** ringtonelibrary architecture
|
||||

|
||||
**ringtone\_library** repository provides a set of easy-to-use APIs for setting and getting ringtone information.
|
||||
RingtoneLibrary APIs can only be used internally, not exposed to public application currently.
|
||||
|
||||
The various capabilities can be categorized as below:
|
||||
- Read ringtone information
|
||||
- Set and remove customized ringtone
|
||||
- Read ringtone list, include system ringtone and customized ringtone
|
||||
- Scan the system prebuilt ringtone directories
|
||||
|
||||
#### 安装教程
|
||||
## Directory Structure<a name="section161941989596"></a>
|
||||
The structure of the repository directory is as follows:
|
||||
```
|
||||
/foundation/multimedia/ringtone_library/ # RingtoneLibrary code
|
||||
├── frameworks # Framework code
|
||||
├── interfaces # API implementation
|
||||
│ └── inner_api # Internal Native API implementation
|
||||
├── LICENSE # License file
|
||||
├── services # RingtoneLibrary function implementation
|
||||
│ ├── ringtone_backup # RingtoneLibrary backup implementation
|
||||
│ ├── ringtone_data_extension # DatashareExtension implementation
|
||||
│ ├── ringtone_dfx # DFX implementation
|
||||
│ ├── ringtone_helper # Helper class
|
||||
│ └── ringtone_scanner # Scanner implementation
|
||||
└── test # Test code
|
||||
```
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
## Repositories Involved<a name="section1533973044317"></a>
|
||||
**[multimedia/ringtone_library](https://gitee.com/openharmony/multimedia_ringtone_library)**
|
||||
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
# RingtoneLibrary组件
|
||||
|
||||
- [简介](#section1158716411637)
|
||||
- [目录](#section161941989596)
|
||||
- [使用说明](#usage-guidelines)
|
||||
- [相关仓](#section1533973044317)
|
||||
|
||||
## 简介<a name="section1158716411637"></a>
|
||||
**图1** ringtonelibrary组件架构图
|
||||

|
||||
**ringtone\_library** 仓库提供了一系列易用的接口用于设定及获取系统铃音信息。
|
||||
RingtoneLibrary接口暂不对外部应用开放, 仅内部使用。
|
||||
|
||||
支持能力列举如下:
|
||||
- 读取铃音内容
|
||||
- 存储和删除自定义铃音
|
||||
- 读取铃音列表,包含系统铃音和自定义铃音
|
||||
- 扫描系统预制铃音目录
|
||||
|
||||
## 目录<a name="section161941989596"></a>
|
||||
仓目录结构如下:
|
||||
```
|
||||
/foundation/multimedia/ringtone_library/ # 铃音库组件代码
|
||||
├── frameworks # 框架代码
|
||||
├── interfaces # 接口代码
|
||||
│ └── inner_api # 内部native接口
|
||||
├── LICENSE # 证书文件
|
||||
├── services # 铃音库服务实现
|
||||
│ ├── ringtone_backup # 铃音库备份升级服务
|
||||
│ ├── ringtone_data_extension # 扩展插件接口
|
||||
│ ├── ringtone_dfx # DFX实现
|
||||
│ ├── ringtone_helper # 辅助类
|
||||
│ └── ringtone_scanner # 扫描功能实现
|
||||
└── test # 测试代码
|
||||
```
|
||||
|
||||
## 使用说明<a name="usage-guidelines"></a>
|
||||
### 概述
|
||||
提供铃音列表的增、删、改、查等接口
|
||||
接口参数主要有对象类型的Uri、DataSharePredicates和DataShareValuesBucket等
|
||||
|
||||
使用接口功能前,需要先获取DataShareHelper
|
||||
```cpp
|
||||
auto saManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
auto remoteObj = saManager->GetSystemAbility(systemAbilityId);
|
||||
std::shared_ptr<DataShare::DataShareHelper> datashareHelper = DataShare::DataShareHelper::Creator(remoteObj, "datashare:///ringtone/ringtone");
|
||||
```
|
||||
|
||||
### 铃音列表
|
||||
#### datashareHelper->Insert(const Uri &uri, const DataShareValuesBucket &value);
|
||||
- 接口说明
|
||||
|
||||
新增铃音
|
||||
|
||||
- insert参数描述
|
||||
|
||||
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
|
||||
| -------- | -------- | ---------------------- | ---- | ------------------------------ |
|
||||
| uri | 只读 | Uri& | 是 | 具体操作的uri |
|
||||
| value | 只读 | DataShareValuesBucket& | 是 | 数据库字段key-value对象 |
|
||||
|
||||
返回值为 来电铃音id
|
||||
|
||||
- 示例
|
||||
```cpp
|
||||
Uri ringtoneUri("datashare:///ringtone/ringtone");
|
||||
int32_t index = 0;
|
||||
const int32_t count = 10;
|
||||
const int64_t ringtoneSize = 1022;
|
||||
const int type = 2;
|
||||
const int64_t addedTime = 1559276453;
|
||||
const int64_t modifiedTime = 1559276455;
|
||||
const int64_t takenTime = 1559276457;
|
||||
const int durationTime = 112;
|
||||
DataShareValuesBucket valuesBucket;
|
||||
valuesBucket.Put(RINGTONE_COLUMN_DATA,
|
||||
static_cast<string>("/path_to_target/test_ringtone.ogg"));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_SIZE, static_cast<int64_t>(ringtoneSize));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_DISPLAY_NAME, static_cast<string>("test_ringtone.ogg");
|
||||
valuesBucket.Put(RINGTONE_COLUMN_TITLE, static_cast<string>("test_ringtone"));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_MEDIA_TYPE, static_cast<int>(type));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_TONE_TYPE, static_cast<int>(type));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_MIME_TYPE, static_cast<string>("ogg"));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_SOURCE_TYPE, static_cast<int>(1));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_DATE_ADDED, static_cast<int64_t>(addedTime));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_DATE_MODIFIED, static_cast<int64_t>(modifiedTime));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_DATE_TAKEN, static_cast<int64_t>(takenTime));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_DURATION, static_cast<int>(durationTime));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_SHOT_TONE_TYPE, static_cast<int>(1));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE, static_cast<int>(type));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_NOTIFICATION_TONE_TYPE, static_cast<int>(1));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_NOTIFICATION_TONE_SOURCE_TYPE, static_cast<int>(type));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_RING_TONE_TYPE, static_cast<int>(1));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_RING_TONE_SOURCE_TYPE, static_cast<int>(type));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_ALARM_TONE_TYPE, static_cast<int>(1));
|
||||
valuesBucket.Put(RINGTONE_COLUMN_ALARM_TONE_SOURCE_TYPE, static_cast<int>(type));
|
||||
int32_t ret = dataShareHelper->Insert(ringtoneUri, valuesBucket);
|
||||
```
|
||||
|
||||
#### datashareHelper->Delete(const Uri &uri, const DataSharePredicates &predicates);
|
||||
- 接口说明
|
||||
|
||||
删除铃音
|
||||
|
||||
- Delete参数描述
|
||||
|
||||
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
|
||||
| -------- | -------- | ---------------------- | ---- | ------------------------------ |
|
||||
| uri | 只读 | Uri& | 是 | 具体操作的uri |
|
||||
| condition | 只读 | DataSharePredicates& | 是 | 删除条件 |
|
||||
|
||||
返回值为删除的铃音数量
|
||||
|
||||
- 示例
|
||||
```cpp
|
||||
Uri ringtoneUri("datashare:///ringtone/ringtone");
|
||||
DataShare::DataSharePredicates deletePredicates;
|
||||
deletePredicates.SetWhereClause(RINGTONE_COLUMN_TONE_ID + " = ? ");
|
||||
deletePredicates.SetWhereArgs({ to_string(1) });
|
||||
int32_t ret = g_dataShareHelper->Delete(ringtoneUri, deletePredicates);
|
||||
```
|
||||
|
||||
#### datashareHelper->Update(const Uri &uri, const DataSharePredicates &predicates, const DataShareValuesBucket &value);
|
||||
- 接口说明
|
||||
|
||||
修改铃音
|
||||
|
||||
- Update参数描述
|
||||
|
||||
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
|
||||
| -------- | -------- | ---------------------- | ---- | ------------------------------ |
|
||||
| uri | 只读 | Uri& | 是 | 具体操作的uri |
|
||||
| condition | 只读 | DataSharePredicates& | 是 | 更新条件 |
|
||||
| value | 只读 | DataShareValuesBucket& | 是 | 数据库字段key-value对象 |
|
||||
|
||||
返回值为修改的铃音数量
|
||||
|
||||
- 示例
|
||||
```cpp
|
||||
Uri ringtoneUri("datashare:///ringtone/ringtone");
|
||||
DataShare::DataSharePredicates updatePredicates;
|
||||
updatePredicates.SetWhereClause(RINGTONE_COLUMN_TONE_ID + " = ? ");
|
||||
updatePredicates.SetWhereArgs({ to_string(1) });
|
||||
DataShareValuesBucket updateValuesBucket;
|
||||
updateValuesBucket.Put(RINGTONE_COLUMN_SHOT_TONE_TYPE, 0);
|
||||
updateValuesBucket.Put(RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE, 0);
|
||||
int32_t ret = dataShareHelper->Update(ringtoneUri, deletePredicates, updateValuesBucket);
|
||||
```
|
||||
|
||||
#### datashareHelper->Query(const Uri &uri, const DataSharePredicates &predicates, std::vector<std::string> &columns, DatashareBusinessError &businessError);
|
||||
- 接口说明
|
||||
|
||||
查询铃音
|
||||
|
||||
- Query参数描述
|
||||
|
||||
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
|
||||
| -------- | -------- | ---------------------- | ---- | ------------------------------ |
|
||||
| uri | 只读 | Uri& | 是 | 具体操作的uri |
|
||||
| condition | 只读 | DataSharePredicates& | 是 | 查询条件 |
|
||||
| resultColumns | 只读 | std::vector<std::string>& | 是 | 需要查询的列字段名称 |
|
||||
| businessError | 只读 | DatashareBusinessError& | 是 | 异常代码 |
|
||||
|
||||
返回值为ResultSet结果集
|
||||
|
||||
- 示例
|
||||
```cpp
|
||||
Uri ringtoneUri("datashare:///ringtone/ringtone");
|
||||
int errCode = 0;
|
||||
DatashareBusinessError businessError;
|
||||
DataSharePredicates queryPredicates;
|
||||
queryPredicates.EqualTo(RINGTONE_COLUMN_SHOT_TONE_TYPE, to_string(1));
|
||||
vector<string> columns = {
|
||||
{ RINGTONE_COLUMN_TONE_ID },
|
||||
{ RINGTONE_COLUMN_DISPLAY_NAME },
|
||||
{ RINGTONE_COLUMN_DATE_ADDED },
|
||||
{ RINGTONE_COLUMN_SHOT_TONE_TYPE }
|
||||
};
|
||||
auto resultSet = dataShareHelper->Query(ringtoneUri, queryPredicates, columns, &businessError);
|
||||
```
|
||||
|
||||
## 相关仓<a name="section1533973044317"></a>
|
||||
**[multimedia/ringtone_library](https://gitee.com/openharmony/multimedia_ringtone_library)**
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Reference in New Issue
Block a user