Merge "The quietening round 2 part 1"
diff --git a/Android.bp b/Android.bp
index e825610..37643aa 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1574,6 +1574,7 @@
metalava_previous_api: ":public-api-for-metalava-annotations",
metalava_merge_annotations_dirs: [
"metalava-manual",
+ "ojluni-annotated-stubs",
],
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 5766a4c..6a11e00 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5945,6 +5945,7 @@
field public static final int CODE_SIP_SERVER_TIMEOUT = 353; // 0x161
field public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352; // 0x160
field public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336; // 0x150
+ field public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343; // 0x157
field public static final int CODE_SIP_USER_REJECTED = 361; // 0x169
field public static final int CODE_SUPP_SVC_CANCELLED = 1202; // 0x4b2
field public static final int CODE_SUPP_SVC_FAILED = 1201; // 0x4b1
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index 61c185f..ba2aaad8 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -45,7 +45,6 @@
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 \
@@ -194,7 +193,6 @@
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 \
diff --git a/cmds/statsd/src/StatsLogProcessor.cpp b/cmds/statsd/src/StatsLogProcessor.cpp
index ab0aa25..8e02f9c 100644
--- a/cmds/statsd/src/StatsLogProcessor.cpp
+++ b/cmds/statsd/src/StatsLogProcessor.cpp
@@ -161,10 +161,6 @@
}
}
-void StatsLogProcessor::OnLogEvent(LogEvent* event) {
- OnLogEvent(event, false);
-}
-
void StatsLogProcessor::resetConfigs() {
std::lock_guard<std::mutex> lock(mMetricsMutex);
resetConfigsLocked(getElapsedRealtimeNs());
@@ -178,7 +174,7 @@
resetConfigsLocked(timestampNs, configKeys);
}
-void StatsLogProcessor::OnLogEvent(LogEvent* event, bool reconnected) {
+void StatsLogProcessor::OnLogEvent(LogEvent* event) {
std::lock_guard<std::mutex> lock(mMetricsMutex);
#ifdef VERY_VERBOSE_PRINTING
@@ -188,41 +184,6 @@
#endif
const int64_t currentTimestampNs = event->GetElapsedTimestampNs();
- if (reconnected && mLastTimestampSeen != 0) {
- // LogReader tells us the connection has just been reset. Now we need
- // to enter reconnection state to find the last CP.
- mInReconnection = true;
- }
-
- if (mInReconnection) {
- // We see the checkpoint
- if (currentTimestampNs == mLastTimestampSeen) {
- mInReconnection = false;
- // Found the CP. ignore this event, and we will start to read from next event.
- return;
- }
- if (currentTimestampNs > mLargestTimestampSeen) {
- // We see a new log but CP has not been found yet. Give up now.
- mLogLossCount++;
- mInReconnection = false;
- StatsdStats::getInstance().noteLogLost(currentTimestampNs);
- // Persist the data before we reset. Do we want this?
- WriteDataToDiskLocked(CONFIG_RESET);
- // We see fresher event before we see the checkpoint. We might have lost data.
- // The best we can do is to reset.
- resetConfigsLocked(currentTimestampNs);
- } else {
- // Still in search of the CP. Keep going.
- return;
- }
- }
-
- mLogCount++;
- mLastTimestampSeen = currentTimestampNs;
- if (mLargestTimestampSeen < currentTimestampNs) {
- mLargestTimestampSeen = currentTimestampNs;
- }
-
resetIfConfigTtlExpiredLocked(currentTimestampNs);
StatsdStats::getInstance().noteAtomLogged(
diff --git a/cmds/statsd/src/StatsLogProcessor.h b/cmds/statsd/src/StatsLogProcessor.h
index 05cf0c1..df80b8e 100644
--- a/cmds/statsd/src/StatsLogProcessor.h
+++ b/cmds/statsd/src/StatsLogProcessor.h
@@ -18,7 +18,6 @@
#include <gtest/gtest_prod.h>
#include "config/ConfigListener.h"
-#include "logd/LogReader.h"
#include "metrics/MetricsManager.h"
#include "packages/UidMap.h"
#include "external/StatsPullerManager.h"
@@ -52,9 +51,6 @@
const std::function<bool(const ConfigKey&)>& sendBroadcast);
virtual ~StatsLogProcessor();
- void OnLogEvent(LogEvent* event, bool reconnectionStarts);
-
- // for testing only.
void OnLogEvent(LogEvent* event);
void OnConfigUpdated(const int64_t timestampNs, const ConfigKey& key,
@@ -174,14 +170,6 @@
int64_t mLastTimestampSeen = 0;
- bool mInReconnection = false;
-
- // Processed log count
- uint64_t mLogCount = 0;
-
- // Log loss detected count
- int mLogLossCount = 0;
-
long mLastPullerCacheClearTimeSec = 0;
#ifdef VERY_VERBOSE_PRINTING
diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp
index 0c241fc..91d68ea 100644
--- a/cmds/statsd/src/StatsService.cpp
+++ b/cmds/statsd/src/StatsService.cpp
@@ -883,8 +883,8 @@
mConfigManager->Startup();
}
-void StatsService::OnLogEvent(LogEvent* event, bool reconnectionStarts) {
- mProcessor->OnLogEvent(event, reconnectionStarts);
+void StatsService::OnLogEvent(LogEvent* event) {
+ mProcessor->OnLogEvent(event);
}
Status StatsService::getData(int64_t key, const String16& packageName, vector<uint8_t>* output) {
diff --git a/cmds/statsd/src/StatsService.h b/cmds/statsd/src/StatsService.h
index ed90050..613f509 100644
--- a/cmds/statsd/src/StatsService.h
+++ b/cmds/statsd/src/StatsService.h
@@ -22,6 +22,7 @@
#include "anomaly/AlarmMonitor.h"
#include "config/ConfigManager.h"
#include "external/StatsPullerManager.h"
+#include "logd/LogListener.h"
#include "packages/UidMap.h"
#include "statscompanion_util.h"
@@ -75,7 +76,7 @@
/**
* Called by LogReader when there's a log event to process.
*/
- virtual void OnLogEvent(LogEvent* event, bool reconnectionStarts);
+ virtual void OnLogEvent(LogEvent* event);
/**
* Binder call for clients to request data for this configuration key.
diff --git a/cmds/statsd/src/config/ConfigManager.h b/cmds/statsd/src/config/ConfigManager.h
index 611c342..122e669 100644
--- a/cmds/statsd/src/config/ConfigManager.h
+++ b/cmds/statsd/src/config/ConfigManager.h
@@ -31,9 +31,6 @@
namespace os {
namespace statsd {
-// Util function to build a hard coded config with test metrics.
-StatsdConfig build_fake_config();
-
/**
* Keeps track of which configurations have been set from various sources.
*/
diff --git a/cmds/statsd/src/guardrail/StatsdStats.cpp b/cmds/statsd/src/guardrail/StatsdStats.cpp
index a955511..c37d0cf 100644
--- a/cmds/statsd/src/guardrail/StatsdStats.cpp
+++ b/cmds/statsd/src/guardrail/StatsdStats.cpp
@@ -180,12 +180,12 @@
noteConfigResetInternalLocked(key);
}
-void StatsdStats::noteLogLost(int64_t timestampNs) {
+void StatsdStats::noteLogLost(int64_t timestampNs, int32_t count) {
lock_guard<std::mutex> lock(mLock);
if (mLogLossTimestampNs.size() == kMaxLoggerErrors) {
mLogLossTimestampNs.pop_front();
}
- mLogLossTimestampNs.push_back(timestampNs);
+ mLogLossTimestampNs.push_back(std::make_pair(timestampNs, count));
}
void StatsdStats::noteBroadcastSent(const ConfigKey& key) {
@@ -529,7 +529,8 @@
}
for (const auto& loss : mLogLossTimestampNs) {
- fprintf(out, "Log loss detected at %lld (elapsedRealtimeNs)\n", (long long)loss);
+ fprintf(out, "Log loss: %lld (elapsedRealtimeNs) - %d (count)\n", (long long)loss.first,
+ loss.second);
}
}
@@ -687,7 +688,7 @@
for (const auto& loss : mLogLossTimestampNs) {
proto.write(FIELD_TYPE_INT64 | FIELD_ID_LOG_LOSS_STATS | FIELD_COUNT_REPEATED,
- (long long)loss);
+ (long long)loss.first);
}
for (const auto& restart : mSystemServerRestartSec) {
diff --git a/cmds/statsd/src/guardrail/StatsdStats.h b/cmds/statsd/src/guardrail/StatsdStats.h
index 9fb2cd8..daea027 100644
--- a/cmds/statsd/src/guardrail/StatsdStats.h
+++ b/cmds/statsd/src/guardrail/StatsdStats.h
@@ -284,7 +284,7 @@
/**
* Records statsd skipped an event.
*/
- void noteLogLost(int64_t timestamp);
+ void noteLogLost(int64_t timestamp, int32_t count);
/**
* Reset the historical stats. Including all stats in icebox, and the tracked stats about
@@ -341,8 +341,8 @@
// Logd errors. Size capped by kMaxLoggerErrors.
std::list<const std::pair<int, int>> mLoggerErrors;
- // Timestamps when we detect log loss after logd reconnect.
- std::list<int64_t> mLogLossTimestampNs;
+ // Timestamps when we detect log loss, and the number of logs lost.
+ std::list<std::pair<int64_t, int32_t>> mLogLossTimestampNs;
std::list<int32_t> mSystemServerRestartSec;
diff --git a/cmds/statsd/src/logd/LogListener.cpp b/cmds/statsd/src/logd/LogListener.cpp
index 6ac7978..ddb26f9 100644
--- a/cmds/statsd/src/logd/LogListener.cpp
+++ b/cmds/statsd/src/logd/LogListener.cpp
@@ -14,17 +14,7 @@
* limitations under the License.
*/
-#include "logd/LogReader.h"
-
-#include <log/log_read.h>
-
-#include <utils/Errors.h>
-
-#include <time.h>
-#include <unistd.h>
-
-using namespace android;
-using namespace std;
+#include "logd/LogListener.h"
namespace android {
namespace os {
diff --git a/cmds/statsd/src/logd/LogListener.h b/cmds/statsd/src/logd/LogListener.h
index f924040..d8b06e9 100644
--- a/cmds/statsd/src/logd/LogListener.h
+++ b/cmds/statsd/src/logd/LogListener.h
@@ -19,7 +19,6 @@
#include "logd/LogEvent.h"
#include <utils/RefBase.h>
-#include <vector>
namespace android {
namespace os {
@@ -33,7 +32,7 @@
LogListener();
virtual ~LogListener();
- virtual void OnLogEvent(LogEvent* msg, bool reconnectionStarts) = 0;
+ virtual void OnLogEvent(LogEvent* msg) = 0;
};
} // namespace statsd
diff --git a/cmds/statsd/src/logd/LogReader.cpp b/cmds/statsd/src/logd/LogReader.cpp
deleted file mode 100644
index 26ae6a3..0000000
--- a/cmds/statsd/src/logd/LogReader.cpp
+++ /dev/null
@@ -1,129 +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.
- */
-
-#include "logd/LogReader.h"
-
-#include "guardrail/StatsdStats.h"
-
-#include <time.h>
-#include <unistd.h>
-#include <utils/Errors.h>
-
-using namespace android;
-using namespace std;
-
-namespace android {
-namespace os {
-namespace statsd {
-
-#define SNOOZE_INITIAL_MS 100
-#define SNOOZE_MAX_MS (10 * 60 * 1000) // Ten minutes
-
-LogReader::LogReader(const sp<LogListener>& listener) : mListener(listener) {
-}
-
-LogReader::~LogReader() {
-}
-
-void LogReader::Run() {
- int nextSnoozeMs = SNOOZE_INITIAL_MS;
-
- // In an ideal world, this outer loop will only ever run one iteration, but it
- // exists to handle crashes in logd. The inner loop inside connect_and_read()
- // reads from logd forever, but if that read fails, we fall out to the outer
- // loop, do the backoff (resetting the backoff timeout if we successfully read
- // something), and then try again.
- while (true) {
- // Connect and read
- int lineCount = connect_and_read();
-
- // Figure out how long to sleep.
- if (lineCount > 0) {
- // If we managed to read at least one line, reset the backoff
- nextSnoozeMs = SNOOZE_INITIAL_MS;
- } else {
- // Otherwise, expontial backoff
- nextSnoozeMs *= 1.5f;
- if (nextSnoozeMs > 10 * 60 * 1000) {
- // Don't wait for toooo long.
- nextSnoozeMs = SNOOZE_MAX_MS;
- }
- }
-
- // Sleep
- timespec ts;
- timespec rem;
- ts.tv_sec = nextSnoozeMs / 1000;
- ts.tv_nsec = (nextSnoozeMs % 1000) * 1000000L;
- while (nanosleep(&ts, &rem) == -1) {
- if (errno == EINTR) {
- ts = rem;
- }
- // other errors are basically impossible
- }
- }
-}
-
-int LogReader::connect_and_read() {
- int lineCount = 0;
- status_t err;
- logger_list* loggers;
- logger* eventLogger;
-
- // Prepare the logging context
- loggers = android_logger_list_alloc(ANDROID_LOG_RDONLY,
- /* don't stop after N lines */ 0,
- /* no pid restriction */ 0);
-
- // Open the buffer(s)
- eventLogger = android_logger_open(loggers, LOG_ID_STATS);
-
- // Read forever
- if (eventLogger) {
- log_msg msg;
- while (true) {
- // Read a message
- err = android_logger_list_read(loggers, &msg);
- // err = 0 - no content, unexpected connection drop or EOF.
- // err = +ive number - size of retrieved data from logger
- // err = -ive number, OS supplied error _except_ for -EAGAIN
- if (err <= 0) {
- StatsdStats::getInstance().noteLoggerError(err);
- fprintf(stderr, "logcat read failure: %s\n", strerror(err));
- break;
- }
-
- // Record that we read one (used above to know how to snooze).
- lineCount++;
-
- // Wrap it in a LogEvent object
- LogEvent event(msg);
-
- // Call the listener
- mListener->OnLogEvent(&event,
- lineCount == 1 /* indicate whether it's a new connection */);
- }
- }
-
- // Free the logger list and close the individual loggers
- android_logger_list_free(loggers);
-
- return lineCount;
-}
-
-} // namespace statsd
-} // namespace os
-} // namespace android
diff --git a/cmds/statsd/src/logd/LogReader.h b/cmds/statsd/src/logd/LogReader.h
deleted file mode 100644
index c51074c..0000000
--- a/cmds/statsd/src/logd/LogReader.h
+++ /dev/null
@@ -1,69 +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.
- */
-
-#ifndef LOGREADER_H
-#define LOGREADER_H
-
-#include "logd/LogListener.h"
-
-#include <utils/RefBase.h>
-
-#include <vector>
-
-namespace android {
-namespace os {
-namespace statsd {
-
-/**
- * Class to read logs from logd.
- */
-class LogReader : public virtual android::RefBase {
-public:
- /**
- * Construct the LogReader with the event listener. (Which is StatsService)
- */
- LogReader(const sp<LogListener>& listener);
-
- /**
- * Destructor.
- */
- virtual ~LogReader();
-
- /**
- * Run the main LogReader loop
- */
- void Run();
-
-private:
- /**
- * Who is going to get the events when they're read.
- */
- sp<LogListener> mListener;
-
- /**
- * Connect to a single instance of logd, and read until there's a read error.
- * Logd can crash, exit, be killed etc.
- *
- * Returns the number of lines that were read.
- */
- int connect_and_read();
-};
-
-} // namespace statsd
-} // namespace os
-} // namespace android
-
-#endif // LOGREADER_H
diff --git a/cmds/statsd/src/main.cpp b/cmds/statsd/src/main.cpp
index 2f15d0f..9002f07 100644
--- a/cmds/statsd/src/main.cpp
+++ b/cmds/statsd/src/main.cpp
@@ -18,7 +18,6 @@
#include "Log.h"
#include "StatsService.h"
-#include "logd/LogReader.h"
#include "socket/StatsSocketListener.h"
#include <binder/IInterface.h>
@@ -39,9 +38,6 @@
using namespace android;
using namespace android::os::statsd;
-const bool kUseLogd = false;
-const bool kUseStatsdSocket = true;
-
/**
* Thread function data.
*/
@@ -49,58 +45,6 @@
sp<StatsService> service;
};
-/**
- * Thread func for where the log reader runs.
- */
-static void* log_reader_thread_func(void* cookie) {
- log_reader_thread_data* data = static_cast<log_reader_thread_data*>(cookie);
- sp<LogReader> reader = new LogReader(data->service);
-
- // Run the read loop. Never returns.
- reader->Run();
-
- ALOGW("statsd LogReader.Run() is not supposed to return.");
-
- delete data;
- return NULL;
-}
-
-/**
- * Creates and starts the thread to own the LogReader.
- */
-static status_t start_log_reader_thread(const sp<StatsService>& service) {
- status_t err;
- pthread_attr_t attr;
- pthread_t thread;
-
- // Thread data.
- std::unique_ptr<log_reader_thread_data> data = std::make_unique<log_reader_thread_data>();
- data->service = service;
-
- // Create the thread
- err = pthread_attr_init(&attr);
- if (err != NO_ERROR) {
- return err;
- }
- err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (err != NO_ERROR) {
- pthread_attr_destroy(&attr);
- return err;
- }
- err = pthread_create(&thread, &attr, log_reader_thread_func,
- static_cast<void*>(data.get()));
- if (err != NO_ERROR) {
- pthread_attr_destroy(&attr);
- return err;
- }
- // Release here rather than in pthread_create, since an error creating the
- // thread leaves `data` ownerless.
- data.release();
- pthread_attr_destroy(&attr);
-
- return NO_ERROR;
-}
-
int main(int /*argc*/, char** /*argv*/) {
// Set up the looper
sp<Looper> looper(Looper::prepare(0 /* opts */));
@@ -124,22 +68,11 @@
sp<StatsSocketListener> socketListener = new StatsSocketListener(service);
- if (kUseLogd) {
- ALOGI("using logd");
- // Start the log reader thread
- status_t err = start_log_reader_thread(service);
- if (err != NO_ERROR) {
- return 1;
- }
- }
-
- if (kUseStatsdSocket) {
ALOGI("using statsd socket");
// Backlog and /proc/sys/net/unix/max_dgram_qlen set to large value
if (socketListener->startListener(600)) {
exit(1);
}
- }
// Loop forever -- the reports run on this thread in a handler, and the
// binder calls remain responsive in their pool of one thread.
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
index fbe0b21..284c451 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
@@ -71,11 +71,14 @@
GaugeMetricProducer::GaugeMetricProducer(const ConfigKey& key, const GaugeMetric& metric,
const int conditionIndex,
const sp<ConditionWizard>& wizard, const int pullTagId,
+ const int triggerAtomId, const int atomId,
const int64_t timeBaseNs, const int64_t startTimeNs,
const sp<StatsPullerManager>& pullerManager)
: MetricProducer(metric.id(), key, timeBaseNs, conditionIndex, wizard),
mPullerManager(pullerManager),
mPullTagId(pullTagId),
+ mTriggerAtomId(triggerAtomId),
+ mAtomId(atomId),
mIsPulled(pullTagId != -1),
mMinBucketSizeNs(metric.min_bucket_size_nanos()),
mDimensionSoftLimit(StatsdStats::kAtomDimensionKeySizeLimitMap.find(pullTagId) !=
@@ -272,12 +275,12 @@
uint64_t atomsToken =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
FIELD_ID_ATOM);
- writeFieldValueTreeToStream(mTagId, *(atom.mFields), protoOutput);
+ writeFieldValueTreeToStream(mAtomId, *(atom.mFields), protoOutput);
protoOutput->end(atomsToken);
}
const bool truncateTimestamp =
android::util::AtomsInfo::kNotTruncatingTimestampAtomWhiteList.find(
- mTagId) ==
+ mAtomId) ==
android::util::AtomsInfo::kNotTruncatingTimestampAtomWhiteList.end();
for (const auto& atom : bucket.mGaugeAtoms) {
const int64_t elapsedTimestampNs = truncateTimestamp ?
@@ -410,7 +413,6 @@
return;
}
int64_t eventTimeNs = event.GetElapsedTimestampNs();
- mTagId = event.GetTagId();
if (eventTimeNs < mCurrentBucketStartTimeNs) {
VLOG("Gauge Skip event due to late arrival: %lld vs %lld", (long long)eventTimeNs,
(long long)mCurrentBucketStartTimeNs);
@@ -418,6 +420,11 @@
}
flushIfNeededLocked(eventTimeNs);
+ if (mTriggerAtomId == event.GetTagId()) {
+ pullLocked(eventTimeNs);
+ return;
+ }
+
// When gauge metric wants to randomly sample the output atom, we just simply use the first
// gauge in the given bucket.
if (mCurrentSlicedBucket->find(eventKey) != mCurrentSlicedBucket->end() &&
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.h b/cmds/statsd/src/metrics/GaugeMetricProducer.h
index cc65440..15be1d7 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.h
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.h
@@ -58,7 +58,8 @@
public:
GaugeMetricProducer(const ConfigKey& key, const GaugeMetric& gaugeMetric,
const int conditionIndex, const sp<ConditionWizard>& wizard,
- const int pullTagId, const int64_t timeBaseNs, const int64_t startTimeNs,
+ const int pullTagId, const int triggerAtomId, const int atomId,
+ const int64_t timeBaseNs, const int64_t startTimeNs,
const sp<StatsPullerManager>& pullerManager);
virtual ~GaugeMetricProducer();
@@ -115,12 +116,16 @@
void pullLocked(const int64_t timestampNs);
- int mTagId;
-
sp<StatsPullerManager> mPullerManager;
// tagId for pulled data. -1 if this is not pulled
const int mPullTagId;
+ // tagId for atoms that trigger the pulling, if any
+ const int mTriggerAtomId;
+
+ // tagId for output atom
+ const int mAtomId;
+
// if this is pulled metric
const bool mIsPulled;
@@ -169,6 +174,7 @@
FRIEND_TEST(GaugeMetricProducerTest, TestPulledWithUpgrade);
FRIEND_TEST(GaugeMetricProducerTest, TestPulledEventsAnomalyDetection);
FRIEND_TEST(GaugeMetricProducerTest, TestFirstBucket);
+ FRIEND_TEST(GaugeMetricProducerTest, TestPullOnTrigger);
};
} // namespace statsd
diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
index 16447e8..192a54b 100644
--- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define DEBUG true // STOPSHIP if true
+#define DEBUG false // STOPSHIP if true
#include "Log.h"
#include "ValueMetricProducer.h"
diff --git a/cmds/statsd/src/metrics/metrics_manager_util.cpp b/cmds/statsd/src/metrics/metrics_manager_util.cpp
index ff48d02..75d6df9 100644
--- a/cmds/statsd/src/metrics/metrics_manager_util.cpp
+++ b/cmds/statsd/src/metrics/metrics_manager_util.cpp
@@ -82,6 +82,28 @@
return true;
}
+bool handlePullMetricTriggerWithLogTrackers(
+ const int64_t trigger, const int metricIndex,
+ const vector<sp<LogMatchingTracker>>& allAtomMatchers,
+ const unordered_map<int64_t, int>& logTrackerMap,
+ unordered_map<int, std::vector<int>>& trackerToMetricMap, int& logTrackerIndex) {
+ auto logTrackerIt = logTrackerMap.find(trigger);
+ if (logTrackerIt == logTrackerMap.end()) {
+ ALOGW("cannot find the AtomMatcher \"%lld\" in config", (long long)trigger);
+ return false;
+ }
+ if (allAtomMatchers[logTrackerIt->second]->getAtomIds().size() > 1) {
+ ALOGE("AtomMatcher \"%lld\" has more than one tag ids."
+ "Trigger can only be one atom type.",
+ (long long)trigger);
+ return false;
+ }
+ logTrackerIndex = logTrackerIt->second;
+ auto& metric_list = trackerToMetricMap[logTrackerIndex];
+ metric_list.push_back(metricIndex);
+ return true;
+}
+
bool handleMetricWithConditions(
const int64_t condition, const int metricIndex,
const unordered_map<int64_t, int>& conditionTrackerMap,
@@ -502,13 +524,29 @@
}
sp<LogMatchingTracker> atomMatcher = allAtomMatchers.at(trackerIndex);
- // If it is pulled atom, it should be simple matcher with one tagId.
+ // For GaugeMetric atom, it should be simple matcher with one tagId.
if (atomMatcher->getAtomIds().size() != 1) {
return false;
}
int atomTagId = *(atomMatcher->getAtomIds().begin());
int pullTagId = statsPullerManager.PullerForMatcherExists(atomTagId) ? atomTagId : -1;
+ int triggerTrackerIndex;
+ int triggerAtomId = -1;
+ if (pullTagId != -1 && metric.has_trigger_event()) {
+ // event_trigger should be used with ALL_CONDITION_CHANGES
+ if (metric.sampling_type() != GaugeMetric::ALL_CONDITION_CHANGES) {
+ return false;
+ }
+ if (!handlePullMetricTriggerWithLogTrackers(metric.trigger_event(), metricIndex,
+ allAtomMatchers, logTrackerMap,
+ trackerToMetricMap, triggerTrackerIndex)) {
+ return false;
+ }
+ sp<LogMatchingTracker> triggerAtomMatcher = allAtomMatchers.at(triggerTrackerIndex);
+ triggerAtomId = *(triggerAtomMatcher->getAtomIds().begin());
+ }
+
int conditionIndex = -1;
if (metric.has_condition()) {
bool good = handleMetricWithConditions(
@@ -524,9 +562,9 @@
}
}
- sp<MetricProducer> gaugeProducer =
- new GaugeMetricProducer(key, metric, conditionIndex, wizard, pullTagId,
- timeBaseTimeNs, currentTimeNs, pullerManager);
+ sp<MetricProducer> gaugeProducer = new GaugeMetricProducer(
+ key, metric, conditionIndex, wizard, pullTagId, triggerAtomId, atomTagId,
+ timeBaseTimeNs, currentTimeNs, pullerManager);
allMetricProducers.push_back(gaugeProducer);
}
for (int i = 0; i < config.no_report_metric_size(); ++i) {
diff --git a/cmds/statsd/src/socket/StatsSocketListener.cpp b/cmds/statsd/src/socket/StatsSocketListener.cpp
index 0392d67..4041da7 100755
--- a/cmds/statsd/src/socket/StatsSocketListener.cpp
+++ b/cmds/statsd/src/socket/StatsSocketListener.cpp
@@ -40,6 +40,7 @@
namespace statsd {
static const int kLogMsgHeaderSize = 28;
+static const int kLibLogTag = 1006;
StatsSocketListener::StatsSocketListener(const sp<LogListener>& listener)
: SocketListener(getLogSocket(), false /*start listen*/), mListener(listener) {
@@ -99,6 +100,22 @@
char* ptr = ((char*)buffer) + sizeof(android_log_header_t);
n -= sizeof(android_log_header_t);
+ // When a log failed to write to statsd socket (e.g., due ot EBUSY), a special message would
+ // be sent to statsd when the socket communication becomes available again.
+ // The format is android_log_event_int_t with a single integer in the payload indicating the
+ // number of logs that failed. (*FORMAT MUST BE IN SYNC WITH system/core/libstats*)
+ // Note that all normal stats logs are in the format of event_list, so there won't be confusion.
+ //
+ // TODO(b/80538532): In addition to log it in StatsdStats, we should properly reset the config.
+ if (n == sizeof(android_log_event_int_t)) {
+ android_log_event_int_t* int_event = reinterpret_cast<android_log_event_int_t*>(ptr);
+ if (int_event->header.tag == kLibLogTag && int_event->payload.type == EVENT_TYPE_INT) {
+ ALOGE("Found dropped events: %d", int_event->payload.data);
+ StatsdStats::getInstance().noteLogLost(getElapsedRealtimeNs(), int_event->payload.data);
+ return true;
+ }
+ }
+
log_msg msg;
msg.entry.len = n;
@@ -111,7 +128,7 @@
LogEvent event(msg);
// Call the listener
- mListener->OnLogEvent(&event, false /*reconnected, N/A in statsd socket*/);
+ mListener->OnLogEvent(&event);
return true;
}
diff --git a/cmds/statsd/src/stats_util.h b/cmds/statsd/src/stats_util.h
index 5fcb161..cfc411f 100644
--- a/cmds/statsd/src/stats_util.h
+++ b/cmds/statsd/src/stats_util.h
@@ -17,7 +17,6 @@
#pragma once
#include "HashableDimensionKey.h"
-#include "logd/LogReader.h"
#include <unordered_map>
diff --git a/cmds/statsd/src/statsd_config.proto b/cmds/statsd/src/statsd_config.proto
index 26dfda3..d19e247 100644
--- a/cmds/statsd/src/statsd_config.proto
+++ b/cmds/statsd/src/statsd_config.proto
@@ -217,6 +217,8 @@
optional int64 what = 2;
+ optional int64 trigger_event = 12;
+
optional FieldFilter gauge_fields_filter = 3;
optional int64 condition = 4;
diff --git a/cmds/statsd/tests/StatsLogProcessor_test.cpp b/cmds/statsd/tests/StatsLogProcessor_test.cpp
index ecc57f5..b6f635c 100644
--- a/cmds/statsd/tests/StatsLogProcessor_test.cpp
+++ b/cmds/statsd/tests/StatsLogProcessor_test.cpp
@@ -238,132 +238,6 @@
EXPECT_EQ(2, report.annotation(0).field_int32());
}
-TEST(StatsLogProcessorTest, TestOutOfOrderLogs) {
- // Setup simple config key corresponding to empty config.
- sp<UidMap> m = new UidMap();
- sp<StatsPullerManager> pullerManager = new StatsPullerManager();
- sp<AlarmMonitor> anomalyAlarmMonitor;
- sp<AlarmMonitor> subscriberAlarmMonitor;
- int broadcastCount = 0;
- StatsLogProcessor p(m, pullerManager, anomalyAlarmMonitor, subscriberAlarmMonitor, 0,
- [&broadcastCount](const ConfigKey& key) {
- broadcastCount++;
- return true;
- });
-
- LogEvent event1(0, 1 /*logd timestamp*/, 1001 /*elapsedRealtime*/);
- event1.init();
-
- LogEvent event2(0, 2, 1002);
- event2.init();
-
- LogEvent event3(0, 3, 1005);
- event3.init();
-
- LogEvent event4(0, 4, 1004);
- event4.init();
-
- // <----- Reconnection happens
-
- LogEvent event5(0, 5, 999);
- event5.init();
-
- LogEvent event6(0, 6, 2000);
- event6.init();
-
- // <----- Reconnection happens
-
- LogEvent event7(0, 7, 3000);
- event7.init();
-
- // first event ever
- p.OnLogEvent(&event1, true);
- EXPECT_EQ(1UL, p.mLogCount);
- EXPECT_EQ(1001LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1001LL, p.mLastTimestampSeen);
-
- p.OnLogEvent(&event2, false);
- EXPECT_EQ(2UL, p.mLogCount);
- EXPECT_EQ(1002LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1002LL, p.mLastTimestampSeen);
-
- p.OnLogEvent(&event3, false);
- EXPECT_EQ(3UL, p.mLogCount);
- EXPECT_EQ(1005LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1005LL, p.mLastTimestampSeen);
-
- p.OnLogEvent(&event4, false);
- EXPECT_EQ(4UL, p.mLogCount);
- EXPECT_EQ(1005LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1004LL, p.mLastTimestampSeen);
- EXPECT_FALSE(p.mInReconnection);
-
- // Reconnect happens, event1 out of buffer. Read event2
- p.OnLogEvent(&event2, true);
- EXPECT_EQ(4UL, p.mLogCount);
- EXPECT_EQ(1005LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1004LL, p.mLastTimestampSeen);
- EXPECT_TRUE(p.mInReconnection);
-
- p.OnLogEvent(&event3, false);
- EXPECT_EQ(4UL, p.mLogCount);
- EXPECT_EQ(1005LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1004LL, p.mLastTimestampSeen);
- EXPECT_TRUE(p.mInReconnection);
-
- p.OnLogEvent(&event4, false);
- EXPECT_EQ(4UL, p.mLogCount);
- EXPECT_EQ(1005LL, p.mLargestTimestampSeen);
- EXPECT_EQ(1004LL, p.mLastTimestampSeen);
- EXPECT_FALSE(p.mInReconnection);
-
- // Fresh event comes.
- p.OnLogEvent(&event5, false);
- EXPECT_EQ(5UL, p.mLogCount);
- EXPECT_EQ(1005LL, p.mLargestTimestampSeen);
- EXPECT_EQ(999LL, p.mLastTimestampSeen);
-
- p.OnLogEvent(&event6, false);
- EXPECT_EQ(6UL, p.mLogCount);
- EXPECT_EQ(2000LL, p.mLargestTimestampSeen);
- EXPECT_EQ(2000LL, p.mLastTimestampSeen);
-
- // Reconnect happens, read from event4
- p.OnLogEvent(&event4, true);
- EXPECT_EQ(6UL, p.mLogCount);
- EXPECT_EQ(2000LL, p.mLargestTimestampSeen);
- EXPECT_EQ(2000LL, p.mLastTimestampSeen);
- EXPECT_TRUE(p.mInReconnection);
-
- p.OnLogEvent(&event5, false);
- EXPECT_EQ(6UL, p.mLogCount);
- EXPECT_EQ(2000LL, p.mLargestTimestampSeen);
- EXPECT_EQ(2000LL, p.mLastTimestampSeen);
- EXPECT_TRUE(p.mInReconnection);
-
- // Before we get out of reconnection state, it reconnects again.
- p.OnLogEvent(&event5, true);
- EXPECT_EQ(6UL, p.mLogCount);
- EXPECT_EQ(2000LL, p.mLargestTimestampSeen);
- EXPECT_EQ(2000LL, p.mLastTimestampSeen);
- EXPECT_TRUE(p.mInReconnection);
-
- p.OnLogEvent(&event6, false);
- EXPECT_EQ(6UL, p.mLogCount);
- EXPECT_EQ(2000LL, p.mLargestTimestampSeen);
- EXPECT_EQ(2000LL, p.mLastTimestampSeen);
- EXPECT_FALSE(p.mInReconnection);
- EXPECT_EQ(0, p.mLogLossCount);
-
- // it reconnects again. All old events are gone. We lose CP.
- p.OnLogEvent(&event7, true);
- EXPECT_EQ(7UL, p.mLogCount);
- EXPECT_EQ(3000LL, p.mLargestTimestampSeen);
- EXPECT_EQ(3000LL, p.mLastTimestampSeen);
- EXPECT_EQ(1, p.mLogLossCount);
- EXPECT_FALSE(p.mInReconnection);
-}
-
#else
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif
diff --git a/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp b/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp
index 2fda858..9471faa 100644
--- a/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp
+++ b/cmds/statsd/tests/metrics/GaugeMetricProducer_test.cpp
@@ -66,7 +66,8 @@
// statsd started long ago.
// The metric starts in the middle of the bucket
GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
- -1, 5, 600 * NS_PER_SEC + NS_PER_SEC/2, pullerManager);
+ -1, -1, tagId, 5, 600 * NS_PER_SEC + NS_PER_SEC / 2,
+ pullerManager);
EXPECT_EQ(600500000000, gaugeProducer.mCurrentBucketStartTimeNs);
EXPECT_EQ(10, gaugeProducer.mCurrentBucketNum);
@@ -100,8 +101,8 @@
}));
GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
- tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager);
- gaugeProducer.setBucketSize(60 * NS_PER_SEC);
+ tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
+ pullerManager);
vector<shared_ptr<LogEvent>> allData;
allData.clear();
@@ -176,10 +177,9 @@
sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
- -1 /* -1 means no pulling */, bucketStartTimeNs,
+ -1 /* -1 means no pulling */, -1, tagId, bucketStartTimeNs,
bucketStartTimeNs, pullerManager);
- gaugeProducer.setBucketSize(60 * NS_PER_SEC);
sp<AnomalyTracker> anomalyTracker = gaugeProducer.addAnomalyTracker(alert, alarmMonitor);
EXPECT_TRUE(anomalyTracker != nullptr);
@@ -261,8 +261,8 @@
}));
GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
- tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager);
- gaugeProducer.setBucketSize(60 * NS_PER_SEC);
+ tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
+ pullerManager);
vector<shared_ptr<LogEvent>> allData;
shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 1);
@@ -328,9 +328,8 @@
return true;
}));
- GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard, tagId, bucketStartTimeNs,
- bucketStartTimeNs, pullerManager);
- gaugeProducer.setBucketSize(60 * NS_PER_SEC);
+ GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard, tagId, -1, tagId,
+ bucketStartTimeNs, bucketStartTimeNs, pullerManager);
gaugeProducer.onConditionChanged(true, bucketStartTimeNs + 8);
EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
@@ -419,9 +418,8 @@
return true;
}));
- GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard, tagId, bucketStartTimeNs,
- bucketStartTimeNs, pullerManager);
- gaugeProducer.setBucketSize(60 * NS_PER_SEC);
+ GaugeMetricProducer gaugeProducer(kConfigKey, metric, 1, wizard, tagId, -1, tagId,
+ bucketStartTimeNs, bucketStartTimeNs, pullerManager);
gaugeProducer.onSlicedConditionMayChange(true, bucketStartTimeNs + 8);
@@ -464,8 +462,8 @@
gaugeFieldMatcher->set_field(tagId);
gaugeFieldMatcher->add_child()->set_field(2);
GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
- tagId, bucketStartTimeNs, bucketStartTimeNs, pullerManager);
- gaugeProducer.setBucketSize(60 * NS_PER_SEC);
+ tagId, -1, tagId, bucketStartTimeNs, bucketStartTimeNs,
+ pullerManager);
Alert alert;
alert.set_id(101);
@@ -530,6 +528,83 @@
EXPECT_TRUE(gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->empty());
}
+TEST(GaugeMetricProducerTest, TestPullOnTrigger) {
+ GaugeMetric metric;
+ metric.set_id(metricId);
+ metric.set_bucket(ONE_MINUTE);
+ metric.set_sampling_type(GaugeMetric::ALL_CONDITION_CHANGES);
+ metric.mutable_gauge_fields_filter()->set_include_all(false);
+ auto gaugeFieldMatcher = metric.mutable_gauge_fields_filter()->mutable_fields();
+ gaugeFieldMatcher->set_field(tagId);
+ gaugeFieldMatcher->add_child()->set_field(1);
+
+ sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
+
+ sp<MockStatsPullerManager> pullerManager = new StrictMock<MockStatsPullerManager>();
+ EXPECT_CALL(*pullerManager, Pull(tagId, _, _))
+ .WillOnce(Invoke([](int tagId, int64_t timeNs,
+ vector<std::shared_ptr<LogEvent>>* data) {
+ data->clear();
+ shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 3);
+ event->write(3);
+ event->init();
+ data->push_back(event);
+ return true;
+ }))
+ .WillOnce(Invoke([](int tagId, int64_t timeNs,
+ vector<std::shared_ptr<LogEvent>>* data) {
+ data->clear();
+ shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
+ event->write(4);
+ event->init();
+ data->push_back(event);
+ return true;
+ }))
+ .WillOnce(Invoke([](int tagId, int64_t timeNs,
+ vector<std::shared_ptr<LogEvent>>* data) {
+ data->clear();
+ shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 20);
+ event->write(5);
+ event->init();
+ data->push_back(event);
+ return true;
+ }));
+
+ int triggerId = 5;
+ GaugeMetricProducer gaugeProducer(kConfigKey, metric, -1 /*-1 meaning no condition*/, wizard,
+ tagId, triggerId, tagId, bucketStartTimeNs, bucketStartTimeNs,
+ pullerManager);
+
+ vector<shared_ptr<LogEvent>> allData;
+ allData.clear();
+
+ EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+ LogEvent trigger(triggerId, bucketStartTimeNs + 10);
+ trigger.init();
+ gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+ EXPECT_EQ(2UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
+ trigger.setElapsedTimestampNs(bucketStartTimeNs + 20);
+ gaugeProducer.onMatchedLogEvent(1 /*log matcher index*/, trigger);
+ EXPECT_EQ(3UL, gaugeProducer.mCurrentSlicedBucket->begin()->second.size());
+
+ allData.clear();
+ shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucket2StartTimeNs + 1);
+ event->write(10);
+ event->init();
+ allData.push_back(event);
+
+ gaugeProducer.onDataPulled(allData);
+ EXPECT_EQ(1UL, gaugeProducer.mCurrentSlicedBucket->size());
+ auto it = gaugeProducer.mCurrentSlicedBucket->begin()->second.front().mFields->begin();
+ EXPECT_EQ(INT, it->mValue.getType());
+ EXPECT_EQ(10, it->mValue.int_value);
+ EXPECT_EQ(1UL, gaugeProducer.mPastBuckets.size());
+ EXPECT_EQ(3UL, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms.size());
+ EXPECT_EQ(3, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms[0].mFields->begin()->mValue.int_value);
+ EXPECT_EQ(4, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms[1].mFields->begin()->mValue.int_value);
+ EXPECT_EQ(5, gaugeProducer.mPastBuckets.begin()->second.back().mGaugeAtoms[2].mFields->begin()->mValue.int_value);
+}
+
} // namespace statsd
} // namespace os
} // namespace android
diff --git a/core/java/android/appwidget/AppWidgetManagerInternal.java b/core/java/android/appwidget/AppWidgetManagerInternal.java
index 7ab3d8b..5694ca8 100644
--- a/core/java/android/appwidget/AppWidgetManagerInternal.java
+++ b/core/java/android/appwidget/AppWidgetManagerInternal.java
@@ -16,12 +16,9 @@
package android.appwidget;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.util.ArraySet;
-import java.util.Set;
-
/**
* App widget manager local system service interface.
*
@@ -36,4 +33,13 @@
* @return Whether the UID hosts widgets from the package.
*/
public abstract @Nullable ArraySet<String> getHostedWidgetPackages(int uid);
+
+ /**
+ * Execute the widget-related work of unlocking a user. This is intentionally
+ * invoked just <em>before</em> the boot-completed broadcast is issued, after
+ * the data-related work of unlock has completed.
+ *
+ * @param userId The user that is being unlocked.
+ */
+ public abstract void unlockUser(int userId);
}
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index 52a2354..081d8d1 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -372,7 +372,7 @@
if (score < 0) {
throw new IllegalArgumentException("Score must be >= 0");
}
- queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, new Integer(score));
+ queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, score, 0);
}
/**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 350602c..0b177c7 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -7154,9 +7154,9 @@
* Whether the device should pulse on pick up gesture.
* @hide
*/
- public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
+ public static final String DOZE_PICK_UP_GESTURE = "doze_pulse_on_pick_up";
- private static final Validator DOZE_PULSE_ON_PICK_UP_VALIDATOR = BOOLEAN_VALIDATOR;
+ private static final Validator DOZE_PICK_UP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
/**
* Whether the device should pulse on long press gesture.
@@ -7168,9 +7168,9 @@
* Whether the device should pulse on double tap gesture.
* @hide
*/
- public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap";
+ public static final String DOZE_DOUBLE_TAP_GESTURE = "doze_pulse_on_double_tap";
- private static final Validator DOZE_PULSE_ON_DOUBLE_TAP_VALIDATOR = BOOLEAN_VALIDATOR;
+ private static final Validator DOZE_DOUBLE_TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
/**
* The current night mode that has been selected by the user. Owned
@@ -8064,8 +8064,8 @@
QS_TILES,
DOZE_ENABLED,
DOZE_ALWAYS_ON,
- DOZE_PULSE_ON_PICK_UP,
- DOZE_PULSE_ON_DOUBLE_TAP,
+ DOZE_PICK_UP_GESTURE,
+ DOZE_DOUBLE_TAP_GESTURE,
NFC_PAYMENT_DEFAULT_COMPONENT,
AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
FACE_UNLOCK_KEYGUARD_ENABLED,
@@ -8207,8 +8207,8 @@
VALIDATORS.put(QS_TILES, QS_TILES_VALIDATOR);
VALIDATORS.put(DOZE_ENABLED, DOZE_ENABLED_VALIDATOR);
VALIDATORS.put(DOZE_ALWAYS_ON, DOZE_ALWAYS_ON_VALIDATOR);
- VALIDATORS.put(DOZE_PULSE_ON_PICK_UP, DOZE_PULSE_ON_PICK_UP_VALIDATOR);
- VALIDATORS.put(DOZE_PULSE_ON_DOUBLE_TAP, DOZE_PULSE_ON_DOUBLE_TAP_VALIDATOR);
+ VALIDATORS.put(DOZE_PICK_UP_GESTURE, DOZE_PICK_UP_GESTURE_VALIDATOR);
+ VALIDATORS.put(DOZE_DOUBLE_TAP_GESTURE, DOZE_DOUBLE_TAP_GESTURE_VALIDATOR);
VALIDATORS.put(NFC_PAYMENT_DEFAULT_COMPONENT, NFC_PAYMENT_DEFAULT_COMPONENT_VALIDATOR);
VALIDATORS.put(AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR);
@@ -8273,7 +8273,6 @@
CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
- CLONE_TO_MANAGED_PROFILE.add(AUTOFILL_SERVICE);
CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
diff --git a/core/java/android/util/MemoryIntArray.java b/core/java/android/util/MemoryIntArray.java
index bf33519..d5bec0f 100644
--- a/core/java/android/util/MemoryIntArray.java
+++ b/core/java/android/util/MemoryIntArray.java
@@ -20,9 +20,10 @@
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
-import libcore.io.IoUtils;
import dalvik.system.CloseGuard;
+import libcore.io.IoUtils;
+
import java.io.Closeable;
import java.io.IOException;
import java.util.UUID;
@@ -56,7 +57,7 @@
private final boolean mIsOwner;
private final long mMemoryAddr;
- private int mFd = -1;
+ private ParcelFileDescriptor mFd;
/**
* Creates a new instance.
@@ -71,8 +72,8 @@
}
mIsOwner = true;
final String name = UUID.randomUUID().toString();
- mFd = nativeCreate(name, size);
- mMemoryAddr = nativeOpen(mFd, mIsOwner);
+ mFd = ParcelFileDescriptor.adoptFd(nativeCreate(name, size));
+ mMemoryAddr = nativeOpen(mFd.getFd(), mIsOwner);
mCloseGuard.open("close");
}
@@ -82,8 +83,8 @@
if (pfd == null) {
throw new IOException("No backing file descriptor");
}
- mFd = pfd.detachFd();
- mMemoryAddr = nativeOpen(mFd, mIsOwner);
+ mFd = ParcelFileDescriptor.adoptFd(pfd.detachFd());
+ mMemoryAddr = nativeOpen(mFd.getFd(), mIsOwner);
mCloseGuard.open("close");
}
@@ -105,7 +106,7 @@
public int get(int index) throws IOException {
enforceNotClosed();
enforceValidIndex(index);
- return nativeGet(mFd, mMemoryAddr, index);
+ return nativeGet(mFd.getFd(), mMemoryAddr, index);
}
/**
@@ -121,7 +122,7 @@
enforceNotClosed();
enforceWritable();
enforceValidIndex(index);
- nativeSet(mFd, mMemoryAddr, index, value);
+ nativeSet(mFd.getFd(), mMemoryAddr, index, value);
}
/**
@@ -131,7 +132,7 @@
*/
public int size() throws IOException {
enforceNotClosed();
- return nativeSize(mFd);
+ return nativeSize(mFd.getFd());
}
/**
@@ -142,8 +143,9 @@
@Override
public void close() throws IOException {
if (!isClosed()) {
- nativeClose(mFd, mMemoryAddr, mIsOwner);
- mFd = -1;
+ nativeClose(mFd.getFd(), mMemoryAddr, mIsOwner);
+ mFd.close();
+ mFd = null;
mCloseGuard.close();
}
}
@@ -152,7 +154,7 @@
* @return Whether this array is closed and shouldn't be used.
*/
public boolean isClosed() {
- return mFd == -1;
+ return mFd == null;
}
@Override
@@ -175,13 +177,8 @@
@Override
public void writeToParcel(Parcel parcel, int flags) {
- ParcelFileDescriptor pfd = ParcelFileDescriptor.adoptFd(mFd);
- try {
- // Don't let writing to a parcel to close our fd - plz
- parcel.writeParcelable(pfd, flags & ~Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } finally {
- pfd.detachFd();
- }
+ // Don't let writing to a parcel to close our fd - plz
+ parcel.writeParcelable(mFd, flags & ~Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
}
@Override
@@ -195,13 +192,13 @@
if (getClass() != obj.getClass()) {
return false;
}
- MemoryIntArray other = (MemoryIntArray) obj;
- return mFd == other.mFd;
+
+ return false;
}
@Override
public int hashCode() {
- return mFd;
+ return mFd.hashCode();
}
private void enforceNotClosed() {
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 8c7ac73..d7a5d68 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1692,13 +1692,13 @@
public static final int PRIVATE_FLAG_IS_SCREEN_DECOR = 0x00400000;
/**
- * Flag to indicate that the status bar window is now in an explicit expanded state, meaning
- * that status bar will not be hidden by any window with flag {@link #FLAG_FULLSCREEN} or
- * {@link View#SYSTEM_UI_FLAG_FULLSCREEN} set.
- * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
+ * Flag to indicate that the status bar window is in a state such that it forces showing
+ * the navigation bar unless the navigation bar window is explicitly set to
+ * {@link View#GONE}.
+ * It only takes effects if this is set by {@link LayoutParams#TYPE_STATUS_BAR}.
* @hide
*/
- public static final int PRIVATE_FLAG_STATUS_BAR_EXPANDED = 0x00800000;
+ public static final int PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION = 0x00800000;
/**
* Control flags that are private to the platform.
@@ -1790,9 +1790,9 @@
equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
name = "IS_SCREEN_DECOR"),
@ViewDebug.FlagToString(
- mask = PRIVATE_FLAG_STATUS_BAR_EXPANDED,
- equals = PRIVATE_FLAG_STATUS_BAR_EXPANDED,
- name = "STATUS_BAR_EXPANDED")
+ mask = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
+ equals = PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION,
+ name = "STATUS_FORCE_SHOW_NAVIGATION")
})
@TestApi
public int privateFlags;
diff --git a/core/java/com/android/internal/app/procstats/AssociationState.java b/core/java/com/android/internal/app/procstats/AssociationState.java
index f63c43f..115ba18 100644
--- a/core/java/com/android/internal/app/procstats/AssociationState.java
+++ b/core/java/com/android/internal/app/procstats/AssociationState.java
@@ -20,9 +20,12 @@
import android.os.Parcel;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.service.procstats.ProcessStatsAssociationStateProto;
+import android.service.procstats.ProcessStatsStateProto;
import android.util.ArrayMap;
import android.util.Slog;
import android.util.TimeUtils;
+import android.util.proto.ProtoOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -656,6 +659,55 @@
}
}
+ public void writeToProto(ProtoOutputStream proto, long fieldId, long now) {
+ final long token = proto.start(fieldId);
+
+ proto.write(ProcessStatsAssociationStateProto.COMPONENT_NAME, mName);
+ final int NSRC = mSources.size();
+ for (int isrc = 0; isrc < NSRC; isrc++) {
+ final SourceKey key = mSources.keyAt(isrc);
+ final SourceState src = mSources.valueAt(isrc);
+ final long sourceToken = proto.start(ProcessStatsAssociationStateProto.SOURCES);
+ proto.write(ProcessStatsAssociationStateProto.Source.PROCESS, key.mProcess);
+ proto.write(ProcessStatsAssociationStateProto.Source.UID, key.mUid);
+ proto.write(ProcessStatsAssociationStateProto.Source.TOTAL_COUNT, src.mCount);
+ long duration = src.mDuration;
+ if (src.mNesting > 0) {
+ duration += now - src.mStartUptime;
+ }
+ proto.write(ProcessStatsAssociationStateProto.Source.TOTAL_DURATION_MS, duration);
+ if (src.mActiveCount != 0) {
+ proto.write(ProcessStatsAssociationStateProto.Source.ACTIVE_COUNT,
+ src.mActiveCount);
+ }
+ final long timeNow = src.mActiveStartUptime != 0 ? (now-src.mActiveStartUptime) : 0;
+ if (src.mDurations != null) {
+ final int N = src.mDurations.getKeyCount();
+ for (int i=0; i<N; i++) {
+ final int dkey = src.mDurations.getKeyAt(i);
+ duration = src.mDurations.getValue(dkey);
+ if (dkey == src.mActiveProcState) {
+ duration += timeNow;
+ }
+ final int procState = SparseMappingTable.getIdFromKey(dkey);
+ DumpUtils.printProcStateDurationProto(proto,
+ ProcessStatsAssociationStateProto.Source.ACTIVE_STATES,
+ procState, duration);
+ }
+ } else {
+ duration = src.mActiveDuration + timeNow;
+ if (duration != 0) {
+ DumpUtils.printProcStateDurationProto(proto,
+ ProcessStatsAssociationStateProto.Source.ACTIVE_STATES,
+ src.mActiveProcState, duration);
+ }
+ }
+ proto.end(sourceToken);
+ }
+
+ proto.end(token);
+ }
+
public String toString() {
return "AssociationState{" + Integer.toHexString(System.identityHashCode(this))
+ " " + mName + " pkg=" + mPackageState.mPackageName + " proc="
diff --git a/core/java/com/android/internal/app/procstats/DumpUtils.java b/core/java/com/android/internal/app/procstats/DumpUtils.java
index e6073e5..701391d 100644
--- a/core/java/com/android/internal/app/procstats/DumpUtils.java
+++ b/core/java/com/android/internal/app/procstats/DumpUtils.java
@@ -16,32 +16,15 @@
package com.android.internal.app.procstats;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.SystemClock;
-import android.os.SystemProperties;
import android.os.UserHandle;
-import android.service.procstats.ProcessStatsProto;
-import android.text.format.DateFormat;
-import android.util.ArrayMap;
-import android.util.ArraySet;
-import android.util.DebugUtils;
-import android.util.Log;
-import android.util.Slog;
-import android.util.SparseArray;
+import android.service.procstats.ProcessStatsStateProto;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
import static com.android.internal.app.procstats.ProcessStats.*;
-import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Objects;
/**
* Utilities for dumping.
@@ -124,20 +107,20 @@
STATE_TAGS[STATE_CACHED_EMPTY] = "e";
STATE_PROTO_ENUMS = new int[STATE_COUNT];
- STATE_PROTO_ENUMS[STATE_PERSISTENT] = ProcessStatsProto.State.PERSISTENT;
- STATE_PROTO_ENUMS[STATE_TOP] = ProcessStatsProto.State.TOP;
- STATE_PROTO_ENUMS[STATE_IMPORTANT_FOREGROUND] = ProcessStatsProto.State.IMPORTANT_FOREGROUND;
- STATE_PROTO_ENUMS[STATE_IMPORTANT_BACKGROUND] = ProcessStatsProto.State.IMPORTANT_BACKGROUND;
- STATE_PROTO_ENUMS[STATE_BACKUP] = ProcessStatsProto.State.BACKUP;
- STATE_PROTO_ENUMS[STATE_SERVICE] = ProcessStatsProto.State.SERVICE;
- STATE_PROTO_ENUMS[STATE_SERVICE_RESTARTING] = ProcessStatsProto.State.SERVICE_RESTARTING;
- STATE_PROTO_ENUMS[STATE_RECEIVER] = ProcessStatsProto.State.RECEIVER;
- STATE_PROTO_ENUMS[STATE_HEAVY_WEIGHT] = ProcessStatsProto.State.HEAVY_WEIGHT;
- STATE_PROTO_ENUMS[STATE_HOME] = ProcessStatsProto.State.HOME;
- STATE_PROTO_ENUMS[STATE_LAST_ACTIVITY] = ProcessStatsProto.State.LAST_ACTIVITY;
- STATE_PROTO_ENUMS[STATE_CACHED_ACTIVITY] = ProcessStatsProto.State.CACHED_ACTIVITY;
- STATE_PROTO_ENUMS[STATE_CACHED_ACTIVITY_CLIENT] = ProcessStatsProto.State.CACHED_ACTIVITY_CLIENT;
- STATE_PROTO_ENUMS[STATE_CACHED_EMPTY] = ProcessStatsProto.State.CACHED_EMPTY;
+ STATE_PROTO_ENUMS[STATE_PERSISTENT] = ProcessStatsStateProto.PERSISTENT;
+ STATE_PROTO_ENUMS[STATE_TOP] = ProcessStatsStateProto.TOP;
+ STATE_PROTO_ENUMS[STATE_IMPORTANT_FOREGROUND] = ProcessStatsStateProto.IMPORTANT_FOREGROUND;
+ STATE_PROTO_ENUMS[STATE_IMPORTANT_BACKGROUND] = ProcessStatsStateProto.IMPORTANT_BACKGROUND;
+ STATE_PROTO_ENUMS[STATE_BACKUP] = ProcessStatsStateProto.BACKUP;
+ STATE_PROTO_ENUMS[STATE_SERVICE] = ProcessStatsStateProto.SERVICE;
+ STATE_PROTO_ENUMS[STATE_SERVICE_RESTARTING] = ProcessStatsStateProto.SERVICE_RESTARTING;
+ STATE_PROTO_ENUMS[STATE_RECEIVER] = ProcessStatsStateProto.RECEIVER;
+ STATE_PROTO_ENUMS[STATE_HEAVY_WEIGHT] = ProcessStatsStateProto.HEAVY_WEIGHT;
+ STATE_PROTO_ENUMS[STATE_HOME] = ProcessStatsStateProto.HOME;
+ STATE_PROTO_ENUMS[STATE_LAST_ACTIVITY] = ProcessStatsStateProto.LAST_ACTIVITY;
+ STATE_PROTO_ENUMS[STATE_CACHED_ACTIVITY] = ProcessStatsStateProto.CACHED_ACTIVITY;
+ STATE_PROTO_ENUMS[STATE_CACHED_ACTIVITY_CLIENT] = ProcessStatsStateProto.CACHED_ACTIVITY_CLIENT;
+ STATE_PROTO_ENUMS[STATE_CACHED_EMPTY] = ProcessStatsStateProto.CACHED_EMPTY;
}
public static final String[] ADJ_SCREEN_NAMES_CSV = new String[] {
@@ -155,8 +138,8 @@
};
static final int[] ADJ_SCREEN_PROTO_ENUMS = new int[] {
- ProcessStatsProto.State.OFF,
- ProcessStatsProto.State.ON
+ ProcessStatsStateProto.OFF,
+ ProcessStatsStateProto.ON
};
static final String[] ADJ_MEM_TAGS = new String[] {
@@ -164,10 +147,10 @@
};
static final int[] ADJ_MEM_PROTO_ENUMS = new int[] {
- ProcessStatsProto.State.NORMAL,
- ProcessStatsProto.State.MODERATE,
- ProcessStatsProto.State.LOW,
- ProcessStatsProto.State.CRITICAL
+ ProcessStatsStateProto.NORMAL,
+ ProcessStatsStateProto.MODERATE,
+ ProcessStatsStateProto.LOW,
+ ProcessStatsStateProto.CRITICAL
};
static final String CSV_SEP = "\t";
@@ -281,6 +264,23 @@
printArrayEntry(pw, ADJ_MEM_TAGS, state, 1);
}
+ public static void printProcStateAdjTagProto(ProtoOutputStream proto, long screenId, long memId,
+ int state) {
+ state = printProto(proto, screenId, ADJ_SCREEN_PROTO_ENUMS,
+ state, ADJ_SCREEN_MOD * STATE_COUNT);
+ printProto(proto, memId, ADJ_MEM_PROTO_ENUMS, state, STATE_COUNT);
+ }
+
+ public static void printProcStateDurationProto(ProtoOutputStream proto, long fieldId,
+ int procState, long duration) {
+ final long stateToken = proto.start(fieldId);
+ DumpUtils.printProto(proto, ProcessStatsStateProto.PROCESS_STATE,
+ DumpUtils.STATE_PROTO_ENUMS, procState, 1);
+ proto.write(ProcessStatsStateProto.DURATION_MS, duration);
+ proto.end(stateToken);
+
+ }
+
public static void printProcStateTagAndValue(PrintWriter pw, int state, long value) {
pw.print(',');
printProcStateTag(pw, state);
diff --git a/core/java/com/android/internal/app/procstats/ProcessState.java b/core/java/com/android/internal/app/procstats/ProcessState.java
index 943c8bd..d7f4736 100644
--- a/core/java/com/android/internal/app/procstats/ProcessState.java
+++ b/core/java/com/android/internal/app/procstats/ProcessState.java
@@ -20,6 +20,7 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.service.procstats.ProcessStatsProto;
+import android.service.procstats.ProcessStatsStateProto;
import android.util.ArrayMap;
import android.util.DebugUtils;
import android.util.Log;
@@ -1377,14 +1378,14 @@
}
final long stateToken = proto.start(ProcessStatsProto.STATES);
DumpUtils.printProcStateTagProto(proto,
- ProcessStatsProto.State.SCREEN_STATE,
- ProcessStatsProto.State.MEMORY_STATE,
- ProcessStatsProto.State.PROCESS_STATE,
+ ProcessStatsStateProto.SCREEN_STATE,
+ ProcessStatsStateProto.MEMORY_STATE,
+ ProcessStatsStateProto.PROCESS_STATE,
type);
long duration = durationByState.get(type);
durationByState.delete(type); // remove the key since it is already being dumped.
- proto.write(ProcessStatsProto.State.DURATION_MS, duration);
+ proto.write(ProcessStatsStateProto.DURATION_MS, duration);
mPssTable.writeStatsToProtoForKey(proto, key);
@@ -1394,18 +1395,18 @@
for (int i = 0; i < durationByState.size(); i++) {
final long stateToken = proto.start(ProcessStatsProto.STATES);
DumpUtils.printProcStateTagProto(proto,
- ProcessStatsProto.State.SCREEN_STATE,
- ProcessStatsProto.State.MEMORY_STATE,
- ProcessStatsProto.State.PROCESS_STATE,
+ ProcessStatsStateProto.SCREEN_STATE,
+ ProcessStatsStateProto.MEMORY_STATE,
+ ProcessStatsStateProto.PROCESS_STATE,
durationByState.keyAt(i));
- proto.write(ProcessStatsProto.State.DURATION_MS, durationByState.valueAt(i));
+ proto.write(ProcessStatsStateProto.DURATION_MS, durationByState.valueAt(i));
proto.end(stateToken);
}
final long totalRunningDuration = getTotalRunningDuration(now);
if (totalRunningDuration > 0) {
final long stateToken = proto.start(ProcessStatsProto.TOTAL_RUNNING_STATE);
- proto.write(ProcessStatsProto.State.DURATION_MS, totalRunningDuration);
+ proto.write(ProcessStatsStateProto.DURATION_MS, totalRunningDuration);
if (mTotalRunningPss[PSS_SAMPLE_COUNT] != 0) {
PssTable.writeStatsToProto(proto, mTotalRunningPss, 0);
}
diff --git a/core/java/com/android/internal/app/procstats/ProcessStats.java b/core/java/com/android/internal/app/procstats/ProcessStats.java
index d088354..14faf66 100644
--- a/core/java/com/android/internal/app/procstats/ProcessStats.java
+++ b/core/java/com/android/internal/app/procstats/ProcessStats.java
@@ -23,6 +23,7 @@
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
+import android.service.procstats.ProcessStatsPackageProto;
import android.service.procstats.ProcessStatsSectionProto;
import android.text.format.DateFormat;
import android.util.ArrayMap;
@@ -2013,10 +2014,8 @@
}
public void writeToProto(ProtoOutputStream proto, long fieldId, long now) {
- final ArrayMap<String, SparseArray<LongSparseArray<PackageState>>> pkgMap =
- mPackages.getMap();
-
final long token = proto.start(fieldId);
+
proto.write(ProcessStatsSectionProto.START_REALTIME_MS, mTimePeriodStartRealtime);
proto.write(ProcessStatsSectionProto.END_REALTIME_MS,
mRunning ? SystemClock.elapsedRealtime() : mTimePeriodEndRealtime);
@@ -2041,16 +2040,31 @@
proto.write(ProcessStatsSectionProto.STATUS, ProcessStatsSectionProto.STATUS_PARTIAL);
}
- ArrayMap<String, SparseArray<ProcessState>> procMap = mProcesses.getMap();
+ final ArrayMap<String, SparseArray<ProcessState>> procMap = mProcesses.getMap();
for (int ip=0; ip<procMap.size(); ip++) {
- String procName = procMap.keyAt(ip);
- SparseArray<ProcessState> uids = procMap.valueAt(ip);
+ final String procName = procMap.keyAt(ip);
+ final SparseArray<ProcessState> uids = procMap.valueAt(ip);
for (int iu=0; iu<uids.size(); iu++) {
final int uid = uids.keyAt(iu);
final ProcessState procState = uids.valueAt(iu);
- procState.writeToProto(proto, ProcessStatsSectionProto.PROCESS_STATS, procName, uid, now);
+ procState.writeToProto(proto, ProcessStatsSectionProto.PROCESS_STATS, procName,
+ uid, now);
}
}
+
+ final ArrayMap<String, SparseArray<LongSparseArray<PackageState>>> pkgMap =
+ mPackages.getMap();
+ for (int ip = 0; ip < pkgMap.size(); ip++) {
+ final SparseArray<LongSparseArray<PackageState>> uids = pkgMap.valueAt(ip);
+ for (int iu = 0; iu < uids.size(); iu++) {
+ final LongSparseArray<PackageState> vers = uids.valueAt(iu);
+ for (int iv = 0; iv < vers.size(); iv++) {
+ final PackageState pkgState = vers.valueAt(iv);
+ pkgState.writeToProto(proto, ProcessStatsSectionProto.PACKAGE_STATS, now);
+ }
+ }
+ }
+
proto.end(token);
}
@@ -2095,6 +2109,33 @@
if (DEBUG) Slog.d(TAG, "GETASC: creating " + as + " in " + proc.getName());
return as;
}
+
+ public void writeToProto(ProtoOutputStream proto, long fieldId, long now) {
+ final long token = proto.start(fieldId);
+
+ proto.write(ProcessStatsPackageProto.PACKAGE, mPackageName);
+ proto.write(ProcessStatsPackageProto.UID, mUid);
+ proto.write(ProcessStatsPackageProto.VERSION, mVersionCode);
+
+ for (int ip = 0; ip < mProcesses.size(); ip++) {
+ final String procName = mProcesses.keyAt(ip);
+ final ProcessState procState = mProcesses.valueAt(ip);
+ procState.writeToProto(proto, ProcessStatsPackageProto.PROCESS_STATS, procName,
+ mUid, now);
+ }
+
+ for (int is = 0; is < mServices.size(); is++) {
+ final ServiceState serviceState = mServices.valueAt(is);
+ serviceState.writeToProto(proto, ProcessStatsPackageProto.PROCESS_STATS, now);
+ }
+
+ for (int ia=0; ia<mAssociations.size(); ia++) {
+ final AssociationState ascState = mAssociations.valueAt(ia);
+ ascState.writeToProto(proto, ProcessStatsPackageProto.ASSOCIATION_STATS, now);
+ }
+
+ proto.end(token);
+ }
}
public static final class ProcessDataCollection {
diff --git a/core/java/com/android/internal/app/procstats/PssTable.java b/core/java/com/android/internal/app/procstats/PssTable.java
index f858e55..fc93c3a 100644
--- a/core/java/com/android/internal/app/procstats/PssTable.java
+++ b/core/java/com/android/internal/app/procstats/PssTable.java
@@ -28,7 +28,7 @@
import static com.android.internal.app.procstats.ProcessStats.PSS_USS_MAXIMUM;
import static com.android.internal.app.procstats.ProcessStats.PSS_COUNT;
-import android.service.procstats.ProcessStatsProto;
+import android.service.procstats.ProcessStatsStateProto;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoUtils;
@@ -153,16 +153,16 @@
public static void writeStatsToProto(ProtoOutputStream proto, final long[] stats,
final int statsIndex) {
- proto.write(ProcessStatsProto.State.SAMPLE_SIZE, stats[statsIndex + PSS_SAMPLE_COUNT]);
- ProtoUtils.toAggStatsProto(proto, ProcessStatsProto.State.PSS,
+ proto.write(ProcessStatsStateProto.SAMPLE_SIZE, stats[statsIndex + PSS_SAMPLE_COUNT]);
+ ProtoUtils.toAggStatsProto(proto, ProcessStatsStateProto.PSS,
stats[statsIndex + PSS_MINIMUM],
stats[statsIndex + PSS_AVERAGE],
stats[statsIndex + PSS_MAXIMUM]);
- ProtoUtils.toAggStatsProto(proto, ProcessStatsProto.State.USS,
+ ProtoUtils.toAggStatsProto(proto, ProcessStatsStateProto.USS,
stats[statsIndex + PSS_USS_MINIMUM],
stats[statsIndex + PSS_USS_AVERAGE],
stats[statsIndex + PSS_USS_MAXIMUM]);
- ProtoUtils.toAggStatsProto(proto, ProcessStatsProto.State.RSS,
+ ProtoUtils.toAggStatsProto(proto, ProcessStatsStateProto.RSS,
stats[statsIndex + PSS_RSS_MINIMUM],
stats[statsIndex + PSS_RSS_AVERAGE],
stats[statsIndex + PSS_RSS_MAXIMUM]);
diff --git a/core/java/com/android/internal/app/procstats/ServiceState.java b/core/java/com/android/internal/app/procstats/ServiceState.java
index 04e61e0..16975a4 100644
--- a/core/java/com/android/internal/app/procstats/ServiceState.java
+++ b/core/java/com/android/internal/app/procstats/ServiceState.java
@@ -19,9 +19,16 @@
import android.os.Parcel;
import android.os.SystemClock;
+import android.service.procstats.ProcessStatsProto;
+import android.service.procstats.ProcessStatsServiceStateProto;
+import android.service.procstats.ProcessStatsStateProto;
import android.util.Slog;
+import android.util.SparseLongArray;
import android.util.TimeUtils;
+import android.util.proto.ProtoOutputStream;
+import android.util.proto.ProtoUtils;
+import static com.android.internal.app.procstats.ProcessStats.PSS_SAMPLE_COUNT;
import static com.android.internal.app.procstats.ProcessStats.STATE_NOTHING;
import java.io.PrintWriter;
@@ -550,6 +557,66 @@
pw.println();
}
+ public void writeToProto(ProtoOutputStream proto, long fieldId, long now) {
+ final long token = proto.start(fieldId);
+ proto.write(ProcessStatsServiceStateProto.SERVICE_NAME, mName);
+ writeTypeToProto(proto, ProcessStatsServiceStateProto.RUNNING_OP,
+ ServiceState.SERVICE_RUN, mRunCount, mRunState, mRunStartTime, now);
+ writeTypeToProto(proto, ProcessStatsServiceStateProto.STARTED_OP,
+ ServiceState.SERVICE_STARTED, mStartedCount, mStartedState, mStartedStartTime, now);
+ writeTypeToProto(proto, ProcessStatsServiceStateProto.FOREGROUND_OP,
+ ServiceState.SERVICE_FOREGROUND, mForegroundCount, mForegroundState,
+ mForegroundStartTime, now);
+ writeTypeToProto(proto, ProcessStatsServiceStateProto.BOUND_OP,
+ ServiceState.SERVICE_BOUND, mBoundCount, mBoundState, mBoundStartTime, now);
+ writeTypeToProto(proto, ProcessStatsServiceStateProto.EXECUTING_OP,
+ ServiceState.SERVICE_EXEC, mExecCount, mExecState, mExecStartTime, now);
+ proto.end(token);
+ }
+
+ public void writeTypeToProto(ProtoOutputStream proto, long fieldId, int serviceType,
+ int opCount, int curState, long curStartTime, long now) {
+ if (opCount <= 0) {
+ return;
+ }
+ final long token = proto.start(fieldId);
+
+ proto.write(ProcessStatsServiceStateProto.OperationInfo.COUNT, opCount);
+ boolean didCurState = false;
+ final int N = mDurations.getKeyCount();
+ for (int i=0; i<N; i++) {
+ final int key = mDurations.getKeyAt(i);
+ long time = mDurations.getValue(key);
+ int type = SparseMappingTable.getIdFromKey(key);
+ int memFactor = type / ServiceState.SERVICE_COUNT;
+ type %= ServiceState.SERVICE_COUNT;
+ if (type != serviceType) {
+ continue;
+ }
+ if (curState == memFactor) {
+ didCurState = true;
+ time += now - curStartTime;
+ }
+ final long stateToken = proto.start(ProcessStatsServiceStateProto.OperationInfo.STATES);
+ DumpUtils.printProcStateAdjTagProto(proto,
+ ProcessStatsStateProto.SCREEN_STATE,
+ ProcessStatsStateProto.MEMORY_STATE,
+ type);
+ proto.write(ProcessStatsStateProto.DURATION_MS, time);
+ proto.end(stateToken);
+ }
+ if (!didCurState && curState != STATE_NOTHING) {
+ final long stateToken = proto.start(ProcessStatsServiceStateProto.OperationInfo.STATES);
+ DumpUtils.printProcStateAdjTagProto(proto,
+ ProcessStatsStateProto.SCREEN_STATE,
+ ProcessStatsStateProto.MEMORY_STATE,
+ curState);
+ proto.write(ProcessStatsStateProto.DURATION_MS, now - curStartTime);
+ proto.end(stateToken);
+ }
+
+ proto.end(token);
+ }
public String toString() {
return "ServiceState{" + Integer.toHexString(System.identityHashCode(this))
diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
index 07bb453..c21159e 100644
--- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
+++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
@@ -36,17 +36,10 @@
public boolean enabled(int user) {
return pulseOnNotificationEnabled(user)
- || pulseOnPickupEnabled(user)
- || pulseOnDoubleTapEnabled(user)
|| pulseOnLongPressEnabled(user)
|| alwaysOnEnabled(user);
}
- public boolean available() {
- return pulseOnNotificationAvailable() || pulseOnPickupAvailable()
- || pulseOnDoubleTapAvailable();
- }
-
public boolean pulseOnNotificationEnabled(int user) {
return boolSettingDefaultOn(Settings.Secure.DOZE_ENABLED, user) && pulseOnNotificationAvailable();
}
@@ -55,30 +48,18 @@
return ambientDisplayAvailable();
}
- public boolean pulseOnPickupEnabled(int user) {
- boolean settingEnabled = boolSettingDefaultOn(Settings.Secure.DOZE_PULSE_ON_PICK_UP, user);
- return (settingEnabled || alwaysOnEnabled(user)) && pulseOnPickupAvailable();
+ public boolean pickupGestureEnabled(int user) {
+ return boolSettingDefaultOn(Settings.Secure.DOZE_PICK_UP_GESTURE, user)
+ && dozePickupSensorAvailable();
}
- public boolean pulseOnPickupAvailable() {
- return dozePulsePickupSensorAvailable() && ambientDisplayAvailable();
- }
-
- public boolean dozePulsePickupSensorAvailable() {
+ public boolean dozePickupSensorAvailable() {
return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup);
}
- public boolean pulseOnPickupCanBeModified(int user) {
- return !alwaysOnEnabled(user);
- }
-
- public boolean pulseOnDoubleTapEnabled(int user) {
- return boolSettingDefaultOn(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, user)
- && pulseOnDoubleTapAvailable();
- }
-
- public boolean pulseOnDoubleTapAvailable() {
- return doubleTapSensorAvailable() && ambientDisplayAvailable();
+ public boolean doubleTapGestureEnabled(int user) {
+ return boolSettingDefaultOn(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, user)
+ && doubleTapSensorAvailable();
}
public boolean doubleTapSensorAvailable() {
diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp
index 0ba9a8c..b1bb555 100644
--- a/core/jni/android_hardware_camera2_DngCreator.cpp
+++ b/core/jni/android_hardware_camera2_DngCreator.cpp
@@ -1748,19 +1748,20 @@
}
}
-
- size_t listSize = builder.getSize();
- uint8_t opcodeListBuf[listSize];
- err = builder.buildOpList(opcodeListBuf);
- if (err == OK) {
- BAIL_IF_INVALID_RET_NULL_SP(writer->addEntry(TAG_OPCODELIST2, listSize, opcodeListBuf,
- TIFF_IFD_0), env, TAG_OPCODELIST2, writer);
- } else {
- ALOGE("%s: Could not build list of opcodes for distortion correction and lens shading"
- "map.", __FUNCTION__);
- jniThrowRuntimeException(env, "failed to construct opcode list for distortion"
- " correction and lens shading map");
- return nullptr;
+ if (builder.getCount() > 0) {
+ size_t listSize = builder.getSize();
+ uint8_t opcodeListBuf[listSize];
+ err = builder.buildOpList(opcodeListBuf);
+ if (err == OK) {
+ BAIL_IF_INVALID_RET_NULL_SP(writer->addEntry(TAG_OPCODELIST2, listSize,
+ opcodeListBuf, TIFF_IFD_0), env, TAG_OPCODELIST2, writer);
+ } else {
+ ALOGE("%s: Could not build list of opcodes for lens shading map and bad pixel "
+ "correction.", __FUNCTION__);
+ jniThrowRuntimeException(env, "failed to construct opcode list for lens shading "
+ "map and bad pixel correction");
+ return nullptr;
+ }
}
}
@@ -1846,18 +1847,20 @@
}
}
- size_t listSize = builder.getSize();
- uint8_t opcodeListBuf[listSize];
- err = builder.buildOpList(opcodeListBuf);
- if (err == OK) {
- BAIL_IF_INVALID_RET_NULL_SP(writer->addEntry(TAG_OPCODELIST3, listSize, opcodeListBuf,
- TIFF_IFD_0), env, TAG_OPCODELIST3, writer);
- } else {
- ALOGE("%s: Could not build list of opcodes for distortion correction and lens shading"
- "map.", __FUNCTION__);
- jniThrowRuntimeException(env, "failed to construct opcode list for distortion"
- " correction and lens shading map");
- return nullptr;
+ if (builder.getCount() > 0) {
+ size_t listSize = builder.getSize();
+ uint8_t opcodeListBuf[listSize];
+ err = builder.buildOpList(opcodeListBuf);
+ if (err == OK) {
+ BAIL_IF_INVALID_RET_NULL_SP(writer->addEntry(TAG_OPCODELIST3, listSize,
+ opcodeListBuf, TIFF_IFD_0), env, TAG_OPCODELIST3, writer);
+ } else {
+ ALOGE("%s: Could not build list of opcodes for distortion correction.",
+ __FUNCTION__);
+ jniThrowRuntimeException(env, "failed to construct opcode list for distortion"
+ " correction");
+ return nullptr;
+ }
}
}
diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp
index bed239f..7ef06dc 100644
--- a/core/jni/android_os_Parcel.cpp
+++ b/core/jni/android_os_Parcel.cpp
@@ -336,8 +336,13 @@
jbyte* a2 = (jbyte*)env->GetPrimitiveArrayCritical(ret, 0);
if (a2) {
const void* data = parcel->readInplace(len);
- memcpy(a2, data, len);
+ if (data) {
+ memcpy(a2, data, len);
+ }
env->ReleasePrimitiveArrayCritical(ret, a2, 0);
+ if (!data) {
+ ret = NULL;
+ }
}
}
}
@@ -360,9 +365,14 @@
jbyte* ar = (jbyte*)env->GetPrimitiveArrayCritical((jarray)dest, 0);
if (ar) {
const void* data = parcel->readInplace(len);
- memcpy(ar, data, len);
+ if (data) {
+ memcpy(ar, data, len);
+ ret = JNI_TRUE;
+ } else {
+ ret = JNI_FALSE;
+ }
+
env->ReleasePrimitiveArrayCritical((jarray)dest, ar, 0);
- ret = JNI_TRUE;
}
}
return ret;
diff --git a/core/proto/android/service/procstats.proto b/core/proto/android/service/procstats.proto
index b2a88b7..41282da 100644
--- a/core/proto/android/service/procstats.proto
+++ b/core/proto/android/service/procstats.proto
@@ -42,7 +42,7 @@
* Data model from /frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
* This proto is defined based on the writeToParcel method.
*
- * Next Tag: 9
+ * Next Tag: 10
*/
message ProcessStatsSectionProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -77,9 +77,86 @@
// Stats for each process.
repeated ProcessStatsProto process_stats = 8;
+
+ // Stats for each package.
+ repeated ProcessStatsPackageProto package_stats = 9;
}
-// Next Tag: 6
+// Next Tag: 10
+message ProcessStatsStateProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ enum ScreenState {
+ SCREEN_UNKNOWN = 0;
+ OFF = 1;
+ ON = 2;
+ }
+ optional ScreenState screen_state = 1;
+
+ enum MemoryState {
+ MEMORY_UNKNOWN = 0;
+ NORMAL = 1; // normal.
+ MODERATE = 2; // moderate memory pressure.
+ LOW = 3; // low memory.
+ CRITICAL = 4; // critical memory.
+ }
+ optional MemoryState memory_state = 2;
+
+ // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
+ // and not frameworks/base/core/java/android/app/ActivityManager.java
+ enum ProcessState {
+ PROCESS_UNKNOWN = 0;
+ // Persistent system process.
+ PERSISTENT = 1;
+ // Top activity; actually any visible activity.
+ TOP = 2;
+ // Important foreground process (ime, wallpaper, etc).
+ IMPORTANT_FOREGROUND = 3;
+ // Important background process.
+ IMPORTANT_BACKGROUND = 4;
+ // Performing backup operation.
+ BACKUP = 5;
+ // Background process running a service.
+ SERVICE = 6;
+ // Process not running, but would be if there was enough RAM.
+ SERVICE_RESTARTING = 7;
+ // Process running a receiver.
+ RECEIVER = 8;
+ // Heavy-weight process (currently not used).
+ HEAVY_WEIGHT = 9;
+ // Process hosting home/launcher app when not on top.
+ HOME = 10;
+ // Process hosting the last app the user was in.
+ LAST_ACTIVITY = 11;
+ // Cached process hosting a previous activity.
+ CACHED_ACTIVITY = 12;
+ // Cached process hosting a client activity.
+ CACHED_ACTIVITY_CLIENT = 13;
+ // Cached process that is empty.
+ CACHED_EMPTY = 14;
+ }
+ optional ProcessState process_state = 3;
+
+ // Millisecond uptime duration spent in this state
+ optional int64 duration_ms = 4;
+
+ // Millisecond elapsed realtime duration spent in this state
+ optional int64 realtime_duration_ms = 9;
+
+ // # of samples taken
+ optional int32 sample_size = 5;
+
+ // PSS is memory reserved for this process
+ optional android.util.AggStats pss = 6;
+
+ // USS is memory shared between processes, divided evenly for accounting
+ optional android.util.AggStats uss = 7;
+
+ // RSS is memory resident for this process
+ optional android.util.AggStats rss = 8;
+}
+
+// Next Tag: 7
message ProcessStatsProto {
option (android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -104,78 +181,103 @@
}
optional Kill kill = 3;
- message State {
- option (android.msg_privacy).dest = DEST_AUTOMATIC;
-
- enum ScreenState {
- SCREEN_UNKNOWN = 0;
- OFF = 1;
- ON = 2;
- }
- optional ScreenState screen_state = 1;
-
- enum MemoryState {
- MEMORY_UNKNOWN = 0;
- NORMAL = 1; // normal.
- MODERATE = 2; // moderate memory pressure.
- LOW = 3; // low memory.
- CRITICAL = 4; // critical memory.
- }
- optional MemoryState memory_state = 2;
-
- // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
- // and not frameworks/base/core/java/android/app/ActivityManager.java
- enum ProcessState {
- PROCESS_UNKNOWN = 0;
- // Persistent system process.
- PERSISTENT = 1;
- // Top activity; actually any visible activity.
- TOP = 2;
- // Important foreground process (ime, wallpaper, etc).
- IMPORTANT_FOREGROUND = 3;
- // Important background process.
- IMPORTANT_BACKGROUND = 4;
- // Performing backup operation.
- BACKUP = 5;
- // Background process running a service.
- SERVICE = 6;
- // Process not running, but would be if there was enough RAM.
- SERVICE_RESTARTING = 7;
- // Process running a receiver.
- RECEIVER = 8;
- // Heavy-weight process (currently not used).
- HEAVY_WEIGHT = 9;
- // Process hosting home/launcher app when not on top.
- HOME = 10;
- // Process hosting the last app the user was in.
- LAST_ACTIVITY = 11;
- // Cached process hosting a previous activity.
- CACHED_ACTIVITY = 12;
- // Cached process hosting a client activity.
- CACHED_ACTIVITY_CLIENT = 13;
- // Cached process that is empty.
- CACHED_EMPTY = 14;
- }
- optional ProcessState process_state = 3;
-
- // Millisecond duration spent in this state
- optional int64 duration_ms = 4;
-
- // # of samples taken
- optional int32 sample_size = 5;
-
- // PSS is memory reserved for this process
- optional android.util.AggStats pss = 6;
-
- // USS is memory shared between processes, divided evenly for accounting
- optional android.util.AggStats uss = 7;
-
- // RSS is memory resident for this process
- optional android.util.AggStats rss = 8;
- }
- repeated State states = 5;
+ // Time and memory spent in various states.
+ repeated ProcessStatsStateProto states = 5;
// Total time process has been running... screen_state, memory_state, and process_state
// will not be set.
- optional State total_running_state = 6;
+ optional ProcessStatsStateProto total_running_state = 6;
+}
+
+// Next Tag: 7
+message ProcessStatsServiceStateProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Name of service component.
+ optional string service_name = 1;
+
+ // Information about a state the service can be in.
+ message OperationInfo {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Number of times the service was in this operation.
+ optional int32 count = 1;
+
+ // Time this operation was active in various states. process_state will not be set;
+ // includes only uptime, not memory info.
+ repeated ProcessStatsStateProto states = 2;
+ }
+
+ // Information about when the service was operating as running (that is how long it was
+ // running for any reason, such as the finer-grained started, bound, and executing times
+ // also reported in this proto).
+ optional OperationInfo running_op = 2;
+
+ // Information about when the service was operating as started.
+ optional OperationInfo started_op = 3;
+
+ // Information about when the service was operating as foreground.
+ optional OperationInfo foreground_op = 4;
+
+ // Information about when the service was operating as bound.
+ optional OperationInfo bound_op = 5;
+
+ // Information about when the service was operating as executing.
+ optional OperationInfo executing_op = 6;
+}
+
+// Next Tag: 7
+message ProcessStatsAssociationStateProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Name of the target component.
+ optional string component_name = 1;
+
+ // Information on one source in this association.
+ message Source {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Name of source process.
+ optional string process = 1;
+
+ // Uid of the source process.
+ optional int32 uid = 2;
+
+ // Total count of the times this association appeared.
+ optional int32 total_count = 3;
+
+ // Millisecond uptime total duration this association was around.
+ optional int64 total_duration_ms = 4;
+
+ // Total count of the times this association became actively impacting its target process.
+ optional int32 active_count = 5;
+
+ // Time association was active in various states. screen_state and memory_state will not
+ // be set; includes only uptime, not memory info.
+ repeated ProcessStatsStateProto active_states = 6;
+ }
+ repeated Source sources = 3;
+}
+
+// Next Tag: 7
+message ProcessStatsPackageProto {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Name of package.
+ optional string package = 1;
+
+ // Uid of the package.
+ optional int32 uid = 2;
+
+ // Version of the package.
+ optional int64 version = 3;
+
+ // Stats for each process running with the package loaded in to it.
+ repeated ProcessStatsProto process_stats = 4;
+
+ // Stats for each of the package's services.
+ repeated ProcessStatsServiceStateProto service_stats = 5;
+
+ // Stats for each association with the package.
+ repeated ProcessStatsAssociationStateProto association_stats = 6;
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index fddb904..c8343e2 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2491,6 +2491,7 @@
<item>com.android.server.notification.VisibilityExtractor</item>
<!-- Depends on ZenModeExtractor -->
<item>com.android.server.notification.BadgeExtractor</item>
+ <item>com.android.server.notification.CriticalNotificationExtractor</item>
</string-array>
diff --git a/core/tests/utiltests/jni/android_util_MemoryIntArrayTest.cpp b/core/tests/utiltests/jni/android_util_MemoryIntArrayTest.cpp
index 57ee2d5..4b14284 100644
--- a/core/tests/utiltests/jni/android_util_MemoryIntArrayTest.cpp
+++ b/core/tests/utiltests/jni/android_util_MemoryIntArrayTest.cpp
@@ -21,36 +21,6 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
-jint android_util_MemoryIntArrayTest_createAshmem(__attribute__((unused)) JNIEnv* env,
- __attribute__((unused)) jobject clazz,
- jstring name, jint size)
-{
-
- if (name == NULL) {
- return -1;
- }
-
- if (size < 0) {
- return -1;
- }
-
- const char* nameStr = env->GetStringUTFChars(name, NULL);
- const int ashmemSize = sizeof(std::atomic_int) * size;
- int fd = ashmem_create_region(nameStr, ashmemSize);
- env->ReleaseStringUTFChars(name, nameStr);
-
- if (fd < 0) {
- return -1;
- }
-
- int setProtResult = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
- if (setProtResult < 0) {
- return -1;
- }
-
- return fd;
-}
-
void android_util_MemoryIntArrayTest_setAshmemSize(__attribute__((unused)) JNIEnv* env,
__attribute__((unused)) jobject clazz, jint fd, jint size)
{
diff --git a/core/tests/utiltests/jni/registration.cpp b/core/tests/utiltests/jni/registration.cpp
index 0c84d98..d4fc2fb 100644
--- a/core/tests/utiltests/jni/registration.cpp
+++ b/core/tests/utiltests/jni/registration.cpp
@@ -16,25 +16,14 @@
#include <jni.h>
-extern jint android_util_MemoryIntArrayTest_createAshmem(JNIEnv* env,
- jobject clazz, jstring name, jint size);
extern void android_util_MemoryIntArrayTest_setAshmemSize(JNIEnv* env,
jobject clazz, jint fd, jint size);
extern "C" {
- JNIEXPORT jint JNICALL Java_android_util_MemoryIntArrayTest_nativeCreateAshmem(
- JNIEnv * env, jobject obj, jstring name, jint size);
JNIEXPORT void JNICALL Java_android_util_MemoryIntArrayTest_nativeSetAshmemSize(
JNIEnv * env, jobject obj, jint fd, jint size);
};
-JNIEXPORT jint JNICALL Java_android_util_MemoryIntArrayTest_nativeCreateAshmem(
- __attribute__((unused)) JNIEnv * env,__attribute__((unused)) jobject obj,
- jstring name, jint size)
-{
- return android_util_MemoryIntArrayTest_createAshmem(env, obj, name, size);
-}
-
JNIEXPORT void JNICALL Java_android_util_MemoryIntArrayTest_nativeSetAshmemSize(
__attribute__((unused)) JNIEnv * env,__attribute__((unused)) jobject obj,
jint fd, jint size)
diff --git a/core/tests/utiltests/src/android/util/MemoryIntArrayTest.java b/core/tests/utiltests/src/android/util/MemoryIntArrayTest.java
index 85817bb..24b33ef 100644
--- a/core/tests/utiltests/src/android/util/MemoryIntArrayTest.java
+++ b/core/tests/utiltests/src/android/util/MemoryIntArrayTest.java
@@ -23,6 +23,7 @@
import static org.junit.Assert.fail;
import android.os.Parcel;
+import android.os.ParcelFileDescriptor;
import android.support.test.runner.AndroidJUnit4;
import libcore.io.IoUtils;
import org.junit.Test;
@@ -251,13 +252,11 @@
// Create a MemoryIntArray to muck with
MemoryIntArray array = new MemoryIntArray(1);
- // Create the fd to stuff in the MemoryIntArray
- final int fd = nativeCreateAshmem("foo", 1);
-
- // Replace the fd with our ahsmem region
- Field fdFiled = MemoryIntArray.class.getDeclaredField("mFd");
- fdFiled.setAccessible(true);
- fdFiled.set(array, fd);
+ // Grab the internal ashmem fd.
+ Field fdField = MemoryIntArray.class.getDeclaredField("mFd");
+ fdField.setAccessible(true);
+ int fd = ((ParcelFileDescriptor)fdField.get(array)).getFd();
+ assertTrue("fd must be valid", fd != -1);
CountDownLatch countDownLatch = new CountDownLatch(2);
@@ -292,10 +291,9 @@
}
if (!success) {
- fail("MemoryIntArray should catch ahshmem size changing under it");
+ fail("MemoryIntArray should catch ashmem size changing under it");
}
}
- private native int nativeCreateAshmem(String name, int size);
private native void nativeSetAshmemSize(int fd, int size);
}
diff --git a/packages/CarSystemUI/res/values/colors.xml b/packages/CarSystemUI/res/values/colors.xml
index e9ddbaf..df8f8db 100644
--- a/packages/CarSystemUI/res/values/colors.xml
+++ b/packages/CarSystemUI/res/values/colors.xml
@@ -19,7 +19,7 @@
<color name="car_accent">#356FE5</color>
<!-- colors for user switcher -->
<color name="car_user_switcher_background_color">#000000</color>
- <color name="car_user_switcher_name_text_color">@color/car_title2_light</color>
+ <color name="car_user_switcher_name_text_color">@color/car_body1_light</color>
<color name="car_user_switcher_add_user_background_color">#131313</color>
<color name="car_nav_icon_fill_color">@color/car_grey_50</color>
<!-- colors for seekbar -->
diff --git a/packages/CarSystemUI/res/values/dimens.xml b/packages/CarSystemUI/res/values/dimens.xml
index 3829aa3..07ecca2 100644
--- a/packages/CarSystemUI/res/values/dimens.xml
+++ b/packages/CarSystemUI/res/values/dimens.xml
@@ -29,7 +29,7 @@
<dimen name="car_primary_icon_size">36dp</dimen>
<!-- dimensions for the car user switcher -->
- <dimen name="car_user_switcher_name_text_size">@dimen/car_title2_size</dimen>
+ <dimen name="car_user_switcher_name_text_size">@dimen/car_body1_size</dimen>
<dimen name="car_user_switcher_vertical_spacing_between_users">124dp</dimen>
<!--These values represent MIN and MAX for hvac-->
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/AnimatedTemperatureView.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/AnimatedTemperatureView.java
index 27d3106..6473f0d 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/AnimatedTemperatureView.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/AnimatedTemperatureView.java
@@ -23,8 +23,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
-import com.android.systemui.statusbar.car.hvac.TemperatureView;
-import com.android.systemui.statusbar.car.hvac.HvacController;
import android.util.AttributeSet;
import android.util.Property;
import android.view.Gravity;
@@ -36,8 +34,8 @@
import android.widget.TextSwitcher;
import android.widget.TextView;
-import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.statusbar.car.hvac.TemperatureView;
/**
* Simple text display of HVAC properties, It is designed to show mTemperature and is configured in
@@ -47,8 +45,6 @@
* hvacAreaId - Example: VehicleSeat.SEAT_ROW_1_LEFT (1)
* hvacTempFormat - Example: "%.1f\u00B0" (1 decimal and the degree symbol)
* hvacOrientaion = Example: left
- * <p>
- * Note: It registers itself with {@link HvacController}
*/
public class AnimatedTemperatureView extends FrameLayout implements TemperatureView {
@@ -158,12 +154,9 @@
ViewGroup.LayoutParams.MATCH_PARENT);
typedArray.recycle();
-
- // register with controller
- HvacController hvacController = Dependency.get(HvacController.class);
- hvacController.addHvacTextView(this);
}
+
private TextView generateTextView() {
TextView textView = new TextView(getContext());
textView.setTextAppearance(mTextAppearanceRes);
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/TemperatureBackgroundAnimator.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/TemperatureBackgroundAnimator.java
index 0bc94b5..3c6d623 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/TemperatureBackgroundAnimator.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/TemperatureBackgroundAnimator.java
@@ -131,7 +131,9 @@
}
void animateOpen() {
- if (!mAnimationsReady || mCircleState == CircleState.ENTERING) {
+ if (!mAnimationsReady
+ || !mAnimatedView.isAttachedToWindow()
+ || mCircleState == CircleState.ENTERING) {
return;
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index b90d307..b0ff9e3 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -23,7 +23,6 @@
import android.bluetooth.BluetoothUuid;
import android.content.Context;
import android.content.SharedPreferences;
-import android.media.AudioManager;
import android.os.ParcelUuid;
import android.os.SystemClock;
import android.text.TextUtils;
@@ -51,7 +50,6 @@
private final Context mContext;
private final LocalBluetoothAdapter mLocalAdapter;
private final LocalBluetoothProfileManager mProfileManager;
- private final AudioManager mAudioManager;
private final BluetoothDevice mDevice;
//TODO: consider remove, BluetoothDevice.getName() is already cached
private String mName;
@@ -187,7 +185,6 @@
mContext = context;
mLocalAdapter = adapter;
mProfileManager = profileManager;
- mAudioManager = context.getSystemService(AudioManager.class);
mDevice = device;
mProfileConnectionState = new HashMap<LocalBluetoothProfile, Integer>();
fillData();
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
index f39b851..e2c8ecd 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
@@ -126,6 +126,12 @@
*/
public static final String META_DATA_PREFERENCE_ICON_BACKGROUND_HINT =
"com.android.settings.bg.hint";
+ /**
+ * Name of the meta-data item that should be set in the AndroidManifest.xml
+ * to specify the icon background color as raw ARGB.
+ */
+ public static final String META_DATA_PREFERENCE_ICON_BACKGROUND_ARGB =
+ "com.android.settings.bg.argb";
/**
* Name of the meta-data item that should be set in the AndroidManifest.xml
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java
index 914d182..dde1746 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java
@@ -54,7 +54,7 @@
final List<ResourcePath> paths = super.getIncludedResourcePaths();
paths.add(resourcePath("file:frameworks/base/packages/SettingsLib/res"));
paths.add(resourcePath("file:frameworks/base/core/res/res"));
- paths.add(resourcePath("file:frameworks/support/appcompat/res"));
+ paths.add(resourcePath("file:out/soong/.intermediates/prebuilts/sdk/current/androidx/androidx.appcompat_appcompat-nodeps/android_common/aar/res/"));
return paths;
}
};
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 007e140..c6ea480 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1791,13 +1791,13 @@
Settings.Secure.DOZE_ALWAYS_ON,
SecureSettingsProto.Doze.ALWAYS_ON);
dumpSetting(s, p,
- Settings.Secure.DOZE_PULSE_ON_PICK_UP,
+ Settings.Secure.DOZE_PICK_UP_GESTURE,
SecureSettingsProto.Doze.PULSE_ON_PICK_UP);
dumpSetting(s, p,
Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
SecureSettingsProto.Doze.PULSE_ON_LONG_PRESS);
dumpSetting(s, p,
- Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
+ Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
SecureSettingsProto.Doze.PULSE_ON_DOUBLE_TAP);
p.end(dozeToken);
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 1c13395..500199f 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -3242,9 +3242,9 @@
getSettingLocked(Settings.Secure.DOZE_ENABLED).getValue());
if (dozeExplicitlyDisabled) {
- secureSettings.insertSettingLocked(Settings.Secure.DOZE_PULSE_ON_PICK_UP,
+ secureSettings.insertSettingLocked(Settings.Secure.DOZE_PICK_UP_GESTURE,
"0", null, true, SettingsState.SYSTEM_PACKAGE_NAME);
- secureSettings.insertSettingLocked(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
+ secureSettings.insertSettingLocked(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
"0", null, true, SettingsState.SYSTEM_PACKAGE_NAME);
}
currentVersion = 131;
diff --git a/packages/SystemUI/Android.mk b/packages/SystemUI/Android.mk
index d9ec0fd0..920e3b6a 100644
--- a/packages/SystemUI/Android.mk
+++ b/packages/SystemUI/Android.mk
@@ -7,7 +7,6 @@
LOCAL_SRC_FILES := $(call all-proto-files-under,src)
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/packages/SystemUI/res/layout/menu_ime.xml b/packages/SystemUI/res/layout/menu_ime.xml
index 8a3a0b1..b047efb 100644
--- a/packages/SystemUI/res/layout/menu_ime.xml
+++ b/packages/SystemUI/res/layout/menu_ime.xml
@@ -19,6 +19,7 @@
android:id="@+id/menu_container"
android:layout_width="@dimen/navigation_key_width"
android:layout_height="match_parent"
+ android:focusable="false"
android:importantForAccessibility="no"
>
<!-- Use nav button width & height=match_parent for parent FrameLayout and buttons because they
diff --git a/packages/SystemUI/res/values-bg/donottranslate.xml b/packages/SystemUI/res/values-bg/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-bg/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-hu/donottranslate.xml b/packages/SystemUI/res/values-hu/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-hu/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-ja/donottranslate.xml b/packages/SystemUI/res/values-ja/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-ja/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-ko/donottranslate.xml b/packages/SystemUI/res/values-ko/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-ko/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-lt/donottranslate.xml b/packages/SystemUI/res/values-lt/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-lt/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-sw720dp/donottranslate.xml b/packages/SystemUI/res/values-sw720dp/donottranslate.xml
deleted file mode 100644
index 0996067..0000000
--- a/packages/SystemUI/res/values-sw720dp/donottranslate.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2011, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. %1$s is DOW, %2$s is date.
- We show both (DOW on one line, then the date) but this can be overridden for locales as
- necessary.
- -->
- <string name="status_bar_date_formatter">%1$s\n%2$s</string>
-
-</resources>
-
diff --git a/packages/SystemUI/res/values-tr/donottranslate.xml b/packages/SystemUI/res/values-tr/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-tr/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-zh-rCN/donottranslate.xml b/packages/SystemUI/res/values-zh-rCN/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-zh-rCN/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/res/values-zh-rTW/donottranslate.xml b/packages/SystemUI/res/values-zh-rTW/donottranslate.xml
deleted file mode 100644
index dcf434d..0000000
--- a/packages/SystemUI/res/values-zh-rTW/donottranslate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- For formatting day of week and date in DateView. Day of week precedes date by default,
- but this may be overridden on a per-locale basis if necessary. -->
- <string name="status_bar_date_formatter">%2$s\n%1$s</string>
-
-</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index 68d77eb..520e40a 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -43,12 +43,9 @@
import android.graphics.Rect;
import android.graphics.Region;
import android.hardware.display.DisplayManager;
-import android.os.Handler;
-import android.os.HandlerThread;
import android.os.SystemProperties;
import android.provider.Settings.Secure;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.DisplayCutout;
import android.view.DisplayInfo;
import android.view.Gravity;
@@ -63,7 +60,6 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
-import com.android.internal.util.Preconditions;
import com.android.systemui.RegionInterceptingFrameLayout.RegionInterceptableView;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentHostManager.FragmentListener;
@@ -83,9 +79,6 @@
* for antialiasing and emulation purposes.
*/
public class ScreenDecorations extends SystemUI implements Tunable {
- private static final boolean DEBUG = false;
- private static final String TAG = "ScreenDecorations";
-
public static final String SIZE = "sysui_rounded_size";
public static final String PADDING = "sysui_rounded_content_padding";
private static final boolean DEBUG_SCREENSHOT_ROUNDED_CORNERS =
@@ -106,23 +99,9 @@
private DisplayCutoutView mCutoutBottom;
private SecureSetting mColorInversionSetting;
private boolean mPendingRotationChange;
- private Handler mHandler;
@Override
public void start() {
- mHandler = startHandlerThread();
- mHandler.post(this::startOnScreenDecorationsThread);
- setupStatusBarPaddingIfNeeded();
- }
-
- @VisibleForTesting
- Handler startHandlerThread() {
- HandlerThread thread = new HandlerThread("ScreenDecorations");
- thread.start();
- return thread.getThreadHandler();
- }
-
- private void startOnScreenDecorationsThread() {
mWindowManager = mContext.getSystemService(WindowManager.class);
mRoundedDefault = mContext.getResources().getDimensionPixelSize(
R.dimen.rounded_corner_radius);
@@ -134,6 +113,12 @@
setupDecorations();
}
+ int padding = mContext.getResources().getDimensionPixelSize(
+ R.dimen.rounded_corner_content_padding);
+ if (padding != 0) {
+ setupPadding(padding);
+ }
+
mDisplayListener = new DisplayManager.DisplayListener() {
@Override
public void onDisplayAdded(int displayId) {
@@ -147,8 +132,8 @@
@Override
public void onDisplayChanged(int displayId) {
- final int newRotation = RotationUtils.getExactRotation(mContext);
- if (mOverlay != null && mBottomOverlay != null && mRotation != newRotation) {
+ if ((hasRoundedCorners() || shouldDrawCutout()) &&
+ mRotation != RotationUtils.getExactRotation(mContext)) {
// We cannot immediately update the orientation. Otherwise
// WindowManager is still deferring layout until it has finished dispatching
// the config changes, which may cause divergence between what we draw
@@ -157,15 +142,10 @@
// - we are trying to redraw. This because WM resized our window and told us to.
// - the config change has been dispatched, so WM is no longer deferring layout.
mPendingRotationChange = true;
- if (DEBUG) {
- Log.i(TAG, "Rotation changed, deferring " + newRotation + ", staying at "
- + mRotation);
- }
-
mOverlay.getViewTreeObserver().addOnPreDrawListener(
- new RestartingPreDrawListener(mOverlay, newRotation));
+ new RestartingPreDrawListener(mOverlay));
mBottomOverlay.getViewTreeObserver().addOnPreDrawListener(
- new RestartingPreDrawListener(mBottomOverlay, newRotation));
+ new RestartingPreDrawListener(mBottomOverlay));
}
updateOrientation();
}
@@ -174,7 +154,7 @@
mRotation = -1;
mDisplayManager = (DisplayManager) mContext.getSystemService(
Context.DISPLAY_SERVICE);
- mDisplayManager.registerDisplayListener(mDisplayListener, mHandler);
+ mDisplayManager.registerDisplayListener(mDisplayListener, null);
}
private void setupDecorations() {
@@ -204,11 +184,10 @@
mWindowManager.getDefaultDisplay().getMetrics(metrics);
mDensity = metrics.density;
- Dependency.get(Dependency.MAIN_HANDLER).post(
- () -> Dependency.get(TunerService.class).addTunable(this, SIZE));
+ Dependency.get(TunerService.class).addTunable(this, SIZE);
// Watch color inversion and invert the overlay as needed.
- mColorInversionSetting = new SecureSetting(mContext, mHandler,
+ mColorInversionSetting = new SecureSetting(mContext, Dependency.get(Dependency.MAIN_HANDLER),
Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED) {
@Override
protected void handleValueChanged(int value, boolean observedChange) {
@@ -220,7 +199,7 @@
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_USER_SWITCHED);
- mContext.registerReceiver(mIntentReceiver, filter, null /* permission */, mHandler);
+ mContext.registerReceiver(mIntentReceiver, filter);
mOverlay.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
@@ -238,11 +217,6 @@
.start();
}
});
-
- mOverlay.getViewTreeObserver().addOnPreDrawListener(
- new ValidatingPreDrawListener(mOverlay));
- mBottomOverlay.getViewTreeObserver().addOnPreDrawListener(
- new ValidatingPreDrawListener(mBottomOverlay));
}
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@@ -272,28 +246,14 @@
@Override
protected void onConfigurationChanged(Configuration newConfig) {
- mHandler.post(() -> {
- int oldRotation = mRotation;
- mPendingRotationChange = false;
- updateOrientation();
- if (DEBUG) Log.i(TAG, "onConfigChanged from rot " + oldRotation + " to " + mRotation);
- if (shouldDrawCutout() && mOverlay == null) {
- setupDecorations();
- }
- if (mOverlay != null) {
- // Updating the layout params ensures that ViewRootImpl will call relayoutWindow(),
- // which ensures that the forced seamless rotation will end, even if we updated
- // the rotation before window manager was ready (and was still waiting for sending
- // the updated rotation).
- updateLayoutParams();
- }
- });
+ mPendingRotationChange = false;
+ updateOrientation();
+ if (shouldDrawCutout() && mOverlay == null) {
+ setupDecorations();
+ }
}
- private void updateOrientation() {
- Preconditions.checkState(mHandler.getLooper().getThread() == Thread.currentThread(),
- "must call on " + mHandler.getLooper().getThread()
- + ", but was " + Thread.currentThread());
+ protected void updateOrientation() {
if (mPendingRotationChange) {
return;
}
@@ -373,19 +333,7 @@
com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout);
}
-
- private void setupStatusBarPaddingIfNeeded() {
- // TODO: This should be moved to a more appropriate place, as it is not related to the
- // screen decorations overlay.
- int padding = mContext.getResources().getDimensionPixelSize(
- R.dimen.rounded_corner_content_padding);
- if (padding != 0) {
- setupStatusBarPadding(padding);
- }
-
- }
-
- private void setupStatusBarPadding(int padding) {
+ private void setupPadding(int padding) {
// Add some padding to all the content near the edge of the screen.
StatusBar sb = getComponent(StatusBar.class);
View statusBar = (sb != null ? sb.getStatusBarWindow() : null);
@@ -454,32 +402,30 @@
@Override
public void onTuningChanged(String key, String newValue) {
- mHandler.post(() -> {
- if (mOverlay == null) return;
- if (SIZE.equals(key)) {
- int size = mRoundedDefault;
- int sizeTop = mRoundedDefaultTop;
- int sizeBottom = mRoundedDefaultBottom;
- if (newValue != null) {
- try {
- size = (int) (Integer.parseInt(newValue) * mDensity);
- } catch (Exception e) {
- }
+ if (mOverlay == null) return;
+ if (SIZE.equals(key)) {
+ int size = mRoundedDefault;
+ int sizeTop = mRoundedDefaultTop;
+ int sizeBottom = mRoundedDefaultBottom;
+ if (newValue != null) {
+ try {
+ size = (int) (Integer.parseInt(newValue) * mDensity);
+ } catch (Exception e) {
}
-
- if (sizeTop == 0) {
- sizeTop = size;
- }
- if (sizeBottom == 0) {
- sizeBottom = size;
- }
-
- setSize(mOverlay.findViewById(R.id.left), sizeTop);
- setSize(mOverlay.findViewById(R.id.right), sizeTop);
- setSize(mBottomOverlay.findViewById(R.id.left), sizeBottom);
- setSize(mBottomOverlay.findViewById(R.id.right), sizeBottom);
}
- });
+
+ if (sizeTop == 0) {
+ sizeTop = size;
+ }
+ if (sizeBottom == 0) {
+ sizeBottom = size;
+ }
+
+ setSize(mOverlay.findViewById(R.id.left), sizeTop);
+ setSize(mOverlay.findViewById(R.id.right), sizeTop);
+ setSize(mBottomOverlay.findViewById(R.id.left), sizeBottom);
+ setSize(mBottomOverlay.findViewById(R.id.right), sizeBottom);
+ }
}
private void setSize(View view, int pixelSize) {
@@ -538,11 +484,6 @@
mVisibilityChangedListener = visibilityChangedListener;
mDecorations = decorations;
setId(R.id.display_cutout);
- if (DEBUG) {
- getViewTreeObserver().addOnDrawListener(() -> Log.i(TAG,
- (mInitialStart ? "OverlayTop" : "OverlayBottom")
- + " drawn in rot " + mRotation));
- }
}
public void setColor(int color) {
@@ -778,66 +719,20 @@
private class RestartingPreDrawListener implements ViewTreeObserver.OnPreDrawListener {
private final View mView;
- private final int mTargetRotation;
- private RestartingPreDrawListener(View view, int targetRotation) {
+ private RestartingPreDrawListener(View view) {
mView = view;
- mTargetRotation = targetRotation;
}
@Override
public boolean onPreDraw() {
- mView.getViewTreeObserver().removeOnPreDrawListener(this);
-
- if (mTargetRotation == mRotation) {
- if (DEBUG) {
- Log.i(TAG, (mView == mOverlay ? "OverlayTop" : "OverlayBottom")
- + " already in target rot "
- + mTargetRotation + ", allow draw without restarting it");
- }
- return true;
- }
-
mPendingRotationChange = false;
+ mView.getViewTreeObserver().removeOnPreDrawListener(this);
// This changes the window attributes - we need to restart the traversal for them to
// take effect.
updateOrientation();
- if (DEBUG) {
- Log.i(TAG, (mView == mOverlay ? "OverlayTop" : "OverlayBottom")
- + " restarting listener fired, restarting draw for rot " + mRotation);
- }
mView.invalidate();
return false;
}
}
-
- /**
- * A pre-draw listener, that validates that the rotation we draw in matches the displays
- * rotation before continuing the draw.
- *
- * This is to prevent a race condition, where we have not received the display changed event
- * yet, and would thus draw in an old orientation.
- */
- private class ValidatingPreDrawListener implements ViewTreeObserver.OnPreDrawListener {
-
- private final View mView;
-
- public ValidatingPreDrawListener(View view) {
- mView = view;
- }
-
- @Override
- public boolean onPreDraw() {
- final int displayRotation = RotationUtils.getExactRotation(mContext);
- if (displayRotation != mRotation && !mPendingRotationChange) {
- if (DEBUG) {
- Log.i(TAG, "Drawing rot " + mRotation + ", but display is at rot "
- + displayRotation + ". Restarting draw");
- }
- mView.invalidate();
- return false;
- }
- return true;
- }
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/analytics/SensorLoggerSession.java b/packages/SystemUI/src/com/android/systemui/analytics/SensorLoggerSession.java
index f8b73a1..d6472b7 100644
--- a/packages/SystemUI/src/com/android/systemui/analytics/SensorLoggerSession.java
+++ b/packages/SystemUI/src/com/android/systemui/analytics/SensorLoggerSession.java
@@ -101,31 +101,31 @@
public Session toProto() {
Session proto = new Session();
- proto.setStartTimestampMillis(mStartTimestampMillis);
- proto.setDurationMillis(mEndTimestampMillis - mStartTimestampMillis);
- proto.setBuild(Build.FINGERPRINT);
- proto.setResult(mResult);
- proto.setType(mType);
+ proto.startTimestampMillis = mStartTimestampMillis;
+ proto.durationMillis = mEndTimestampMillis - mStartTimestampMillis;
+ proto.build = Build.FINGERPRINT;
+ proto.result = mResult;
+ proto.type = mType;
proto.sensorEvents = mSensorEvents.toArray(proto.sensorEvents);
proto.touchEvents = mMotionEvents.toArray(proto.touchEvents);
proto.phoneEvents = mPhoneEvents.toArray(proto.phoneEvents);
- proto.setTouchAreaWidth(mTouchAreaWidth);
- proto.setTouchAreaHeight(mTouchAreaHeight);
+ proto.touchAreaWidth = mTouchAreaWidth;
+ proto.touchAreaHeight = mTouchAreaHeight;
return proto;
}
private PhoneEvent phoneEventToProto(int eventType, long sysTimeNanos) {
PhoneEvent proto = new PhoneEvent();
- proto.setType(eventType);
- proto.setTimeOffsetNanos(sysTimeNanos - mStartSystemTimeNanos);
+ proto.type = eventType;
+ proto.timeOffsetNanos = sysTimeNanos - mStartSystemTimeNanos;
return proto;
}
private SensorEvent sensorEventToProto(android.hardware.SensorEvent ev, long sysTimeNanos) {
SensorEvent proto = new SensorEvent();
- proto.setType(ev.sensor.getType());
- proto.setTimeOffsetNanos(sysTimeNanos - mStartSystemTimeNanos);
- proto.setTimestamp(ev.timestamp);
+ proto.type = ev.sensor.getType();
+ proto.timeOffsetNanos = sysTimeNanos - mStartSystemTimeNanos;
+ proto.timestamp = ev.timestamp;
proto.values = ev.values.clone();
return proto;
}
@@ -133,17 +133,17 @@
private TouchEvent motionEventToProto(MotionEvent ev) {
int count = ev.getPointerCount();
TouchEvent proto = new TouchEvent();
- proto.setTimeOffsetNanos(ev.getEventTimeNano() - mStartSystemTimeNanos);
- proto.setAction(ev.getActionMasked());
- proto.setActionIndex(ev.getActionIndex());
+ proto.timeOffsetNanos = ev.getEventTimeNano() - mStartSystemTimeNanos;
+ proto.action = ev.getActionMasked();
+ proto.actionIndex = ev.getActionIndex();
proto.pointers = new TouchEvent.Pointer[count];
for (int i = 0; i < count; i++) {
TouchEvent.Pointer p = new TouchEvent.Pointer();
- p.setX(ev.getX(i));
- p.setY(ev.getY(i));
- p.setSize(ev.getSize(i));
- p.setPressure(ev.getPressure(i));
- p.setId(ev.getPointerId(i));
+ p.x = ev.getX(i);
+ p.y = ev.getY(i);
+ p.size = ev.getSize(i);
+ p.pressure = ev.getPressure(i);
+ p.id = ev.getPointerId(i);
proto.pointers[i] = p;
}
return proto;
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
index 79de48a..1cacdb5 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java
@@ -62,10 +62,10 @@
private static SummaryStats sEmergencyCallStats;
private static SummaryStats[][] sProxStats; // [reason][near/far]
- public static void tracePickupPulse(Context context, boolean withinVibrationThreshold) {
+ public static void tracePickupWakeUp(Context context, boolean withinVibrationThreshold) {
if (!ENABLED) return;
init(context);
- log("pickupPulse withinVibrationThreshold=" + withinVibrationThreshold);
+ log("pickupWakeUp withinVibrationThreshold=" + withinVibrationThreshold);
(withinVibrationThreshold ? sPickupPulseNearVibrationStats
: sPickupPulseNotNearVibrationStats).append();
}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index e87bd09..18dffa7 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -91,13 +91,13 @@
false /* touchscreen */),
mPickupSensor = new TriggerSensor(
mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE),
- Settings.Secure.DOZE_PULSE_ON_PICK_UP,
- config.pulseOnPickupAvailable(),
+ Settings.Secure.DOZE_PICK_UP_GESTURE,
+ config.dozePickupSensorAvailable(),
DozeLog.PULSE_REASON_SENSOR_PICKUP, false /* touchCoords */,
false /* touchscreen */),
new TriggerSensor(
findSensorWithType(config.doubleTapSensorType()),
- Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
+ Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
true /* configured */,
DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP,
dozeParameters.doubleTapReportsTouchCoordinates(),
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
index be3e322..4391a44 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
@@ -129,7 +129,9 @@
boolean isPickup = pulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP;
boolean isLongPress = pulseReason == DozeLog.PULSE_REASON_SENSOR_LONG_PRESS;
- if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT) && !isLongPress) {
+ if (isLongPress) {
+ requestPulse(pulseReason, sensorPerformedProxCheck);
+ } else {
proximityCheckThenCall((result) -> {
if (result == ProximityCheck.RESULT_NEAR) {
// In pocket, drop event.
@@ -138,13 +140,13 @@
if (isDoubleTap) {
mDozeHost.onDoubleTap(screenX, screenY);
mMachine.wakeUp();
+ } else if (isPickup) {
+ mMachine.wakeUp();
} else {
mDozeHost.extendPulse();
}
}, sensorPerformedProxCheck, pulseReason);
return;
- } else {
- requestPulse(pulseReason, sensorPerformedProxCheck);
}
if (isPickup) {
@@ -152,7 +154,7 @@
SystemClock.elapsedRealtime() - mNotificationPulseTime;
final boolean withinVibrationThreshold =
timeSinceNotification < mDozeParameters.getPickupVibrationThreshold();
- DozeLog.tracePickupPulse(mContext, withinVibrationThreshold);
+ DozeLog.tracePickupWakeUp(mContext, withinVibrationThreshold);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 6c94aa4..a195fc9 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -1399,6 +1399,7 @@
private final ColorExtractor mColorExtractor;
private boolean mKeyguardShowing;
private boolean mShouldDisplaySeparatedButton;
+ private boolean mShowing;
public ActionsDialog(Context context, OnClickListener clickListener, MyAdapter adapter,
OnItemLongClickListener longClickListener, boolean shouldDisplaySeparatedButton) {
@@ -1507,6 +1508,7 @@
@Override
public void show() {
super.show();
+ mShowing = true;
mGradientDrawable.setAlpha(0);
mHardwareLayout.setTranslationX(getAnimTranslation());
mHardwareLayout.setAlpha(0);
@@ -1526,6 +1528,10 @@
@Override
public void dismiss() {
+ if (!mShowing) {
+ return;
+ }
+ mShowing = false;
mHardwareLayout.setTranslationX(0);
mHardwareLayout.setAlpha(1);
mHardwareLayout.animate()
@@ -1544,6 +1550,7 @@
void dismissImmediately() {
super.dismiss();
+ mShowing = false;
}
private float getAnimTranslation() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java b/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java
index a1c2577..87c64c7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java
@@ -47,16 +47,12 @@
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
- switch (attr) {
- case R.styleable.PseudoGridView_numColumns:
- mNumColumns = a.getInt(attr, 3);
- break;
- case R.styleable.PseudoGridView_verticalSpacing:
- mVerticalSpacing = a.getDimensionPixelSize(attr, 0);
- break;
- case R.styleable.PseudoGridView_horizontalSpacing:
- mHorizontalSpacing = a.getDimensionPixelSize(attr, 0);
- break;
+ if (attr == R.styleable.PseudoGridView_numColumns) {
+ mNumColumns = a.getInt(attr, 3);
+ } else if (attr == R.styleable.PseudoGridView_verticalSpacing) {
+ mVerticalSpacing = a.getDimensionPixelSize(attr, 0);
+ } else if (attr == R.styleable.PseudoGridView_horizontalSpacing) {
+ mHorizontalSpacing = a.getDimensionPixelSize(attr, 0);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java
index 1e9a618..ad7d1b6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailItemView.java
@@ -69,13 +69,10 @@
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
- switch (attr) {
- case R.styleable.UserDetailItemView_regularFontFamily:
- mRegularTypeface = Typeface.create(a.getString(attr), 0 /* style */);
- break;
- case R.styleable.UserDetailItemView_activatedFontFamily:
- mActivatedTypeface = Typeface.create(a.getString(attr), 0 /* style */);
- break;
+ if (attr == R.styleable.UserDetailItemView_regularFontFamily) {
+ mRegularTypeface = Typeface.create(a.getString(attr), 0 /* style */);
+ } else if (attr == R.styleable.UserDetailItemView_activatedFontFamily) {
+ mActivatedTypeface = Typeface.create(a.getString(attr), 0 /* style */);
}
}
a.recycle();
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 3eb3160..98925b9 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -226,22 +226,16 @@
public boolean performAccessibilityAction(View host, int action, Bundle args) {
int currentPosition = getCurrentPosition();
SnapTarget nextTarget = null;
- switch (action) {
- case R.id.action_move_tl_full:
- nextTarget = mSnapAlgorithm.getDismissEndTarget();
- break;
- case R.id.action_move_tl_70:
- nextTarget = mSnapAlgorithm.getLastSplitTarget();
- break;
- case R.id.action_move_tl_50:
- nextTarget = mSnapAlgorithm.getMiddleTarget();
- break;
- case R.id.action_move_tl_30:
- nextTarget = mSnapAlgorithm.getFirstSplitTarget();
- break;
- case R.id.action_move_rb_full:
- nextTarget = mSnapAlgorithm.getDismissStartTarget();
- break;
+ if (action == R.id.action_move_tl_full) {
+ nextTarget = mSnapAlgorithm.getDismissEndTarget();
+ } else if (action == R.id.action_move_tl_70) {
+ nextTarget = mSnapAlgorithm.getLastSplitTarget();
+ } else if (action == R.id.action_move_tl_50) {
+ nextTarget = mSnapAlgorithm.getMiddleTarget();
+ } else if (action == R.id.action_move_tl_30) {
+ nextTarget = mSnapAlgorithm.getFirstSplitTarget();
+ } else if (action == R.id.action_move_rb_full) {
+ nextTarget = mSnapAlgorithm.getDismissStartTarget();
}
if (nextTarget != null) {
startDragging(true /* animate */, false /* touching */);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index aa07c70..6920d10 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -41,6 +41,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.car.hvac.HvacController;
+import com.android.systemui.statusbar.car.hvac.TemperatureView;
import com.android.systemui.statusbar.phone.CollapsedStatusBarFragment;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.BatteryController;
@@ -82,6 +83,7 @@
private ActivityManagerWrapper mActivityManagerWrapper;
private DeviceProvisionedController mDeviceProvisionedController;
private boolean mDeviceIsProvisioned = true;
+ private HvacController mHvacController;
@Override
public void start() {
@@ -95,8 +97,7 @@
createBatteryController();
mCarBatteryController.startListening();
- Log.d(TAG, "Connecting to HVAC service");
- Dependency.get(HvacController.class).connectToCarService();
+ mHvacController.connectToCarService();
mCarFacetButtonController = Dependency.get(CarFacetButtonController.class);
mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
@@ -119,10 +120,11 @@
* before and after the device is provisioned
*/
private void restartNavBars() {
+ // remove and reattach all hvac components such that we don't keep a reference to unused
+ // ui elements
+ mHvacController.removeAllComponents();
+ addTemperatureViewToController(mStatusBarWindow);
mCarFacetButtonController.removeAll();
-
- Dependency.get(HvacController.class).removeAllComponents();
-
if (mNavigationBarWindow != null) {
mNavigationBarWindow.removeAllViews();
mNavigationBarView = null;
@@ -137,9 +139,22 @@
mRightNavigationBarWindow.removeAllViews();
mRightNavigationBarView = null;
}
+
buildNavBarContent();
}
+ private void addTemperatureViewToController(View v) {
+ if (v instanceof TemperatureView) {
+ Log.d(TAG, "addTemperatureViewToController: found ");
+ mHvacController.addHvacTextView((TemperatureView) v);
+ } else if (v instanceof ViewGroup) {
+ ViewGroup viewGroup = (ViewGroup) v;
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ addTemperatureViewToController(viewGroup.getChildAt(i));
+ }
+ }
+ }
+
/**
* Allows for showing or hiding just the navigation bars. This is indented to be used when
* the full screen user selector is shown.
@@ -214,6 +229,7 @@
@Override
protected void makeStatusBarView() {
super.makeStatusBarView();
+ mHvacController = Dependency.get(HvacController.class);
mNotificationPanelBackground = getDefaultWallpaper();
mScrimController.setScrimBehindDrawable(mNotificationPanelBackground);
@@ -226,6 +242,7 @@
// when a device has connected by bluetooth.
mBatteryMeterView.setVisibility(View.GONE);
});
+ addTemperatureViewToController(mStatusBarWindow);
}
private BatteryController createBatteryController() {
@@ -264,7 +281,6 @@
private void buildNavBarWindows() {
if (mShowBottom) {
-
mNavigationBarWindow = (ViewGroup) View.inflate(mContext,
R.layout.navigation_bar_window, null);
}
@@ -342,6 +358,7 @@
throw new RuntimeException("Unable to build botom nav bar due to missing layout");
}
mNavigationBarView.setStatusBar(this);
+ addTemperatureViewToController(mNavigationBarView);
}
private void buildLeft(int layout) {
@@ -352,6 +369,7 @@
throw new RuntimeException("Unable to build left nav bar due to missing layout");
}
mLeftNavigationBarView.setStatusBar(this);
+ addTemperatureViewToController(mLeftNavigationBarView);
}
@@ -362,6 +380,8 @@
Log.e(TAG, "CarStatusBar failed inflate for R.layout.car_navigation_bar");
throw new RuntimeException("Unable to build right nav bar due to missing layout");
}
+ mRightNavigationBarView.setStatusBar(this);
+ addTemperatureViewToController(mRightNavigationBarView);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java
index 32fd054..6c924e3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.car.hvac;
import android.car.Car;
-import android.car.CarNotConnectedException;
import android.car.hardware.CarPropertyValue;
import android.car.hardware.hvac.CarHvacManager;
import android.car.hardware.hvac.CarHvacManager.CarHvacEventCallback;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureTextView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureTextView.java
index 8143c13..4d8ce43 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureTextView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureTextView.java
@@ -21,7 +21,6 @@
import android.util.AttributeSet;
import android.widget.TextView;
-import com.android.systemui.Dependency;
import com.android.systemui.R;
/**
@@ -31,8 +30,6 @@
* hvacPropertyId - Example: CarHvacManager.ID_ZONED_TEMP_SETPOINT (16385)
* hvacAreaId - Example: VehicleSeat.SEAT_ROW_1_LEFT (1)
* hvacTempFormat - Example: "%.1f\u00B0" (1 decimal and the degree symbol)
- *
- * Note: It registers itself with {@link HvacController}
*/
public class TemperatureTextView extends TextView implements TemperatureView {
@@ -47,10 +44,6 @@
mPropertyId = typedArray.getInt(R.styleable.TemperatureView_hvacPropertyId, -1);
String format = typedArray.getString(R.styleable.TemperatureView_hvacTempFormat);
mTempFormat = (format == null) ? "%.1f\u00B0" : format;
-
- // register with controller
- HvacController hvacController = Dependency.get(HvacController.class);
- hvacController.addHvacTextView(this);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 67967d4..094912b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -2772,16 +2772,18 @@
case AccessibilityNodeInfo.ACTION_LONG_CLICK:
doLongClickCallback();
return true;
- case R.id.action_snooze:
- NotificationMenuRowPlugin provider = getProvider();
- if (provider == null) {
- provider = createMenu();
+ default:
+ if (action == R.id.action_snooze) {
+ NotificationMenuRowPlugin provider = getProvider();
+ if (provider == null) {
+ provider = createMenu();
+ }
+ MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
+ if (snoozeMenu != null) {
+ doLongClickCallback(getWidth() / 2, getHeight() / 2, snoozeMenu);
+ }
+ return true;
}
- MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
- if (snoozeMenu != null) {
- doLongClickCallback(getWidth() / 2, getHeight() / 2, snoozeMenu);
- }
- return true;
}
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index ad2e9dc..b7c1b10 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -265,13 +265,11 @@
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
- switch (action) {
- case R.id.action_toggle_overview:
- SysUiServiceProvider.getComponent(getContext(), Recents.class)
- .toggleRecentApps();
- break;
- default:
- return super.performAccessibilityAction(host, action, args);
+ if (action == R.id.action_toggle_overview) {
+ SysUiServiceProvider.getComponent(getContext(), Recents.class)
+ .toggleRecentApps();
+ } else {
+ return super.performAccessibilityAction(host, action, args);
}
return true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java
index 09833d4..7b9ed88 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NearestTouchFrame.java
@@ -98,6 +98,7 @@
return mClickableChildren
.stream()
.filter(v -> v.isAttachedToWindow())
+ .filter(v -> v.isFocusable())
.map(v -> new Pair<>(distance(v, event), v))
.min(Comparator.comparingInt(f -> f.first))
.get().second;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
index 0db408c..0a724bd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
@@ -536,7 +536,8 @@
return 0;
}
- int translation = (int) (mLastVisibleIconState.xTranslation + mIconSize);
+ int translation = (int) (isLayoutRtl() ? getWidth() - mLastVisibleIconState.xTranslation
+ : mLastVisibleIconState.xTranslation + mIconSize);
// There's a chance that last translation goes beyond the edge maybe
return Math.min(getWidth(), translation);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
index a38328a..a5716f2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -180,12 +180,12 @@
mLpChanged.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
}
- private void applyExpandedFlag(State state) {
- if (state.panelExpanded || state.isKeyguardShowingAndNotOccluded() || state.bouncerShowing
+ private void applyForceShowNavigationFlag(State state) {
+ if (state.panelExpanded || state.bouncerShowing
|| ENABLE_REMOTE_INPUT && state.remoteInputActive) {
- mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_BAR_EXPANDED;
+ mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
} else {
- mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_BAR_EXPANDED;
+ mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
}
}
@@ -243,7 +243,7 @@
applyKeyguardFlags(state);
applyForceStatusBarVisibleFlag(state);
applyFocusableFlag(state);
- applyExpandedFlag(state);
+ applyForceShowNavigationFlag(state);
adjustScreenOrientation(state);
applyHeight(state);
applyUserActivityTimeout(state);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java
index dc1b35d..2ed2edb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java
@@ -45,25 +45,18 @@
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
- switch (attr) {
- case R.styleable.UserAvatarView_avatarPadding:
- setAvatarPadding(a.getDimension(attr, 0));
- break;
- case R.styleable.UserAvatarView_frameWidth:
- setFrameWidth(a.getDimension(attr, 0));
- break;
- case R.styleable.UserAvatarView_framePadding:
- setFramePadding(a.getDimension(attr, 0));
- break;
- case R.styleable.UserAvatarView_frameColor:
- setFrameColor(a.getColorStateList(attr));
- break;
- case R.styleable.UserAvatarView_badgeDiameter:
- setBadgeDiameter(a.getDimension(attr, 0));
- break;
- case R.styleable.UserAvatarView_badgeMargin:
- setBadgeMargin(a.getDimension(attr, 0));
- break;
+ if (attr == R.styleable.UserAvatarView_avatarPadding) {
+ setAvatarPadding(a.getDimension(attr, 0));
+ } else if (attr == R.styleable.UserAvatarView_frameWidth) {
+ setFrameWidth(a.getDimension(attr, 0));
+ } else if (attr == R.styleable.UserAvatarView_framePadding) {
+ setFramePadding(a.getDimension(attr, 0));
+ } else if (attr == R.styleable.UserAvatarView_frameColor) {
+ setFrameColor(a.getColorStateList(attr));
+ } else if (attr == R.styleable.UserAvatarView_badgeDiameter) {
+ setBadgeDiameter(a.getDimension(attr, 0));
+ } else if (attr == R.styleable.UserAvatarView_badgeMargin) {
+ setBadgeMargin(a.getDimension(attr, 0));
}
}
a.recycle();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 8dbdd21..cf39404 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -979,7 +979,7 @@
private SubscriptionInfo addSignalController(int id, int simSlotIndex) {
SubscriptionInfo info = new SubscriptionInfo(id, "", simSlotIndex, "", "", 0, 0, "", 0,
- null, null, null, "");
+ null, null, null, "", false, null, null);
MobileSignalController controller = new MobileSignalController(mContext,
mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info,
mSubDefaults, mReceiverHandler.getLooper());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index c76a4b5..dd03162 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -127,19 +127,14 @@
final int length = arr.getIndexCount();
for (int i = 0; i < length; i++) {
int attr = arr.getIndex(i);
- switch (attr) {
- case R.styleable.SmartReplyView_spacing:
- spacing = arr.getDimensionPixelSize(i, 0);
- break;
- case R.styleable.SmartReplyView_singleLineButtonPaddingHorizontal:
- singleLineButtonPaddingHorizontal = arr.getDimensionPixelSize(i, 0);
- break;
- case R.styleable.SmartReplyView_doubleLineButtonPaddingHorizontal:
- doubleLineButtonPaddingHorizontal = arr.getDimensionPixelSize(i, 0);
- break;
- case R.styleable.SmartReplyView_buttonStrokeWidth:
- strokeWidth = arr.getDimensionPixelSize(i, 0);
- break;
+ if (attr == R.styleable.SmartReplyView_spacing) {
+ spacing = arr.getDimensionPixelSize(i, 0);
+ } else if (attr == R.styleable.SmartReplyView_singleLineButtonPaddingHorizontal) {
+ singleLineButtonPaddingHorizontal = arr.getDimensionPixelSize(i, 0);
+ } else if (attr == R.styleable.SmartReplyView_doubleLineButtonPaddingHorizontal) {
+ doubleLineButtonPaddingHorizontal = arr.getDimensionPixelSize(i, 0);
+ } else if (attr == R.styleable.SmartReplyView_buttonStrokeWidth) {
+ strokeWidth = arr.getDimensionPixelSize(i, 0);
}
}
arr.recycle();
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 02babac..41e4768 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -149,6 +149,7 @@
private boolean mHovering = false;
private boolean mShowActiveStreamOnly;
private boolean mConfigChanged = false;
+ private boolean mIsAnimatingDismiss = false;
public VolumeDialogImpl(Context context) {
mContext = new ContextThemeWrapper(context, com.android.systemui.R.style.qs_theme);
@@ -582,18 +583,24 @@
protected void dismissH(int reason) {
mHandler.removeMessages(H.DISMISS);
mHandler.removeMessages(H.SHOW);
+ if (mIsAnimatingDismiss) {
+ return;
+ }
mDialogView.animate().cancel();
+ mIsAnimatingDismiss = false;
mShowing = false;
mDialogView.setTranslationX(0);
mDialogView.setAlpha(1);
ViewPropertyAnimator animator = mDialogView.animate()
+ .withStartAction(() -> mIsAnimatingDismiss = true)
.alpha(0)
.setDuration(250)
.setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
.withEndAction(() -> mHandler.postDelayed(() -> {
if (D.BUG) Log.d(TAG, "mDialog.dismiss()");
mDialog.dismiss();
+ mIsAnimatingDismiss = false;
}, 50));
if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2);
animator.start();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
index 644c0b3..f1bf31d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
@@ -34,10 +34,8 @@
import android.app.Fragment;
import android.content.res.Configuration;
-import android.os.Handler;
import android.support.test.filters.SmallTest;
import android.testing.AndroidTestingRunner;
-import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
import android.view.Display;
import android.view.View;
@@ -62,7 +60,6 @@
@SmallTest
public class ScreenDecorationsTest extends SysuiTestCase {
- private TestableLooper mTestableLooper;
private ScreenDecorations mScreenDecorations;
private StatusBar mStatusBar;
private WindowManager mWindowManager;
@@ -74,10 +71,6 @@
@Before
public void setup() {
- mTestableLooper = TestableLooper.get(this);
- mDependency.injectTestDependency(Dependency.MAIN_HANDLER,
- new Handler(mTestableLooper.getLooper()));
-
mStatusBar = mock(StatusBar.class);
mWindowManager = mock(WindowManager.class);
mView = spy(new StatusBarWindowView(mContext, null));
@@ -95,31 +88,7 @@
mTunerService = mDependency.injectMockDependency(TunerService.class);
-
- mScreenDecorations = new ScreenDecorations() {
- @Override
- public void start() {
- super.start();
- mTestableLooper.processAllMessages();
- }
-
- @Override
- Handler startHandlerThread() {
- return new Handler(mTestableLooper.getLooper());
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- mTestableLooper.processAllMessages();
- }
-
- @Override
- public void onTuningChanged(String key, String newValue) {
- super.onTuningChanged(key, newValue);
- mTestableLooper.processAllMessages();
- }
- };
+ mScreenDecorations = new ScreenDecorations();
mScreenDecorations.mContext = mContext;
mScreenDecorations.mComponents = mContext.getComponents();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java
index 62d80ac..f45500a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java
@@ -45,12 +45,12 @@
boolean[] doneHolder = new boolean[1];
AmbientDisplayConfiguration config = mock(AmbientDisplayConfiguration.class,
noDefaultAnswer(doneHolder));
- when(config.pulseOnDoubleTapEnabled(anyInt())).thenReturn(false);
- when(config.pulseOnPickupEnabled(anyInt())).thenReturn(false);
+ when(config.doubleTapGestureEnabled(anyInt())).thenReturn(false);
+ when(config.pickupGestureEnabled(anyInt())).thenReturn(false);
when(config.pulseOnNotificationEnabled(anyInt())).thenReturn(true);
when(config.doubleTapSensorType()).thenReturn(null);
- when(config.pulseOnPickupAvailable()).thenReturn(false);
+ when(config.dozePickupSensorAvailable()).thenReturn(false);
doneHolder[0] = true;
return config;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java
index 667a508..2423e14 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NearestTouchFrameTest.java
@@ -171,6 +171,23 @@
ev.recycle();
}
+ @Test
+ public void testFurtherSelectedWhenCloserNotFocusable() {
+ View closer = mockViewAt(0, 0, 10, 10);
+ View further = mockViewAt(20, 0, 10, 10);
+ closer.setFocusable(false);
+
+ mNearestTouchFrame.addView(closer);
+ mNearestTouchFrame.addView(further);
+ mNearestTouchFrame.onMeasure(0, 0);
+
+ MotionEvent ev = MotionEvent.obtain(0, 0, 0,
+ 12 /* x */, 5 /* y */, 0);
+ mNearestTouchFrame.onTouchEvent(ev);
+ verify(further).onTouchEvent(eq(ev));
+ ev.recycle();
+ }
+
private View mockViewAt(int x, int y, int width, int height) {
View v = spy(new View(mContext));
doAnswer(invocation -> {
@@ -187,6 +204,7 @@
v.setRight(width);
v.setTop(0);
v.setBottom(height);
+ v.setFocusable(true);
return v;
}
}
\ No newline at end of file
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetService.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetService.java
index c9c7adc..f69b638 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetService.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetService.java
@@ -48,11 +48,6 @@
}
@Override
- public void onUnlockUser(int userHandle) {
- FgThread.getHandler().post(() -> mImpl.onUserUnlocked(userHandle));
- }
-
- @Override
public void onStopUser(int userHandle) {
mImpl.onUserStopped(userHandle);
}
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index db8ad12..b71d7a7 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -19,7 +19,6 @@
import static android.content.Context.KEYGUARD_SERVICE;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import android.annotation.UserIdInt;
@@ -2697,7 +2696,12 @@
}
}
- void onUserUnlocked(int userId) {
+ /**
+ * This does not use the usual onUserUnlocked() listener mechanism because it is
+ * invoked at a choreographed point in the middle of the user unlock sequence,
+ * before the boot-completed broadcast is issued and the listeners notified.
+ */
+ void handleUserUnlocked(int userId) {
if (isProfileWithLockedParent(userId)) {
return;
}
@@ -2734,7 +2738,7 @@
}
}
}
- Slog.i(TAG, "Async processing of onUserUnlocked u" + userId + " took "
+ Slog.i(TAG, "Processing of handleUserUnlocked u" + userId + " took "
+ (SystemClock.elapsedRealtime() - time) + " ms");
}
@@ -4801,5 +4805,11 @@
return widgetPackages;
}
}
+
+ @Override
+ public void unlockUser(int userId) {
+ handleUserUnlocked(userId);
+ }
+
}
}
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index 5c14459..50f15ca0 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -624,7 +624,7 @@
// them will get the new sequence number at that point. (See for example how testing
// of JobScheduler's BatteryController works.)
sendBatteryChangedIntentLocked();
- if (mLastBatteryLevel != mHealthInfo.batteryLevel) {
+ if (mLastBatteryLevel != mHealthInfo.batteryLevel || mLastPlugType != mPlugType) {
sendBatteryLevelChangedIntentLocked();
}
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 6b3f8f8..914404b 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -2194,8 +2194,7 @@
break;
}
case NetworkAgent.EVENT_NETWORK_SCORE_CHANGED: {
- Integer score = (Integer) msg.obj;
- if (score != null) updateNetworkScore(nai, score.intValue());
+ updateNetworkScore(nai, msg.arg1);
break;
}
case NetworkAgent.EVENT_SET_EXPLICITLY_SELECTED: {
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index abcd6ef..5f391d8 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -646,12 +646,7 @@
SystemProperties.set(PROP_QTAGUID_ENABLED, mBandwidthControlEnabled ? "1" : "0");
- try {
- mConnector.execute("strict", "enable");
- mStrictEnabled = true;
- } catch (NativeDaemonConnectorException e) {
- Log.wtf(TAG, "Failed strict enable", e);
- }
+ mStrictEnabled = true;
setDataSaverModeEnabled(mDataSaverMode);
@@ -1809,26 +1804,26 @@
}
private void applyUidCleartextNetworkPolicy(int uid, int policy) {
- final String policyString;
+ final int policyValue;
switch (policy) {
case StrictMode.NETWORK_POLICY_ACCEPT:
- policyString = "accept";
+ policyValue = INetd.PENALTY_POLICY_ACCEPT;
break;
case StrictMode.NETWORK_POLICY_LOG:
- policyString = "log";
+ policyValue = INetd.PENALTY_POLICY_LOG;
break;
case StrictMode.NETWORK_POLICY_REJECT:
- policyString = "reject";
+ policyValue = INetd.PENALTY_POLICY_REJECT;
break;
default:
throw new IllegalArgumentException("Unknown policy " + policy);
}
try {
- mConnector.execute("strict", "set_uid_cleartext_policy", uid, policyString);
+ mNetdService.strictUidCleartextPenalty(uid, policyValue);
mUidCleartextPolicy.put(uid, policy);
- } catch (NativeDaemonConnectorException e) {
- throw e.rethrowAsParcelableException();
+ } catch (RemoteException | ServiceSpecificException e) {
+ throw new IllegalStateException(e);
}
}
@@ -1846,6 +1841,7 @@
return;
}
+ // TODO: remove this code after removing prepareNativeDaemon()
if (!mStrictEnabled) {
// Module isn't enabled yet; stash the requested policy away to
// apply later once the daemon is connected.
diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java
index a05a3e7..0deaee7 100644
--- a/services/core/java/com/android/server/PinnerService.java
+++ b/services/core/java/com/android/server/PinnerService.java
@@ -43,6 +43,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.os.UserManager;
import android.provider.MediaStore;
import android.provider.Settings;
import android.system.ErrnoException;
@@ -104,6 +105,7 @@
private final Context mContext;
private final ActivityManagerInternal mAmInternal;
private final IActivityManager mAm;
+ private final UserManager mUserManager;
/** The list of the statically pinned files. */
@GuardedBy("this")
@@ -165,6 +167,8 @@
mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
mAm = ActivityManager.getService();
+ mUserManager = mContext.getSystemService(UserManager.class);
+
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addDataScheme("package");
@@ -195,12 +199,16 @@
*/
@Override
public void onSwitchUser(int userHandle) {
- sendPinAppsMessage(userHandle);
+ if (!mUserManager.isManagedProfile(userHandle)) {
+ sendPinAppsMessage(userHandle);
+ }
}
@Override
public void onUnlockUser(int userHandle) {
- sendPinAppsMessage(userHandle);
+ if (!mUserManager.isManagedProfile(userHandle)) {
+ sendPinAppsMessage(userHandle);
+ }
}
/**
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index f854df6..257e119 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -24,7 +24,6 @@
import static android.app.ActivityManager.USER_OP_SUCCESS;
import static android.os.Process.SHELL_UID;
import static android.os.Process.SYSTEM_UID;
-
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -49,6 +48,7 @@
import android.app.IUserSwitchObserver;
import android.app.KeyguardManager;
import android.app.usage.UsageEvents;
+import android.appwidget.AppWidgetManagerInternal;
import android.content.Context;
import android.content.IIntentReceiver;
import android.content.Intent;
@@ -535,6 +535,9 @@
}
}
+ // Spin up app widgets prior to boot-complete, so they can be ready promptly
+ mInjector.startUserWidgets(userId);
+
Slog.i(TAG, "Sending BOOT_COMPLETE user #" + userId);
// Do not report secondary users, runtime restarts or first boot/upgrade
if (userId == UserHandle.USER_SYSTEM
@@ -2174,6 +2177,11 @@
}
}
+ void startUserWidgets(int userId) {
+ AppWidgetManagerInternal awm = LocalServices.getService(AppWidgetManagerInternal.class);
+ awm.unlockUser(userId);
+ }
+
void updateUserConfiguration() {
mService.mActivityTaskManager.updateUserConfiguration();
}
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index d06e785..f4d20b3 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -1014,12 +1014,7 @@
Bundle finalExtras = new Bundle(extras);
String packageName = syncAdapterInfo.componentName.getPackageName();
// If the app did not run and has no account access, done
- try {
- if (!mPackageManagerInternal.wasPackageEverLaunched(packageName, userId)) {
- continue;
- }
- } catch (IllegalArgumentException e) {
- // Package not found, race with an uninstall
+ if (!wasPackageEverLaunched(packageName, userId)) {
continue;
}
mAccountManagerInternal.requestAccountAccess(account.account,
@@ -3352,7 +3347,7 @@
String packageName = op.owningPackage;
final int userId = UserHandle.getUserId(op.owningUid);
// If the app did not run and has no account access, done
- if (!mPackageManagerInternal.wasPackageEverLaunched(packageName, userId)) {
+ if (!wasPackageEverLaunched(packageName, userId)) {
return;
}
mAccountManagerInternal.requestAccountAccess(op.target.account,
@@ -4059,4 +4054,12 @@
public void resetTodayStats() {
mSyncStorageEngine.resetTodayStats(/*force=*/ true);
}
+
+ private boolean wasPackageEverLaunched(String packageName, int userId) {
+ try {
+ return mPackageManagerInternal.wasPackageEverLaunched(packageName, userId);
+ } catch (IllegalArgumentException e) {
+ return false; // Package has been removed.
+ }
+ }
}
diff --git a/services/core/java/com/android/server/dreams/DreamManagerService.java b/services/core/java/com/android/server/dreams/DreamManagerService.java
index 5292d3e5f..ba05b49 100644
--- a/services/core/java/com/android/server/dreams/DreamManagerService.java
+++ b/services/core/java/com/android/server/dreams/DreamManagerService.java
@@ -50,7 +50,6 @@
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
-import android.text.TextUtils;
import android.util.Slog;
import android.view.Display;
@@ -124,7 +123,7 @@
}
}, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler);
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP), false,
+ Settings.Secure.getUriFor(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE), false,
mDozeEnabledObserver, UserHandle.USER_ALL);
writePulseGestureEnabled();
}
diff --git a/services/core/java/com/android/server/notification/CriticalNotificationExtractor.java b/services/core/java/com/android/server/notification/CriticalNotificationExtractor.java
new file mode 100644
index 0000000..a899a08
--- /dev/null
+++ b/services/core/java/com/android/server/notification/CriticalNotificationExtractor.java
@@ -0,0 +1,93 @@
+/*
+ * 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 com.android.server.notification;
+
+import android.app.Notification;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.util.Slog;
+
+/**
+ * Sets the criticality of a notification record. This is used to allow a bypass to all other
+ * ranking signals. It is required in the automotive use case to facilitate placing emergency and
+ * warning notifications above all others. It does not process notifications unless the system
+ * has the automotive feature flag set.
+ * <p>
+ * Note: it is up to the notification ranking system to determine the effect of criticality values
+ * on a notification record
+ *
+ */
+public class CriticalNotificationExtractor implements NotificationSignalExtractor {
+
+ private static final String TAG = "CriticalNotificationExt";
+ private static final boolean DBG = false;
+ private boolean mSupportsCriticalNotifications = false;
+ /**
+ * Intended to bypass all other ranking, notification should be placed above all others.
+ * In the automotive case, the notification would be used to tell a driver to pull over
+ * immediately
+ */
+ static final int CRITICAL = 0;
+ /**
+ * Indicates a notification should be place above all notifications except those marked as
+ * critical. In the automotive case this is a check engine light.
+ */
+ static final int CRITICAL_LOW = 1;
+ /** Normal notification. */
+ static final int NORMAL = 2;
+
+ @Override
+ public void initialize(Context context, NotificationUsageStats usageStats) {
+ if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + ".");
+ mSupportsCriticalNotifications = supportsCriticalNotifications(context);
+ }
+
+ private boolean supportsCriticalNotifications(Context context) {
+ return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0);
+ }
+
+ @Override
+ public RankingReconsideration process(NotificationRecord record) {
+ if (!mSupportsCriticalNotifications) {
+ if (DBG) Slog.d(TAG, "skipping since system does not support critical notification");
+ return null;
+ }
+ if (record == null || record.getNotification() == null) {
+ if (DBG) Slog.d(TAG, "skipping empty notification");
+ return null;
+ }
+ // Note: The use of both CATEGORY_CAR_EMERGENCY and CATEGORY_CAR_WARNING is restricted to
+ // System apps
+ if (record.isCategory(Notification.CATEGORY_CAR_EMERGENCY)) {
+ record.setCriticality(CRITICAL);
+ } else if (record.isCategory(Notification.CATEGORY_CAR_WARNING)) {
+ record.setCriticality(CRITICAL_LOW);
+ } else {
+ record.setCriticality(NORMAL);
+ }
+ return null;
+ }
+
+ @Override
+ public void setConfig(RankingConfig config) {
+ }
+
+ @Override
+ public void setZenHelper(ZenModeHelper helper) {
+ }
+
+}
diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java
index a86927e..a6d8615 100644
--- a/services/core/java/com/android/server/notification/NotificationRecord.java
+++ b/services/core/java/com/android/server/notification/NotificationRecord.java
@@ -144,6 +144,8 @@
private int mSystemImportance = IMPORTANCE_UNSPECIFIED;
private int mAssistantImportance = IMPORTANCE_UNSPECIFIED;
private int mImportance = IMPORTANCE_UNSPECIFIED;
+ // Field used in global sort key to bypass normal notifications
+ private int mCriticality = CriticalNotificationExtractor.NORMAL;
private CharSequence mImportanceExplanation = null;
private int mSuppressedVisualEffects = 0;
@@ -760,6 +762,19 @@
return mIntercept;
}
+ /**
+ * Set to affect global sort key.
+ *
+ * @param criticality used in a string based sort thus 0 is the most critical
+ */
+ public void setCriticality(int criticality) {
+ mCriticality = criticality;
+ }
+
+ public int getCriticality() {
+ return mCriticality;
+ }
+
public boolean isIntercepted() {
return mIntercept;
}
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index f5e58ea..b1e9144 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -106,6 +106,8 @@
synchronized (mProxyByGroupTmp) {
// record individual ranking result and nominate proxies for each group
+ // Note: iteration is done backwards such that the index can be used as a sort key
+ // in a string compare below
for (int i = N - 1; i >= 0; i--) {
final NotificationRecord record = notificationList.get(i);
record.setAuthoritativeRank(i);
@@ -138,7 +140,8 @@
boolean isGroupSummary = record.getNotification().isGroupSummary();
record.setGlobalSortKey(
- String.format("intrsv=%c:grnk=0x%04x:gsmry=%c:%s:rnk=0x%04x",
+ String.format("crtcl=0x%04x:intrsv=%c:grnk=0x%04x:gsmry=%c:%s:rnk=0x%04x",
+ record.getCriticality(),
record.isRecentlyIntrusive()
&& record.getImportance() > NotificationManager.IMPORTANCE_MIN
? '0' : '1',
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index 9ca02ba..3f28ee6 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -574,13 +574,13 @@
Settings.Secure.DOZE_ALWAYS_ON, 0, userId);
android.provider.Settings.Secure.putIntForUser(
context.getContentResolver(),
- Settings.Secure.DOZE_PULSE_ON_PICK_UP, 0, userId);
+ Settings.Secure.DOZE_PICK_UP_GESTURE, 0, userId);
android.provider.Settings.Secure.putIntForUser(
context.getContentResolver(),
Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, 0, userId);
android.provider.Settings.Secure.putIntForUser(
context.getContentResolver(),
- Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, 0, userId);
+ Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, 0, userId);
}
break;
case UserManager.DISALLOW_CONFIG_LOCATION:
@@ -684,9 +684,9 @@
case android.provider.Settings.Secure.DOZE_ENABLED:
case android.provider.Settings.Secure.DOZE_ALWAYS_ON:
- case android.provider.Settings.Secure.DOZE_PULSE_ON_PICK_UP:
+ case android.provider.Settings.Secure.DOZE_PICK_UP_GESTURE:
case android.provider.Settings.Secure.DOZE_PULSE_ON_LONG_PRESS:
- case android.provider.Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP:
+ case android.provider.Settings.Secure.DOZE_DOUBLE_TAP_GESTURE:
if ("0".equals(value)) {
return false;
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 5769207..d15271c 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -76,7 +76,7 @@
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_BAR_EXPANDED;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_CROSSFADE;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_JUMPCUT;
@@ -128,7 +128,6 @@
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_UNCOVERED;
-import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.LID_ABSENT;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.LID_CLOSED;
import static com.android.server.policy.WindowManagerPolicy.WindowManagerFuncs.LID_OPEN;
import static com.android.server.wm.WindowManagerPolicyProto.FOCUSED_APP_TOKEN;
@@ -223,7 +222,6 @@
import android.speech.RecognizerIntent;
import android.telecom.TelecomManager;
import android.util.ArraySet;
-import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
import android.util.LongSparseArray;
@@ -269,7 +267,6 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.IShortcutService;
-import com.android.internal.policy.KeyguardDismissCallback;
import com.android.internal.policy.PhoneWindow;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.util.ArrayUtils;
@@ -4331,8 +4328,9 @@
if (!isKeyguardShowing) {
navTranslucent &= areTranslucentBarsAllowed();
}
- boolean statusBarExpandedNotKeyguard = !isKeyguardShowing && mStatusBar != null
- && (mStatusBar.getAttrs().privateFlags & PRIVATE_FLAG_STATUS_BAR_EXPANDED) != 0;
+ boolean statusBarForcesShowingNavigation = !isKeyguardShowing && mStatusBar != null
+ && (mStatusBar.getAttrs().privateFlags
+ & PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0;
// When the navigation bar isn't visible, we put up a fake input window to catch all
// touch events. This way we can detect when the user presses anywhere to bring back the
@@ -4358,7 +4356,7 @@
navVisible |= !canHideNavigationBar();
boolean updateSysUiVisibility = layoutNavigationBar(displayFrames, uiMode, navVisible,
- navTranslucent, navAllowedHidden, statusBarExpandedNotKeyguard);
+ navTranslucent, navAllowedHidden, statusBarForcesShowingNavigation);
if (DEBUG_LAYOUT) Slog.i(TAG, "mDock rect:" + displayFrames.mDock);
updateSysUiVisibility |= layoutStatusBar(displayFrames, sysui, isKeyguardShowing);
if (updateSysUiVisibility) {
@@ -4511,7 +4509,7 @@
private boolean layoutNavigationBar(DisplayFrames displayFrames, int uiMode, boolean navVisible,
boolean navTranslucent, boolean navAllowedHidden,
- boolean statusBarExpandedNotKeyguard) {
+ boolean statusBarForcesShowingNavigation) {
if (mNavigationBar == null) {
return false;
}
@@ -4545,7 +4543,7 @@
= displayFrames.mRestrictedOverscan.bottom = top;
} else {
// We currently want to hide the navigation UI - unless we expanded the status bar.
- mNavigationBarController.setBarShowingLw(statusBarExpandedNotKeyguard);
+ mNavigationBarController.setBarShowingLw(statusBarForcesShowingNavigation);
}
if (navVisible && !navTranslucent && !navAllowedHidden
&& !mNavigationBar.isAnimatingLw()
@@ -4568,7 +4566,7 @@
= displayFrames.mRestrictedOverscan.right = left;
} else {
// We currently want to hide the navigation UI - unless we expanded the status bar.
- mNavigationBarController.setBarShowingLw(statusBarExpandedNotKeyguard);
+ mNavigationBarController.setBarShowingLw(statusBarForcesShowingNavigation);
}
if (navVisible && !navTranslucent && !navAllowedHidden
&& !mNavigationBar.isAnimatingLw()
@@ -4591,7 +4589,7 @@
displayFrames.mRestrictedOverscan.left = right;
} else {
// We currently want to hide the navigation UI - unless we expanded the status bar.
- mNavigationBarController.setBarShowingLw(statusBarExpandedNotKeyguard);
+ mNavigationBarController.setBarShowingLw(statusBarForcesShowingNavigation);
}
if (navVisible && !navTranslucent && !navAllowedHidden
&& !mNavigationBar.isAnimatingLw()
@@ -5401,19 +5399,21 @@
mStatusBarController.setShowTransparent(true /* transparent */);
}
- boolean statusBarExpanded =
- (mStatusBar.getAttrs().privateFlags & PRIVATE_FLAG_STATUS_BAR_EXPANDED) != 0;
+ boolean statusBarForcesShowingNavigation
+ = (mStatusBar.getAttrs().privateFlags
+ & PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0;
boolean topAppHidesStatusBar = topAppHidesStatusBar();
if (mForceStatusBar || mForceStatusBarFromKeyguard || mForceStatusBarTransparent
- || statusBarExpanded) {
+ || statusBarForcesShowingNavigation) {
if (DEBUG_LAYOUT) Slog.v(TAG, "Showing status bar: forced");
if (mStatusBarController.setBarShowingLw(true)) {
changes |= FINISH_LAYOUT_REDO_LAYOUT;
}
// Maintain fullscreen layout until incoming animation is complete.
topIsFullscreen = mTopIsFullscreen && mStatusBar.isAnimatingLw();
- // Transient status bar on the lockscreen is not allowed
- if ((mForceStatusBarFromKeyguard || statusBarExpanded)
+ // Transient status bar is not allowed if status bar is on lockscreen or status bar
+ // is expecting the navigation keys from the user.
+ if ((mForceStatusBarFromKeyguard || statusBarForcesShowingNavigation)
&& mStatusBarController.isTransientShowing()) {
mStatusBarController.updateVisibilityLw(false /*transientAllowed*/,
mLastSystemUiFlags, mLastSystemUiFlags);
diff --git a/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java b/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java
index f5e6e72..f2cbc86 100644
--- a/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java
+++ b/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java
@@ -21,7 +21,6 @@
import android.graphics.Matrix;
import android.view.DisplayInfo;
-import android.view.Surface.Rotation;
import com.android.server.wm.utils.CoordinateTransforms;
@@ -67,16 +66,6 @@
}
/**
- * Returns the rotation of the display before it started rotating.
- *
- * @return the old rotation of the display
- */
- @Rotation
- public int getOldRotation() {
- return mOldRotation;
- }
-
- /**
* Removes the transform to the window token's surface that undoes the effect of the global
* display rotation.
*
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 58fb7a0..0d093d1 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -634,10 +634,6 @@
void forceSeamlesslyRotateIfAllowed(int oldRotation, int rotation) {
if (mForceSeamlesslyRotate) {
- if (mPendingForcedSeamlessRotate != null) {
- oldRotation = mPendingForcedSeamlessRotate.getOldRotation();
- }
-
mPendingForcedSeamlessRotate = new ForcedSeamlessRotator(
oldRotation, rotation, getDisplayInfo());
mPendingForcedSeamlessRotate.unrotate(this.mToken);
diff --git a/services/robotests/README b/services/robotests/README
new file mode 100644
index 0000000..3c68292
--- /dev/null
+++ b/services/robotests/README
@@ -0,0 +1,23 @@
+This folder is for Robolectric tests inside the platform.
+
+To add a test class annotate it as follows:
+
+@RunWith(FrameworkRobolectricTestRunner.class)
+@Config(manifest = Config.NONE, sdk = 26)
+@SystemLoaderClasses({ClassUnderTest.class, DependencyClasses.class})
+@SystemLoaderPackages({"com.android.server.yourmodule"})
+
+Robolectric loads some classes that it decides from versioned jars of the framework. Since we are
+part of the framework some of our classes get loaded from these jars. This is NOT what we want, we
+want to test against what we wrote in the tree. Because of this we use a custom test runner,
+FrameworkRobolectricTestRunner, that bypasses these jars and loads certain classes from the system
+class loader.
+
+To specify which classes to load use either @SystemLoaderClasses or @SystemLoaderPackages. In
+practice:
+* You MUST put the class under test here.
+* If you encounter any exceptions that might be caused by a different version of the class being
+loaded, such as NoSuchMethodException, put the class involved in the exception in this annotation
+and try again.
+
+Check Android.mk file for more info.
diff --git a/services/tests/servicestests/src/com/android/server/display/BrightnessMappingStrategyTest.java b/services/tests/servicestests/src/com/android/server/display/BrightnessMappingStrategyTest.java
index 284d443..36f7751 100644
--- a/services/tests/servicestests/src/com/android/server/display/BrightnessMappingStrategyTest.java
+++ b/services/tests/servicestests/src/com/android/server/display/BrightnessMappingStrategyTest.java
@@ -531,8 +531,8 @@
@Test
public void testGammaCorrectionChangeAtEdges() {
// The algorithm behaves differently at the edges, because gamma correction there tends to
- // be extreme. If we add a user data point at (x0, y0+0.3), the adjustment should be
- // 0.3*2 = 0.6, resulting in a gamma of 3**-0.6 = ~0.52.
+ // be extreme. If we add a user data point at (x0, y0+0.3), the adjustment should be 0.3,
+ // resulting in a gamma of 3**-0.6 = ~0.52.
final int x0 = 100;
final int x2 = 2500;
final int x4 = 4900;
@@ -547,17 +547,15 @@
assertEquals(y2, strategy.getBrightness(x2), 0.01f /* tolerance */);
assertEquals(y4, strategy.getBrightness(x4), 0.01f /* tolerance */);
// Rollin':
- float increase = 0.3f;
- float adjustment = increase * 2;
+ float adjustment = 0.3f;
float gamma = (float) MathUtils.pow(MAXIMUM_GAMMA, -adjustment);
- strategy.addUserDataPoint(x0, y0 + increase);
- assertEquals(y0 + increase, strategy.getBrightness(x0), 0.01f /* tolerance */);
+ strategy.addUserDataPoint(x0, y0 + adjustment);
+ assertEquals(y0 + adjustment, strategy.getBrightness(x0), 0.01f /* tolerance */);
assertEquals(MathUtils.pow(y2, gamma), strategy.getBrightness(x2), 0.01f /* tolerance */);
assertEquals(MathUtils.pow(y4, gamma), strategy.getBrightness(x4), 0.01f /* tolerance */);
assertEquals(adjustment, strategy.getAutoBrightnessAdjustment(), 0.01f /* tolerance */);
- // Similarly, if we set a user data point at (x4, 1.0), the adjustment should be (1-y4)*2.
- increase = 1.0f - y4;
- adjustment = increase * 2;
+ // Similarly, if we set a user data point at (x4, 1.0), the adjustment should be 1 - y4.
+ adjustment = 1.0f - y4;
gamma = (float) MathUtils.pow(MAXIMUM_GAMMA, -adjustment);
strategy.addUserDataPoint(x4, 1.0f);
assertEquals(MathUtils.pow(y0, gamma), strategy.getBrightness(x0), 0.01f /* tolerance */);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/CriticalNotificationExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/CriticalNotificationExtractorTest.java
new file mode 100644
index 0000000..1409da1
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/notification/CriticalNotificationExtractorTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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 com.android.server.notification;
+
+import static android.app.NotificationManager.IMPORTANCE_LOW;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.content.pm.PackageManager;
+import android.os.UserHandle;
+import android.service.notification.StatusBarNotification;
+import android.testing.TestableContext;
+
+import com.android.server.UiServiceTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+public class CriticalNotificationExtractorTest extends UiServiceTestCase {
+ @Mock
+ private PackageManager mPackageManagerClient;
+ private TestableContext mContext = spy(getContext());
+ private CriticalNotificationExtractor mExtractor;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext.setMockPackageManager(mPackageManagerClient);
+ mExtractor = new CriticalNotificationExtractor();
+ }
+
+ /** confirm there is no affect on notifcations if the automotive feature flag is not set */
+ @Test
+ public void testExtractCritically_nonsupporting() throws Exception {
+ when(mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0))
+ .thenReturn(false);
+ mExtractor.initialize(mContext, null);
+
+ assertCriticality(Notification.CATEGORY_CAR_EMERGENCY,
+ CriticalNotificationExtractor.NORMAL);
+
+ assertCriticality(Notification.CATEGORY_CAR_WARNING, CriticalNotificationExtractor.NORMAL);
+
+ assertCriticality(Notification.CATEGORY_CAR_INFORMATION,
+ CriticalNotificationExtractor.NORMAL);
+
+ assertCriticality(Notification.CATEGORY_CALL,
+ CriticalNotificationExtractor.NORMAL);
+ }
+
+ @Test
+ public void testExtractCritically() throws Exception {
+ when(mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0))
+ .thenReturn(true);
+ mExtractor.initialize(mContext, null);
+
+ assertCriticality(Notification.CATEGORY_CAR_EMERGENCY,
+ CriticalNotificationExtractor.CRITICAL);
+
+ assertCriticality(Notification.CATEGORY_CAR_WARNING,
+ CriticalNotificationExtractor.CRITICAL_LOW);
+
+ assertCriticality(Notification.CATEGORY_CAR_INFORMATION,
+ CriticalNotificationExtractor.NORMAL);
+
+ assertCriticality(Notification.CATEGORY_CALL,
+ CriticalNotificationExtractor.NORMAL);
+ }
+
+ private void assertCriticality(String cat, int criticality) {
+ NotificationRecord info = generateRecord(cat);
+ mExtractor.process(info);
+ assertThat(info.getCriticality(), is(criticality));
+ }
+
+
+ private NotificationRecord generateRecord(String category) {
+ NotificationChannel channel = new NotificationChannel("a", "a", IMPORTANCE_LOW);
+ final Notification.Builder builder = new Notification.Builder(getContext())
+ .setContentTitle("foo")
+ .setCategory(category)
+ .setSmallIcon(android.R.drawable.sym_def_app_icon);
+ Notification n = builder.build();
+ StatusBarNotification sbn = new StatusBarNotification("", "", 0, "", 0,
+ 0, n, UserHandle.ALL, null, System.currentTimeMillis());
+ return new NotificationRecord(getContext(), sbn, channel);
+ }
+}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java
index 7e0fcc9..5638cb36 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/RankingHelperTest.java
@@ -203,8 +203,42 @@
}
@Test
+ public void testSortShouldRespectCritical() throws Exception {
+ ArrayList<NotificationRecord> notificationList = new ArrayList<NotificationRecord>(7);
+ NotificationRecord critical = generateRecord(0);
+ NotificationRecord critical_ish = generateRecord(1);
+ NotificationRecord critical_notAtAll = generateRecord(100);
+
+ notificationList.add(critical_ish);
+ notificationList.add(mRecordGroupGSortA);
+ notificationList.add(critical_notAtAll);
+ notificationList.add(mRecordGroupGSortB);
+ notificationList.add(mRecordNoGroup);
+ notificationList.add(mRecordNoGroupSortA);
+ notificationList.add(critical);
+ mHelper.sort(notificationList);
+
+ assertTrue(mHelper.indexOf(notificationList, critical) == 0);
+ assertTrue(mHelper.indexOf(notificationList, critical_ish) == 1);
+ assertTrue(mHelper.indexOf(notificationList, critical_notAtAll) == 6);
+ }
+
+ private NotificationRecord generateRecord(int criticality) {
+ NotificationChannel channel = new NotificationChannel("a", "a", IMPORTANCE_LOW);
+ final Notification.Builder builder = new Notification.Builder(getContext())
+ .setContentTitle("foo")
+ .setSmallIcon(android.R.drawable.sym_def_app_icon);
+ Notification n = builder.build();
+ StatusBarNotification sbn = new StatusBarNotification("", "", 0, "", 0,
+ 0, n, UserHandle.ALL, null, System.currentTimeMillis());
+ NotificationRecord notificationRecord = new NotificationRecord(getContext(), sbn, channel);
+ notificationRecord.setCriticality(criticality);
+ return notificationRecord;
+ }
+
+ @Test
public void testFindAfterRankingWithASplitGroup() throws Exception {
- ArrayList<NotificationRecord> notificationList = new ArrayList<NotificationRecord>(3);
+ ArrayList<NotificationRecord> notificationList = new ArrayList<NotificationRecord>(4);
notificationList.add(mRecordGroupGSortA);
notificationList.add(mRecordGroupGSortB);
notificationList.add(mRecordNoGroup);
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index 2a41829..c240dbb 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -17,14 +17,11 @@
package android.telephony;
import android.annotation.CallSuper;
-import android.annotation.IntDef;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
/**
@@ -32,44 +29,6 @@
* CellIdentityXxx which represents cell identity for specific network access technology.
*/
public abstract class CellIdentity implements Parcelable {
- /**
- * Cell identity type
- * @hide
- */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(prefix = "TYPE_", value = {TYPE_GSM, TYPE_CDMA, TYPE_LTE, TYPE_WCDMA, TYPE_TDSCDMA})
- public @interface Type {}
-
- /**
- * Unknown cell identity type
- * @hide
- */
- public static final int TYPE_UNKNOWN = 0;
- /**
- * GSM cell identity type
- * @hide
- */
- public static final int TYPE_GSM = 1;
- /**
- * CDMA cell identity type
- * @hide
- */
- public static final int TYPE_CDMA = 2;
- /**
- * LTE cell identity type
- * @hide
- */
- public static final int TYPE_LTE = 3;
- /**
- * WCDMA cell identity type
- * @hide
- */
- public static final int TYPE_WCDMA = 4;
- /**
- * TDS-CDMA cell identity type
- * @hide
- */
- public static final int TYPE_TDSCDMA = 5;
/** @hide */
public static final int INVALID_CHANNEL_NUMBER = -1;
@@ -138,7 +97,9 @@
* @hide
* @return The type of the cell identity
*/
- public @Type int getType() { return mType; }
+ public @CellInfo.Type int getType() {
+ return mType;
+ }
/**
* Returns the channel number of the cell identity.
@@ -217,11 +178,12 @@
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
- case TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
- case TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
- case TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
- case TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
- case TYPE_TDSCDMA: return CellIdentityTdscdma.createFromParcelBody(in);
+ case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
+ case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
+ case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
+ case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
+ case CellInfo.TYPE_TDSCDMA:
+ return CellIdentityTdscdma.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java
index 58a2c45..2809066 100644
--- a/telephony/java/android/telephony/CellIdentityCdma.java
+++ b/telephony/java/android/telephony/CellIdentityCdma.java
@@ -54,7 +54,7 @@
* @hide
*/
public CellIdentityCdma() {
- super(TAG, TYPE_CDMA, null, null, null, null);
+ super(TAG, CellInfo.TYPE_CDMA, null, null, null, null);
mNetworkId = Integer.MAX_VALUE;
mSystemId = Integer.MAX_VALUE;
mBasestationId = Integer.MAX_VALUE;
@@ -94,7 +94,7 @@
*/
public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, String alphal,
String alphas) {
- super(TAG, TYPE_CDMA, null, null, alphal, alphas);
+ super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas);
mNetworkId = nid;
mSystemId = sid;
mBasestationId = bid;
@@ -213,7 +213,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
- super.writeToParcel(dest, TYPE_CDMA);
+ super.writeToParcel(dest, CellInfo.TYPE_CDMA);
dest.writeInt(mNetworkId);
dest.writeInt(mSystemId);
dest.writeInt(mBasestationId);
@@ -223,7 +223,7 @@
/** Construct from Parcel, type has already been processed */
private CellIdentityCdma(Parcel in) {
- super(TAG, TYPE_CDMA, in);
+ super(TAG, CellInfo.TYPE_CDMA, in);
mNetworkId = in.readInt();
mSystemId = in.readInt();
mBasestationId = in.readInt();
diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java
index c697880..4031254 100644
--- a/telephony/java/android/telephony/CellIdentityGsm.java
+++ b/telephony/java/android/telephony/CellIdentityGsm.java
@@ -42,7 +42,7 @@
* @hide
*/
public CellIdentityGsm() {
- super(TAG, TYPE_GSM, null, null, null, null);
+ super(TAG, CellInfo.TYPE_GSM, null, null, null, null);
mLac = Integer.MAX_VALUE;
mCid = Integer.MAX_VALUE;
mArfcn = Integer.MAX_VALUE;
@@ -92,7 +92,7 @@
*/
public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr,
String mncStr, String alphal, String alphas) {
- super(TAG, TYPE_GSM, mccStr, mncStr, alphal, alphas);
+ super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas);
mLac = lac;
mCid = cid;
mArfcn = arfcn;
@@ -237,7 +237,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
- super.writeToParcel(dest, TYPE_GSM);
+ super.writeToParcel(dest, CellInfo.TYPE_GSM);
dest.writeInt(mLac);
dest.writeInt(mCid);
dest.writeInt(mArfcn);
@@ -246,7 +246,7 @@
/** Construct from Parcel, type has already been processed */
private CellIdentityGsm(Parcel in) {
- super(TAG, TYPE_GSM, in);
+ super(TAG, CellInfo.TYPE_GSM, in);
mLac = in.readInt();
mCid = in.readInt();
mArfcn = in.readInt();
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java
index 177fced..5257372 100644
--- a/telephony/java/android/telephony/CellIdentityLte.java
+++ b/telephony/java/android/telephony/CellIdentityLte.java
@@ -44,7 +44,7 @@
* @hide
*/
public CellIdentityLte() {
- super(TAG, TYPE_LTE, null, null, null, null);
+ super(TAG, CellInfo.TYPE_LTE, null, null, null, null);
mCi = Integer.MAX_VALUE;
mPci = Integer.MAX_VALUE;
mTac = Integer.MAX_VALUE;
@@ -99,7 +99,7 @@
*/
public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
String mncStr, String alphal, String alphas) {
- super(TAG, TYPE_LTE, mccStr, mncStr, alphal, alphas);
+ super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
mCi = ci;
mPci = pci;
mTac = tac;
@@ -241,7 +241,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
- super.writeToParcel(dest, TYPE_LTE);
+ super.writeToParcel(dest, CellInfo.TYPE_LTE);
dest.writeInt(mCi);
dest.writeInt(mPci);
dest.writeInt(mTac);
@@ -251,7 +251,7 @@
/** Construct from Parcel, type has already been processed */
private CellIdentityLte(Parcel in) {
- super(TAG, TYPE_LTE, in);
+ super(TAG, CellInfo.TYPE_LTE, in);
mCi = in.readInt();
mPci = in.readInt();
mTac = in.readInt();
diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java
index b99fe46..21b9601 100644
--- a/telephony/java/android/telephony/CellIdentityTdscdma.java
+++ b/telephony/java/android/telephony/CellIdentityTdscdma.java
@@ -40,7 +40,7 @@
* @hide
*/
public CellIdentityTdscdma() {
- super(TAG, TYPE_TDSCDMA, null, null, null, null);
+ super(TAG, CellInfo.TYPE_TDSCDMA, null, null, null, null);
mLac = Integer.MAX_VALUE;
mCid = Integer.MAX_VALUE;
mCpid = Integer.MAX_VALUE;
@@ -75,7 +75,7 @@
*/
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn,
String alphal, String alphas) {
- super(TAG, TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
+ super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
mLac = lac;
mCid = cid;
mCpid = cpid;
@@ -175,7 +175,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
- super.writeToParcel(dest, TYPE_TDSCDMA);
+ super.writeToParcel(dest, CellInfo.TYPE_TDSCDMA);
dest.writeInt(mLac);
dest.writeInt(mCid);
dest.writeInt(mCpid);
@@ -184,7 +184,7 @@
/** Construct from Parcel, type has already been processed */
private CellIdentityTdscdma(Parcel in) {
- super(TAG, TYPE_TDSCDMA, in);
+ super(TAG, CellInfo.TYPE_TDSCDMA, in);
mLac = in.readInt();
mCid = in.readInt();
mCpid = in.readInt();
diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java
index 43f9406..a4ac8e3 100644
--- a/telephony/java/android/telephony/CellIdentityWcdma.java
+++ b/telephony/java/android/telephony/CellIdentityWcdma.java
@@ -42,7 +42,7 @@
* @hide
*/
public CellIdentityWcdma() {
- super(TAG, TYPE_TDSCDMA, null, null, null, null);
+ super(TAG, CellInfo.TYPE_WCDMA, null, null, null, null);
mLac = Integer.MAX_VALUE;
mCid = Integer.MAX_VALUE;
mPsc = Integer.MAX_VALUE;
@@ -93,7 +93,7 @@
*/
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
String mccStr, String mncStr, String alphal, String alphas) {
- super(TAG, TYPE_WCDMA, mccStr, mncStr, alphal, alphas);
+ super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas);
mLac = lac;
mCid = cid;
mPsc = psc;
@@ -227,7 +227,7 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
- super.writeToParcel(dest, TYPE_WCDMA);
+ super.writeToParcel(dest, CellInfo.TYPE_WCDMA);
dest.writeInt(mLac);
dest.writeInt(mCid);
dest.writeInt(mPsc);
@@ -236,7 +236,7 @@
/** Construct from Parcel, type has already been processed */
private CellIdentityWcdma(Parcel in) {
- super(TAG, TYPE_WCDMA, in);
+ super(TAG, CellInfo.TYPE_WCDMA, in);
mLac = in.readInt();
mCid = in.readInt();
mPsc = in.readInt();
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index bffeb17..6b320f4 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -29,17 +29,43 @@
*/
public abstract class CellInfo implements Parcelable {
- // Type fields for parceling
- /** @hide */
- protected static final int TYPE_GSM = 1;
- /** @hide */
- protected static final int TYPE_CDMA = 2;
- /** @hide */
- protected static final int TYPE_LTE = 3;
- /** @hide */
- protected static final int TYPE_WCDMA = 4;
- /** @hide */
- protected static final int TYPE_TDCDMA = 5;
+ /**
+ * Cell identity type
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = "TYPE_", value = {TYPE_GSM, TYPE_CDMA, TYPE_LTE, TYPE_WCDMA, TYPE_TDSCDMA})
+ public @interface Type {}
+ /**
+ * Unknown cell identity type
+ * @hide
+ */
+ public static final int TYPE_UNKNOWN = 0;
+ /**
+ * GSM cell identity type
+ * @hide
+ */
+ public static final int TYPE_GSM = 1;
+ /**
+ * CDMA cell identity type
+ * @hide
+ */
+ public static final int TYPE_CDMA = 2;
+ /**
+ * LTE cell identity type
+ * @hide
+ */
+ public static final int TYPE_LTE = 3;
+ /**
+ * WCDMA cell identity type
+ * @hide
+ */
+ public static final int TYPE_WCDMA = 4;
+ /**
+ * TD-SCDMA cell identity type
+ * @hide
+ */
+ public static final int TYPE_TDSCDMA = 5;
// Type to distinguish where time stamp gets recorded.
@@ -161,6 +187,7 @@
public int getTimeStampType() {
return mTimeStampType;
}
+
/** @hide */
public void setTimeStampType(int timeStampType) {
if (timeStampType < TIMESTAMP_TYPE_UNKNOWN || timeStampType > TIMESTAMP_TYPE_JAVA_RIL) {
@@ -272,7 +299,7 @@
case TYPE_CDMA: return CellInfoCdma.createFromParcelBody(in);
case TYPE_LTE: return CellInfoLte.createFromParcelBody(in);
case TYPE_WCDMA: return CellInfoWcdma.createFromParcelBody(in);
- case TYPE_TDCDMA: return CellInfoTdscdma.createFromParcelBody(in);
+ case TYPE_TDSCDMA: return CellInfoTdscdma.createFromParcelBody(in);
default: throw new RuntimeException("Bad CellInfo Parcel");
}
}
diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java
index 4fb1bce..40cadde 100644
--- a/telephony/java/android/telephony/CellInfoTdscdma.java
+++ b/telephony/java/android/telephony/CellInfoTdscdma.java
@@ -110,7 +110,7 @@
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags, TYPE_TDCDMA);
+ super.writeToParcel(dest, flags, TYPE_TDSCDMA);
mCellIdentityTdscdma.writeToParcel(dest, flags);
mCellSignalStrengthTdscdma.writeToParcel(dest, flags);
}
diff --git a/telephony/java/android/telephony/PreciseDisconnectCause.java b/telephony/java/android/telephony/PreciseDisconnectCause.java
index 46e2adb..2acaf34 100644
--- a/telephony/java/android/telephony/PreciseDisconnectCause.java
+++ b/telephony/java/android/telephony/PreciseDisconnectCause.java
@@ -332,6 +332,8 @@
public static final int SIP_NOT_REACHABLE = 1320;
/** Others */
public static final int SIP_CLIENT_ERROR = 1321;
+ /** 481 : Transaction Does Not Exist */
+ public static final int SIP_TRANSACTION_DOES_NOT_EXIST = 1322;
/** 5xx responses
* 501 : Server Internal Error
*/
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index d76e39b..667ad91 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -139,28 +139,6 @@
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, String mcc, String mnc, String countryIso) {
- this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
- roaming, icon, mcc, mnc, countryIso, false /* isEmbedded */,
- null /* accessRules */, null /* accessRules */);
- }
-
- /**
- * @hide
- */
- public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
- CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
- Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
- @Nullable UiccAccessRule[] accessRules) {
- this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
- roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, null /* cardId */);
- }
-
- /**
- * @hide
- */
- public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
- CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardId) {
this.mId = id;
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 8782a41..ae3f7a2 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -6648,14 +6648,12 @@
@Deprecated
public boolean isTtyModeSupported() {
try {
- ITelephony telephony = getITelephony();
- if (telephony != null) {
- return telephony.isTtyModeSupported();
+ TelecomManager telecomManager = TelecomManager.from(mContext);
+ if (telecomManager != null) {
+ return telecomManager.isTtySupported();
}
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#isTtyModeSupported", e);
} catch (SecurityException e) {
- Log.e(TAG, "Permission error calling ITelephony#isTtyModeSupported", e);
+ Log.e(TAG, "Permission error calling TelecomManager#isTtySupported", e);
}
return false;
}
diff --git a/telephony/java/android/telephony/ims/ImsReasonInfo.java b/telephony/java/android/telephony/ims/ImsReasonInfo.java
index 81f2fe7..662cc7a6 100644
--- a/telephony/java/android/telephony/ims/ImsReasonInfo.java
+++ b/telephony/java/android/telephony/ims/ImsReasonInfo.java
@@ -163,6 +163,8 @@
public static final int CODE_SIP_NOT_REACHABLE = 341;
// Others
public static final int CODE_SIP_CLIENT_ERROR = 342;
+ // 481 Transaction Does Not Exist
+ public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343;
// 5xx responses
// 501 : Server Internal Error
public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351;
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index 36b5578..2ba2cf7 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -288,44 +288,48 @@
Printer r_txt_printer(&fout_text);
for (const auto& package : table.packages) {
- for (const auto& type : package->types) {
- for (const auto& entry : type->entries) {
- // Check access modifiers.
- switch(entry->visibility.level) {
- case Visibility::Level::kUndefined :
- r_txt_printer.Print("default ");
- break;
- case Visibility::Level::kPublic :
- r_txt_printer.Print("public ");
- break;
- case Visibility::Level::kPrivate :
- r_txt_printer.Print("private ");
- }
+ // Only print resources defined locally, e.g. don't write android attributes.
+ if (package->name.empty()) {
+ for (const auto& type : package->types) {
+ for (const auto& entry : type->entries) {
+ // Check access modifiers.
+ switch (entry->visibility.level) {
+ case Visibility::Level::kUndefined :
+ r_txt_printer.Print("default ");
+ break;
+ case Visibility::Level::kPublic :
+ r_txt_printer.Print("public ");
+ break;
+ case Visibility::Level::kPrivate :
+ r_txt_printer.Print("private ");
+ }
- if (type->type != ResourceType::kStyleable) {
- r_txt_printer.Print("int ");
- r_txt_printer.Print(to_string(type->type));
- r_txt_printer.Print(" ");
- r_txt_printer.Println(entry->name);
- } else {
- r_txt_printer.Print("int[] styleable ");
- r_txt_printer.Println(entry->name);
+ if (type->type != ResourceType::kStyleable) {
+ r_txt_printer.Print("int ");
+ r_txt_printer.Print(to_string(type->type));
+ r_txt_printer.Print(" ");
+ r_txt_printer.Println(entry->name);
+ } else {
+ r_txt_printer.Print("int[] styleable ");
+ r_txt_printer.Println(entry->name);
- if (!entry->values.empty()) {
- auto styleable = static_cast<const Styleable*>(entry->values.front()->value.get());
- for (const auto& attr : styleable->entries) {
- // The visibility of the children under the styleable does not matter as they are
- // nested under their parent and use its visibility.
- r_txt_printer.Print("default int styleable ");
- r_txt_printer.Print(entry->name);
- // If the package name is present, also include it in the mangled name (e.g.
- // "android")
- if (!attr.name.value().package.empty()) {
+ if (!entry->values.empty()) {
+ auto styleable =
+ static_cast<const Styleable*>(entry->values.front()->value.get());
+ for (const auto& attr : styleable->entries) {
+ // The visibility of the children under the styleable does not matter as they are
+ // nested under their parent and use its visibility.
+ r_txt_printer.Print("default int styleable ");
+ r_txt_printer.Print(entry->name);
+ // If the package name is present, also include it in the mangled name (e.g.
+ // "android")
+ if (!attr.name.value().package.empty()) {
+ r_txt_printer.Print("_");
+ r_txt_printer.Print(MakePackageSafeName(attr.name.value().package));
+ }
r_txt_printer.Print("_");
- r_txt_printer.Print(MakePackageSafeName(attr.name.value().package));
+ r_txt_printer.Println(attr.name.value().entry);
}
- r_txt_printer.Print("_");
- r_txt_printer.Println(attr.name.value().entry);
}
}
}