Merge "Updating javadoc for updateAppWidgetProviderInfo API" into pi-dev
diff --git a/api/current.txt b/api/current.txt
index 414491c..f5990eb 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7281,6 +7281,13 @@
field public static final java.lang.String SLICE_METADATA_KEY = "android.metadata.SLICE_URI";
}
+ public class SliceMetrics {
+ ctor public SliceMetrics(android.content.Context, android.net.Uri);
+ method public void logHidden();
+ method public void logTouch(android.net.Uri);
+ method public void logVisible();
+ }
+
public abstract class SliceProvider extends android.content.ContentProvider {
ctor public SliceProvider();
method public final int delete(android.net.Uri, java.lang.String, java.lang.String[]);
@@ -29475,7 +29482,7 @@
field public static final java.lang.String EXTRA_ID = "android.nfc.extra.ID";
field public static final java.lang.String EXTRA_NDEF_MESSAGES = "android.nfc.extra.NDEF_MESSAGES";
field public static final java.lang.String EXTRA_READER_PRESENCE_CHECK_DELAY = "presence";
- field public static final java.lang.String EXTRA_SE_NAME = "android.nfc.extra.SE_NAME";
+ field public static final java.lang.String EXTRA_SECURE_ELEMENT_NAME = "android.nfc.extra.SECURE_ELEMENT_NAME";
field public static final java.lang.String EXTRA_TAG = "android.nfc.extra.TAG";
field public static final int FLAG_READER_NFC_A = 1; // 0x1
field public static final int FLAG_READER_NFC_B = 2; // 0x2
diff --git a/api/system-current.txt b/api/system-current.txt
index 0e33c17..e1b576d 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5213,10 +5213,10 @@
method public boolean handlePinMmi(java.lang.String);
method public boolean handlePinMmiForSubscriber(int, java.lang.String);
method public boolean isDataConnectivityPossible();
- method public deprecated boolean isIdle();
- method public deprecated boolean isOffhook();
- method public deprecated boolean isRadioOn();
- method public deprecated boolean isRinging();
+ method public boolean isIdle();
+ method public boolean isOffhook();
+ method public boolean isRadioOn();
+ method public boolean isRinging();
method public boolean isVideoCallingEnabled();
method public deprecated boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
method public boolean needsOtaServiceProvisioning();
diff --git a/cmds/statsd/src/StatsLogProcessor.cpp b/cmds/statsd/src/StatsLogProcessor.cpp
index 652ec9d..8b681edd 100644
--- a/cmds/statsd/src/StatsLogProcessor.cpp
+++ b/cmds/statsd/src/StatsLogProcessor.cpp
@@ -112,8 +112,8 @@
}
void StatsLogProcessor::mapIsolatedUidToHostUidIfNecessaryLocked(LogEvent* event) const {
- if (android::util::kAtomsWithAttributionChain.find(event->GetTagId()) !=
- android::util::kAtomsWithAttributionChain.end()) {
+ if (android::util::AtomsInfo::kAtomsWithAttributionChain.find(event->GetTagId()) !=
+ android::util::AtomsInfo::kAtomsWithAttributionChain.end()) {
for (auto& value : *(event->getMutableValues())) {
if (value.mField.getPosAtDepth(0) > kAttributionField) {
break;
@@ -123,12 +123,20 @@
updateUid(&value.mValue, hostUid);
}
}
- } else if (android::util::kAtomsWithUidField.find(event->GetTagId()) !=
- android::util::kAtomsWithUidField.end() &&
- event->getValues().size() > 0 && (event->getValues())[0].mValue.getType() == INT) {
- Value& value = (*event->getMutableValues())[0].mValue;
- const int hostUid = mUidMap->getHostUidOrSelf(value.int_value);
- updateUid(&value, hostUid);
+ } else {
+ auto it = android::util::AtomsInfo::kAtomsWithUidField.find(event->GetTagId());
+ if (it != android::util::AtomsInfo::kAtomsWithUidField.end()) {
+ int uidField = it->second; // uidField is the field number in proto,
+ // starting from 1
+ if (uidField > 0 && (int)event->getValues().size() >= uidField &&
+ (event->getValues())[uidField - 1].mValue.getType() == INT) {
+ Value& value = (*event->getMutableValues())[uidField - 1].mValue;
+ const int hostUid = mUidMap->getHostUidOrSelf(value.int_value);
+ updateUid(&value, hostUid);
+ } else {
+ ALOGE("Malformed log, uid not found. %s", event->ToString().c_str());
+ }
+ }
}
}
diff --git a/cmds/statsd/src/atom_field_options.proto b/cmds/statsd/src/atom_field_options.proto
index 19d00b7..a2a03b1 100644
--- a/cmds/statsd/src/atom_field_options.proto
+++ b/cmds/statsd/src/atom_field_options.proto
@@ -67,4 +67,7 @@
extend google.protobuf.FieldOptions {
// Flags to decorate an atom that presents a state change.
optional StateAtomFieldOption stateFieldOption = 50000;
+
+ // Flags to decorate the uid fields in an atom.
+ optional bool is_uid = 50001 [default = false];
}
\ No newline at end of file
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index f74188f..bcbee47 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -209,7 +209,7 @@
* frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
*/
message UidProcessStateChanged {
- optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
+ optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
// The state, from frameworks/base/core/proto/android/app/enums.proto.
optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
@@ -223,7 +223,7 @@
*/
message ProcessLifeCycleStateChanged {
// TODO: should be a string tagged w/ uid annotation
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The process name (usually same as the app name).
optional string name = 2;
@@ -593,7 +593,7 @@
*/
message MobileRadioPowerStateChanged {
// TODO: Add attribution instead of uid?
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
optional android.telephony.DataConnectionPowerStateEnum state = 2;
@@ -608,7 +608,7 @@
*/
message WifiRadioPowerStateChanged {
// TODO: Add attribution instead of uid?
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
optional android.telephony.DataConnectionPowerStateEnum state = 2;
@@ -1130,7 +1130,8 @@
*/
message DaveyOccurred {
// The UID that logged this atom.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
+ ;
// Amount of time it took to render the frame. Should be >=700ms.
optional int64 jank_duration_millis = 2;
@@ -1187,7 +1188,7 @@
* frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
*/
message ActivityForegroundStateChanged {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional string pkg_name = 2;
optional string class_name = 3;
@@ -1205,7 +1206,7 @@
*/
message DropboxErrorChanged {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// Tag used when recording this error to dropbox. Contains data_ or system_ prefix.
optional string tag = 2;
@@ -1236,7 +1237,7 @@
*/
message AppBreadcrumbReported {
// The uid of the application that sent this custom atom.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
optional int32 label = 2;
@@ -1260,7 +1261,7 @@
*/
message AnomalyDetected {
// Uid that owns the config whose anomaly detection alert fired.
- optional int32 config_uid = 1;
+ optional int32 config_uid = 1 [(is_uid) = true];
// Id of the config whose anomaly detection alert fired.
optional int64 config_id = 2;
@@ -1271,7 +1272,7 @@
message AppStartChanged {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The app package name.
optional string pkg_name = 2;
@@ -1318,7 +1319,7 @@
message AppStartCancelChanged {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The app package name.
optional string pkg_name = 2;
@@ -1338,7 +1339,7 @@
message AppStartFullyDrawnChanged {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The app package name.
optional string pkg_name = 2;
@@ -1369,7 +1370,7 @@
*/
message PictureInPictureStateChanged {
// -1 if it is not available
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional string short_name = 2;
@@ -1388,7 +1389,7 @@
* services/core/java/com/android/server/wm/Session.java
*/
message OverlayStateChanged {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional string package_name = 2;
@@ -1409,7 +1410,7 @@
* //frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
*/
message ForegroundServiceStateChanged {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// package_name + "/" + class_name
optional string short_name = 2;
@@ -1429,6 +1430,7 @@
* frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
*/
message IsolatedUidChanged {
+ // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
// The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
optional int32 parent_uid = 1;
@@ -1450,7 +1452,7 @@
message PacketWakeupOccurred {
// The uid owning the socket into which the packet was delivered, or -1 if the packet was
// delivered nowhere.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The interface name on which the packet was received.
optional string iface = 2;
// The ethertype value of the packet.
@@ -1478,7 +1480,7 @@
*/
message AppStartMemoryStateCaptured {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The process name.
optional string process_name = 2;
@@ -1524,7 +1526,7 @@
*/
message LmkKillOccurred {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The process name.
optional string process_name = 2;
@@ -1556,7 +1558,7 @@
*/
message AppDied {
// timestamp(elapsedRealtime) of record creation
- optional uint64 timestamp_millis = 1;
+ optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
}
//////////////////////////////////////////////////////////////////////
@@ -1570,7 +1572,7 @@
* StatsCompanionService (using BatteryStats to get which interfaces are wifi)
*/
message WifiBytesTransfer {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional int64 rx_bytes = 2;
@@ -1588,9 +1590,10 @@
* StatsCompanionService (using BatteryStats to get which interfaces are wifi)
*/
message WifiBytesTransferByFgBg {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
- // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
+ // 1 denotes foreground and 0 denotes background. This is called Set in
+ // NetworkStats.
optional int32 is_foreground = 2;
optional int64 rx_bytes = 3;
@@ -1609,7 +1612,7 @@
* StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
*/
message MobileBytesTransfer {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional int64 rx_bytes = 2;
@@ -1627,9 +1630,10 @@
* StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
*/
message MobileBytesTransferByFgBg {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
- // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
+ // 1 denotes foreground and 0 denotes background. This is called Set in
+ // NetworkStats.
optional int32 is_foreground = 2;
optional int64 rx_bytes = 3;
@@ -1648,7 +1652,7 @@
* StatsCompanionService
*/
message BluetoothBytesTransfer {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional int64 rx_bytes = 2;
@@ -1708,7 +1712,7 @@
* Note that isolated process uid time should be attributed to host uids.
*/
message CpuTimePerUid {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional uint64 user_time_millis = 2;
optional uint64 sys_time_millis = 3;
}
@@ -1719,7 +1723,7 @@
* For each uid, we order the time by descending frequencies.
*/
message CpuTimePerUidFreq {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional uint32 freq_index = 2;
optional uint64 time_millis = 3;
}
@@ -1801,7 +1805,7 @@
*/
message ProcessMemoryState {
// The uid if available. -1 means not available.
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
// The process name.
optional string process_name = 2;
@@ -1853,7 +1857,7 @@
* The file contains a monotonically increasing count of time for a single boot.
*/
message CpuActiveTime {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional uint64 time_millis = 2;
}
@@ -1867,7 +1871,7 @@
* The file contains a monotonically increasing count of time for a single boot.
*/
message CpuClusterTime {
- optional int32 uid = 1;
+ optional int32 uid = 1 [(is_uid) = true];
optional int32 cluster_index = 2;
optional uint64 time_millis = 3;
}
diff --git a/cmds/statsd/src/external/puller_util.cpp b/cmds/statsd/src/external/puller_util.cpp
index 0b0c5c4..ea23623 100644
--- a/cmds/statsd/src/external/puller_util.cpp
+++ b/cmds/statsd/src/external/puller_util.cpp
@@ -112,7 +112,8 @@
VLOG("Unknown pull atom id %d", tagId);
return;
}
- if (android::util::kAtomsWithUidField.find(tagId) == android::util::kAtomsWithUidField.end()) {
+ if (android::util::AtomsInfo::kAtomsWithUidField.find(tagId) ==
+ android::util::AtomsInfo::kAtomsWithUidField.end()) {
VLOG("No uid to merge for atom %d", tagId);
return;
}
diff --git a/cmds/statsd/src/metrics/EventMetricProducer.cpp b/cmds/statsd/src/metrics/EventMetricProducer.cpp
index 778eb8e..bd8b293 100644
--- a/cmds/statsd/src/metrics/EventMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/EventMetricProducer.cpp
@@ -134,8 +134,8 @@
uint64_t wrapperToken =
mProto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_DATA);
const bool truncateTimestamp =
- android::util::kNotTruncatingTimestampAtomWhiteList.find(event.GetTagId()) ==
- android::util::kNotTruncatingTimestampAtomWhiteList.end();
+ android::util::AtomsInfo::kNotTruncatingTimestampAtomWhiteList.find(event.GetTagId()) ==
+ android::util::AtomsInfo::kNotTruncatingTimestampAtomWhiteList.end();
if (truncateTimestamp) {
mProto->write(FIELD_TYPE_INT64 | FIELD_ID_ELAPSED_TIMESTAMP_NANOS,
(long long)truncateTimestampNsToFiveMinutes(event.GetElapsedTimestampNs()));
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
index 55a281e..49034ac 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
@@ -195,8 +195,9 @@
protoOutput->end(atomsToken);
}
const bool truncateTimestamp =
- android::util::kNotTruncatingTimestampAtomWhiteList.find(mTagId) ==
- android::util::kNotTruncatingTimestampAtomWhiteList.end();
+ android::util::AtomsInfo::kNotTruncatingTimestampAtomWhiteList.find(
+ mTagId) ==
+ android::util::AtomsInfo::kNotTruncatingTimestampAtomWhiteList.end();
const int64_t wall_clock_ns = truncateTimestamp ?
truncateTimestampNsToFiveMinutes(getWallClockNs()) : getWallClockNs();
for (const auto& atom : bucket.mGaugeAtoms) {
diff --git a/cmds/statsd/src/metrics/metrics_manager_util.cpp b/cmds/statsd/src/metrics/metrics_manager_util.cpp
index 901f500..c6112fd 100644
--- a/cmds/statsd/src/metrics/metrics_manager_util.cpp
+++ b/cmds/statsd/src/metrics/metrics_manager_util.cpp
@@ -170,9 +170,10 @@
// 1. must not have "stop". must have "dimension"
if (!simplePredicate.has_stop() && simplePredicate.has_dimensions()) {
// TODO: need to check the start atom matcher too.
- auto it = android::util::kStateAtomsFieldOptions.find(simplePredicate.dimensions().field());
+ auto it = android::util::AtomsInfo::kStateAtomsFieldOptions.find(
+ simplePredicate.dimensions().field());
// 2. must be based on a state atom.
- if (it != android::util::kStateAtomsFieldOptions.end()) {
+ if (it != android::util::AtomsInfo::kStateAtomsFieldOptions.end()) {
// 3. dimension must be primary fields + state field IN ORDER
size_t expectedDimensionCount = it->second.primaryFields.size() + 1;
vector<Matcher> dimensions;
diff --git a/core/java/android/app/slice/SliceMetrics.java b/core/java/android/app/slice/SliceMetrics.java
new file mode 100644
index 0000000..a7069bc
--- /dev/null
+++ b/core/java/android/app/slice/SliceMetrics.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2018 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 android.app.slice;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.net.Uri;
+
+import com.android.internal.logging.MetricsLogger;
+
+/**
+ * Metrics interface for slices.
+ *
+ * This is called by SliceView, so Slice develoers should
+ * not need to reference this class.
+ *
+ * @see androidx.slice.widget.SliceView
+ */
+public class SliceMetrics {
+
+ private static final String TAG = "SliceMetrics";
+ private MetricsLogger mMetricsLogger;
+
+ /**
+ * An object to be used throughout the life of a slice to register events.
+ */
+ public SliceMetrics(@NonNull Context context, @NonNull Uri uri) {
+ mMetricsLogger = new MetricsLogger();
+ }
+
+ /**
+ * To be called whenever the slice becomes visible to the user.
+ */
+ public void logVisible() {
+ }
+
+ /**
+ * To be called whenever the slice becomes invisible to the user.
+ */
+ public void logHidden() {
+ }
+
+ /**
+ * To be called whenever the use interacts with a slice.
+ *@param subSlice The URI of the sub-slice that is the subject of the interaction.
+ */
+ public void logTouch(@NonNull Uri subSlice) {
+ }
+}
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index b02d48d..c3f23a1 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -225,7 +225,7 @@
* Indicates the Secure Element on which the transaction occurred.
* eSE1...eSEn for Embedded Secure Elements, SIM1...SIMn for UICC, etc.
*/
- public static final String EXTRA_SE_NAME = "android.nfc.extra.SE_NAME";
+ public static final String EXTRA_SECURE_ELEMENT_NAME = "android.nfc.extra.SECURE_ELEMENT_NAME";
public static final int STATE_OFF = 1;
public static final int STATE_TURNING_ON = 2;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 79b6ea6..50d9767 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -9541,6 +9541,12 @@
public static final String BLE_SCAN_LOW_LATENCY_INTERVAL_MS =
"ble_scan_low_latency_interval_ms";
+ /**
+ * The mode that BLE scanning clients will be moved to when in the background.
+ * @hide
+ */
+ public static final String BLE_SCAN_BACKGROUND_MODE = "ble_scan_background_mode";
+
/**
* Used to save the Wifi_ON state prior to tethering.
* This state will be checked to restore Wifi after
diff --git a/core/proto/android/service/graphicsstats.proto b/core/proto/android/service/graphicsstats.proto
index f422065..c2fedf5 100644
--- a/core/proto/android/service/graphicsstats.proto
+++ b/core/proto/android/service/graphicsstats.proto
@@ -56,7 +56,7 @@
// Number of "missed vsync" events.
optional int32 missed_vsync_count = 3;
- // Number of "high input latency" events.
+ // Number of frames in triple-buffering scenario (high input latency)
optional int32 high_input_latency_count = 4;
// Number of "slow UI thread" events.
@@ -67,6 +67,9 @@
// Number of "slow draw" events.
optional int32 slow_draw_count = 7;
+
+ // Number of frames that missed their deadline (aka, visibly janked)
+ optional int32 missed_deadline_count = 8;
}
message GraphicsStatsHistogramBucketProto {
diff --git a/core/proto/android/service/notification.proto b/core/proto/android/service/notification.proto
index 5c40e5f..cccd2fe 100644
--- a/core/proto/android/service/notification.proto
+++ b/core/proto/android/service/notification.proto
@@ -93,7 +93,8 @@
message ServiceProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
- repeated string name = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
+ // Package or component name.
+ repeated string name = 1;
optional int32 user_id = 2;
optional bool is_primary = 3;
}
@@ -169,16 +170,16 @@
message ZenRuleProto {
option (android.msg_privacy).dest = DEST_EXPLICIT;
- // Required for automatic (unique).
+ // Required for automatic ZenRules (unique).
optional string id = 1;
- // Required for automatic.
+ // Required for automatic ZenRules.
optional string name = 2;
- // Required for automatic.
+ // Required for automatic ZenRules.
optional int64 creation_time_ms = 3 [
(android.privacy).dest = DEST_AUTOMATIC
];
optional bool enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
- // Package name, only used for manual rules.
+ // Package name, only used for manual ZenRules.
optional string enabler = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
// User manually disabled this instance.
optional bool is_snoozing = 6 [
@@ -188,7 +189,7 @@
(android.privacy).dest = DEST_AUTOMATIC
];
- // Required for automatic.
+ // Required for automatic ZenRules.
optional string condition_id = 8;
optional ConditionProto condition = 9;
optional android.content.ComponentNameProto component = 10;
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index cc36b96..63343be 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -129,6 +129,7 @@
Settings.Global.BLE_SCAN_BALANCED_INTERVAL_MS,
Settings.Global.BLE_SCAN_LOW_LATENCY_WINDOW_MS,
Settings.Global.BLE_SCAN_LOW_LATENCY_INTERVAL_MS,
+ Settings.Global.BLE_SCAN_BACKGROUND_MODE,
Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX,
Settings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX,
Settings.Global.BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX,
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index b455419..c6a6113 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -325,6 +325,7 @@
<permission name="android.permission.SET_TIME"/>
<permission name="android.permission.SET_TIME_ZONE"/>
<permission name="android.permission.SIGNAL_PERSISTENT_PROCESSES"/>
+ <permission name="android.permission.START_TASKS_FROM_RECENTS" />
<permission name="android.permission.STOP_APP_SWITCHES"/>
<permission name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
<permission name="android.permission.UPDATE_APP_OPS_STATS"/>
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index cf29e43..81a7980 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -38,16 +38,27 @@
namespace uirenderer {
struct Comparison {
+ JankType type;
+ std::function<int64_t(nsecs_t)> computeThreadshold;
FrameInfoIndex start;
FrameInfoIndex end;
};
-static const Comparison COMPARISONS[] = {
- {FrameInfoIndex::IntendedVsync, FrameInfoIndex::Vsync},
- {FrameInfoIndex::OldestInputEvent, FrameInfoIndex::Vsync},
- {FrameInfoIndex::Vsync, FrameInfoIndex::SyncStart},
- {FrameInfoIndex::SyncStart, FrameInfoIndex::IssueDrawCommandsStart},
- {FrameInfoIndex::IssueDrawCommandsStart, FrameInfoIndex::FrameCompleted},
+static const std::array<Comparison, 4> COMPARISONS{
+ Comparison{JankType::kMissedVsync, [](nsecs_t) { return 1; }, FrameInfoIndex::IntendedVsync,
+ FrameInfoIndex::Vsync},
+
+ Comparison{JankType::kSlowUI,
+ [](nsecs_t frameInterval) { return static_cast<int64_t>(.5 * frameInterval); },
+ FrameInfoIndex::Vsync, FrameInfoIndex::SyncStart},
+
+ Comparison{JankType::kSlowSync,
+ [](nsecs_t frameInterval) { return static_cast<int64_t>(.2 * frameInterval); },
+ FrameInfoIndex::SyncStart, FrameInfoIndex::IssueDrawCommandsStart},
+
+ Comparison{JankType::kSlowRT,
+ [](nsecs_t frameInterval) { return static_cast<int64_t>(.75 * frameInterval); },
+ FrameInfoIndex::IssueDrawCommandsStart, FrameInfoIndex::FrameCompleted},
};
// If the event exceeds 10 seconds throw it away, this isn't a jank event
@@ -91,24 +102,10 @@
void JankTracker::setFrameInterval(nsecs_t frameInterval) {
mFrameInterval = frameInterval;
- mThresholds[kMissedVsync] = 1;
- /*
- * Due to interpolation and sample rate differences between the touch
- * panel and the display (example, 85hz touch panel driving a 60hz display)
- * we call high latency 1.5 * frameinterval
- *
- * NOTE: Be careful when tuning this! A theoretical 1,000hz touch panel
- * on a 60hz display will show kOldestInputEvent - kIntendedVsync of being 15ms
- * Thus this must always be larger than frameInterval, or it will fail
- */
- mThresholds[kHighInputLatency] = static_cast<int64_t>(1.5 * frameInterval);
- // Note that these do not add up to 1. This is intentional. It's to deal
- // with variance in values, and should be sort of an upper-bound on what
- // is reasonable to expect.
- mThresholds[kSlowUI] = static_cast<int64_t>(.5 * frameInterval);
- mThresholds[kSlowSync] = static_cast<int64_t>(.2 * frameInterval);
- mThresholds[kSlowRT] = static_cast<int64_t>(.75 * frameInterval);
+ for (auto& comparison : COMPARISONS) {
+ mThresholds[comparison.type] = comparison.computeThreadshold(frameInterval);
+ }
}
void JankTracker::finishFrame(const FrameInfo& frame) {
@@ -129,28 +126,48 @@
totalDuration -= forgiveAmount;
}
}
+
LOG_ALWAYS_FATAL_IF(totalDuration <= 0, "Impossible totalDuration %" PRId64, totalDuration);
mData->reportFrame(totalDuration);
(*mGlobalData)->reportFrame(totalDuration);
- // Keep the fast path as fast as possible.
- if (CC_LIKELY(totalDuration < mFrameInterval)) {
- return;
- }
-
// Only things like Surface.lockHardwareCanvas() are exempt from tracking
- if (frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS) {
+ if (CC_UNLIKELY(frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS)) {
return;
}
- mData->reportJank();
- (*mGlobalData)->reportJank();
+ if (totalDuration > mFrameInterval) {
+ mData->reportJank();
+ (*mGlobalData)->reportJank();
+ }
- for (int i = 0; i < NUM_BUCKETS; i++) {
- int64_t delta = frame.duration(COMPARISONS[i].start, COMPARISONS[i].end);
- if (delta >= mThresholds[i] && delta < IGNORE_EXCEEDING) {
- mData->reportJankType((JankType)i);
- (*mGlobalData)->reportJankType((JankType)i);
+ bool isTripleBuffered = mSwapDeadline > frame[FrameInfoIndex::IntendedVsync];
+
+ mSwapDeadline = std::max(mSwapDeadline + mFrameInterval,
+ frame[FrameInfoIndex::IntendedVsync] + mFrameInterval);
+
+ // If we hit the deadline, cool!
+ if (frame[FrameInfoIndex::FrameCompleted] < mSwapDeadline) {
+ if (isTripleBuffered) {
+ mData->reportJankType(JankType::kHighInputLatency);
+ (*mGlobalData)->reportJankType(JankType::kHighInputLatency);
+ }
+ return;
+ }
+
+ mData->reportJankType(JankType::kMissedDeadline);
+ (*mGlobalData)->reportJankType(JankType::kMissedDeadline);
+
+ // Janked, reset the swap deadline
+ nsecs_t jitterNanos = frame[FrameInfoIndex::FrameCompleted] - frame[FrameInfoIndex::Vsync];
+ nsecs_t lastFrameOffset = jitterNanos % mFrameInterval;
+ mSwapDeadline = frame[FrameInfoIndex::FrameCompleted] - lastFrameOffset + mFrameInterval;
+
+ for (auto& comparison : COMPARISONS) {
+ int64_t delta = frame.duration(comparison.start, comparison.end);
+ if (delta >= mThresholds[comparison.type] && delta < IGNORE_EXCEEDING) {
+ mData->reportJankType(comparison.type);
+ (*mGlobalData)->reportJankType(comparison.type);
}
}
diff --git a/libs/hwui/JankTracker.h b/libs/hwui/JankTracker.h
index dc6a7ff..110211e 100644
--- a/libs/hwui/JankTracker.h
+++ b/libs/hwui/JankTracker.h
@@ -75,6 +75,7 @@
std::array<int64_t, NUM_BUCKETS> mThresholds;
int64_t mFrameInterval;
+ nsecs_t mSwapDeadline;
// The amount of time we will erase from the total duration to account
// for SF vsync offsets with HWC2 blocking dequeueBuffers.
// (Vsync + mDequeueBlockTolerance) is the point at which we expect
diff --git a/libs/hwui/ProfileData.cpp b/libs/hwui/ProfileData.cpp
index b392ecd..f9cf549 100644
--- a/libs/hwui/ProfileData.cpp
+++ b/libs/hwui/ProfileData.cpp
@@ -23,8 +23,7 @@
static const char* JANK_TYPE_NAMES[] = {
"Missed Vsync", "High input latency", "Slow UI thread",
- "Slow bitmap uploads", "Slow issue draw commands",
-};
+ "Slow bitmap uploads", "Slow issue draw commands", "Frame deadline missed"};
// The bucketing algorithm controls so to speak
// If a frame is <= to this it goes in bucket 0
diff --git a/libs/hwui/ProfileData.h b/libs/hwui/ProfileData.h
index 1e688ab..564920b 100644
--- a/libs/hwui/ProfileData.h
+++ b/libs/hwui/ProfileData.h
@@ -33,6 +33,7 @@
kSlowUI,
kSlowSync,
kSlowRT,
+ kMissedDeadline,
// must be last
NUM_BUCKETS,
diff --git a/libs/hwui/service/GraphicsStatsService.cpp b/libs/hwui/service/GraphicsStatsService.cpp
index e0303a8..599226b 100644
--- a/libs/hwui/service/GraphicsStatsService.cpp
+++ b/libs/hwui/service/GraphicsStatsService.cpp
@@ -176,6 +176,8 @@
summary->set_slow_bitmap_upload_count(summary->slow_bitmap_upload_count() +
data->jankTypeCount(kSlowSync));
summary->set_slow_draw_count(summary->slow_draw_count() + data->jankTypeCount(kSlowRT));
+ summary->set_missed_deadline_count(summary->missed_deadline_count()
+ + data->jankTypeCount(kMissedDeadline));
bool creatingHistogram = false;
if (proto->histogram_size() == 0) {
@@ -246,6 +248,7 @@
dprintf(fd, "\nNumber Slow UI thread: %d", summary.slow_ui_thread_count());
dprintf(fd, "\nNumber Slow bitmap uploads: %d", summary.slow_bitmap_upload_count());
dprintf(fd, "\nNumber Slow issue draw commands: %d", summary.slow_draw_count());
+ dprintf(fd, "\nNumber Frame deadline missed: %d", summary.missed_deadline_count());
dprintf(fd, "\nHISTOGRAM:");
for (const auto& it : proto->histogram()) {
dprintf(fd, " %dms=%d", it.render_millis(), it.frame_count());
diff --git a/libs/hwui/tests/common/scenes/JankyScene.cpp b/libs/hwui/tests/common/scenes/JankyScene.cpp
new file mode 100644
index 0000000..f5e6b31
--- /dev/null
+++ b/libs/hwui/tests/common/scenes/JankyScene.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#include "TestSceneBase.h"
+
+#include <unistd.h>
+
+class JankyScene;
+
+static TestScene::Registrar _JankyScene(TestScene::Info{
+ "janky",
+ "A scene that intentionally janks just enough to stay in "
+ "triple buffering.",
+ TestScene::simpleCreateScene<JankyScene>});
+
+class JankyScene : public TestScene {
+public:
+ sp<RenderNode> card;
+
+ void createContent(int width, int height, Canvas& canvas) override {
+ card = TestUtils::createNode(0, 0, 200, 200, [](RenderProperties& props, Canvas& canvas) {
+ canvas.drawColor(0xFF0000FF, SkBlendMode::kSrcOver);
+ });
+ canvas.drawColor(0xFFFFFFFF, SkBlendMode::kSrcOver); // background
+ canvas.drawRenderNode(card.get());
+ }
+
+ void doFrame(int frameNr) override {
+ int curFrame = frameNr % 150;
+ if (curFrame & 1) {
+ usleep(15000);
+ }
+ // we animate left and top coordinates, which in turn animates width and
+ // height (bottom/right coordinates are fixed)
+ card->mutateStagingProperties().setLeftTop(curFrame, curFrame);
+ card->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y);
+ }
+};
\ No newline at end of file
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index f6ec6a8..ec25d2d 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -416,6 +416,29 @@
}
}
+ /**
+ * Set this device as active device
+ * @return true if at least one profile on this device is set to active, false otherwise
+ */
+ public boolean setActive() {
+ boolean result = false;
+ A2dpProfile a2dpProfile = mProfileManager.getA2dpProfile();
+ if (a2dpProfile != null && isConnectedProfile(a2dpProfile)) {
+ if (a2dpProfile.setActiveDevice(getDevice())) {
+ Log.i(TAG, "OnPreferenceClickListener: A2DP active device=" + this);
+ result = true;
+ }
+ }
+ HeadsetProfile headsetProfile = mProfileManager.getHeadsetProfile();
+ if ((headsetProfile != null) && isConnectedProfile(headsetProfile)) {
+ if (headsetProfile.setActiveDevice(getDevice())) {
+ Log.i(TAG, "OnPreferenceClickListener: Headset active device=" + this);
+ result = true;
+ }
+ }
+ return result;
+ }
+
void refreshName() {
fetchName();
dispatchAttributesChanged();
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
index 0775727..632b014 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
@@ -294,4 +294,24 @@
// Verify new alias is returned on getName
assertThat(cachedBluetoothDevice.getName()).isEqualTo(DEVICE_ALIAS_NEW);
}
+
+ @Test
+ public void testSetActive() {
+ when(mProfileManager.getA2dpProfile()).thenReturn(mA2dpProfile);
+ when(mProfileManager.getHeadsetProfile()).thenReturn(mHfpProfile);
+ when(mA2dpProfile.setActiveDevice(any(BluetoothDevice.class))).thenReturn(true);
+ when(mHfpProfile.setActiveDevice(any(BluetoothDevice.class))).thenReturn(true);
+
+ assertThat(mCachedDevice.setActive()).isFalse();
+
+ mCachedDevice.onProfileStateChanged(mA2dpProfile, BluetoothProfile.STATE_CONNECTED);
+ assertThat(mCachedDevice.setActive()).isTrue();
+
+ mCachedDevice.onProfileStateChanged(mA2dpProfile, BluetoothProfile.STATE_DISCONNECTED);
+ mCachedDevice.onProfileStateChanged(mHfpProfile, BluetoothProfile.STATE_CONNECTED);
+ assertThat(mCachedDevice.setActive()).isTrue();
+
+ mCachedDevice.onProfileStateChanged(mHfpProfile, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mCachedDevice.setActive()).isFalse();
+ }
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 5102cbd..cb5763f 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2774,7 +2774,9 @@
}
private void notifyForSettingsChange(int key, String name) {
- final int userId = getUserIdFromKey(key);
+ final int userId = isGlobalSettingsKey(key)
+ ? UserHandle.USER_ALL : getUserIdFromKey(key);
+
Uri uri = getNotificationUriFor(key, name);
mGenerationRegistry.incrementGeneration(key);
@@ -2938,7 +2940,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 159;
+ private static final int SETTINGS_VERSION = 160;
private final int mUserId;
@@ -3646,6 +3648,28 @@
currentVersion = 159;
}
+ if (currentVersion == 159) {
+ // Version 160: Hiding notifications from the lockscreen is only available as
+ // primary user option, profiles can only make them redacted. If a profile was
+ // configured to not show lockscreen notifications, ensure that at the very
+ // least these will be come hidden.
+ if (mUserManager.isManagedProfile(userId)) {
+ final SettingsState secureSettings = getSecureSettingsLocked(userId);
+ Setting showNotifications = secureSettings.getSettingLocked(
+ Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS);
+ // The default value is "1", check if user has turned it off.
+ if ("0".equals(showNotifications.getValue())) {
+ secureSettings.insertSettingLocked(
+ Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, "0",
+ null /* tag */, false /* makeDefault */,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ // The setting is no longer valid for managed profiles, it should be
+ // treated as if it was set to "1".
+ secureSettings.deleteSettingLocked(Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS);
+ }
+ currentVersion = 160;
+ }
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 589ae2a..b49f1ac 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -121,6 +121,7 @@
<uses-permission android:name="android.permission.MANAGE_APP_OPS_MODES" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" />
+ <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" />
<uses-permission android:name="android.permission.ACTIVITY_EMBEDDING" />
<uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java
index 940c9ef..5fa6c79 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java
@@ -29,6 +29,8 @@
private IRecentsAnimationController mAnimationController;
+ public RecentsAnimationControllerCompat() { }
+
public RecentsAnimationControllerCompat(IRecentsAnimationController animationController) {
mAnimationController = animationController;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
index cc584e7e..ccabb79 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
@@ -389,7 +389,7 @@
* "public" (secure & locked) mode?
*/
private boolean userAllowsNotificationsInPublic(int userHandle) {
- if (userHandle == UserHandle.USER_ALL) {
+ if (isCurrentProfile(userHandle)) {
return true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index ae55ae8e..739d8d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -158,6 +158,7 @@
private final WakeLock mWakeLock;
private boolean mWakeLockHeld;
+ private boolean mKeyguardOccluded;
public ScrimController(LightBarController lightBarController, ScrimView scrimBehind,
ScrimView scrimInFront, View headsUpScrim, Consumer<Integer> scrimVisibleListener,
@@ -268,12 +269,13 @@
// AOD wallpapers should fade away after a while
if (mWallpaperSupportsAmbientMode && mDozeParameters.getAlwaysOn()
- && (mState == ScrimState.AOD || mState == ScrimState.PULSING)) {
+ && mState == ScrimState.AOD) {
if (!mWallpaperVisibilityTimedOut) {
mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(),
AlarmTimeout.MODE_IGNORE_IF_SCHEDULED);
}
- } else {
+ // Do not re-schedule timeout when pulsing, let's save some extra battery.
+ } else if (mState != ScrimState.PULSING) {
mTimeTicker.cancel();
mWallpaperVisibilityTimedOut = false;
}
@@ -317,7 +319,7 @@
@VisibleForTesting
protected void onHideWallpaperTimeout() {
- if (mState != ScrimState.AOD && mState != ScrimState.PULSING) {
+ if (mState != ScrimState.AOD) {
return;
}
@@ -478,11 +480,13 @@
mLightBarController.setScrimColor(mScrimInFront.getColors());
}
- // We want to override the back scrim opacity for AOD and PULSING
+ // We want to override the back scrim opacity for the AOD state
// when it's time to fade the wallpaper away.
- boolean overrideBackScrimAlpha = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
- && mWallpaperVisibilityTimedOut;
- if (overrideBackScrimAlpha) {
+ boolean aodWallpaperTimeout = mState == ScrimState.AOD && mWallpaperVisibilityTimedOut;
+ // We also want to hide FLAG_SHOW_WHEN_LOCKED activities under the scrim.
+ boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
+ && mKeyguardOccluded;
+ if (aodWallpaperTimeout || occludedKeyguard) {
mCurrentBehindAlpha = 1;
}
@@ -926,6 +930,10 @@
mExpansionAffectsAlpha = expansionAffectsAlpha;
}
+ public void setKeyguardOccluded(boolean keyguardOccluded) {
+ mKeyguardOccluded = keyguardOccluded;
+ }
+
public interface Callback {
default void onStart() {
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index c92f300..7422a43 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -2040,6 +2040,7 @@
public void setOccluded(boolean occluded) {
mIsOccluded = occluded;
+ mScrimController.setKeyguardOccluded(occluded);
updateHideIconsForBouncer(false /* animate */);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index f088c0b..d32c9a8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -475,6 +475,19 @@
Assert.assertTrue("Should be focusable on keyguard", mScrimInFront.isFocusable());
}
+ @Test
+ public void testHidesShowWhenLockedActivity() {
+ mScrimController.setWallpaperSupportsAmbientMode(true);
+ mScrimController.setKeyguardOccluded(true);
+ mScrimController.transitionTo(ScrimState.AOD);
+ mScrimController.finishAnimationsImmediately();
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+
+ mScrimController.transitionTo(ScrimState.PULSING);
+ mScrimController.finishAnimationsImmediately();
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ }
+
/**
* Conserves old notification density after leaving state and coming back.
*
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index 14baaeb..f13fa4e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -30,6 +30,7 @@
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -547,6 +548,16 @@
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
}
+ @Test
+ public void testSetOccluded_propagatesToScrimController() {
+ mStatusBar.setOccluded(true);
+ verify(mScrimController).setKeyguardOccluded(eq(true));
+
+ reset(mScrimController);
+ mStatusBar.setOccluded(false);
+ verify(mScrimController).setKeyguardOccluded(eq(false));
+ }
+
static class TestableStatusBar extends StatusBar {
public TestableStatusBar(StatusBarKeyguardViewManager man,
UnlockMethodCache unlock, KeyguardIndicationController key,
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 9ef84d2..c036549 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1649,16 +1649,7 @@
// Check if volume update should be send to Hearing Aid
if ((device & AudioSystem.DEVICE_OUT_HEARING_AID) != 0) {
- synchronized (mHearingAidLock) {
- if (mHearingAid != null) {
- //hearing aid expect volume value in range -128dB to 0dB
- int gainDB = (int)AudioSystem.getStreamVolumeDB(streamType, newIndex/10,
- AudioSystem.DEVICE_OUT_HEARING_AID);
- if (gainDB < BT_HEARING_AID_GAIN_MIN)
- gainDB = BT_HEARING_AID_GAIN_MIN;
- mHearingAid.setVolume(gainDB);
- }
- }
+ setHearingAidVolume(newIndex);
}
// Check if volume update should be sent to Hdmi system audio.
@@ -1907,16 +1898,7 @@
}
if ((device & AudioSystem.DEVICE_OUT_HEARING_AID) != 0) {
- synchronized (mHearingAidLock) {
- if (mHearingAid != null) {
- //hearing aid expect volume value in range -128dB to 0dB
- int gainDB = (int)AudioSystem.getStreamVolumeDB(streamType, index/10, AudioSystem.DEVICE_OUT_HEARING_AID);
- if (gainDB < BT_HEARING_AID_GAIN_MIN)
- gainDB = BT_HEARING_AID_GAIN_MIN;
- mHearingAid.setVolume(gainDB);
-
- }
- }
+ setHearingAidVolume(index);
}
if (streamTypeAlias == AudioSystem.STREAM_MUSIC) {
@@ -5624,8 +5606,24 @@
makeDeviceListKey(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, address));
}
+ private void setHearingAidVolume(int index) {
+ synchronized (mHearingAidLock) {
+ if (mHearingAid != null) {
+ //hearing aid expect volume value in range -128dB to 0dB
+ int gainDB = (int)AudioSystem.getStreamVolumeDB(AudioSystem.STREAM_MUSIC, index/10,
+ AudioSystem.DEVICE_OUT_HEARING_AID);
+ if (gainDB < BT_HEARING_AID_GAIN_MIN)
+ gainDB = BT_HEARING_AID_GAIN_MIN;
+ mHearingAid.setVolume(gainDB);
+ }
+ }
+ }
+
// must be called synchronized on mConnectedDevices
private void makeHearingAidDeviceAvailable(String address, String name, String eventSource) {
+ int index = mStreamStates[AudioSystem.STREAM_MUSIC].getIndex(AudioSystem.DEVICE_OUT_HEARING_AID);
+ setHearingAidVolume(index);
+
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_HEARING_AID,
AudioSystem.DEVICE_STATE_AVAILABLE, address, name);
mConnectedDevices.put(
diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
index ad2fabb..235f63e 100644
--- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -29,6 +29,7 @@
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.Rect;
+import android.os.IBinder;
import android.util.Slog;
import android.util.proto.ProtoOutputStream;
import android.view.Display;
@@ -268,15 +269,23 @@
.build();
// capture a screenshot into the surface we just created
- Surface sur = new Surface();
- sur.copyFrom(mSurfaceControl);
// TODO(multidisplay): we should use the proper display
- SurfaceControl.screenshot(SurfaceControl.getBuiltInDisplay(
- SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN), sur);
- t.setLayer(mSurfaceControl, SCREEN_FREEZE_LAYER_SCREENSHOT);
- t.setAlpha(mSurfaceControl, 0);
- t.show(mSurfaceControl);
- sur.destroy();
+ final int displayId = SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN;
+ final IBinder displayHandle = SurfaceControl.getBuiltInDisplay(displayId);
+ // This null check below is to guard a race condition where WMS didn't have a chance to
+ // respond to display disconnection before handling rotation , that surfaceflinger may
+ // return a null handle here because it doesn't think that display is valid anymore.
+ if (displayHandle != null) {
+ Surface sur = new Surface();
+ sur.copyFrom(mSurfaceControl);
+ SurfaceControl.screenshot(displayHandle, sur);
+ t.setLayer(mSurfaceControl, SCREEN_FREEZE_LAYER_SCREENSHOT);
+ t.setAlpha(mSurfaceControl, 0);
+ t.show(mSurfaceControl);
+ sur.destroy();
+ } else {
+ Slog.w(TAG, "Built-in display " + displayId + " is null.");
+ }
} catch (OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate freeze surface", e);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 7dff667..c1300b3 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1455,7 +1455,6 @@
* {@hide}
*/
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public int getCurrentPhoneType() {
return getCurrentPhoneType(getSubId());
}
@@ -1471,17 +1470,7 @@
* @hide
*/
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public int getCurrentPhoneType(int subId) {
- return getCurrentPhoneType(subId, false);
- }
-
- /**
- * getCurrentPhoneType() with optional check if device is voice capable.
- *
- * @hide
- */
- public int getCurrentPhoneType(int subId, boolean checkIsVoiceCapable) {
int phoneId;
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
// if we don't have any sims, we don't have subscriptions, but we
@@ -1490,7 +1479,8 @@
} else {
phoneId = SubscriptionManager.getPhoneId(subId);
}
- return getCurrentPhoneTypeForSlot(phoneId, checkIsVoiceCapable);
+
+ return getCurrentPhoneTypeForSlot(phoneId);
}
/**
@@ -1498,15 +1488,11 @@
*
* @hide
*/
- public int getCurrentPhoneTypeForSlot(int slotIndex, boolean checkIsVoiceCapable) {
+ public int getCurrentPhoneTypeForSlot(int slotIndex) {
try{
ITelephony telephony = getITelephony();
if (telephony != null) {
- if (checkIsVoiceCapable) {
- return telephony.getVoiceCapableActivePhoneTypeForSlot(slotIndex);
- } else {
- return telephony.getActivePhoneTypeForSlot(slotIndex);
- }
+ return telephony.getActivePhoneTypeForSlot(slotIndex);
} else {
// This can happen when the ITelephony interface is not up yet.
return getPhoneTypeFromProperty(slotIndex);
@@ -1532,7 +1518,10 @@
* @see #PHONE_TYPE_SIP
*/
public int getPhoneType() {
- return getCurrentPhoneType(getSubId(), true);
+ if (!isVoiceCapable()) {
+ return PHONE_TYPE_NONE;
+ }
+ return getCurrentPhoneType();
}
private int getPhoneTypeFromProperty() {
@@ -5842,14 +5831,12 @@
/** @hide */
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public List<String> getCarrierPackageNamesForIntent(Intent intent) {
return getCarrierPackageNamesForIntentAndPhone(intent, getPhoneId());
}
/** @hide */
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) {
try {
ITelephony telephony = getITelephony();
@@ -5959,11 +5946,7 @@
}
}
- /**
- * @deprecated Use {@link android.telecom.TelecomManager#isInCall} instead
- * @hide
- */
- @Deprecated
+ /** @hide */
@SystemApi
@RequiresPermission(anyOf = {
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
@@ -5980,11 +5963,7 @@
return false;
}
- /**
- * @deprecated Use {@link android.telecom.TelecomManager#isRinging} instead
- * @hide
- */
- @Deprecated
+ /** @hide */
@SystemApi
@RequiresPermission(anyOf = {
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
@@ -6001,11 +5980,7 @@
return false;
}
- /**
- * @deprecated Use {@link android.telecom.TelecomManager#isInCall} instead
- * @hide
- */
- @Deprecated
+ /** @hide */
@SystemApi
@RequiresPermission(anyOf = {
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
@@ -6022,11 +5997,7 @@
return true;
}
- /**
- * @deprecated Use {@link android.telephony.TelephonyManager#getServiceState} instead
- * @hide
- */
- @Deprecated
+ /** @hide */
@SystemApi
@RequiresPermission(anyOf = {
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
@@ -6317,7 +6288,6 @@
/** @hide */
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isDataConnectivityPossible() {
try {
ITelephony telephony = getITelephony();
@@ -6332,7 +6302,6 @@
/** @hide */
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean needsOtaServiceProvisioning() {
try {
ITelephony telephony = getITelephony();
@@ -6435,7 +6404,10 @@
/** @hide */
@SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+ android.Manifest.permission.READ_PHONE_STATE
+ })
public boolean isVideoCallingEnabled() {
try {
ITelephony telephony = getITelephony();
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 23b4dc0..fbb69ad 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -375,8 +375,6 @@
/**
* Report whether data connectivity is possible.
- *
- * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
*/
boolean isDataConnectivityPossible(int subId);
@@ -415,25 +413,11 @@
* Returns the current active phone type as integer for particular slot.
* Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
* and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
- *
- * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
- *
* @param slotIndex - slot to query.
*/
int getActivePhoneTypeForSlot(int slotIndex);
/**
- * Returns the current active phone type as integer for particular slot.
- * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
- * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
- *
- * If the device is not voice-capable, return PHONE_TYPE_NONE
- *
- * @param slotIndex - slot to query.
- */
- int getVoiceCapableActivePhoneTypeForSlot(int slotIndex);
-
- /**
* Returns the CDMA ERI icon index to display
* @param callingPackage package making the call.
*/
@@ -480,8 +464,6 @@
* Returns true if OTA service provisioning needs to run.
* Only relevant on some technologies, others will always
* return false.
- *
- * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
*/
boolean needsOtaServiceProvisioning();
@@ -994,8 +976,6 @@
* Returns list of the package names of the carrier apps that should handle the input intent
* and have carrier privileges for the given phoneId.
*
- * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
- *
* @param intent Intent that will be sent.
* @param phoneId The phoneId on which the carrier app has carrier privileges.
* @return list of carrier app package names that can handle the intent on phoneId.
@@ -1120,8 +1100,6 @@
/**
* Whether video calling has been enabled by the user.
*
- * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE
- *
* @param callingPackage The package making the call.
* @return {@code true} if the user has enabled video calling, {@code false} otherwise.
*/
diff --git a/tools/stats_log_api_gen/Collation.cpp b/tools/stats_log_api_gen/Collation.cpp
index ab106d7..ebdcdfd 100644
--- a/tools/stats_log_api_gen/Collation.cpp
+++ b/tools/stats_log_api_gen/Collation.cpp
@@ -46,7 +46,8 @@
message(that.message),
fields(that.fields),
primaryFields(that.primaryFields),
- exclusiveField(that.exclusiveField) {}
+ exclusiveField(that.exclusiveField),
+ uidField(that.uidField) {}
AtomDecl::AtomDecl(int c, const string& n, const string& m)
:code(c),
@@ -262,6 +263,18 @@
errorCount++;
}
}
+
+ if (field->options().GetExtension(os::statsd::is_uid) == true) {
+ if (javaType != JAVA_TYPE_INT) {
+ errorCount++;
+ }
+
+ if (atomDecl->uidField == 0) {
+ atomDecl->uidField = it->first;
+ } else {
+ errorCount++;
+ }
+ }
}
return errorCount;
diff --git a/tools/stats_log_api_gen/Collation.h b/tools/stats_log_api_gen/Collation.h
index edba3e2..5d2c302 100644
--- a/tools/stats_log_api_gen/Collation.h
+++ b/tools/stats_log_api_gen/Collation.h
@@ -84,6 +84,8 @@
vector<int> primaryFields;
int exclusiveField = 0;
+ int uidField = 0;
+
AtomDecl();
AtomDecl(const AtomDecl& that);
AtomDecl(int code, const string& name, const string& message);
diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp
index d58c223..300c701 100644
--- a/tools/stats_log_api_gen/main.cpp
+++ b/tools/stats_log_api_gen/main.cpp
@@ -113,6 +113,98 @@
fprintf(out, "// the single event tag id for all stats logs\n");
fprintf(out, "const static int kStatsEventTag = 1937006964;\n");
+ std::set<string> kTruncatingAtomNames = {"mobile_radio_power_state_changed",
+ "audio_state_changed",
+ "call_state_changed",
+ "phone_signal_strength_changed",
+ "mobile_bytes_transfer_by_fg_bg",
+ "mobile_bytes_transfer"};
+ fprintf(out,
+ "const std::set<int> "
+ "AtomsInfo::kNotTruncatingTimestampAtomWhiteList = {\n");
+ for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
+ atom != atoms.decls.end(); atom++) {
+ if (kTruncatingAtomNames.find(atom->name) ==
+ kTruncatingAtomNames.end()) {
+ string constant = make_constant_name(atom->name);
+ fprintf(out, " %s,\n", constant.c_str());
+ }
+ }
+ fprintf(out, "};\n");
+ fprintf(out, "\n");
+
+ fprintf(out,
+ "const std::set<int> AtomsInfo::kAtomsWithAttributionChain = {\n");
+ for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
+ atom != atoms.decls.end(); atom++) {
+ for (vector<AtomField>::const_iterator field = atom->fields.begin();
+ field != atom->fields.end(); field++) {
+ if (field->javaType == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ string constant = make_constant_name(atom->name);
+ fprintf(out, " %s,\n", constant.c_str());
+ break;
+ }
+ }
+ }
+ fprintf(out, "};\n");
+ fprintf(out, "\n");
+
+ fprintf(out,
+ "static std::map<int, int> "
+ "getAtomUidField() {\n");
+ fprintf(out, " std::map<int, int> uidField;\n");
+ for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
+ atom != atoms.decls.end(); atom++) {
+ if (atom->uidField == 0) {
+ continue;
+ }
+ fprintf(out,
+ "\n // Adding uid field for atom "
+ "(%d)%s\n",
+ atom->code, atom->name.c_str());
+ fprintf(out, " uidField[static_cast<int>(%s)] = %d;\n",
+ make_constant_name(atom->name).c_str(), atom->uidField);
+ }
+
+ fprintf(out, " return uidField;\n");
+ fprintf(out, "};\n");
+
+ fprintf(out,
+ "const std::map<int, int> AtomsInfo::kAtomsWithUidField = "
+ "getAtomUidField();\n");
+
+ fprintf(out,
+ "static std::map<int, StateAtomFieldOptions> "
+ "getStateAtomFieldOptions() {\n");
+ fprintf(out, " std::map<int, StateAtomFieldOptions> options;\n");
+ fprintf(out, " StateAtomFieldOptions opt;\n");
+ for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
+ atom != atoms.decls.end(); atom++) {
+ if (atom->primaryFields.size() == 0 && atom->exclusiveField == 0) {
+ continue;
+ }
+ fprintf(out,
+ "\n // Adding primary and exclusive fields for atom "
+ "(%d)%s\n",
+ atom->code, atom->name.c_str());
+ fprintf(out, " opt.primaryFields.clear();\n");
+ for (const auto& field : atom->primaryFields) {
+ fprintf(out, " opt.primaryFields.push_back(%d);\n", field);
+ }
+
+ fprintf(out, " opt.exclusiveField = %d;\n", atom->exclusiveField);
+ fprintf(out, " options[static_cast<int>(%s)] = opt;\n",
+ make_constant_name(atom->name).c_str());
+ }
+
+ fprintf(out, " return options;\n");
+ fprintf(out, " }\n");
+
+ fprintf(out,
+ "const std::map<int, StateAtomFieldOptions> "
+ "AtomsInfo::kStateAtomsFieldOptions = "
+ "getStateAtomFieldOptions();\n");
+
// Print write methods
fprintf(out, "\n");
for (set<vector<java_type_t>>::const_iterator signature = atoms.signatures.begin();
@@ -366,89 +458,26 @@
fprintf(out, "};\n");
fprintf(out, "\n");
- std::set<string> kTruncatingAtomNames =
- { "mobile_radio_power_state_changed", "audio_state_changed", "call_state_changed",
- "phone_signal_strength_changed", "mobile_bytes_transfer_by_fg_bg",
- "mobile_bytes_transfer"};
- fprintf(out, "const static std::set<int> kNotTruncatingTimestampAtomWhiteList = {\n");
- for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
- atom != atoms.decls.end(); atom++) {
- if (kTruncatingAtomNames.find(atom->name) == kTruncatingAtomNames.end()) {
- string constant = make_constant_name(atom->name);
- fprintf(out, " %s,\n", constant.c_str());
- }
- }
- fprintf(out, "};\n");
- fprintf(out, "\n");
-
- fprintf(out, "const static std::set<int> kAtomsWithUidField = {\n");
- for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
- atom != atoms.decls.end(); atom++) {
- for (vector<AtomField>::const_iterator field = atom->fields.begin();
- field != atom->fields.end(); field++) {
- if (field->name == "uid") {
- string constant = make_constant_name(atom->name);
- fprintf(out, " %s,\n", constant.c_str());
- break;
- }
- }
- }
- fprintf(out, "};\n");
- fprintf(out, "\n");
-
- fprintf(out, "const static std::set<int> kAtomsWithAttributionChain = {\n");
- for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
- atom != atoms.decls.end(); atom++) {
- for (vector<AtomField>::const_iterator field = atom->fields.begin();
- field != atom->fields.end(); field++) {
- if (field->javaType == JAVA_TYPE_ATTRIBUTION_CHAIN) {
- string constant = make_constant_name(atom->name);
- fprintf(out, " %s,\n", constant.c_str());
- break;
- }
- }
- }
- fprintf(out, "};\n");
- fprintf(out, "\n");
-
- fprintf(out, "const static int kMaxPushedAtomId = %d;\n\n", maxPushedAtomId);
-
fprintf(out, "struct StateAtomFieldOptions {\n");
fprintf(out, " std::vector<int> primaryFields;\n");
fprintf(out, " int exclusiveField;\n");
+ fprintf(out, "};\n");
fprintf(out, "\n");
+
+ fprintf(out, "struct AtomsInfo {\n");
fprintf(out,
- " static std::map<int, StateAtomFieldOptions> "
- "getStateAtomFieldOptions() {\n");
- fprintf(out, " std::map<int, StateAtomFieldOptions> options;\n");
- fprintf(out, " StateAtomFieldOptions opt;\n");
- for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
- atom != atoms.decls.end(); atom++) {
- if (atom->primaryFields.size() == 0 && atom->exclusiveField == 0) {
- continue;
- }
- fprintf(out,
- "\n // Adding primary and exclusive fields for atom "
- "(%d)%s\n",
- atom->code, atom->name.c_str());
- fprintf(out, " opt.primaryFields.clear();\n");
- for (const auto& field : atom->primaryFields) {
- fprintf(out, " opt.primaryFields.push_back(%d);\n", field);
- }
-
- fprintf(out, " opt.exclusiveField = %d;\n", atom->exclusiveField);
- fprintf(out, " options[static_cast<int>(%s)] = opt;\n",
- make_constant_name(atom->name).c_str());
- }
-
- fprintf(out, " return options;\n");
- fprintf(out, " }\n");
+ " const static std::set<int> "
+ "kNotTruncatingTimestampAtomWhiteList;\n");
+ fprintf(out, " const static std::map<int, int> kAtomsWithUidField;\n");
+ fprintf(out,
+ " const static std::set<int> kAtomsWithAttributionChain;\n");
+ fprintf(out,
+ " const static std::map<int, StateAtomFieldOptions> "
+ "kStateAtomsFieldOptions;\n");
fprintf(out, "};\n");
- fprintf(out,
- "const static std::map<int, StateAtomFieldOptions> "
- "kStateAtomsFieldOptions = "
- "StateAtomFieldOptions::getStateAtomFieldOptions();\n");
+ fprintf(out, "const static int kMaxPushedAtomId = %d;\n\n",
+ maxPushedAtomId);
// Print write methods
fprintf(out, "//\n");
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 309bc80..2f7b50d 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -28,7 +28,6 @@
import android.net.wifi.ISoftApCallback;
import android.net.wifi.PasspointManagementObjectDefinition;
import android.net.wifi.ScanResult;
-import android.net.wifi.ScanSettings;
import android.net.wifi.WifiActivityEnergyInfo;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
@@ -86,7 +85,7 @@
boolean disableNetwork(int netId, String packageName);
- void startScan(in ScanSettings requested, in WorkSource ws, String packageName);
+ void startScan(String packageName);
List<ScanResult> getScanResults(String callingPackage);
diff --git a/wifi/java/android/net/wifi/ScanSettings.aidl b/wifi/java/android/net/wifi/ScanSettings.aidl
deleted file mode 100644
index ebd2a39..0000000
--- a/wifi/java/android/net/wifi/ScanSettings.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) 2014, 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 android.net.wifi;
-
-parcelable ScanSettings;
diff --git a/wifi/java/android/net/wifi/ScanSettings.java b/wifi/java/android/net/wifi/ScanSettings.java
deleted file mode 100644
index 094ce34..0000000
--- a/wifi/java/android/net/wifi/ScanSettings.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2014, 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 android.net.wifi;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * Bundle of customized scan settings
- *
- * @see WifiManager#startCustomizedScan
- *
- * @hide
- */
-public class ScanSettings implements Parcelable {
-
- /** channel set to scan. this can be null or empty, indicating a full scan */
- public Collection<WifiChannel> channelSet;
-
- /** public constructor */
- public ScanSettings() { }
-
- /** copy constructor */
- public ScanSettings(ScanSettings source) {
- if (source.channelSet != null)
- channelSet = new ArrayList<WifiChannel>(source.channelSet);
- }
-
- /** check for validity */
- public boolean isValid() {
- for (WifiChannel channel : channelSet)
- if (!channel.isValid()) return false;
- return true;
- }
-
- /** implement Parcelable interface */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** implement Parcelable interface */
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(channelSet == null ? 0 : channelSet.size());
- if (channelSet != null)
- for (WifiChannel channel : channelSet) channel.writeToParcel(out, flags);
- }
-
- /** implement Parcelable interface */
- public static final Parcelable.Creator<ScanSettings> CREATOR =
- new Parcelable.Creator<ScanSettings>() {
- @Override
- public ScanSettings createFromParcel(Parcel in) {
- ScanSettings settings = new ScanSettings();
- int size = in.readInt();
- if (size > 0) {
- settings.channelSet = new ArrayList<WifiChannel>(size);
- while (size-- > 0)
- settings.channelSet.add(WifiChannel.CREATOR.createFromParcel(in));
- }
- return settings;
- }
-
- @Override
- public ScanSettings[] newArray(int size) {
- return new ScanSettings[size];
- }
- };
-}
diff --git a/wifi/java/android/net/wifi/WifiChannel.java b/wifi/java/android/net/wifi/WifiChannel.java
deleted file mode 100644
index 640481e..0000000
--- a/wifi/java/android/net/wifi/WifiChannel.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2014, 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 android.net.wifi;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Wifi Channel
- *
- * @see ScanSettings
- *
- * @hide
- */
-public class WifiChannel implements Parcelable {
-
- private static final int MIN_FREQ_MHZ = 2412;
- private static final int MAX_FREQ_MHZ = 5825;
-
- private static final int MIN_CHANNEL_NUM = 1;
- private static final int MAX_CHANNEL_NUM = 196;
-
- /** frequency */
- public int freqMHz;
-
- /** channel number */
- public int channelNum;
-
- /** is it a DFS channel? */
- public boolean isDFS;
-
- /** public constructor */
- public WifiChannel() { }
-
- /** check for validity */
- public boolean isValid() {
- if (freqMHz < MIN_FREQ_MHZ || freqMHz > MAX_FREQ_MHZ) return false;
- if (channelNum < MIN_CHANNEL_NUM || channelNum > MAX_CHANNEL_NUM) return false;
- return true;
- }
-
- /** implement Parcelable interface */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** implement Parcelable interface */
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(freqMHz);
- out.writeInt(channelNum);
- out.writeInt(isDFS ? 1 : 0);
- }
-
- /** implement Parcelable interface */
- public static final Parcelable.Creator<WifiChannel> CREATOR =
- new Parcelable.Creator<WifiChannel>() {
- @Override
- public WifiChannel createFromParcel(Parcel in) {
- WifiChannel channel = new WifiChannel();
- channel.freqMHz = in.readInt();
- channel.channelNum = in.readInt();
- channel.isDFS = in.readInt() != 0;
- return channel;
- }
-
- @Override
- public WifiChannel[] newArray(int size) {
- return new WifiChannel[size];
- }
- };
-}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index d2cdf8d..c8df087 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1634,7 +1634,7 @@
public boolean startScan(WorkSource workSource) {
try {
String packageName = mContext.getOpPackageName();
- mService.startScan(null, workSource, packageName);
+ mService.startScan(packageName);
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();