summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp24
-rw-r--r--api/system-current.txt19
-rw-r--r--cmds/incident/Android.bp46
-rw-r--r--cmds/incident/Android.mk48
-rw-r--r--cmds/incidentd/Android.bp117
-rw-r--r--cmds/incidentd/Android.mk156
-rw-r--r--cmds/statsd/Android.bp257
-rw-r--r--cmds/statsd/Android.mk306
-rw-r--r--cmds/statsd/tools/Android.mk20
-rw-r--r--cmds/statsd/tools/dogfood/Android.bp37
-rw-r--r--cmds/statsd/tools/dogfood/Android.mk33
-rw-r--r--cmds/statsd/tools/loadtest/Android.bp37
-rw-r--r--cmds/statsd/tools/loadtest/Android.mk33
-rw-r--r--core/java/com/android/internal/os/Zygote.java5
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp16
-rw-r--r--core/jni/fd_utils.cpp1
-rw-r--r--libs/incident/Android.bp50
-rw-r--r--libs/incident/Android.mk43
-rw-r--r--services/usage/java/com/android/server/usage/StorageStatsService.java4
-rw-r--r--telephony/java/android/telephony/RadioAccessFamily.java123
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java164
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyPermissions.java21
22 files changed, 891 insertions, 669 deletions
diff --git a/Android.bp b/Android.bp
index 867816160e25..433979b0673e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -223,8 +223,7 @@ java_defaults {
"core/java/android/os/IDeviceIdentifiersPolicyService.aidl",
"core/java/android/os/IDeviceIdleController.aidl",
"core/java/android/os/IHardwarePropertiesManager.aidl",
- "core/java/android/os/IIncidentManager.aidl",
- "core/java/android/os/IIncidentReportStatusListener.aidl",
+ ":libincident_aidl",
"core/java/android/os/IMaintenanceActivityListener.aidl",
"core/java/android/os/IMessenger.aidl",
"core/java/android/os/INetworkActivityListener.aidl",
@@ -237,8 +236,7 @@ java_defaults {
"core/java/android/os/IRecoverySystemProgressListener.aidl",
"core/java/android/os/IRemoteCallback.aidl",
"core/java/android/os/ISchedulingPolicyService.aidl",
- "core/java/android/os/IStatsCompanionService.aidl",
- "core/java/android/os/IStatsManager.aidl",
+ ":statsd_aidl",
"core/java/android/os/ISystemUpdateManager.aidl",
"core/java/android/os/IThermalEventListener.aidl",
"core/java/android/os/IThermalService.aidl",
@@ -707,6 +705,22 @@ java_defaults {
}
+filegroup {
+ name: "libincident_aidl",
+ srcs: [
+ "core/java/android/os/IIncidentManager.aidl",
+ "core/java/android/os/IIncidentReportStatusListener.aidl",
+ ],
+}
+
+filegroup {
+ name: "statsd_aidl",
+ srcs: [
+ "core/java/android/os/IStatsCompanionService.aidl",
+ "core/java/android/os/IStatsManager.aidl",
+ ],
+}
+
java_library {
name: "framework",
defaults: ["framework-defaults"],
@@ -913,12 +927,14 @@ gensrcs {
"core/proto/android/os/batterytype.proto",
"core/proto/android/os/cpufreq.proto",
"core/proto/android/os/cpuinfo.proto",
+ "core/proto/android/os/data.proto",
"core/proto/android/os/kernelwake.proto",
"core/proto/android/os/pagetypeinfo.proto",
"core/proto/android/os/procrank.proto",
"core/proto/android/os/ps.proto",
"core/proto/android/os/system_properties.proto",
"core/proto/android/util/event_log_tags.proto",
+ "core/proto/android/util/log.proto",
],
// Append protoc-gen-cppstream tool's PATH otherwise aprotoc can't find the plugin tool
diff --git a/api/system-current.txt b/api/system-current.txt
index 9b1400c377de..3ad8f0918007 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5293,6 +5293,7 @@ package android.telephony {
method public int getRadioPowerState();
method public int getSimApplicationState();
method public int getSimCardState();
+ method public int getSupportedRadioAccessFamily();
method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
method public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
method public android.os.Bundle getVisualVoicemailSettings();
@@ -5358,6 +5359,24 @@ package android.telephony {
field public static final int NETWORK_MODE_TDSCDMA_WCDMA = 14; // 0xe
field public static final int NETWORK_MODE_WCDMA_ONLY = 2; // 0x2
field public static final int NETWORK_MODE_WCDMA_PREF = 0; // 0x0
+ field public static final int NETWORK_TYPE_BITMASK_1xRTT = 128; // 0x80
+ field public static final int NETWORK_TYPE_BITMASK_CDMA = 16; // 0x10
+ field public static final int NETWORK_TYPE_BITMASK_EDGE = 4; // 0x4
+ field public static final int NETWORK_TYPE_BITMASK_EHRPD = 16384; // 0x4000
+ field public static final int NETWORK_TYPE_BITMASK_EVDO_0 = 32; // 0x20
+ field public static final int NETWORK_TYPE_BITMASK_EVDO_A = 64; // 0x40
+ field public static final int NETWORK_TYPE_BITMASK_EVDO_B = 4096; // 0x1000
+ field public static final int NETWORK_TYPE_BITMASK_GPRS = 2; // 0x2
+ field public static final int NETWORK_TYPE_BITMASK_GSM = 65536; // 0x10000
+ field public static final int NETWORK_TYPE_BITMASK_HSDPA = 256; // 0x100
+ field public static final int NETWORK_TYPE_BITMASK_HSPA = 1024; // 0x400
+ field public static final int NETWORK_TYPE_BITMASK_HSPAP = 32768; // 0x8000
+ field public static final int NETWORK_TYPE_BITMASK_HSUPA = 512; // 0x200
+ field public static final int NETWORK_TYPE_BITMASK_LTE = 8192; // 0x2000
+ field public static final int NETWORK_TYPE_BITMASK_LTE_CA = 524288; // 0x80000
+ field public static final int NETWORK_TYPE_BITMASK_TD_SCDMA = 131072; // 0x20000
+ field public static final int NETWORK_TYPE_BITMASK_UMTS = 8; // 0x8
+ field public static final int NETWORK_TYPE_BITMASK_UNKNOWN = 1; // 0x1
field public static final int RADIO_POWER_OFF = 0; // 0x0
field public static final int RADIO_POWER_ON = 1; // 0x1
field public static final int RADIO_POWER_UNAVAILABLE = 2; // 0x2
diff --git a/cmds/incident/Android.bp b/cmds/incident/Android.bp
new file mode 100644
index 000000000000..2a5ec5bfacaf
--- /dev/null
+++ b/cmds/incident/Android.bp
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 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.
+
+cc_binary {
+ name: "incident",
+
+ srcs: [
+ "main.cpp",
+ ":incident_sections",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "liblog",
+ "libutils",
+ "libincident",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-variable",
+ "-Wunused-parameter",
+ ],
+}
+
+genrule {
+ name: "incident_sections",
+ tools: ["incident-section-gen"],
+ out: ["incident_sections.cpp"],
+ cmd: "$(location incident-section-gen) incident > $(out)",
+}
diff --git a/cmds/incident/Android.mk b/cmds/incident/Android.mk
deleted file mode 100644
index 8615f9b63e43..000000000000
--- a/cmds/incident/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2016 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- main.cpp
-
-LOCAL_MODULE := incident
-
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- libbinder \
- libcutils \
- liblog \
- libutils \
- libincident
-
-LOCAL_CFLAGS += \
- -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
-
-LOCAL_MODULE_CLASS := EXECUTABLES
-gen_src_dir := $(local-generated-sources-dir)
-
-gen := $(gen_src_dir)/incident_sections.cpp
-$(gen): $(HOST_OUT_EXECUTABLES)/incident-section-gen
-$(gen): PRIVATE_CUSTOM_TOOL = \
- $(HOST_OUT_EXECUTABLES)/incident-section-gen incident > $@
-$(gen): $(HOST_OUT_EXECUTABLES)/incident-section-gen
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(gen)
-
-gen_src_dir:=
-gen:=
-
-include $(BUILD_EXECUTABLE)
diff --git a/cmds/incidentd/Android.bp b/cmds/incidentd/Android.bp
new file mode 100644
index 000000000000..1e970f46b01d
--- /dev/null
+++ b/cmds/incidentd/Android.bp
@@ -0,0 +1,117 @@
+// Copyright (C) 2016 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.
+
+// =========
+// incidentd
+// =========
+
+cc_binary {
+ name: "incidentd",
+
+ srcs: [
+ "src/**/*.cpp",
+ ":incidentd_section_list",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-variable",
+ "-Wunused-parameter",
+
+ // Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
+ "-Wno-error=implicit-fallthrough",
+
+ // optimize for size (protobuf glop can get big)
+ "-Os",
+ //"-g",
+ //"-O0",
+ ],
+
+ local_include_dirs: ["src"],
+ generated_headers: ["gen-platform-proto-constants"],
+
+ shared_libs: [
+ "libbase",
+ "libbinder",
+ "libdebuggerd_client",
+ "libdumputils",
+ "libincident",
+ "liblog",
+ "libprotoutil",
+ "libservices",
+ "libutils",
+ ],
+
+ init_rc: ["incidentd.rc"],
+}
+
+// ==============
+// incidentd_test
+// ==============
+
+cc_test {
+ name: "incidentd_test",
+ test_suites: ["device-tests"],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ "-Wno-unused-variable",
+ "-Wunused-parameter",
+
+ // Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
+ "-Wno-error=implicit-fallthrough",
+ ],
+
+ local_include_dirs: ["src"],
+ generated_headers: ["gen-platform-proto-constants"],
+
+ srcs: [
+ "tests/**/*.cpp",
+ "src/PrivacyBuffer.cpp",
+ "src/FdBuffer.cpp",
+ "src/Privacy.cpp",
+ "src/Reporter.cpp",
+ "src/Section.cpp",
+ "src/Throttler.cpp",
+ "src/incidentd_util.cpp",
+ "src/report_directory.cpp",
+ ],
+
+ data: ["testdata/**/*"],
+
+ static_libs: ["libgmock"],
+
+ shared_libs: [
+ "libbase",
+ "libbinder",
+ "libdebuggerd_client",
+ "libdumputils",
+ "libincident",
+ "liblog",
+ "libprotobuf-cpp-lite",
+ "libprotoutil",
+ "libservices",
+ "libutils",
+ ],
+}
+
+genrule {
+ name: "incidentd_section_list",
+ tools: ["incident-section-gen"],
+ out: ["section_list.cpp"],
+ cmd: "$(location incident-section-gen) incidentd > $(out)",
+}
diff --git a/cmds/incidentd/Android.mk b/cmds/incidentd/Android.mk
deleted file mode 100644
index eba558653b04..000000000000
--- a/cmds/incidentd/Android.mk
+++ /dev/null
@@ -1,156 +0,0 @@
-# Copyright (C) 2016 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-# proto files used in incidentd to generate cppstream proto headers.
-PROTO_FILES:= \
- frameworks/base/core/proto/android/os/backtrace.proto \
- frameworks/base/core/proto/android/os/data.proto \
- frameworks/base/core/proto/android/util/log.proto
-
-# ========= #
-# incidentd #
-# ========= #
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := incidentd
-
-LOCAL_SRC_FILES := $(call all-cpp-files-under, src) \
-
-LOCAL_CFLAGS += \
- -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
-
-# Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
-LOCAL_CFLAGS += -Wno-error=implicit-fallthrough
-
-ifeq (debug,)
- LOCAL_CFLAGS += \
- -g -O0
-else
- # optimize for size (protobuf glop can get big)
- LOCAL_CFLAGS += \
- -Os
-endif
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
-
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- libbinder \
- libdebuggerd_client \
- libdumputils \
- libincident \
- liblog \
- libprotoutil \
- libservices \
- libutils
-
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-gen_src_dir := $(local-generated-sources-dir)
-
-# generate section_list.cpp
-GEN_LIST := $(gen_src_dir)/src/section_list.cpp
-$(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen
-$(GEN_LIST): PRIVATE_CUSTOM_TOOL = \
- $(HOST_OUT_EXECUTABLES)/incident-section-gen incidentd > $@
-$(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN_LIST)
-GEN_LIST:=
-
-# generate cppstream proto, add proto files to PROTO_FILES
-GEN_PROTO := $(gen_src_dir)/proto.timestamp
-$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES)
-$(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir)
-$(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \
- $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \
- --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \
- $(PROTO_FILES) \
- && touch $@
-$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN_PROTO)
-GEN_PROTO:=
-
-gen_src_dir:=
-
-LOCAL_INIT_RC := incidentd.rc
-
-include $(BUILD_EXECUTABLE)
-
-# ============== #
-# incidentd_test #
-# ============== #
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := incidentd_test
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS := -Werror -Wall -Wno-unused-variable -Wunused-parameter
-
-# Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
-LOCAL_CFLAGS += -Wno-error=implicit-fallthrough
-
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
-
-LOCAL_SRC_FILES := $(call all-cpp-files-under, tests) \
- src/PrivacyBuffer.cpp \
- src/FdBuffer.cpp \
- src/Privacy.cpp \
- src/Reporter.cpp \
- src/Section.cpp \
- src/Throttler.cpp \
- src/incidentd_util.cpp \
- src/report_directory.cpp \
-
-LOCAL_STATIC_LIBRARIES := \
- libgmock \
-
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- libbinder \
- libdebuggerd_client \
- libdumputils \
- libincident \
- liblog \
- libprotobuf-cpp-lite \
- libprotoutil \
- libservices \
- libutils \
-
-LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, testdata)
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-gen_src_dir := $(local-generated-sources-dir)
-# generate cppstream proto for testing
-GEN_PROTO := $(gen_src_dir)/test.proto.timestamp
-$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES)
-$(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir)
-$(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \
- $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \
- --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \
- $(PROTO_FILES) \
- && touch $@
-$(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN_PROTO)
-GEN_PROTO:=
-
-gen_src_dir:=
-
-include $(BUILD_NATIVE_TEST)
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index f1bf10cfa767..5c3d17e30585 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -1,5 +1,5 @@
//
-// Copyright (C) 2015 The Android Open Source Project
+// Copyright (C) 2017 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.
@@ -42,6 +42,261 @@ cc_library_host_shared {
}
+cc_defaults {
+ name: "statsd_defaults",
+ aidl: {
+ include_dirs: ["frameworks/base/core/java"],
+ },
+
+ srcs: [
+ ":statsd_aidl",
+ "src/statsd_config.proto",
+ "src/FieldValue.cpp",
+ "src/hash.cpp",
+ "src/stats_log_util.cpp",
+ "src/anomaly/AlarmMonitor.cpp",
+ "src/anomaly/AlarmTracker.cpp",
+ "src/anomaly/AnomalyTracker.cpp",
+ "src/anomaly/DurationAnomalyTracker.cpp",
+ "src/anomaly/subscriber_util.cpp",
+ "src/condition/CombinationConditionTracker.cpp",
+ "src/condition/condition_util.cpp",
+ "src/condition/SimpleConditionTracker.cpp",
+ "src/condition/ConditionWizard.cpp",
+ "src/condition/StateTracker.cpp",
+ "src/config/ConfigKey.cpp",
+ "src/config/ConfigListener.cpp",
+ "src/config/ConfigManager.cpp",
+ "src/external/Perfetto.cpp",
+ "src/external/StatsPuller.cpp",
+ "src/external/StatsCompanionServicePuller.cpp",
+ "src/external/SubsystemSleepStatePuller.cpp",
+ "src/external/ResourceHealthManagerPuller.cpp",
+ "src/external/ResourceThermalManagerPuller.cpp",
+ "src/external/StatsPullerManagerImpl.cpp",
+ "src/external/puller_util.cpp",
+ "src/logd/LogEvent.cpp",
+ "src/logd/LogListener.cpp",
+ "src/logd/LogReader.cpp",
+ "src/matchers/CombinationLogMatchingTracker.cpp",
+ "src/matchers/matcher_util.cpp",
+ "src/matchers/SimpleLogMatchingTracker.cpp",
+ "src/metrics/MetricProducer.cpp",
+ "src/metrics/EventMetricProducer.cpp",
+ "src/metrics/CountMetricProducer.cpp",
+ "src/metrics/DurationMetricProducer.cpp",
+ "src/metrics/duration_helper/OringDurationTracker.cpp",
+ "src/metrics/duration_helper/MaxDurationTracker.cpp",
+ "src/metrics/ValueMetricProducer.cpp",
+ "src/metrics/GaugeMetricProducer.cpp",
+ "src/metrics/MetricsManager.cpp",
+ "src/metrics/metrics_manager_util.cpp",
+ "src/packages/UidMap.cpp",
+ "src/perfetto/perfetto_config.proto",
+ "src/storage/StorageManager.cpp",
+ "src/StatsLogProcessor.cpp",
+ "src/StatsService.cpp",
+ "src/statscompanion_util.cpp",
+ "src/subscriber/IncidentdReporter.cpp",
+ "src/subscriber/SubscriberReporter.cpp",
+ "src/HashableDimensionKey.cpp",
+ "src/guardrail/StatsdStats.cpp",
+ "src/socket/StatsSocketListener.cpp",
+ ],
+
+ local_include_dirs: [
+ "src",
+ ],
+
+ static_libs: [
+ "libhealthhalutils",
+ "libplatformprotos",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libbinder",
+ "libincident",
+ "liblog",
+ "libutils",
+ "libservices",
+ "libprotoutil",
+ "libstatslog",
+ "libhardware",
+ "libhardware_legacy",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "android.hardware.health@2.0",
+ "android.hardware.power@1.0",
+ "android.hardware.power@1.1",
+ "android.hardware.thermal@1.0",
+ "libpackagelistparser",
+ "libsysutils",
+ "libcutils",
+ ],
+}
+
+// =========
+// statsd
+// =========
+
+cc_binary {
+ name: "statsd",
+ defaults: ["statsd_defaults"],
+
+ srcs: ["src/main.cpp"],
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wno-unused-parameter",
+ // optimize for size (protobuf glop can get big)
+ "-Os",
+ // "-g",
+ // "-O0",
+ ],
+
+ product_variables: {
+ eng: {
+ // Enable sanitizer and allow very verbose printing on eng builds
+ cflags: ["-DVERY_VERBOSE_PRINTING"],
+ sanitize: {
+ address: true,
+ },
+ },
+ },
+
+ proto: {
+ type: "lite",
+ },
+
+ shared_libs: ["libgtest_prod"],
+
+ init_rc: ["statsd.rc"],
+}
+
+// ==============
+// statsd_test
+// ==============
+
+cc_test {
+ name: "statsd_test",
+ defaults: ["statsd_defaults"],
+ test_suites: ["device-tests"],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-variable",
+ "-Wno-unused-function",
+ "-Wno-unused-parameter",
+ ],
+
+ srcs: [
+ "src/atom_field_options.proto",
+ "src/atoms.proto",
+ "src/stats_log.proto",
+ "tests/AlarmMonitor_test.cpp",
+ "tests/anomaly/AlarmTracker_test.cpp",
+ "tests/anomaly/AnomalyTracker_test.cpp",
+ "tests/ConfigManager_test.cpp",
+ "tests/external/puller_util_test.cpp",
+ "tests/indexed_priority_queue_test.cpp",
+ "tests/LogEntryMatcher_test.cpp",
+ "tests/LogReader_test.cpp",
+ "tests/LogEvent_test.cpp",
+ "tests/MetricsManager_test.cpp",
+ "tests/StatsLogProcessor_test.cpp",
+ "tests/StatsService_test.cpp",
+ "tests/UidMap_test.cpp",
+ "tests/FieldValue_test.cpp",
+ "tests/condition/CombinationConditionTracker_test.cpp",
+ "tests/condition/SimpleConditionTracker_test.cpp",
+ "tests/condition/StateTracker_test.cpp",
+ "tests/metrics/OringDurationTracker_test.cpp",
+ "tests/metrics/MaxDurationTracker_test.cpp",
+ "tests/metrics/CountMetricProducer_test.cpp",
+ "tests/metrics/DurationMetricProducer_test.cpp",
+ "tests/metrics/EventMetricProducer_test.cpp",
+ "tests/metrics/ValueMetricProducer_test.cpp",
+ "tests/metrics/GaugeMetricProducer_test.cpp",
+ "tests/guardrail/StatsdStats_test.cpp",
+ "tests/metrics/metrics_test_helper.cpp",
+ "tests/statsd_test_util.cpp",
+ "tests/e2e/WakelockDuration_e2e_test.cpp",
+ "tests/e2e/MetricConditionLink_e2e_test.cpp",
+ "tests/e2e/Alarm_e2e_test.cpp",
+ "tests/e2e/Attribution_e2e_test.cpp",
+ "tests/e2e/GaugeMetric_e2e_push_test.cpp",
+ "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
+ "tests/e2e/ValueMetric_pull_e2e_test.cpp",
+ "tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp",
+ "tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp",
+ "tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp",
+ "tests/e2e/Anomaly_count_e2e_test.cpp",
+ "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
+ "tests/e2e/ConfigTtl_e2e_test.cpp",
+ "tests/e2e/PartialBucket_e2e_test.cpp",
+ ],
+
+ static_libs: ["libgmock"],
+
+ proto: {
+ type: "full",
+ include_dirs: ["external/protobuf/src"],
+ },
+
+ shared_libs: ["libprotobuf-cpp-full"],
+
+}
+
+//#############################
+// statsd micro benchmark
+//#############################
+
+cc_benchmark {
+ name: "statsd_benchmark",
+ defaults: ["statsd_defaults"],
+
+ srcs: [
+ "src/atom_field_options.proto",
+ "src/atoms.proto",
+ "src/stats_log.proto",
+ "benchmark/main.cpp",
+ "benchmark/hello_world_benchmark.cpp",
+ "benchmark/log_event_benchmark.cpp",
+ "benchmark/stats_write_benchmark.cpp",
+ "benchmark/filter_value_benchmark.cpp",
+ "benchmark/get_dimensions_for_condition_benchmark.cpp",
+ "benchmark/metric_util.cpp",
+ "benchmark/duration_metric_benchmark.cpp",
+ ],
+
+ proto: {
+ type: "full",
+ include_dirs: ["external/protobuf/src"],
+ },
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ "-Wno-unused-variable",
+ "-Wno-unused-function",
+
+ // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
+ "-Wno-varargs"
+ ],
+
+ shared_libs: [
+ "libgtest_prod",
+ "libstatslog",
+ "libprotobuf-cpp-full",
+ ],
+}
// ==== java proto device library (for test only) ==============================
java_library {
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
deleted file mode 100644
index 3dc81fa98673..000000000000
--- a/cmds/statsd/Android.mk
+++ /dev/null
@@ -1,306 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-statsd_common_src := \
- ../../core/java/android/os/IStatsCompanionService.aidl \
- ../../core/java/android/os/IStatsManager.aidl \
- src/statsd_config.proto \
- src/FieldValue.cpp \
- src/hash.cpp \
- src/stats_log_util.cpp \
- src/anomaly/AlarmMonitor.cpp \
- src/anomaly/AlarmTracker.cpp \
- src/anomaly/AnomalyTracker.cpp \
- src/anomaly/DurationAnomalyTracker.cpp \
- src/anomaly/subscriber_util.cpp \
- src/condition/CombinationConditionTracker.cpp \
- src/condition/condition_util.cpp \
- src/condition/SimpleConditionTracker.cpp \
- src/condition/ConditionWizard.cpp \
- src/condition/StateTracker.cpp \
- src/config/ConfigKey.cpp \
- src/config/ConfigListener.cpp \
- src/config/ConfigManager.cpp \
- src/external/Perfetto.cpp \
- src/external/StatsPuller.cpp \
- src/external/StatsCompanionServicePuller.cpp \
- src/external/SubsystemSleepStatePuller.cpp \
- src/external/ResourceHealthManagerPuller.cpp \
- src/external/ResourceThermalManagerPuller.cpp \
- src/external/StatsPullerManagerImpl.cpp \
- src/external/puller_util.cpp \
- src/logd/LogEvent.cpp \
- src/logd/LogListener.cpp \
- src/logd/LogReader.cpp \
- src/matchers/CombinationLogMatchingTracker.cpp \
- src/matchers/matcher_util.cpp \
- src/matchers/SimpleLogMatchingTracker.cpp \
- src/metrics/MetricProducer.cpp \
- src/metrics/EventMetricProducer.cpp \
- src/metrics/CountMetricProducer.cpp \
- src/metrics/DurationMetricProducer.cpp \
- src/metrics/duration_helper/OringDurationTracker.cpp \
- src/metrics/duration_helper/MaxDurationTracker.cpp \
- src/metrics/ValueMetricProducer.cpp \
- src/metrics/GaugeMetricProducer.cpp \
- src/metrics/MetricsManager.cpp \
- src/metrics/metrics_manager_util.cpp \
- src/packages/UidMap.cpp \
- src/perfetto/perfetto_config.proto \
- src/storage/StorageManager.cpp \
- src/StatsLogProcessor.cpp \
- src/StatsService.cpp \
- src/statscompanion_util.cpp \
- src/subscriber/IncidentdReporter.cpp \
- src/subscriber/SubscriberReporter.cpp \
- src/HashableDimensionKey.cpp \
- src/guardrail/StatsdStats.cpp \
- src/socket/StatsSocketListener.cpp
-
-statsd_common_c_includes := \
- $(LOCAL_PATH)/src \
- $(LOCAL_PATH)/../../libs/services/include
-
-statsd_common_aidl_includes := \
- $(LOCAL_PATH)/../../core/java
-
-statsd_common_static_libraries := \
- libhealthhalutils \
- libplatformprotos \
-
-statsd_common_shared_libraries := \
- libbase \
- libbinder \
- libincident \
- liblog \
- libutils \
- libservices \
- libprotoutil \
- libstatslog \
- libhardware \
- libhardware_legacy \
- libhidlbase \
- libhidltransport \
- libhwbinder \
- android.hardware.health@2.0 \
- android.hardware.power@1.0 \
- android.hardware.power@1.1 \
- android.hardware.thermal@1.0 \
- libpackagelistparser \
- libsysutils \
- libcutils
-
-# =========
-# statsd
-# =========
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := statsd
-
-LOCAL_SRC_FILES := \
- $(statsd_common_src) \
- src/main.cpp
-
-LOCAL_CFLAGS += \
- -Wall \
- -Wextra \
- -Werror \
- -Wno-unused-parameter
-
-ifeq (debug,)
- LOCAL_CFLAGS += \
- -g -O0
-else
- # optimize for size (protobuf glop can get big)
- LOCAL_CFLAGS += \
- -Os
-endif
-LOCAL_PROTOC_OPTIMIZE_TYPE := lite
-
-LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
-LOCAL_C_INCLUDES += $(statsd_common_c_includes)
-
-LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
-
-LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
- libgtest_prod
-
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-# Enable sanitizer and allow very verbose printing on eng builds
-ifeq ($(TARGET_BUILD_VARIANT),eng)
- LOCAL_CLANG := true
- LOCAL_SANITIZE := address
- LOCAL_CFLAGS += \
- -DVERY_VERBOSE_PRINTING
-endif
-
-LOCAL_INIT_RC := statsd.rc
-
-include $(BUILD_EXECUTABLE)
-
-
-# ==============
-# statsd_test
-# ==============
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := statsd_test
-LOCAL_COMPATIBILITY_SUITE := device-tests
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
-LOCAL_C_INCLUDES += $(statsd_common_c_includes)
-
-LOCAL_CFLAGS += \
- -Wall \
- -Werror \
- -Wno-missing-field-initializers \
- -Wno-unused-variable \
- -Wno-unused-function \
- -Wno-unused-parameter
-
-LOCAL_SRC_FILES := \
- $(statsd_common_src) \
- src/atom_field_options.proto \
- src/atoms.proto \
- src/stats_log.proto \
- tests/AlarmMonitor_test.cpp \
- tests/anomaly/AlarmTracker_test.cpp \
- tests/anomaly/AnomalyTracker_test.cpp \
- tests/ConfigManager_test.cpp \
- tests/external/puller_util_test.cpp \
- tests/indexed_priority_queue_test.cpp \
- tests/LogEntryMatcher_test.cpp \
- tests/LogReader_test.cpp \
- tests/LogEvent_test.cpp \
- tests/MetricsManager_test.cpp \
- tests/StatsLogProcessor_test.cpp \
- tests/StatsService_test.cpp \
- tests/UidMap_test.cpp \
- tests/FieldValue_test.cpp \
- tests/condition/CombinationConditionTracker_test.cpp \
- tests/condition/SimpleConditionTracker_test.cpp \
- tests/condition/StateTracker_test.cpp \
- tests/metrics/OringDurationTracker_test.cpp \
- tests/metrics/MaxDurationTracker_test.cpp \
- tests/metrics/CountMetricProducer_test.cpp \
- tests/metrics/DurationMetricProducer_test.cpp \
- tests/metrics/EventMetricProducer_test.cpp \
- tests/metrics/ValueMetricProducer_test.cpp \
- tests/metrics/GaugeMetricProducer_test.cpp \
- tests/guardrail/StatsdStats_test.cpp \
- tests/metrics/metrics_test_helper.cpp \
- tests/statsd_test_util.cpp \
- tests/e2e/WakelockDuration_e2e_test.cpp \
- tests/e2e/MetricConditionLink_e2e_test.cpp \
- tests/e2e/Alarm_e2e_test.cpp \
- tests/e2e/Attribution_e2e_test.cpp \
- tests/e2e/GaugeMetric_e2e_push_test.cpp \
- tests/e2e/GaugeMetric_e2e_pull_test.cpp \
- tests/e2e/ValueMetric_pull_e2e_test.cpp \
- tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp \
- tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp \
- tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp \
- tests/e2e/Anomaly_count_e2e_test.cpp \
- tests/e2e/Anomaly_duration_sum_e2e_test.cpp \
- tests/e2e/ConfigTtl_e2e_test.cpp \
- tests/e2e/PartialBucket_e2e_test.cpp
-
-LOCAL_STATIC_LIBRARIES := \
- $(statsd_common_static_libraries) \
- libgmock
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_PROTOC_FLAGS := \
- -Iexternal/protobuf/src
-
-LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
- libprotobuf-cpp-full
-
-include $(BUILD_NATIVE_TEST)
-
-##############################
-# statsd micro benchmark
-##############################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := statsd_benchmark
-
-LOCAL_SRC_FILES := $(statsd_common_src) \
- src/atom_field_options.proto \
- src/atoms.proto \
- src/stats_log.proto \
- benchmark/main.cpp \
- benchmark/hello_world_benchmark.cpp \
- benchmark/log_event_benchmark.cpp \
- benchmark/stats_write_benchmark.cpp \
- benchmark/filter_value_benchmark.cpp \
- benchmark/get_dimensions_for_condition_benchmark.cpp \
- benchmark/metric_util.cpp \
- benchmark/duration_metric_benchmark.cpp
-
-LOCAL_STATIC_LIBRARIES := \
- $(statsd_common_static_libraries)
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_PROTOC_FLAGS := \
- -Iexternal/protobuf/src
-
-LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
- libprotobuf-cpp-full
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- platformprotoslite
-
-LOCAL_C_INCLUDES := $(statsd_common_c_includes)
-
-LOCAL_CFLAGS := -Wall \
- -Werror \
- -Wno-unused-parameter \
- -Wno-unused-variable \
- -Wno-unused-function \
-
-# Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
-LOCAL_CFLAGS += -Wno-varargs
-
-LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
-
-LOCAL_STATIC_LIBRARIES := \
- $(statsd_common_static_libraries)
-
-LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
- libgtest_prod \
- libstatslog
-
-LOCAL_MODULE_TAGS := eng tests
-
-include $(BUILD_NATIVE_BENCHMARK)
-
-
-statsd_common_src:=
-statsd_common_aidl_includes:=
-statsd_common_c_includes:=
-statsd_common_static_libraries:=
-statsd_common_shared_libraries:=
-
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/cmds/statsd/tools/Android.mk b/cmds/statsd/tools/Android.mk
deleted file mode 100644
index 7253c9637026..000000000000
--- a/cmds/statsd/tools/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2017 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.
-#
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-#Include the sub-makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH)) \ No newline at end of file
diff --git a/cmds/statsd/tools/dogfood/Android.bp b/cmds/statsd/tools/dogfood/Android.bp
new file mode 100644
index 000000000000..bb494a6025af
--- /dev/null
+++ b/cmds/statsd/tools/dogfood/Android.bp
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 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.
+//
+//
+
+android_app {
+ name: "StatsdDogfood",
+ platform_apis: true,
+
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+ static_libs: [
+ "platformprotoslite",
+ "statsdprotolite",
+ ],
+
+ privileged: true,
+ dex_preopt: {
+ enabled: false,
+ },
+ certificate: "platform",
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/cmds/statsd/tools/dogfood/Android.mk b/cmds/statsd/tools/dogfood/Android.mk
deleted file mode 100644
index baf235bb91be..000000000000
--- a/cmds/statsd/tools/dogfood/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2017 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.
-#
-#
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := StatsdDogfood
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_STATIC_JAVA_LIBRARIES := platformprotoslite \
- statsdprotolite
-
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_DEX_PREOPT := false
-LOCAL_CERTIFICATE := platform
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/cmds/statsd/tools/loadtest/Android.bp b/cmds/statsd/tools/loadtest/Android.bp
new file mode 100644
index 000000000000..bf87fc51dce1
--- /dev/null
+++ b/cmds/statsd/tools/loadtest/Android.bp
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 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.
+//
+//
+
+android_app {
+ name: "StatsdLoadtest",
+ platform_apis: true,
+
+ srcs: ["src/**/*.java"],
+
+ resource_dirs: ["res"],
+ static_libs: [
+ "platformprotoslite",
+ "statsdprotolite",
+ ],
+
+ certificate: "platform",
+ privileged: true,
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/cmds/statsd/tools/loadtest/Android.mk b/cmds/statsd/tools/loadtest/Android.mk
deleted file mode 100644
index 219cd9525bbd..000000000000
--- a/cmds/statsd/tools/loadtest/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2017 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.
-#
-#
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := StatsdLoadtest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_STATIC_JAVA_LIBRARIES := platformprotoslite \
- statsdprotolite
-
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_PACKAGE)
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 4ee950aa2beb..8b3829b3d6b7 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -211,6 +211,11 @@ public final class Zygote {
*/
native protected static void nativeUnmountStorageOnInit();
+ private static void callPostForkSystemServerHooks() {
+ // SystemServer specific post fork hooks run before child post fork hooks.
+ VM_HOOKS.postForkSystemServer();
+ }
+
private static void callPostForkChildHooks(int runtimeFlags, boolean isSystemServer,
boolean isZygote, String instructionSet) {
VM_HOOKS.postForkChild(runtimeFlags, isSystemServer, isZygote, instructionSet);
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 0022cf889098..da258019f053 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -81,6 +81,7 @@ static pid_t gSystemServerPid = 0;
static const char kZygoteClassName[] = "com/android/internal/os/Zygote";
static jclass gZygoteClass;
+static jmethodID gCallPostForkSystemServerHooks;
static jmethodID gCallPostForkChildHooks;
static bool g_is_security_enforced = true;
@@ -728,6 +729,18 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGi
// Unset the SIGCHLD handler, but keep ignoring SIGHUP (rationale in SetSignalHandlers).
UnsetChldSignalHandler();
+ if (is_system_server) {
+ env->CallStaticVoidMethod(gZygoteClass, gCallPostForkSystemServerHooks);
+ if (env->ExceptionCheck()) {
+ fail_fn("Error calling post fork system server hooks.");
+ }
+ // TODO(oth): Remove hardcoded label here (b/117874058).
+ static const char* kSystemServerLabel = "u:r:system_server:s0";
+ if (selinux_android_setcon(kSystemServerLabel) != 0) {
+ fail_fn(CREATE_ERROR("selinux_android_setcon(%s)", kSystemServerLabel));
+ }
+ }
+
env->CallStaticVoidMethod(gZygoteClass, gCallPostForkChildHooks, runtime_flags,
is_system_server, is_child_zygote, instructionSet);
if (env->ExceptionCheck()) {
@@ -1020,6 +1033,9 @@ static const JNINativeMethod gMethods[] = {
int register_com_android_internal_os_Zygote(JNIEnv* env) {
gZygoteClass = MakeGlobalRefOrDie(env, FindClassOrDie(env, kZygoteClassName));
+ gCallPostForkSystemServerHooks = GetStaticMethodIDOrDie(env, gZygoteClass,
+ "callPostForkSystemServerHooks",
+ "()V");
gCallPostForkChildHooks = GetStaticMethodIDOrDie(env, gZygoteClass, "callPostForkChildHooks",
"(IZZLjava/lang/String;)V");
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index c5904e0e9e5e..d457a1b48e38 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -37,6 +37,7 @@ static const char* kPathWhitelist[] = {
"/dev/socket/zygote",
"/dev/socket/zygote_secondary",
"/dev/socket/webview_zygote",
+ "/dev/socket/heapprofd",
"/sys/kernel/debug/tracing/trace_marker",
"/system/framework/framework-res.apk",
"/dev/urandom",
diff --git a/libs/incident/Android.bp b/libs/incident/Android.bp
new file mode 100644
index 000000000000..0619a9c100dd
--- /dev/null
+++ b/libs/incident/Android.bp
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 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.
+
+cc_library_shared {
+ name: "libincident",
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-variable",
+ "-Wunused-parameter",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "liblog",
+ "libutils",
+ ],
+
+ aidl: {
+ include_dirs: ["frameworks/base/core/java"],
+ export_aidl_headers: true,
+ },
+
+ srcs: [
+ ":libincident_aidl",
+ "proto/android/os/header.proto",
+ "proto/android/os/metadata.proto",
+ "src/IncidentReportArgs.cpp",
+ ],
+
+ proto: {
+ type: "lite",
+ export_proto_headers: true,
+ },
+
+ export_include_dirs: ["include"],
+}
diff --git a/libs/incident/Android.mk b/libs/incident/Android.mk
deleted file mode 100644
index 08c834699f40..000000000000
--- a/libs/incident/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2016 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libincident
-
-LOCAL_CFLAGS := \
- -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter
-
-LOCAL_SHARED_LIBRARIES := \
- libbinder \
- liblog \
- libutils
-
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/../../core/java
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include
-
-LOCAL_SRC_FILES := \
- ../../core/java/android/os/IIncidentManager.aidl \
- ../../core/java/android/os/IIncidentReportStatusListener.aidl \
- proto/android/os/header.proto \
- proto/android/os/metadata.proto \
- src/IncidentReportArgs.cpp
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_PROTO_OPTIMIZE_TYPE := lite
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/services/usage/java/com/android/server/usage/StorageStatsService.java b/services/usage/java/com/android/server/usage/StorageStatsService.java
index 61d6b7def981..142ab9f9baea 100644
--- a/services/usage/java/com/android/server/usage/StorageStatsService.java
+++ b/services/usage/java/com/android/server/usage/StorageStatsService.java
@@ -33,6 +33,7 @@ import android.content.pm.PackageStats;
import android.content.pm.UserInfo;
import android.net.Uri;
import android.os.Binder;
+import android.os.Build;
import android.os.Environment;
import android.os.FileUtils;
import android.os.Handler;
@@ -169,7 +170,8 @@ public class StorageStatsService extends IStorageStatsManager.Stub {
enforcePermission(Binder.getCallingUid(), callingPackage);
if (volumeUuid == StorageManager.UUID_PRIVATE_INTERNAL) {
- return SystemProperties.getBoolean(StorageManager.PROP_HAS_RESERVED, false);
+ return SystemProperties.getBoolean(StorageManager.PROP_HAS_RESERVED, false)
+ || Build.IS_CONTAINER;
} else {
return false;
}
diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java
index 1d79988fecb3..da3acc2eedfe 100644
--- a/telephony/java/android/telephony/RadioAccessFamily.java
+++ b/telephony/java/android/telephony/RadioAccessFamily.java
@@ -29,29 +29,32 @@ import com.android.internal.telephony.RILConstants;
*/
public class RadioAccessFamily implements Parcelable {
- // Radio Access Family
+ /**
+ * TODO: get rid of RAF definition in RadioAccessFamily and
+ * use {@link TelephonyManager.NetworkTypeBitMask}
+ */
// 2G
- public static final int RAF_UNKNOWN = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN);
- public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
- public static final int RAF_GPRS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS);
- public static final int RAF_EDGE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE);
- public static final int RAF_IS95A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
- public static final int RAF_IS95B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B);
- public static final int RAF_1xRTT = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
+ public static final int RAF_UNKNOWN = TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
+ public static final int RAF_GSM = TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
+ public static final int RAF_GPRS = TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
+ public static final int RAF_EDGE = TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
+ public static final int RAF_IS95A = TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ public static final int RAF_IS95B = TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ public static final int RAF_1xRTT = TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
// 3G
- public static final int RAF_EVDO_0 = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0);
- public static final int RAF_EVDO_A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A);
- public static final int RAF_EVDO_B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B);
- public static final int RAF_EHRPD = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD);
- public static final int RAF_HSUPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA);
- public static final int RAF_HSDPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA);
- public static final int RAF_HSPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
- public static final int RAF_HSPAP = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP);
- public static final int RAF_UMTS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
- public static final int RAF_TD_SCDMA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA);
+ public static final int RAF_EVDO_0 = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
+ public static final int RAF_EVDO_A = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
+ public static final int RAF_EVDO_B = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
+ public static final int RAF_EHRPD = TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
+ public static final int RAF_HSUPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
+ public static final int RAF_HSDPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
+ public static final int RAF_HSPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
+ public static final int RAF_HSPAP = TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
+ public static final int RAF_UMTS = TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
+ public static final int RAF_TD_SCDMA = TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
// 4G
- public static final int RAF_LTE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
- public static final int RAF_LTE_CA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA);
+ public static final int RAF_LTE = TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
+ public static final int RAF_LTE_CA = TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
// Grouping of RAFs
// 2G
@@ -74,9 +77,9 @@ public class RadioAccessFamily implements Parcelable {
* Constructor.
*
* @param phoneId the phone ID
- * @param radioAccessFamily the phone radio access family defined
- * in RadioAccessFamily. It's a bit mask value to represent
- * the support type.
+ * @param radioAccessFamily the phone radio access family bitmask based on
+ * {@link TelephonyManager.NetworkTypeBitMask}. It's a bit mask value to represent the support
+ * type.
*/
@UnsupportedAppUsage
public RadioAccessFamily(int phoneId, int radioAccessFamily) {
@@ -100,7 +103,7 @@ public class RadioAccessFamily implements Parcelable {
* @return radio access family
*/
@UnsupportedAppUsage
- public int getRadioAccessFamily() {
+ public @TelephonyManager.NetworkTypeBitMask int getRadioAccessFamily() {
return mRadioAccessFamily;
}
@@ -388,4 +391,76 @@ public class RadioAccessFamily implements Parcelable {
}
return result;
}
+
+ /**
+ * convert RAF from {@link ServiceState.RilRadioTechnology} bitmask to
+ * {@link TelephonyManager.NetworkTypeBitMask}, the bitmask represented by
+ * {@link TelephonyManager.NetworkType}. Reasons are {@link TelephonyManager.NetworkType} are
+ * public while {@link ServiceState.RilRadioTechnology} are hidden. We
+ * don't want to expose two sets of definition to public.
+ *
+ * @param raf bitmask represented by {@link ServiceState.RilRadioTechnology}
+ * @return {@link TelephonyManager.NetworkTypeBitMask}
+ */
+ public static int convertToNetworkTypeBitMask(int raf) {
+ int networkTypeRaf = 0;
+
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
+ }
+ // convert both IS95A/IS95B to CDMA as network mode doesn't support CDMA
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
+ }
+
+ return (networkTypeRaf == 0) ? TelephonyManager.NETWORK_TYPE_UNKNOWN : networkTypeRaf;
+ }
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 2508b6d160d0..0ee493c5ba7b 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -8773,4 +8773,168 @@ public class TelephonyManager {
return isEnabled;
}
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(flag = true, prefix = {"NETWORK_TYPE_BITMASK_"},
+ value = {NETWORK_TYPE_BITMASK_UNKNOWN,
+ NETWORK_TYPE_BITMASK_GSM,
+ NETWORK_TYPE_BITMASK_GPRS,
+ NETWORK_TYPE_BITMASK_EDGE,
+ NETWORK_TYPE_BITMASK_CDMA,
+ NETWORK_TYPE_BITMASK_1xRTT,
+ NETWORK_TYPE_BITMASK_EVDO_0,
+ NETWORK_TYPE_BITMASK_EVDO_A,
+ NETWORK_TYPE_BITMASK_EVDO_B,
+ NETWORK_TYPE_BITMASK_EHRPD,
+ NETWORK_TYPE_BITMASK_HSUPA,
+ NETWORK_TYPE_BITMASK_HSDPA,
+ NETWORK_TYPE_BITMASK_HSPA,
+ NETWORK_TYPE_BITMASK_HSPAP,
+ NETWORK_TYPE_BITMASK_UMTS,
+ NETWORK_TYPE_BITMASK_TD_SCDMA,
+ NETWORK_TYPE_BITMASK_LTE,
+ NETWORK_TYPE_BITMASK_LTE_CA,
+ })
+ public @interface NetworkTypeBitMask {}
+
+ // 2G
+ /**
+ * network type bitmask unknown.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_UNKNOWN = (1 << NETWORK_TYPE_UNKNOWN);
+ /**
+ * network type bitmask indicating the support of radio tech GSM.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_GSM = (1 << NETWORK_TYPE_GSM);
+ /**
+ * network type bitmask indicating the support of radio tech GPRS.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_GPRS = (1 << NETWORK_TYPE_GPRS);
+ /**
+ * network type bitmask indicating the support of radio tech EDGE.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EDGE = (1 << NETWORK_TYPE_EDGE);
+ /**
+ * network type bitmask indicating the support of radio tech CDMA(IS95A/IS95B).
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_CDMA = (1 << NETWORK_TYPE_CDMA);
+ /**
+ * network type bitmask indicating the support of radio tech 1xRTT.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_1xRTT = (1 << NETWORK_TYPE_1xRTT);
+ // 3G
+ /**
+ * network type bitmask indicating the support of radio tech EVDO 0.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EVDO_0 = (1 << NETWORK_TYPE_EVDO_0);
+ /**
+ * network type bitmask indicating the support of radio tech EVDO A.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EVDO_A = (1 << NETWORK_TYPE_EVDO_A);
+ /**
+ * network type bitmask indicating the support of radio tech EVDO B.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EVDO_B = (1 << NETWORK_TYPE_EVDO_B);
+ /**
+ * network type bitmask indicating the support of radio tech EHRPD.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EHRPD = (1 << NETWORK_TYPE_EHRPD);
+ /**
+ * network type bitmask indicating the support of radio tech HSUPA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSUPA = (1 << NETWORK_TYPE_HSUPA);
+ /**
+ * network type bitmask indicating the support of radio tech HSDPA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSDPA = (1 << NETWORK_TYPE_HSDPA);
+ /**
+ * network type bitmask indicating the support of radio tech HSPA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSPA = (1 << NETWORK_TYPE_HSPA);
+ /**
+ * network type bitmask indicating the support of radio tech HSPAP.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSPAP = (1 << NETWORK_TYPE_HSPAP);
+ /**
+ * network type bitmask indicating the support of radio tech UMTS.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_UMTS = (1 << NETWORK_TYPE_UMTS);
+ /**
+ * network type bitmask indicating the support of radio tech TD_SCDMA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_TD_SCDMA = (1 << NETWORK_TYPE_TD_SCDMA);
+ // 4G
+ /**
+ * network type bitmask indicating the support of radio tech LTE.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_LTE = (1 << NETWORK_TYPE_LTE);
+ /**
+ * network type bitmask indicating the support of radio tech LTE CA (carrier aggregation).
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_LTE_CA = (1 << NETWORK_TYPE_LTE_CA);
+
+ /**
+ * @return Modem supported radio access family bitmask {@link NetworkTypeBitMask}
+ *
+ * <p>Requires permission: {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or
+ * that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public @NetworkTypeBitMask int getSupportedRadioAccessFamily() {
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ return telephony.getRadioAccessFamily(getSlotIndex(), getOpPackageName());
+ } else {
+ // This can happen when the ITelephony interface is not up yet.
+ return NETWORK_TYPE_BITMASK_UNKNOWN;
+ }
+ } catch (RemoteException ex) {
+ // This shouldn't happen in the normal case
+ return NETWORK_TYPE_BITMASK_UNKNOWN;
+ } catch (NullPointerException ex) {
+ // This could happen before phone restarts due to crashing
+ return NETWORK_TYPE_BITMASK_UNKNOWN;
+ }
+ }
+
}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
index 06378ba95d59..3822cbe8402e 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
@@ -269,6 +269,27 @@ public final class TelephonyPermissions {
}
/**
+ * Ensure the caller (or self, if not processing an IPC) has
+ * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or carrier privileges.
+ *
+ * @throws SecurityException if the caller does not have the required permission/privileges
+ */
+ public static void enforeceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
+ Context context, int subId, String message) {
+ if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ == PERMISSION_GRANTED) {
+ return;
+ }
+
+ if (DBG) {
+ Rlog.d(LOG_TAG, "No READ_PRIVILEDED_PHONE_STATE permission, " +
+ "check carrier privilege next.");
+ }
+
+ enforceCallingOrSelfCarrierPrivilege(subId, message);
+ }
+
+ /**
* Make sure the caller (or self, if not processing an IPC) has carrier privileges.
*
* @throws SecurityException if the caller does not have the required privileges