Refactor directories in statsd

apex/framework > framework
apex/aidl > aidl
apex/jni > framework/jni
apex/service > service

Bug: 167962588
Test: TH
Change-Id: Ie400fb24add9bb05c3f258a27e73634b6ed3ca81
diff --git a/framework/Android.bp b/framework/Android.bp
new file mode 100644
index 0000000..59fd9c2
--- /dev/null
+++ b/framework/Android.bp
@@ -0,0 +1,111 @@
+// Copyright (C) 2019 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 {
+    default_visibility: [ ":__pkg__" ]
+}
+
+genrule {
+    name: "statslog-statsd-java-gen",
+    tools: ["stats-log-api-gen"],
+    cmd: "$(location stats-log-api-gen) --java $(out) --module statsd" +
+         " --javaPackage com.android.internal.statsd --javaClass StatsdStatsLog",
+    out: ["com/android/internal/statsd/StatsdStatsLog.java"],
+}
+
+java_library_static {
+    name: "statslog-statsd",
+    srcs: [
+        ":statslog-statsd-java-gen",
+    ],
+    visibility: [
+        "//cts/hostsidetests/statsd/apps:__subpackages__",
+        "//vendor:__subpackages__",
+    ],
+}
+
+filegroup {
+    name: "framework-statsd-sources",
+    srcs: [
+        "java/**/*.java",
+        ":framework-statsd-aidl-sources",
+        ":statslog-statsd-java-gen",
+    ],
+    visibility: [
+        "//frameworks/base", // For the "global" stubs.
+        "//frameworks/base/apex/statsd:__subpackages__",
+        "//packages/modules/StatsD/framework:__subpackages__",
+    ],
+}
+java_sdk_library {
+    name: "framework-statsd",
+    defaults: ["framework-module-defaults"],
+    installable: true,
+
+    srcs: [
+        ":framework-statsd-sources",
+    ],
+
+    permitted_packages: [
+        "android.app",
+        "android.os",
+        "android.util",
+        // From :statslog-statsd-java-gen
+        "com.android.internal.statsd",
+    ],
+
+    api_packages: [
+        "android.app",
+        "android.os",
+        "android.util",
+    ],
+
+    hostdex: true, // for hiddenapi check
+
+    impl_library_visibility: [
+        "//frameworks/base/apex/statsd/framework/test:__subpackages__",
+        "//packages/modules/StatsD/framework/test:__subpackages__",
+    ],
+
+    apex_available: [
+        "com.android.os.statsd",
+        "test_com.android.os.statsd",
+    ],
+}
+
+// JNI library for StatsLog.write
+cc_library_shared {
+    name: "libstats_jni",
+    srcs: ["jni/**/*.cpp"],
+    header_libs: ["libnativehelper_header_only"],
+    shared_libs: [
+        "liblog",  // Has a stable abi - should not be copied into apex.
+        "libstatssocket",
+    ],
+    stl: "libc++_static",
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wextra",
+        "-Wno-unused-parameter",
+    ],
+    apex_available: [
+        "com.android.os.statsd",
+        "test_com.android.os.statsd",
+    ],
+    visibility: [
+        "//packages/modules/StatsD/apex:__subpackages__",
+    ],
+}
+