• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "media_app_uri_sensitive_column.h"
17 #include "media_column.h"
18 #include "base_column.h"
19 
20 namespace OHOS {
21 namespace Media {
22 
23 const std::string AppUriSensitiveColumn::ID = "id";
24 const std::string AppUriSensitiveColumn::APP_ID = "appid";
25 const std::string AppUriSensitiveColumn::FILE_ID = "file_id";
26 const std::string AppUriSensitiveColumn::URI_TYPE = "uri_type";
27 const std::string AppUriSensitiveColumn::HIDE_SENSITIVE_TYPE = "sensitive_type";
28 const std::string AppUriSensitiveColumn::IS_FORCE_SENSITIVE = "is_force_sensitive";
29 const std::string AppUriSensitiveColumn::DATE_MODIFIED = "date_modified";
30 const std::string AppUriSensitiveColumn::SOURCE_TOKENID = "src_tokenid";
31 const std::string AppUriSensitiveColumn::TARGET_TOKENID = "target_tokenid";
32 
33 const int AppUriSensitiveColumn::URI_PHOTO = 1;
34 const int AppUriSensitiveColumn::URI_AUDIO = 2;
35 const std::set<int> AppUriSensitiveColumn::URI_TYPES_ALL = {
36     AppUriSensitiveColumn::URI_PHOTO, AppUriSensitiveColumn::URI_AUDIO};
37 
38 const int AppUriSensitiveColumn::SENSITIVE_ALL_DESENSITIZE = 0;
39 const int AppUriSensitiveColumn::SENSITIVE_GEOGRAPHIC_LOCATION_DESENSITIZE = 1;
40 const int AppUriSensitiveColumn::SENSITIVE_SHOOTING_PARAM_DESENSITIZE = 2;
41 const int AppUriSensitiveColumn::SENSITIVE_NO_DESENSITIZE = 3;
42 const std::set<int> AppUriSensitiveColumn::SENSITIVE_TYPES_ALL = {
43     AppUriSensitiveColumn::SENSITIVE_ALL_DESENSITIZE,
44     AppUriSensitiveColumn::SENSITIVE_GEOGRAPHIC_LOCATION_DESENSITIZE,
45     AppUriSensitiveColumn::SENSITIVE_SHOOTING_PARAM_DESENSITIZE,
46     AppUriSensitiveColumn::SENSITIVE_NO_DESENSITIZE};
47 
48 const std::string AppUriSensitiveColumn::URI_URITYPE_APPID_INDEX = "uri_uritype_appid_index";
49 
50 const std::string AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE = "UriSensitive";
51 
52 const std::set<std::string> AppUriSensitiveColumn::DEFAULT_FETCH_COLUMNS = {AppUriSensitiveColumn::ID};
53 
54 const std::string AppUriSensitiveColumn::DROP_APP_URI_SENSITIVE_TABLE = "DROP TABLE IF EXISTS " +
55     AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE;
56 
57 const std::string AppUriSensitiveColumn::CREATE_APP_URI_SENSITIVE_TABLE =
58     "CREATE TABLE IF NOT EXISTS " + AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE + "(" +
59     AppUriSensitiveColumn::ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
60     AppUriSensitiveColumn::APP_ID + " TEXT, " + AppUriSensitiveColumn::FILE_ID + " INTEGER, " +
61     AppUriSensitiveColumn::URI_TYPE + " INTEGER, " + AppUriSensitiveColumn::HIDE_SENSITIVE_TYPE + " INTEGER, " +
62     AppUriSensitiveColumn::DATE_MODIFIED + " BIGINT," + AppUriSensitiveColumn::IS_FORCE_SENSITIVE + " INT DEFAULT 0, " +
63     AppUriSensitiveColumn::SOURCE_TOKENID + " BIGINT, " + AppUriSensitiveColumn::TARGET_TOKENID + " BIGINT)";
64 
65 const std::string AppUriSensitiveColumn::CREATE_URI_URITYPE_APPID_INDEX = BaseColumn::CreateIndex() +
66     AppUriSensitiveColumn::URI_URITYPE_APPID_INDEX + " ON " +
67     AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE + " (" +
68     AppUriSensitiveColumn::FILE_ID + " DESC," +
69     AppUriSensitiveColumn::URI_TYPE + "," +
70     AppUriSensitiveColumn::IS_FORCE_SENSITIVE + "," +
71     AppUriSensitiveColumn::APP_ID + " DESC,"  +
72     AppUriSensitiveColumn::SOURCE_TOKENID + " DESC," +
73     AppUriSensitiveColumn::TARGET_TOKENID + " DESC)";
74 
75 const std::string AppUriSensitiveColumn::DELETE_APP_URI_SENSITIVE_TABLE =
76     "DELETE FROM " + AppUriSensitiveColumn::APP_URI_SENSITIVE_TABLE;
77 
78 const std::set<std::string> AppUriSensitiveColumn::ALL_COLUMNS = {
79     AppUriSensitiveColumn::ID, AppUriSensitiveColumn::APP_ID, AppUriSensitiveColumn::FILE_ID,
80     AppUriSensitiveColumn::URI_TYPE, AppUriSensitiveColumn::HIDE_SENSITIVE_TYPE,
81     AppUriSensitiveColumn::DATE_MODIFIED, AppUriSensitiveColumn::IS_FORCE_SENSITIVE,
82     AppUriSensitiveColumn::SOURCE_TOKENID, AppUriSensitiveColumn::TARGET_TOKENID
83 };
84 } // namespace Media
85 } // namespace OHOS