# Copyright (c) 2023 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.

import("//build/ohos.gni")

java_library("ability_access_ctrl_android_java") {
  java_files = [ "src/AbilityAccessCtrl.java" ]
  classpath_deps = [
    "//foundation/arkui/ace_engine/adapter/android/build:ace_android_adapter_java"
  ]
  input_jars_paths = [
    "//prebuilts/androidx/activity-1.5.1/classes.jar",
    "//prebuilts/androidx/core-1.8.0/classes.jar",
    "//prebuilts/androidx/fragment-1.5.5/classes.jar",
    "//prebuilts/androidx/lifecycle_viewmodel-2.5.1/classes.jar",
    "//prebuilts/androidx/savedstate-1.2.0/classes.jar",
    "//prebuilts/androidx/lifecycle_common-2.5.1/lifecycle_common.jar",
  ]
  subsystem_name = "plugins"
  part_name = "ability_access_ctrl"
}

ohos_combine_jars("ability_access_ctrl_java") {
  deps = [ ":ability_access_ctrl_android_java" ]

  subsystem_name = "plugins"
  part_name = "ability_access_ctrl"
  jar_path = "${root_out_dir}/plugins/ability_access_ctrl/ace_ability_access_ctrl_android.jar"
}

ohos_source_set("ability_access_ctrl_android_jni") {
  sources = [
    "jni/ability_access_ctrl_impl.cpp",
    "jni/ability_access_ctrl_jni.cpp",
    "jni/permission_mapper.cpp",
  ]

  defines = [ "ANDROID_PLATFORM" ]

  deps = [
    ":ability_access_ctrl_java",
    "//plugins/interfaces/native:ace_plugin_util_android",
  ]

  subsystem_name = "plugins"
  part_name = "ability_access_ctrl"
}