chromium/components/browser_ui/photo_picker/android/BUILD.gn

# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")

source_set("android") {
  sources = [
    "features.cc",
    "features.h",
    "photo_picker_sandbox_bridge.cc",
  ]
  deps = [
    ":photo_picker_jni_headers",
    "//base",
    "//sandbox",
    "//sandbox:sandbox_buildflags",
  ]
}

android_library("java") {
  sources = [
    "java/src/org/chromium/components/browser_ui/photo_picker/BitmapScalerTask.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/BitmapUtils.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/DecodeVideoTask.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/DecoderServiceHost.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTask.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/ImageDecoder.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDelegateBase.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDialog.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerFeatures.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerToolbar.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerAdapter.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerBitmap.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerBitmapView.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerBitmapViewHolder.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerCategoryView.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerVideoPlayer.java",
  ]

  resources_package = "org.chromium.components.browser_ui.photo_picker"
  deps = [
    ":java_resources",
    "//base:base_java",
    "//build/android:build_java",
    "//components/browser_ui/util/android:java",
    "//components/browser_ui/widget/android:java",
    "//content/public/android:content_java",
    "//net/android:net_java",
    "//third_party/androidx:androidx_activity_activity_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_appcompat_appcompat_java",
    "//third_party/androidx:androidx_appcompat_appcompat_resources_java",
    "//third_party/androidx:androidx_core_core_java",
    "//third_party/androidx:androidx_recyclerview_recyclerview_java",
    "//third_party/androidx:androidx_vectordrawable_vectordrawable_java",
    "//third_party/jni_zero:jni_zero_java",
    "//ui/android:ui_java",
  ]
  srcjar_deps = [
    ":photo_picker_aidl",
    ":photo_picker_jni_headers",
  ]
}

generate_jni("photo_picker_jni_headers") {
  sources = [
    "java/src/org/chromium/components/browser_ui/photo_picker/ImageDecoder.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerFeatures.java",
  ]
}

android_aidl("photo_picker_aidl") {
  import_include = [ "java/src/" ]
  sources = [
    "java/src/org/chromium/components/browser_ui/photo_picker/IDecoderService.aidl",
    "java/src/org/chromium/components/browser_ui/photo_picker/IDecoderServiceCallback.aidl",
  ]
}

android_resources("java_resources") {
  sources = [
    "java/res/drawable/fast_forward_message_gradient.xml",
    "java/res/drawable/file_picker_scrim.xml",
    "java/res/drawable/ic_full_screen_exit_white_24dp.xml",
    "java/res/drawable/ic_full_screen_white_24dp.xml",
    "java/res/drawable/ic_pause_circle_outline_white_24dp.xml",
    "java/res/drawable/ic_photo_camera_grey.xml",
    "java/res/drawable/ic_play_circle_filled_white_24dp.xml",
    "java/res/drawable/photo_picker_large_button_shadow.xml",
    "java/res/drawable/photo_picker_seekbar_thumb.xml",
    "java/res/drawable/photo_picker_seekbar_track.xml",
    "java/res/drawable/video_player_gradient.xml",
    "java/res/drawable/zoom_in.xml",
    "java/res/drawable/zoom_out.xml",
    "java/res/layout/photo_picker_bitmap_view.xml",
    "java/res/layout/photo_picker_dialog.xml",
    "java/res/layout/photo_picker_toolbar.xml",
    "java/res/layout/video_player.xml",
    "java/res/values-night/colors.xml",
    "java/res/values/colors.xml",
    "java/res/values/dimens.xml",
    "java/res/values/styles.xml",
  ]
  deps = [
    "//components/browser_ui/strings/android:browser_ui_strings_grd",
    "//components/browser_ui/styles/android:java_resources",
    "//components/browser_ui/widget/android:java_resources",
    "//ui/android:ui_java_resources",
  ]
}

robolectric_library("junit") {
  resources_package = "org.chromium.components.browser_ui.photo_picker"
  sources = [
    "java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTaskTest.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PickerBitmapViewTest.java",
  ]
  deps = [
    ":java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_junit_test_support",
    "//base/test:test_support_java",
    "//net/android:net_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
    "//ui/android:ui_java",
  ]
}

android_library("test_support_java") {
  testonly = true

  sources = [ "java/src/org/chromium/components/browser_ui/photo_picker/TestImageDecoderService.java" ]
  mergeable_android_manifests =
      [ "java/AndroidManifest_TestImageDecoderService.xml" ]

  deps = [
    ":java",
    "//base:base_java",
    "//build/android:build_java",
  ]
}

android_library("unit_device_javatests") {
  testonly = true

  sources = [
    "java/src/org/chromium/components/browser_ui/photo_picker/DecoderServiceHostTest.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/ImageDecoderTest.java",
    "java/src/org/chromium/components/browser_ui/photo_picker/PhotoPickerDialogTest.java",
  ]
  deps = [
    ":java",
    ":java_resources",
    ":test_support_java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//build/android:build_java",
    "//chrome/test/android:chrome_java_integration_test_support",
    "//components/browser_ui/test/android:test_support_java",
    "//components/browser_ui/widget/android:java",
    "//components/browser_ui/widget/android:test_support_java",
    "//content/public/test/android:content_java_test_support",
    "//third_party/androidx:androidx_activity_activity_java",
    "//third_party/androidx:androidx_appcompat_appcompat_java",
    "//third_party/androidx:androidx_appcompat_appcompat_resources_java",
    "//third_party/androidx:androidx_core_core_java",
    "//third_party/androidx:androidx_recyclerview_recyclerview_java",
    "//third_party/androidx:androidx_test_monitor_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/hamcrest:hamcrest_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
    "//ui/android:ui_java",
    "//ui/android:ui_java_test_support",
  ]
  resources_package = "org.chromium.components.browser_ui.photo_picker"
}